[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.6, Sun Mar 21 02:20:55 2004 UTC revision 1.34, Sat Mar 12 20:30:38 2005 UTC
# Line 1  Line 1 
1  package HTML;  package HTML;
2    
3    use FIG;
4  use Carp;  use Carp;
5  use Data::Dumper;  use Data::Dumper;
6  use LWP::UserAgent;  use LWP::UserAgent;
7  use LWP::Simple;  use LWP::Simple;
8  use URI::URL;  use URI::URL;
9  use HTTP::Request::Common;  use HTTP::Request::Common;
10    use POSIX;
11    
12  sub show_page {  sub new
13      my($cgi,$html,$no_home) = @_;  {
14      my $i;      my($class) = @_;
15    
16      #      my $self = {};
17      # Find the HTML header  
18      #      return bless $self, $class;
19    }
20    
21    sub compute_html_header
22    {
23        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
24        my($additional_insert,$user) = @_;
25      my $html_hdr_file = "./Html/html.hdr";      my $html_hdr_file = "./Html/html.hdr";
26      if (! -f $html_hdr_file)      if (! -f $html_hdr_file)
27      {      {
28          $html_hdr_file = "$FIG_Config::fig/CGI/Html/html.hdr";          $html_hdr_file = "$FIG_Config::fig/CGI/Html/html.hdr";
29      }      }
30        my @html_hdr = &FIG::file_read($html_hdr_file);
31        push( @html_hdr, "<br><a href=\"index.cgi?user=$user\">FIG search</a>\n" );
32    
33        if (@html_hdr)
34        {
35            my $insert_stuff;
36            my @ver = &FIG::file_head("$FIG_Config::fig_disk/CURRENT_RELEASE", 1);
37            my $ver = $ver[0];
38            chomp $ver;
39            if ($ver =~ /^cvs\.(\d+)$/)
40            {
41                my $d = asctime(localtime($1));
42                chomp($d);
43                $ver .=  " ($d)";
44            }
45            my $host = &FIG::get_local_hostname();
46            $insert_stuff = "SEED version <b>$ver</b> on $host";
47            if ($additional_insert)
48            {
49                $insert_stuff .= "<br>" . $additional_insert;
50            }
51    
52            for $_ (@html_hdr)
53            {
54                s,(href|img\s+src)="/FIG/,\1="$FIG_Config::cgi_base,g;
55                if ($_ eq "<!-- HEADER_INSERT -->\n")
56                {
57                    $_ = $insert_stuff;
58                }
59            }
60        }
61    
62        return @html_hdr;
63    }
64    
65    sub show_page {
66        #warn "SHOWPAGE: cgi=", Dumper(@_);
67        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
68        my($cgi,$html,$no_home, $css) = @_;
69        my $i;
70    
71    
72        # ARGUMENTS:
73        #     $cgi is the CGI method
74        #     $html is an array with all the html in it. It is just joined by "\n" (and not <br> or <p>
75        #     $no_home
76        #     $css is a reference to a hash. The key is the name of the CSS sheet and the value is the URL of that sheet. Note the usual rules about relative css urls
77        #               the sheet named "Default" is considered to be the default style sheet, and if this is not set it points at $FIG_Config::HTML/css/default.css
78        #               the sheet named "Sans Serif" is considered to the the first alternate, and if this is not set it points at $FIG_Config::HTML/css/sanserif.css
79    
80        #
81        # Find the HTML header
82        #
83    
84      my $html_tail_file = "./Html/html.tail";      my $html_tail_file = "./Html/html.tail";
85      if (! -f $html_tail_file)      if (! -f $html_tail_file)
# Line 27  Line 87 
87          $html_tail_file = "$FIG_Config::fig/CGI/Html/html.tail";          $html_tail_file = "$FIG_Config::fig/CGI/Html/html.tail";
88      }      }
89    
90        my $user = $cgi->param('user') || "";
91        my @html_hdr = compute_html_header(undef,$user);
92    
93    
94      print $cgi->header;      print $cgi->header;
95    
# Line 145  Line 208 
208      #      #
209      #  <BODY> goes after last head line      #  <BODY> goes after last head line
210      #      #
211        #  RAE:
212        #  Added the javascript for the buttons immediately after body.
213        #  Note if no buttons are added we still (at the moment) add the script,
214        #  but it only adds a little text (495 characters) to the html and noone will notice!
215    
216      if ( $body_line < 0 )      if ( $body_line < 0 )
217      {      {
218            my $js=&javascript;
219          $body_line = $last_head_line + 1;          $body_line = $last_head_line + 1;
220          splice( @$html, $body_line, 0, "<BODY>\n" );          splice( @$html, $body_line, 0, "<BODY>\n$js\n" );
221      }      }
222    
223      #      #
224      #  Seed page header (if it exists) goes after <BODY>      #  Seed page header (if it exists) goes after <BODY>
225      #      #
226    
227      if ( -f $html_hdr_file )      if (@html_hdr)
228      {      {
229          splice( @$html, $body_line + 1, 0, `cat $html_hdr_file` );          splice( @$html, $body_line + 1, 0, @html_hdr );
230      }      }
231    
232      #      #
# Line 171  Line 239 
239          splice( @$html, $body_line, 0, "</HEAD>\n" );          splice( @$html, $body_line, 0, "</HEAD>\n" );
240      }      }
241    
242        # RAE:
243        # Add css here
244        # Note that at the moment I define these two sheets here. I think this should be moved out, but I want to try it and see what happens
245        # css has the format
246        # <link rel='stylesheet' title='default' href='/css/default.css' type='text/css'>
247        if (!$css || !$css->{'Default'})
248        {
249           $css->{'Default'}="/FIG/Html/css/default.css";
250        }
251        if (!$css->{"Sans Serif"})
252        {
253           $css->{'Sans Serif'}="/FIG/Html/css/sanserif.css";
254        }
255        my $csstext = "<link rel='stylesheet' title='default' href='".$css->{'Default'}."' type='text/css'>\n";
256        $csstext   .= "<link rel='alternate stylesheet' title='Sans Serif' href='".$css->{'Sans Serif'}."' type='text/css'>\n";
257    
258        foreach my $k (keys %$css)
259        {
260           next if (lc($k) eq "default" || lc($k) eq "sans serif");
261           $csstext .= "<link rel='stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";
262        }
263        splice( @$html, $head_end_line, 1, "$csstext</HEAD>\n" );  # note here I am replacing the </head> line. Could be bad...? But it doesn't increment everything else.
264    
265      #      #
266      #  <BASE ...> goes before </HEAD>      #  <BASE ...> goes before </HEAD>
267      #      #
# Line 183  Line 274 
274          #  only, or every update?), I provide an alternative derivation          #  only, or every update?), I provide an alternative derivation
275          #  from $cgi_url. -- GJO          #  from $cgi_url. -- GJO
276          #          #
277            # BASE href needs to be absolute. RDO.
278          my $base_url = $FIG_Config::cgi_base;          #
279          if ( ! $base_url )                      # if cgi_base was not defined          #
280          {          $base_url = &FIG::cgi_url;
281              $base_url = $FIG_Config::cgi_url;   # get the full cgi url  #       my $base_url = $FIG_Config::cgi_base;
282              $base_url =~ s~^http://[^/]*~~;     # remove protocol and host  #       if ( ! $base_url )                      # if cgi_base was not defined
283              $base_url =~ m~/$~ || $base_url =~ s~$~/~; # check trailing slash  #       {
284          }  #           $base_url = $FIG_Config::cgi_url;   # get the full cgi url
285    #           $base_url =~ s~^http://[^/]*~~;     # remove protocol and host
286    #           $base_url =~ m~/$~ || $base_url =~ s~$~/~; # check trailing slash
287    #       }
288    
289          $base_line = $head_end_line;          $base_line = $head_end_line;
290          splice( @$html, $base_line, 0, "<BASE href=\"$base_url\">\n" );          splice( @$html, $base_line, 0, "<BASE href=\"$base_url/\">\n" );
291      }      }
292    
293      #      #
# Line 228  Line 322 
322      }      }
323    
324      #      #
325        # See if we have a site-specific tail (for disclaimers, etc).
326        #
327    
328        my $site_tail = "$FIG_Config::fig_disk/config/site_tail.html";
329        my $site_fh;
330        if (open($site_fh, "<$site_tail"))
331        {
332            push(@tail, <$site_fh>);
333            close($site_fh);
334        }
335    
336        #
337      #  Figure out where to insert The SEED tail.  Before </body>,      #  Figure out where to insert The SEED tail.  Before </body>,
338      #  or before </html>, or at end of page.      #  or before </html>, or at end of page.
339      #      #
# Line 255  Line 361 
361          splice( @$html, $i, 0, @tags );          splice( @$html, $i, 0, @tags );
362      }      }
363    
364      print @$html;      print join "\n", @$html;
365  }  }
366    
367  sub make_table {  sub make_table {
368      my($col_hdrs,$tab,$title,$instr) = @_;      my($col_hdrs,$tab,$title, %options ) = @_;
369      my(@tab);      my(@tab);
370    
371      push( @tab, "\n<table border>\n",      my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";
372        push( @tab, "\n<table $border>\n",
373                  "\t<caption><b>$title</b></caption>\n",                  "\t<caption><b>$title</b></caption>\n",
374                  "\t<tr>\n\t\t<th>"                  "\t<tr>\n\t\t"
375                . join( "</th>\n\t\t<th>", @$col_hdrs )                . join( "\n", map { &expand($_, "th") } @$col_hdrs )
376                . "</th>\n\t</tr>\n"                . "\n\t</tr>\n"
377          );          );
378      my($i,$nowrap);      my($i);
   
     for ($i=0; ($i < @$instr) && ($instr->[$i] !~ /nowrap/); $i++) {}  
     $nowrap = ($i == @$instr) ? "" : " nowrap";  
379    
380      my $row;      my $row;
381      foreach $row (@$tab)      foreach $row (@$tab)
382      {      {
383          push( @tab, "\t<tr>\n"          push( @tab, "\t<tr>\n"
384                    . join( "\n", map { &expand($_,$nowrap) } @$row )                    . join( "\n", map { &expand($_) } @$row )
385                    . "\n\t</tr>\n"                    . "\n\t</tr>\n"
386              );              );
387      }      }
# Line 286  Line 390 
390  }  }
391    
392  sub expand {  sub expand {
393      my($x,$nowrap) = @_;      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
394        my($x, $tag) = @_;
395    
396        $tag = "td" unless $tag;
397        my $endtag=$tag;
398        # RAE modified this so that you can pass in a reference to an array where the first element is the data to
399        # display and the second element is optional things like colspan and align. Note that in this case you need to include the td
400        # use something like ["some data to appear", "td colspan=4 bgcolor=gray"]
401        if (ref($x) eq "ARRAY") {($x, $tag)=@$x; if ($tag =~ /td/) {$endtag = "td"}}
402    
403      if ($x =~ /^\@([^:]+)\:([^:]+)\:(.*)$/)      if ($x =~ /^\@([^:]+)\:(.*)$/)
404      {      {
405          return "\t\t<td$nowrap $1=\"$2\">$3</td>";          return "\t\t<$tag $1>$2</$endtag>";
406      }      }
407      else      else
408      {      {
409          return "\t\t<td$nowrap>$x</td>";          return "\t\t<$tag>$x</$endtag>";
410      }      }
411  }  }
412    
413    sub set_ec_links {
414        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
415        my($cgi,$x) = @_;
416        my($before,$match,$after);
417    
418        if ($x =~ /^(.*)(EC \d+\.\d+\.\d+\.\d+)(.*)/s)
419        {
420            $before = $1;
421            $match = $2;
422            $after = $3;
423            return &set_ec_links($cgi,$before) . &HTML::ec_link($match) . &set_ec_links($cgi,$after);
424        }
425        return $x;
426    }
427    
428  sub ec_link {  sub ec_link {
429        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
430      my($role) = @_;      my($role) = @_;
431    
432      if ($role =~ /(\d+\.\d+\.\d+\.\d+)/)      if ($role =~ /(\d+\.\d+\.\d+\.\d+)/)
# Line 312  Line 440 
440  }  }
441    
442  sub role_link {  sub role_link {
443        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
444      my($cgi,$role) = @_;      my($cgi,$role) = @_;
445    
446      my $roleR = ($role =~ /^(\d+\.\d+\.\d+\.\d+)\s+-\s+/) ? $1 : $role;      my $roleR = ($role =~ /^(\d+\.\d+\.\d+\.\d+)\s+-\s+/) ? $1 : $role;
# Line 322  Line 451 
451      return "<a href=$link>$role</a>";      return "<a href=$link>$role</a>";
452  }  }
453    
454    #
455    # Local means to eliminate the fig|org.peg from the
456    # text of the link.
457    #
458  sub fid_link {  sub fid_link {
459        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
460      my($cgi,$fid,$local,$just_url) = @_;      my($cgi,$fid,$local,$just_url) = @_;
461      my($n);      my($n);
462    
# Line 347  Line 481 
481          my $user = $cgi->param('user');          my $user = $cgi->param('user');
482          if (! $user) { $user = "" }          if (! $user) { $user = "" }
483          my $trans = $cgi->param('translate') ? "&translate=1" : "";          my $trans = $cgi->param('translate') ? "&translate=1" : "";
484          my $link = $cgi->url() . "?prot=$fid&user=$user$trans";          my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";
485          $link =~ s/[a-z_A-Z]+\.cgi\?/protein.cgi?/;          my $link = &FIG::cgi_url . "/protein.cgi?prot=$fid&user=$user$trans$sprout";
486            $link =~ s/[a-z_A-Z0-9]+\.cgi\?/protein.cgi?/;
487            #
488            # Elimin the p2p part if we're in that subdir. Ugh.
489            #
490            $link =~ s,p2p/protein.cgi,protein.cgi,;
491    
492          if ($just_url)          if ($just_url)
493          {          {
494              return $link;              return $link;
# Line 362  Line 502 
502  }  }
503    
504  sub family_link {  sub family_link {
505        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
506      my($family,$user) = @_;      my($family,$user) = @_;
507    
508      return $family;      return $family;
# Line 370  Line 511 
511  use URI::Escape;  use URI::Escape;
512    
513  sub get_html {  sub get_html {
514        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
515      my( $url, $type, $kv_pairs) = @_;      my( $url, $type, $kv_pairs) = @_;
516      my( $encoded, $ua, $args, @args, $out, @output, $x );      my( $encoded, $ua, $args, @args, $out, @output, $x );
517    
518      $ua = new LWP::UserAgent;      $ua = new LWP::UserAgent;
519      $ua->timeout( 900 );      $ua->timeout( 900 );
   
520      if ($type =~/post/i)      if ($type =~/post/i)
521      {      {
522          $args = [];          $args = [];
# Line 435  Line 576 
576  }  }
577    
578  sub trim_output {  sub trim_output {
579        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
580      my($out) = @_;      my($out) = @_;
581      my $i;      my $i;
582    
# Line 472  Line 614 
614  }  }
615    
616  sub set_prot_links {  sub set_prot_links {
617        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
618      my($cgi,$x) = @_;      my($cgi,$x) = @_;
619      my($before,$match,$after);      my($before,$match,$after);
620    
621      if ($x =~ /^(.*)(fig\|\d+\.\d+\.peg\.\d+)(.*)$/)      if ($x =~ /^(.*)(fig\|\d+\.\d+\.peg\.\d+)(.*)/s)
622      {      {
623          $before = $1;          $before = $1;
624          $match = $2;          $match = $2;
625          $after = $3;          $after = $3;
626          return &set_prot_links($cgi,$before) . &HTML::fid_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";          return &set_prot_links($cgi,$before) . &HTML::fid_link($cgi,$match) . &set_prot_links($cgi,$after);
627      }      }
628      elsif ($x =~ /^(.*)(gi\|\d+)(.*)$/)      elsif ($x =~ /^(.*)\b([NXYZA]P_[0-9\.]+)\b(.*)/s)
629      {      {
630          $before = $1;          $before = $1;
631          $match = $2;          $match = $2;
632          $after = $3;          $after = $3;
633          return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";          return &set_prot_links($cgi,$before) . &HTML::refseq_link($cgi,$match) . &set_prot_links($cgi,$after);
634      }      }
635      elsif ($x =~ /^(.*)(sp\|[A-Z0-9]{6})(.*)$/)      elsif ($x =~ /^(.*)(gi\|\d+)(.*)/s)
636      {      {
637          $before = $1;          $before = $1;
638          $match = $2;          $match = $2;
639          $after = $3;          $after = $3;
640          return &set_prot_links($cgi,$before) . &HTML::sp_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";          return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after);
641      }      }
642      elsif ($x =~ /^(.*)(pirnr\|NF\d+)(.*)$/)      elsif ($x =~  /^(.*)(uni\|[A-Z0-9]{6})(.*)/s)
643      {      {
644          $before = $1;          $before = $1;
645          $match = $2;          $match = $2;
646          $after = $3;          $after = $3;
647          return &set_prot_links($cgi,$before) . &HTML::pir_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";          return &set_prot_links($cgi,$before) . &HTML::uni_link($cgi,$match) . &set_prot_links($cgi,$after);
648        }
649        elsif ($x =~ /^(.*)(sp\|[A-Z0-9]{6})(.*)/s)
650        {
651            $before = $1;
652            $match = $2;
653            $after = $3;
654            return &set_prot_links($cgi,$before) . &HTML::sp_link($cgi,$match) . &set_prot_links($cgi,$after);
655        }
656        elsif ($x =~ /^(.*)(pirnr\|NF\d+)(.*)/s)
657        {
658            $before = $1;
659            $match = $2;
660            $after = $3;
661            return &set_prot_links($cgi,$before) . &HTML::pir_link($cgi,$match) . &set_prot_links($cgi,$after);
662        }
663        elsif ($x =~ /^(.*)(kegg\|[a-z]{2,4}:[a-zA-Z_0-9]+)(.*)/s)
664        {
665            $before = $1;
666            $match = $2;
667            $after = $3;
668            return &set_prot_links($cgi,$before) . &HTML::kegg_link($cgi,$match) . &set_prot_links($cgi,$after);
669      }      }
670      return $x;      return $x;
671  }  }
672    
673    sub refseq_link {
674        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
675        my($cgi,$id) = @_;
676    
677        if ($id =~ /^[NXYZA]P_/)
678        {
679            return "<a href=http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=protein&cmd=search&term=$id>$id</a>";
680        }
681    }
682    
683  sub gi_link {  sub gi_link {
684        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
685      my($cgi,$gi) = @_;      my($cgi,$gi) = @_;
686    
687      if ($gi =~ /^gi\|(\d+)$/)      if ($gi =~ /^gi\|(\d+)$/)
# Line 516  Line 691 
691      return $gi;      return $gi;
692  }  }
693    
694    sub uni_link {
695        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
696        my($cgi,$uni) = @_;
697    
698        if ($uni =~ /^uni\|(\S+)$/)
699        {
700            return "<a href=http://www.pir.uniprot.org/cgi-bin/upEntry?id=$1>$uni</a>";
701        }
702        return $uni;
703    }
704    
705  sub sp_link {  sub sp_link {
706        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
707      my($cgi,$sp) = @_;      my($cgi,$sp) = @_;
708    
709      if ($sp =~ /^sp\|(\S+)$/)      if ($sp =~ /^sp\|(\S+)$/)
# Line 527  Line 714 
714  }  }
715    
716  sub pir_link {  sub pir_link {
717        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
718      my($cgi,$pir) = @_;      my($cgi,$pir) = @_;
719    
720      if ($pir =~ /^pirnr\|(NF\d+)$/)      if ($pir =~ /^pirnr\|(NF\d+)$/)
# Line 536  Line 724 
724      return $pir;      return $pir;
725  }  }
726    
727    sub kegg_link {
728        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
729        my($cgi,$kegg) = @_;
730    
731        if ($kegg =~ /^kegg\|([^:]+):(\S+)$/)
732        {
733            return "<a href=http://www.genome.ad.jp/dbget-bin/www_bget?$1+$2>$kegg</a>";
734        }
735        return $kegg;
736    }
737    
738    sub set_map_links {
739        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
740        my($cgi,$x) = @_;
741        my($before,$match,$after);
742    
743        my $org = ($cgi->param('org') || $cgi->param('genome') || "");
744    
745        if ($x =~ /^(.*)(MAP\d+)(.*)/s)
746        {
747            $before = $1;
748            $match = $2;
749            $after = $3;
750            return &set_map_links($cgi,$before) . &map_link($cgi,$match,$org) . &set_map_links($cgi,$after);
751        }
752        return $x;
753    }
754    
755    sub map_link {
756        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
757        my($cgi,$map,$org) = @_;
758    
759        $user = $cgi->param('user');
760        $user = $user ? $user : "";
761        $org = $org ? $org : "";
762        my $url = "$FIG_Config::cgi_url/show_kegg_map.cgi?user=$user&map=$map&org=$org";
763        my $link = "<a href=\"$url\">$map</a>";
764        return $link;
765    }
766    
767    sub javascript {
768        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
769            #### MODIFIED BY RAE TO ADD JAVA SUPPORT FOR CHECK ALL/UNCHECK ALL
770            # This routine takes three arguments, $html, $form, and $button
771            # $html is the ref to the array with the html in it
772            # $form is the name of the form. This must be added whenever start_form is called
773            # by including a -name entry. This is only used for the javascript
774            # $button is the name of the button that should be checked/unchecked.
775            #
776            # At the moment this add's four buttons:
777            # Check all, check's all
778            # Check first half will check the first 50% of the entries
779            # Check second half will check the second 50% of the entries
780            # Uncheck all will remove the checks.
781    
782            # Note that the other change is I added a -name=>'fig_checked' to the start_form
783            # field. The name is needed for the java script.
784            #
785    
786              $java_script=<<EOF;
787      <SCRIPT LANGUAGE="JavaScript">
788      <!-- Begin
789      function checkAll(field)
790      {
791       for (i = 0; i < field.length; i++)
792       field[i].checked = true ;
793      }
794    
795      function checkFirst(field)
796      {
797       for (i = 0; i < field.length/2; i++)
798       field[i].checked = true;
799      }
800    
801      function checkSecond(field)
802      {
803       for (i=Math.round(field.length/2); i < field.length; i++)
804       field[i].checked = true ;
805      }
806    
807      function uncheckAll(field)
808      {
809       for (i = 0; i < field.length; i++)
810       field[i].checked = false ;
811      }
812      //  End -->
813      </script>
814    EOF
815            return $java_script;
816    }
817    
818    sub java_buttons {
819        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
820      ## ADDED BY RAE
821      # Provides code to include check all/first half/second half/none for javascrspt
822      # this takes two variables - the form name provided in start_form with the
823      # -name => field and the checkbox name
824      my ($form, $button)=@_;
825    
826      $java_script="<input type=\"button\" name=\"CheckAll\" value=\"Check All\"\nonClick=\"checkAll(document.$form.$button)\">\n";
827      $java_script.="<input type=\"button\" name=\"CheckFirst\" value=\"Check First Half\"\nonClick=\"checkFirst(document.$form.$button)\">\n";
828      $java_script.="<input type=\"button\" name=\"CheckSecond\" value=\"Check Second Half\"\nonClick=\"checkSecond(document.$form.$button)\">\n";
829      $java_script.="<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\"\nonClick=\"uncheckAll(document.$form.$button)\">\n";
830    
831      return $java_script;
832    }
833    
834    sub sub_link {
835        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
836        my($cgi,$sub) = @_;
837        my($sub_link);
838    
839        my $user = $cgi->param('user');
840        if ($user)
841        {
842            $sub_link = "<a href=./subsys.cgi?ssa_name=$sub&request=show_ssa&user=$user>$sub</a>";
843        }
844        else
845        {
846            $sub_link = $sub;
847        }
848        return $sub_link;
849    }
850    
851  1  1

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.34

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3