[Bio] / FigKernelPackages / HTML.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/HTML.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45, Tue Jun 28 23:02:07 2005 UTC revision 1.46, Wed Jun 29 04:33:02 2005 UTC
# Line 231  Line 231 
231      #  Added the javascript for the buttons immediately after body.      #  Added the javascript for the buttons immediately after body.
232      #  Note if no buttons are added we still (at the moment) add the script,      #  Note if no buttons are added we still (at the moment) add the script,
233      #  but it only adds a little text (495 characters) to the html and noone will notice!      #  but it only adds a little text (495 characters) to the html and noone will notice!
234        #  RAE: This is now deprecated because everything is in an external file, FIG.js, included later
235    
236      if ( $body_line < 0 )      if ( $body_line < 0 )
237      {      {
         my $js=&javascript;  
238          $body_line = $last_head_line + 1;          $body_line = $last_head_line + 1;
239          splice( @$html, $body_line, 0, "<BODY>\n$js\n" );          splice( @$html, $body_line, 0, "<BODY>\n" );
240      }      }
241    
242      #      #
# Line 290  Line 290 
290      # we are cluttering the HTML code with all the javascripts when they could easily be in external files      # we are cluttering the HTML code with all the javascripts when they could easily be in external files
291      # this solution allows us to source other files      # this solution allows us to source other files
292    
293        # the file FIG.js contains most of the java script we use routinely. Every browser will just cache this and so
294        # it will reduce our overhead.
295    
296      # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts      # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts
297      if ($javasrc && ref($javasrc) eq "ARRAY") {      push @$javasrc, "/FIG/Html/css/FIG.js";
298       foreach my $script (@$javasrc) {       foreach my $script (@$javasrc) {
299        $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";        $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";
300       }       }
     }  
301    
302    
303    
# Line 835  Line 837 
837      return $link;      return $link;
838  }  }
839    
 sub javascript {  
     shift if UNIVERSAL::isa($_[0],__PACKAGE__);  
         #### MODIFIED BY RAE TO ADD JAVA SUPPORT FOR CHECK ALL/UNCHECK ALL  
         # This routine takes three arguments, $html, $form, and $button  
         # $html is the ref to the array with the html in it  
         # $form is the name of the form. This must be added whenever start_form is called  
         # by including a -name entry. This is only used for the javascript  
         # $button is the name of the button that should be checked/unchecked.  
         #  
         # At the moment this add's four buttons:  
         # Check all, check's all  
         # Check first half will check the first 50% of the entries  
         # Check second half will check the second 50% of the entries  
         # Uncheck all will remove the checks.  
   
         # Note that the other change is I added a -name=>'fig_checked' to the start_form  
         # field. The name is needed for the java script.  
         #  
   
           $java_script=<<EOF;  
   <SCRIPT LANGUAGE="JavaScript">  
   <!-- Begin  
   function checkAll(field)  
   {  
    for (i = 0; i < field.length; i++)  
    field[i].checked = true ;  
   }  
   
   function checkFirst(field)  
   {  
    for (i = 0; i < field.length/2; i++)  
    field[i].checked = true;  
   }  
   
   function checkSecond(field)  
   {  
    for (i=Math.round(field.length/2); i < field.length; i++)  
    field[i].checked = true ;  
   }  
   
   function uncheckAll(field)  
   {  
    for (i = 0; i < field.length; i++)  
    field[i].checked = false ;  
   }  
   //  End -->  
   </script>  
 EOF  
         return $java_script;  
 }  
   
840  sub java_buttons {  sub java_buttons {
841      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
842    ## ADDED BY RAE    ## ADDED BY RAE

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3