version 1.110, 2005/07/12 06:52:48
|
version 1.112, 2005/07/12 16:11:19
|
Line 1188 sub render {
|
Line 1188 sub render {
|
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result .= <<SCRIPT; |
$result .= <<SCRIPT; |
<script> |
<script type="text/javascript"> |
|
// <!-- |
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]; |
Line 1197 sub render {
|
Line 1198 sub render {
|
} |
} |
} |
} |
} |
} |
|
// --> |
</script> |
</script> |
SCRIPT |
SCRIPT |
} |
} |
Line 1265 BUTTONS
|
Line 1267 BUTTONS
|
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],"<>&\"'") |
. "'"; |
. "'"; |
if ($checkedChoices{$choice->[1]}) { |
if ($checkedChoices{$choice->[1]}) { |
$result .= " checked "; |
$result .= " checked='checked' "; |
} |
} |
$result .= qq{id="$id"}; |
$result .= qq{id="id$id"}; |
my $choiceLabel = $choice->[0]; |
my $choiceLabel = $choice->[0]; |
if ($choice->[4]) { # if we need to evaluate this choice |
if ($choice->[4]) { # if we need to evaluate this choice |
$choiceLabel = "sub { my $helper = shift; my $state = shift;" . |
$choiceLabel = "sub { my $helper = shift; my $state = shift;" . |
Line 1279 BUTTONS
|
Line 1281 BUTTONS
|
$choiceLabel = eval($choiceLabel); |
$choiceLabel = eval($choiceLabel); |
$choiceLabel = &$choiceLabel($helper, $self); |
$choiceLabel = &$choiceLabel($helper, $self); |
} |
} |
$result .= "/></td><td> ".qq{<label for="$id">}. |
$result .= "/></td><td> ".qq{<label for="id$id">}. |
$choiceLabel. "</label></td></tr>\n"; |
$choiceLabel. "</label></td></tr>\n"; |
} |
} |
$result .= "</table>\n\n\n"; |
$result .= "</table>\n\n\n"; |
Line 1427 sub render {
|
Line 1429 sub render {
|
HTML::Entities::encode($choice->[1],"<>&\"'") |
HTML::Entities::encode($choice->[1],"<>&\"'") |
. "'"; |
. "'"; |
if ($checkedChoices{$choice->[1]}) { |
if ($checkedChoices{$choice->[1]}) { |
$result .= " selected"; |
$result .= " selected='selected' "; |
} |
} |
my $choiceLabel = $choice->[0]; |
my $choiceLabel = $choice->[0]; |
if ($choice->[4]) { # if we need to evaluate this choice |
if ($choice->[4]) { # if we need to evaluate this choice |
Line 1436 sub render {
|
Line 1438 sub render {
|
$choiceLabel = eval($choiceLabel); |
$choiceLabel = eval($choiceLabel); |
$choiceLabel = &$choiceLabel($helper, $self); |
$choiceLabel = &$choiceLabel($helper, $self); |
} |
} |
$result .= ">" . &mtn($choiceLabel) . "\n"; |
$result .= ">" . &mtn($choiceLabel) . "</option>\n"; |
} |
} |
$result .= "</select>\n"; |
$result .= "</select>\n"; |
|
|
Line 1566 sub render {
|
Line 1568 sub render {
|
$result .= "<select name='${var}month'>\n"; |
$result .= "<select name='${var}month'>\n"; |
for ($i = 0; $i < 12; $i++) { |
for ($i = 0; $i < 12; $i++) { |
if ($i == $date->mon) { |
if ($i == $date->mon) { |
$result .= "<option value='$i' selected>"; |
$result .= "<option value='$i' selected='selected'>"; |
} else { |
} else { |
$result .= "<option value='$i'>"; |
$result .= "<option value='$i'>"; |
} |
} |
Line 1578 sub render {
|
Line 1580 sub render {
|
$result .= "<select name='${var}day'>\n"; |
$result .= "<select name='${var}day'>\n"; |
for ($i = 1; $i < 32; $i++) { |
for ($i = 1; $i < 32; $i++) { |
if ($i == $date->mday) { |
if ($i == $date->mday) { |
$result .= '<option selected>'; |
$result .= '<option selected="selected">'; |
} else { |
} else { |
$result .= '<option>'; |
$result .= '<option>'; |
} |
} |
Line 1590 sub render {
|
Line 1592 sub render {
|
$result .= "<select name='${var}year'>\n"; |
$result .= "<select name='${var}year'>\n"; |
for ($i = 2000; $i < 2030; $i++) { # update this after 64-bit dates |
for ($i = 2000; $i < 2030; $i++) { # update this after 64-bit dates |
if ($date->year + 1900 == $i) { |
if ($date->year + 1900 == $i) { |
$result .= "<option selected>"; |
$result .= "<option selected='selected'>"; |
} else { |
} else { |
$result .= "<option>"; |
$result .= "<option>"; |
} |
} |
Line 1605 sub render {
|
Line 1607 sub render {
|
my $pm = &mt('p.m.'); |
my $pm = &mt('p.m.'); |
# Build hour |
# Build hour |
$result .= "<select name='${var}hour'>\n"; |
$result .= "<select name='${var}hour'>\n"; |
$result .= "<option " . ($date->hour == 0 ? 'selected ':'') . |
$result .= "<option " . ($date->hour == 0 ? 'selected="selected" ':'') . |
" value='0'>" . &mt('midnight') . "</option>\n"; |
" value='0'>" . &mt('midnight') . "</option>\n"; |
for ($i = 1; $i < 12; $i++) { |
for ($i = 1; $i < 12; $i++) { |
if ($date->hour == $i) { |
if ($date->hour == $i) { |
$result .= "<option selected value='$i'>$i $am</option>\n"; |
$result .= "<option selected='selected' value='$i'>$i $am</option>\n"; |
} else { |
} else { |
$result .= "<option value='$i'>$i $am</option>\n"; |
$result .= "<option value='$i'>$i $am</option>\n"; |
} |
} |
} |
} |
$result .= "<option " . ($date->hour == 12 ? 'selected ':'') . |
$result .= "<option " . ($date->hour == 12 ? 'selected="selected" ':'') . |
" value='12'>" . &mt('noon') . "</option>\n"; |
" value='12'>" . &mt('noon') . "</option>\n"; |
for ($i = 13; $i < 24; $i++) { |
for ($i = 13; $i < 24; $i++) { |
my $printedHour = $i - 12; |
my $printedHour = $i - 12; |
if ($date->hour == $i) { |
if ($date->hour == $i) { |
$result .= "<option selected value='$i'>$printedHour $pm</option>\n"; |
$result .= "<option selected='selected' value='$i'>$printedHour $pm</option>\n"; |
} else { |
} else { |
$result .= "<option value='$i'>$printedHour $pm</option>\n"; |
$result .= "<option value='$i'>$printedHour $pm</option>\n"; |
} |
} |
Line 1634 sub render {
|
Line 1636 sub render {
|
$printedMinute = "0" . $printedMinute; |
$printedMinute = "0" . $printedMinute; |
} |
} |
if ($date->min == $i) { |
if ($date->min == $i) { |
$result .= "<option selected>"; |
$result .= "<option selected='selected'>"; |
} else { |
} else { |
$result .= "<option>"; |
$result .= "<option>"; |
} |
} |
Line 1930 sub render {
|
Line 1932 sub render {
|
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script type="text/javascript"> |
|
// <!-- |
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]; |
Line 1939 sub render {
|
Line 1942 sub render {
|
} |
} |
} |
} |
} |
} |
|
// --> |
</script> |
</script> |
SCRIPT |
SCRIPT |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 2016 BUTTONS
|
Line 2020 BUTTONS
|
"\|\|\|"; |
"\|\|\|"; |
my $checked =""; |
my $checked =""; |
if($var_value =~ /\Q|||$raw_name|||\E/) { |
if($var_value =~ /\Q|||$raw_name|||\E/) { |
$checked = "checked"; |
$checked = "checked='checked'"; |
} |
} |
$col .= |
$col .= |
"<td align='center'><input type='checkbox' name ='$option_var". |
"<td align='center'><input type='checkbox' name ='$option_var". |
Line 2027 BUTTONS
|
Line 2031 BUTTONS
|
|
|
$col .= "<td align='center'><input type='$inputType' name='${var}.forminput' "; |
$col .= "<td align='center'><input type='$inputType' name='${var}.forminput' "; |
if (!$checked && !$multichoice) { |
if (!$checked && !$multichoice) { |
$col .= "checked "; |
$col .= "checked='checked' "; |
$checked = 1; |
$checked = 1; |
} |
} |
if ($multichoice) { # all resources start checked; see bug 1174 |
if ($multichoice) { # all resources start checked; see bug 1174 |
$col .= "checked "; |
$col .= "checked='checked' "; |
$checked = 1; |
$checked = 1; |
} |
} |
$col .= "value='" . $resource_name . "' /></td>"; |
$col .= "value='" . $resource_name . "' /></td>"; |
Line 2057 BUTTONS
|
Line 2061 BUTTONS
|
}; |
}; |
$result.=(<<RADIO); |
$result.=(<<RADIO); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <!-- |
function updateRadio(form,name,value) { |
function updateRadio(form,name,value) { |
var radiobutton=form[name]; |
var radiobutton=form[name]; |
for (var i=0; i<radiobutton.length; i++) { |
for (var i=0; i<radiobutton.length; i++) { |
Line 2072 BUTTONS
|
Line 2077 BUTTONS
|
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" /> |
|
|
Line 2203 sub render {
|
Line 2209 sub render {
|
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script type="text/javascript"> |
|
// <!-- |
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]; |
Line 2236 sub render {
|
Line 2243 sub render {
|
} |
} |
} |
} |
} |
} |
|
// --> |
</script> |
</script> |
SCRIPT |
SCRIPT |
|
|
Line 2342 BUTTONS
|
Line 2350 BUTTONS
|
$self->{'variable'} . '.forminput' . "'"; |
$self->{'variable'} . '.forminput' . "'"; |
|
|
if (!$self->{'multichoice'} && !$checked) { |
if (!$self->{'multichoice'} && !$checked) { |
$result .= " checked "; |
$result .= " checked='checked' "; |
$checked = 1; |
$checked = 1; |
} |
} |
$result .= |
$result .= |
Line 2547 sub render {
|
Line 2555 sub render {
|
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script type="text/javascript"> |
|
// <!-- |
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]; |
Line 2565 sub render {
|
Line 2574 sub render {
|
} |
} |
} |
} |
} |
} |
|
// --> |
</script> |
</script> |
SCRIPT |
SCRIPT |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 2670 BUTTONS
|
Line 2680 BUTTONS
|
. ".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'; |
$result .= ' checked="checked"'; |
} |
} |
$result .= "/></td><td bgcolor='$color'>". |
$result .= "/></td><td bgcolor='$color'>". |
qq{<label for="$id">}. $file . "</label></td>" . |
qq{<label for="$id">}. $file . "</label></td>" . |