version 1.156, 2006/07/03 11:12:24
|
version 1.158, 2006/08/01 15:12:32
|
Line 486 sub declareVar {
|
Line 486 sub declareVar {
|
$self->{VARS}->{$var} = ''; |
$self->{VARS}->{$var} = ''; |
} |
} |
|
|
my $envname = 'form.' . $var . '.forminput'; |
my $envname = 'form.' . $var . '_forminput'; |
if (defined($env{$envname})) { |
if (defined($env{$envname})) { |
if (ref($env{$envname})) { |
if (ref($env{$envname})) { |
$self->{VARS}->{$var} = join('|||', @{$env{$envname}}); |
$self->{VARS}->{$var} = join('|||', @{$env{$envname}}); |
Line 1280 sub render {
|
Line 1280 sub render {
|
function checkall(value, checkName) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1353 BUTTONS
|
Line 1353 BUTTONS
|
foreach my $choice (@{$self->{CHOICES}}) { |
foreach my $choice (@{$self->{CHOICES}}) { |
my $id = &new_id(); |
my $id = &new_id(); |
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<td valign='top'><input type='$type' name='$var.forminput'" |
$result .= "<td valign='top'><input type='$type' name='${var}_forminput'" |
. " value='" . |
. " value='" . |
HTML::Entities::encode($choice->[1],"<>&\"'") |
HTML::Entities::encode($choice->[1],"<>&\"'") |
. "'"; |
. "'"; |
Line 1372 BUTTONS
|
Line 1372 BUTTONS
|
$choiceLabel. "</label></td>"; |
$choiceLabel. "</label></td>"; |
if ($choice->[4]) { |
if ($choice->[4]) { |
$result .='<td><input type="text" size="5" name="' |
$result .='<td><input type="text" size="5" name="' |
.$choice->[4].'.forminput" value="' |
.$choice->[4].'_forminput" value="' |
.$choice->[5].'" /></td>'; |
.$choice->[5].'" /></td>'; |
} |
} |
$result .= "</tr>\n"; |
$result .= "</tr>\n"; |
Line 1387 BUTTONS
|
Line 1387 BUTTONS
|
# given, switch to it |
# given, switch to it |
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '_forminput'}; |
|
|
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
$self->{ERROR_MSG} = |
$self->{ERROR_MSG} = |
Line 1411 sub postprocess {
|
Line 1411 sub postprocess {
|
} |
} |
if ($choice->[4]) { |
if ($choice->[4]) { |
my $varname = $choice->[4]; |
my $varname = $choice->[4]; |
$helper->{'VARS'}->{$varname} = $env{'form.'."$varname.forminput"}; |
$helper->{'VARS'}->{$varname} = $env{'form.'."${varname}_forminput"}; |
} |
} |
} |
} |
return 1; |
return 1; |
Line 1520 sub render {
|
Line 1520 sub render {
|
$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1; |
$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1; |
} |
} |
|
|
$result .= "<select name='${var}.forminput'>\n"; |
$result .= "<select name='${var}_forminput'>\n"; |
foreach my $choice (@{$self->{CHOICES}}) { |
foreach my $choice (@{$self->{CHOICES}}) { |
$result .= "<option value='" . |
$result .= "<option value='" . |
HTML::Entities::encode($choice->[1],"<>&\"'") |
HTML::Entities::encode($choice->[1],"<>&\"'") |
Line 1546 sub render {
|
Line 1546 sub render {
|
# given, switch to it |
# given, switch to it |
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '_forminput'}; |
|
|
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
$self->{ERROR_MSG} = "You must choose one or more choices to" . |
$self->{ERROR_MSG} = "You must choose one or more choices to" . |
Line 2099 sub render {
|
Line 2099 sub render {
|
function checkall(value, checkName) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 2198 BUTTONS
|
Line 2198 BUTTONS
|
} |
} |
$col .= |
$col .= |
"<td align='center'><input type='checkbox' name ='$option_var". |
"<td align='center'><input type='checkbox' name ='$option_var". |
".forminput' value='". |
"_forminput' value='". |
$resource_name . "' $checked /> </td>"; |
$resource_name . "' $checked /> </td>"; |
} |
} |
} |
} |
|
|
$col .= "<td align='center'><input type='$inputType' name='${var}.forminput' "; |
$col .= "<td align='center'><input type='$inputType' name='${var}_forminput' "; |
if (%defaultSymbs) { |
if (%defaultSymbs) { |
my $symb=$resource->symb(); |
my $symb=$resource->symb(); |
if (exists($defaultSymbs{$symb})) { |
if (exists($defaultSymbs{$symb})) { |
Line 2232 BUTTONS
|
Line 2232 BUTTONS
|
my $resource_name = |
my $resource_name = |
&HTML::Entities::encode(&$valueFunc($resource),"<>&\"'"); |
&HTML::Entities::encode(&$valueFunc($resource),"<>&\"'"); |
if ($addparts && (scalar(@{$resource->parts}) > 1)) { |
if ($addparts && (scalar(@{$resource->parts}) > 1)) { |
$col .= "<select onclick=\"javascript:updateRadio(this.form,'${var}.forminput','$resource_name');updateHidden(this.form,'$id','${var}');\" name='part_$id.forminput'>\n"; |
$col .= "<select onclick=\"javascript:updateRadio(this.form,'${var}_forminput','$resource_name');updateHidden(this.form,'$id','${var}');\" name='part_${id}_forminput'>\n"; |
$col .= "<option value=\"$part\">All Parts</option>\n"; |
$col .= "<option value=\"$part\">All Parts</option>\n"; |
foreach my $part (@{$resource->parts}) { |
foreach my $part (@{$resource->parts}) { |
$col .= "<option value=\"$part\">Part: $part</option>\n"; |
$col .= "<option value=\"$part\">Part: $part</option>\n"; |
Line 2254 BUTTONS
|
Line 2254 BUTTONS
|
} |
} |
} |
} |
function updateHidden(form,id,name) { |
function updateHidden(form,id,name) { |
var select=form['part_'+id+'.forminput']; |
var select=form['part_'+id+'_forminput']; |
var hidden=form[name+'_part.forminput']; |
var hidden=form[name+'_part_forminput']; |
var which=select.selectedIndex; |
var which=select.selectedIndex; |
hidden.value=select.options[which].value; |
hidden.value=select.options[which].value; |
} |
} |
// --> |
// --> |
</script> |
</script> |
<input type="hidden" name="${var}_part.forminput" /> |
<input type="hidden" name="${var}_part_forminput" /> |
|
|
RADIO |
RADIO |
$env{'form.condition'} = !$self->{'toponly'}; |
$env{'form.condition'} = !$self->{'toponly'}; |
Line 2430 sub render {
|
Line 2430 sub render {
|
|
|
# Current personel |
# Current personel |
|
|
$result .= '<h4>Select Currently Enrolled Students and Active Course Personnel</h4>'; |
$result .= '<h4>'.&mt('Select Currently Enrolled Students and Active Course Personnel').'</h4>'; |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
"helpform", |
"helpform", |
"current", |
"current", |
Line 2442 sub render {
|
Line 2442 sub render {
|
|
|
# If activeonly is not set then we can also give the expired students: |
# If activeonly is not set then we can also give the expired students: |
# |
# |
if (!$self->{'activeonly'} && ((scalar @$expired_members) > 0)) { |
if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) { |
|
|
# And future. |
# And future. |
|
|
$result .= '<h4>Select Future Enrolled Students and Future Course Personnel</h4>'; |
$result .= '<h4>'.&mt('Select Future Enrolled Students and Future Course Personnel').'</h4>'; |
|
|
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
"helpform", |
"helpform", |
Line 2455 sub render {
|
Line 2455 sub render {
|
$self->{'multichoice'}, |
$self->{'multichoice'}, |
$self->{'variable'}, |
$self->{'variable'}, |
0); |
0); |
|
} |
|
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) { |
# Past |
# Past |
|
|
$result .= '<h4>Select Previously Enrolled Students and Inactive Course Personnel</h4>'; |
$result .= '<h4>'.&mt('Select Previously Enrolled Students and Inactive Course Personnel').'</h4>'; |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
"helpform", |
"helpform", |
"past", |
"past", |
Line 2475 sub render {
|
Line 2477 sub render {
|
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
|
|
my $result = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $result = $env{'form.' . $self->{'variable'} . '_forminput'}; |
if (!$result && !$self->{'emptyallowed'}) { |
if (!$result && !$self->{'emptyallowed'}) { |
if ($self->{'coursepersonnel'}) { |
if ($self->{'coursepersonnel'}) { |
$self->{ERROR_MSG} = |
$self->{ERROR_MSG} = |
Line 2660 sub render {
|
Line 2662 sub render {
|
function checkall(value, checkName) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 2777 BUTTONS
|
Line 2779 BUTTONS
|
my $id = &new_id(); |
my $id = &new_id(); |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
"<input $onclick type='$type' name='" . $var |
"<input $onclick type='$type' name='" . $var |
. ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). |
. "_forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). |
"'"; |
"'"; |
if (!$self->{'multichoice'} && $choices == 0) { |
if (!$self->{'multichoice'} && $choices == 0) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
Line 2838 sub fileState {
|
Line 2840 sub fileState {
|
|
|
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $result = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $result = $env{'form.' . $self->{'variable'} . '_forminput'}; |
if (!$result) { |
if (!$result) { |
$self->{ERROR_MSG} = 'You must choose at least one file '. |
$self->{ERROR_MSG} = 'You must choose at least one file '. |
'to continue.'; |
'to continue.'; |
Line 3074 sub render {
|
Line 3076 sub render {
|
$result .= '<p><font color="#FF0000">' . $self->{ERROR_MSG} . '</font></p>'; |
$result .= '<p><font color="#FF0000">' . $self->{ERROR_MSG} . '</font></p>'; |
} |
} |
|
|
$result .= '<input type="string" name="' . $self->{'variable'} . '.forminput"'; |
$result .= '<input type="string" name="' . $self->{'variable'} . '_forminput"'; |
|
|
if (defined($self->{'size'})) { |
if (defined($self->{'size'})) { |
$result .= ' size="' . $self->{'size'} . '"'; |
$result .= ' size="' . $self->{'size'} . '"'; |