Diff for /loncom/interface/lonhelper.pm between versions 1.21 and 1.22

version 1.21, 2003/05/07 18:22:43 version 1.22, 2003/05/07 18:48:15
Line 1835  sub render { Line 1835  sub render {
   
     my $filterFunc = $self->{FILTER_FUNC};      my $filterFunc = $self->{FILTER_FUNC};
     my $buttons = '';      my $buttons = '';
       my $type = 'radio';
       if ($self->{'multichoice'}) {
           $type = 'checkbox';
       }
   
     if ($self->{'multichoice'}) {      if ($self->{'multichoice'}) {
         $result = <<SCRIPT;          $result = <<SCRIPT;
Line 1848  sub render { Line 1852  sub render {
         }          }
     }      }
   
     function checkallid(value, idName) {      function checkallclass(value, className) {
         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.id == idName) {              if (ele.type == "$type" && ele.onclick) {
                 document.forms.helpform.elements[i].checked=value;                  document.forms.helpform.elements[i].checked=value;
             }              }
         }          }
Line 1862  SCRIPT Line 1866  SCRIPT
 <br /> &nbsp;  <br /> &nbsp;
 <input type="button" onclick="checkall(true, '$var')" value="Select All Files" />  <input type="button" onclick="checkall(true, '$var')" value="Select All Files" />
 <input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" />  <input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" />
 <input type="button" onclick="checkallid(true, 'Published')" value="Select All Published" />  <input type="button" onclick="checkallclass(true, 'Published')" value="Select All Published" />
 <input type="button" onclick="checkallid(false, 'Published')" value="Unselect All Published" />  <input type="button" onclick="checkallclass(false, 'Published')" value="Unselect All Published" />
 <br /> &nbsp;  <br /> &nbsp;
 BUTTONS  BUTTONS
     }      }
Line 1892  BUTTONS Line 1896  BUTTONS
     # Keeps track if there are no choices, prints appropriate error      # Keeps track if there are no choices, prints appropriate error
     # if there are none.       # if there are none. 
     my $choices = 0;      my $choices = 0;
     my $type = 'radio';  
     if ($self->{'multichoice'}) {  
         $type = 'checkbox';  
     }  
     # Print each legitimate file choice.      # Print each legitimate file choice.
     for my $file (@fileList) {      for my $file (@fileList) {
         $file = (split(/&/, $file))[0];          $file = (split(/&/, $file))[0];
Line 1905  BUTTONS Line 1905  BUTTONS
         my $fileName = $subdir .'/'. $file;          my $fileName = $subdir .'/'. $file;
         if (&$filterFunc($file)) {          if (&$filterFunc($file)) {
             (my $status, my $color) = @{fileState($subdir, $file)};              (my $status, my $color) = @{fileState($subdir, $file)};
   
               # Netscape 4 is stupid and there's nowhere to put the
               # information on the input tag that the file is Published,
               # Unpublished, etc. In *real* browsers we can just say
               # "class='Published'" and check the className attribute of
               # the input tag, but Netscape 4 is too stupid to understand
               # that attribute, and un-comprehended attributes are not
               # reflected into the object model. So instead, what I do 
               # is either have or don't have an "onclick" handler that 
               # does nothing, give Published files the onclick handler, and
               # have the checker scripts check for that. Stupid and clumsy,
               # and only gives us binary "yes/no" information (at least I
               # couldn't figure out how to reach into the event handler's
               # actual code to retreive a value), but it works well enough
               # here.
   
               my $onclick = '';
               if ($status eq 'Published') {
                   $onclick = 'onclick="a=1" ';
               }
             $result .= '<tr><td align="right"' . " bgcolor='$color'>" .              $result .= '<tr><td align="right"' . " bgcolor='$color'>" .
                 "<input id='$status' type='$type' name='" . $var                  "<input $onclick type='$type' name='" . $var
             . ".forminput' value='" . HTML::Entities::encode($fileName) .              . ".forminput' value='" . HTML::Entities::encode($fileName) .
                 "'";                  "'";
             if (!$self->{'multichoice'} && $choices == 0) {              if (!$self->{'multichoice'} && $choices == 0) {

Removed from v.1.21  
changed lines
  Added in v.1.22


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