/[cricket]/generate-overview.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /generate-overview.pl

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

revision 1.10 by dpavlin, Sat May 24 12:21:42 2003 UTC revision 1.15 by dpavlin, Sat Aug 9 21:31:19 2003 UTC
# Line 36  BEGIN { Line 36  BEGIN {
36  #       $gBaseURL = "http://localhost/~cricket/grapher.cgi";  #       $gBaseURL = "http://localhost/~cricket/grapher.cgi";
37          my $hostname = `hostname -f`;          my $hostname = `hostname -f`;
38          chomp($hostname);          chomp($hostname);
39          $gBaseURL = "http://$hostname/cgi-bin/cricket/grapher.cgi";          $gBaseURL = "/cgi-bin/cricket/grapher.cgi";
40    
41          # change this to destination directory          # change this to destination directory
42          $path = "/data/mon/";          $path = "/data/mon/";
# Line 116  foreach my $key (keys %html_file) { Line 116  foreach my $key (keys %html_file) {
116          print OUT "<html><head><title>$key</title>";          print OUT "<html><head><title>$key</title>";
117          print OUT '<meta content="no-cache" http-equiv="Pragma">          print OUT '<meta content="no-cache" http-equiv="Pragma">
118                  <meta content="300" http-equiv="Refresh">' if ($filename =~ m/Daily/i);                  <meta content="300" http-equiv="Refresh">' if ($filename =~ m/Daily/i);
119          print OUT <<'HTMLEND' if ($dynamic_js);          print OUT '</head><body>';
120            my $html=<<'HTMLEND';
121    
122  <script language="JavaScript">  <script language="JavaScript">
123  var Selected = "";  var Selected = "";
124    
125  function Switch(elm)  function Switch(elm)
126  {  {
127          var cookie = Get_Cookie("overview");          var cookie = Get_Cookie("##cookie_name##");
128    
129          var elmref;          var elmref;
130    
# Line 135  function Switch(elm) Line 136  function Switch(elm)
136                  if (elmref) elmref.style.display = 'none';                  if (elmref) elmref.style.display = 'none';
137                  elmref = eval("document.getElementById('" + Selected + "_h0')");                  elmref = eval("document.getElementById('" + Selected + "_h0')");
138                  // roll-up color                  // roll-up color
139                  if (elmref) elmref.bgColor = '#eeeeee';                  if (elmref) elmref.bgColor = '#e0e0e0';
140          }          }
141          if (Selected != elm.name)          if (Selected != elm.name)
142          {          {
# Line 157  function Switch(elm) Line 158  function Switch(elm)
158          // or use this to unroll more than one line          // or use this to unroll more than one line
159          Selected = elm.name;          Selected = elm.name;
160          elmref = eval("document.getElementById('" + Selected + "_h1')");          elmref = eval("document.getElementById('" + Selected + "_h1')");
161            elmref0 = eval("document.getElementById('" + Selected + "_h0')");
162          if (elmref)          if (elmref)
163          {          {
164                  if (elmref.style.display=='none') elmref.style.display='';                  if (elmref.style.display=='none') {
165                  else elmref.style.display = 'none';                          elmref.style.display='';
166                            if (elmref0) elmref0.bgColor = '#eeeeee';
167                    } else {
168                            elmref.style.display = 'none';
169                            if (elmref0) elmref0.bgColor = '#e0e0e0';
170                    }
171                  cookie ^= 1 << Selected;                  cookie ^= 1 << Selected;
172          }          }
173    
174          Set_Cookie("overview",cookie);          Set_Cookie("##cookie_name##",cookie);
175          return false;          return false;
176  }  }
177    
# Line 179  function SwitchThis() Line 186  function SwitchThis()
186  <table border=0 id=DynamicTable bgColor='#e0e0e0' cellpadding=2 cellspacing=1>  <table border=0 id=DynamicTable bgColor='#e0e0e0' cellpadding=2 cellspacing=1>
187    
188  HTMLEND  HTMLEND
189          print OUT "</head><body>";          if ($dynamic_js) {
190                    my $cookie_name = $key;
191                    $cookie_name =~ s/[^a-zA-Z0-9]//g;
192                    $html =~ s/##cookie_name##/$cookie_name/g;
193                    print OUT $html;
194            }
195    
196          print OUT $html_file{$key};          print OUT $html_file{$key};
197          print OUT <<'HTMLEND' if ($dynamic_js);          $html = <<'HTMLEND';
198  </table>  </table>
199    
200  <script language=javascript>  <script language=javascript>
# Line 213  function Delete_Cookie(name,path,domain) Line 226  function Delete_Cookie(name,path,domain)
226    
227  var table = document.getElementById("DynamicTable");  var table = document.getElementById("DynamicTable");
228  var links = table.getElementsByTagName("a");  var links = table.getElementsByTagName("a");
229  var cookie = Get_Cookie("overview");  var cookie = Get_Cookie("##cookie_name##");
230  var new_cookie = 0;  var new_cookie = 0;
231  for (var i = 0; i < links.length; i++) {  for (var i = 0; i < links.length; i++) {
232      if (links[i].id == "DynMessLink") {      if (links[i].id == "DynMessLink") {
233          links[i].onclick = SwitchThis;          links[i].onclick = SwitchThis;
234          elmref = eval("document.getElementById('" + links[i].name + "_h1')");          elmref = eval("document.getElementById('" + links[i].name + "_h1')");
235            elmref0 = eval("document.getElementById('" + links[i].name + "_h0')");
236          if (elmref && cookie) {          if (elmref && cookie) {
237                  if (cookie & 1 << links[i].name) {                  if (cookie & 1 << links[i].name) {
238                          elmref.style.display='';                          elmref.style.display='';
239                            if (elmref0) elmref0.bgColor = '#eeeeee';
240                  } else {                  } else {
241                          elmref.style.display = 'none';                          elmref.style.display = 'none';
242                            if (elmref0) elmref0.bgColor = '#e0e0e0';
243                  }                  }
244          } else if(elmref) {          } else if(elmref) {
245                    // default: show all
246                    new_cookie |= 1 << links[i].name;
247                  if (elmref.style.display=='none') {                  if (elmref.style.display=='none') {
248                          elmref.style.display='';                          elmref.style.display='';
249                          new_cookie |= 1 << links[i].name;                          if (elmref0) elmref0.bgColor = '#eeeeee';
250                  } else {                  } else {
251                          elmref.style.display = 'none';                          // hide? no...
252                          //new_cookie &= !( 1 << links[i].name );                          //elmref.style.display = 'none';
253                            //if (elmref0) elmref0.bgColor = '#e0e0e0';
254                            if (elmref0) elmref0.bgColor = '#eeeeee';
255                  }                  }
256          }          }
257      }      }
258  }  }
259  if (new_cookie) Set_Cookie("overview",new_cookie);  if (new_cookie) Set_Cookie("##cookie_name##",new_cookie);
260  </script>  </script>
261  HTMLEND  HTMLEND
262    
263            if ($dynamic_js) {
264                    my $cookie_name = $key;
265                    $cookie_name =~ s/[^a-zA-Z0-9]//g;
266                    $html =~ s/##cookie_name##/$cookie_name/g;
267                    print OUT $html;
268            }
269    
270          print OUT "</body></html>";          print OUT "</body></html>";
271          close(OUT);          close(OUT);
272    
# Line 251  sub do_html { Line 278  sub do_html {
278          my ($desc,$url,$img) = @_;          my ($desc,$url,$img) = @_;
279          if ($dynamic_js) {          if ($dynamic_js) {
280                  my $html =<<'HTMLEND';                  my $html =<<'HTMLEND';
281  <tr bgcolor='#eeeeee' id=##id##_h0>  <tr bgcolor='#e0e0e0' id=##id##_h0>
282  <td><a href="#" id=DynMessLink name=##id## >##desc##</a></td>  <td><a name="##id##"><a href="###id##" id=DynMessLink name=##id## >##desc##</a></td>
283  </tr>  </tr>
284  <tr id=##id##_h1 style='display:none' bgcolor='#ffffff' >  <tr id=##id##_h1 style='' bgcolor='#ffffff' >
285  <td><a href="##url##"><img src="##img##"</td>  <td><a href="##url##"><img src="##img##"</td>
286  </tr>  </tr>
287  HTMLEND  HTMLEND

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.26