[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.19, Sat Aug 7 17:55:16 2004 UTC revision 1.20, Mon Aug 23 21:46:44 2004 UTC
# Line 175  Line 175 
175      #      #
176      #  <BODY> goes after last head line      #  <BODY> goes after last head line
177      #      #
178        #  RAE: Added the javascript for the buttons immediately after body.
179        #  Note if no buttons are added we still (at the moment) add the script,
180        #  but it only adds a little text (495 characters) to the html and noone will notice!
181    
182      if ( $body_line < 0 )      if ( $body_line < 0 )
183      {      {
184            my $js=&javascript;
185          $body_line = $last_head_line + 1;          $body_line = $last_head_line + 1;
186          splice( @$html, $body_line, 0, "<BODY>\n" );          splice( @$html, $body_line, 0, "<BODY>\n$js\n" );
187      }      }
188    
189      #      #
# Line 667  Line 671 
671      return $link;      return $link;
672  }  }
673    
674    sub javascript {
675            #### MODIFIED BY RAE TO ADD JAVA SUPPORT FOR CHECK ALL/UNCHECK ALL
676            # This routine takes three arguments, $html, $form, and $button
677            # $html is the ref to the array with the html in it
678            # $form is the name of the form. This must be added whenever start_form is called
679            # by including a -name entry. This is only used for the javascript
680            # $button is the name of the button that should be checked/unchecked.
681            #
682            # At the moment this add's four buttons:
683            # Check all, check's all
684            # Check first half will check the first 50% of the entries
685            # Check second half will check the second 50% of the entries
686            # Uncheck all will remove the checks.
687    
688            # Note that the other change is I added a -name=>'fig_checked' to the start_form
689            # field. The name is needed for the java script.
690            #
691    
692              $java_script=<<EOF;
693      <SCRIPT LANGUAGE="JavaScript">
694      <!-- Begin
695      function checkAll(field)
696      {
697       for (i = 0; i < field.length; i++)
698       field[i].checked = true ;
699      }
700    
701      function checkFirst(field)
702      {
703       for (i = 0; i < field.length/2; i++)
704       field[i].checked = true;
705      }
706    
707      function checkSecond(field)
708      {
709       for (i=Math.round(field.length/2); i < field.length; i++)
710       field[i].checked = true ;
711      }
712    
713      function uncheckAll(field)
714      {
715       for (i = 0; i < field.length; i++)
716       field[i].checked = false ;
717      }
718      //  End -->
719      </script>
720    EOF
721            return $java_script;
722    }
723    
724    sub java_buttons {
725      ## ADDED BY RAE
726      # Provides code to include check all/first half/second half/none for javascrspt
727      # this takes two variables - the form name provided in start_form with the
728      # -name => field and the checkbox name
729      my ($form, $button)=@_;
730    
731      $java_script="<input type=\"button\" name=\"CheckAll\" value=\"Check All\"\nonClick=\"checkAll(document.$form.$button)\">\n";
732      $java_script.="<input type=\"button\" name=\"CheckFirst\" value=\"Check First Half\"\nonClick=\"checkFirst(document.$form.$button)\">\n";
733      $java_script.="<input type=\"button\" name=\"CheckSecond\" value=\"Check Second Half\"\nonClick=\"checkSecond(document.$form.$button)\">\n";
734      $java_script.="<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\"\nonClick=\"uncheckAll(document.$form.$button)\">\n";
735    
736      return $java_script;
737    }
738    
739  1  1

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3