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

Annotation of /FigKernelPackages/FIGjs.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (view) (download) (as text)

1 : olson 1.12 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : heiko 1.1 package FIGjs;
19 : overbeek 1.7 use FIG;
20 : golsen 1.10 use strict;
21 : heiko 1.1
22 :     =pod
23 :    
24 :     =head1 FIGjs javascript package. delivers links and creates HTML code for mouseover info
25 :    
26 :     usage: mouseover($title, $info, $menu)
27 :    
28 :     creates a tooltip with title = $title and $info <HTML text>
29 :     can be plugged in to any html
30 :     example
31 :    
32 :     push(@$html,"<area shape=\"rect\" coords=\"$coords\" href=\"$link\" ".&FIGjs::mouseover( "Peg info", $object->[6]).">\n");
33 :    
34 :     =cut
35 :    
36 : golsen 1.10 # Note that the actual script has now been put into FigCSS/FIG.js
37 :     # this contains several javascript methods, separates them from the html,
38 :     # and keeps things cleaner this method is here because it is almost certainly
39 :     # being called in places I have missed.
40 :     # RAE
41 :    
42 : heiko 1.1 sub toolTipScript {
43 : golsen 1.10 # my $url = &FIG::cgi_url() . "/Html/css/FIG.js";
44 :     # Changed to relative URL -- GJO
45 :    
46 : parrello 1.15 my $url = "$FIG_Config::cgi_url/Html/css/FIG.js";
47 : parrello 1.14 qq(<script language="JavaScript" type="text/javascript" src="$url"></script>);
48 : golsen 1.10 }
49 : heiko 1.1
50 :    
51 : golsen 1.10 # Cleaned, simplified and commented -- GJO
52 : overbeek 1.11
53 :     =head2 mouseover()
54 :    
55 :     Generate a mouseover for your code.
56 :    
57 :     You can use it like this:
58 :     push @$html, "<a " . FIGjs::mouseover("Title", "Body Text", "Menu", $parent, $title_bg_color, $text_bg_color) . " href='link.cgi'>a link</a>";
59 :    
60 :     and the appropriate javascript will be added for you.
61 :    
62 :     Title: The title of the popup that appears in bold
63 :     Body Text: The text to appear in the box.
64 :     Menu: This is probably the alternate menu that appears on the pinned regions page??
65 :    
66 :     Please note these should be HTML code so <b>text</b> will appear as bold. Also, please don't put linebreaks in the text since that breaks everything.
67 :     The text strings supplied must already be HTML escaped (< or & will be treated as HTML, not text).
68 :    
69 :     $parent is whether to place the box under the cursor or elsewhere on the page (e.g. top right corner)
70 :     Please note that there is an error at the moment and the value of parent doesn't affect anything.
71 :     Note also that I (RAE) didn't add this, but I have left it here for compatability with mouseover calls that expect it to be here.
72 :    
73 :     $title_bg_color is the color of the background for the title. The default blue color is #333399. Please include the # in describing the color
74 :     $text_bg_color is the color of the body of the text. The default body color is #CCCCFF. Please include the # in describing the color
75 :    
76 :     You don't need to supply the default colors, but can make the box red or green if you like.
77 :    
78 :     =cut
79 :    
80 : heiko 1.1
81 :     sub mouseover {
82 : overbeek 1.11 my ($title, $text, $menu, $parent, $hc, $bc) = @_;
83 : golsen 1.10
84 :     defined( $title ) or $title = '';
85 :     $title =~ s/'/\\'/g; # escape '
86 : golsen 1.13 $title =~ s/"/&quot;/g; # escape "
87 :    
88 :     # Fixed incorrect quoting of $text (reversed single and double quote)
89 :     # -- GJO
90 : olson 1.2
91 : golsen 1.10 defined( $text ) or $text = '';
92 : golsen 1.13 $text =~ s/'/\\'/g; # escape '
93 :     $text =~ s/"/&quot;/g; # escape "
94 : redwards 1.5
95 : golsen 1.10 defined( $menu ) or $menu = '';
96 : golsen 1.13 $menu =~ s/'/\\'/g; # escape '
97 :     $menu =~ s/"/&quot;/g; # escape "
98 : golsen 1.10
99 : overbeek 1.11 qq( onMouseover="javascript:if(!this.tooltip) this.tooltip=new Popup_Tooltip(this,'$title','$text','$menu','$parent','$hc','$bc');this.tooltip.addHandler(); return false;" );
100 : heiko 1.1 }
101 :    
102 : golsen 1.10
103 :     # I'm not sure that this exists -- GJO
104 : overbeek 1.11 # I agree, and I don't think it is ever called. I have added a die statement on 11/17/2005, feel free to delete this
105 :     # if it has been a while and no one has complained about things dying -- Rob
106 : golsen 1.10
107 : heiko 1.1 sub toolTipLink {
108 : overbeek 1.11 die "toolTipLink was called. Please email this error to Rob (RobE\@thefig.info). Sorry\n";
109 : heiko 1.1 return '<script src="Html/popup_tooltip.js" type="text/javascript"></script>';
110 :     }
111 : golsen 1.10
112 :    
113 : olson 1.2 sub setValueScript {
114 : golsen 1.10 return <<'SCRIPT';
115 : olson 1.2 <script type="text/javascript">
116 : golsen 1.10 function setValue(id, val) {
117 : olson 1.2 var element = document.getElementById(id);
118 :     element.value = val;
119 :     }
120 :     </script>
121 :     SCRIPT
122 : golsen 1.10 }
123 : olson 1.2
124 : heiko 1.1 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3