Diff for /loncom/interface/lonhelper.pm between versions 1.110 and 1.111

version 1.110, 2005/07/12 06:52:48 version 1.111, 2005/07/12 16:03:12
Line 1265  BUTTONS Line 1265  BUTTONS
         my $id = &new_id();          my $id = &new_id();
         $result .= "<tr>\n<td width='20'>&nbsp;</td>\n";          $result .= "<tr>\n<td width='20'>&nbsp;</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 1279  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 1427  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 1566  sub render { Line 1566  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 1578  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 1590  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 1605  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 1634  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 2016  BUTTONS Line 2016  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 2027  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 2342  BUTTONS Line 2342  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 2670  BUTTONS Line 2670  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>" .

Removed from v.1.110  
changed lines
  Added in v.1.111


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>