Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:20:01

0001 #!/usr/bin/perl -w
0002 
0003 # This script is the main entry point to the HTML Output from the PHENIX Online
0004 # monitoring. It is a CGI script, written in perl. It is heavily based on 
0005 # Morten's JavaScript Tree Menu http://www.treemenu.com.
0006 # (The only add-on here is that the menu is dynamically generated, 
0007 # thanks to a "menu" ASCII file which is generated by the MakeHTML 
0008 # methods of OnlMonDraw children).
0009 #
0010 # The main purpose is to *dynamically* generate some javascript and html pages 
0011 # that will produce a tree menu on the left of the navigator window, in order
0012 # to navigate through the html outputs of a given run, and/or to allow the 
0013 # user to select a given run to be shown.
0014 #
0015 #------------------------------------------------------------------------------
0016 # Usage(s) (for users)
0017 # 
0018 # mon.cgi?runselect=1
0019 #   will (dynamically) generate a page where you can see the list of runs
0020 #   for which html output is available
0021 # 
0022 # mon.cgi?runtype=xxx&runnumber=yyy
0023 #   will (dynamically) generate a tree menu for run yyy (of type xxx), where
0024 #   xxx is either eventdata, calibdata, junkdata or unknowndata. The latter
0025 #   state is a temporary one, and should last only a few minutes/hours after
0026 #   the run is taken (ideally, if we were sure to be able to reliably get
0027 #   the run type from the db at html production time, there would be no such
0028 #   state). The move from unknowndata to the 3 other categories is expected
0029 #   to be handled by another script, possibly ran from a cronjob.
0030 #
0031 # mon.cgi?help=1
0032 #   get some help about usage of this script.
0033 #
0034 #------------------------------------------------------------------------------
0035 #
0036 # Usage(s) (internal)
0037 #
0038 # mon.cgi?runtype=xxx&runnumber=yyy&menucode=1
0039 #   generate the javascript code used to produce the tree menu layout for a 
0040 #   given run.
0041 #
0042 #------------------------------------------------------------------------------
0043 #
0044 # Expected directory structure : see README file.
0045 #
0046 #------------------------------------------------------------------------------
0047 #
0048 # Output customization.
0049 #
0050 # The various html pages produced can have their look modified through
0051 # a Cascading Style Sheet (variable $css below). Icons can be changed
0052 # too (see print_code_2 subroutine below).
0053 #
0054 #------------------------------------------------------------------------------
0055 #
0056 # L. Aphecetche (aphecetc@in2p3.fr) Nov. 2003.
0057 #
0058 
0059 use File::Basename;
0060 use File::Find;
0061 use CGI;
0062 
0063 use strict;
0064 
0065 use CGI::Carp 'fatalsToBrowser';
0066 $CGI::POST_MAX = 1024;  # max 1K posts
0067 $CGI::DISABLE_UPLOADS = 1;  # no uploads
0068 
0069 my $css = "mon.css";
0070 
0071 my $q = new CGI;
0072 
0073 print $q->header();
0074 
0075 my $help = $q->param('help');
0076 
0077 if ( defined $help ) {
0078   help();
0079   print $q->end_html;
0080   exit;
0081 }
0082 
0083 my $photo = $q->param('photo');
0084 
0085 my $contacts = $q->param('contacts');
0086 
0087 my $runnumber = $q->param('runnumber');
0088 
0089 my $runselect = $q->param('runselect');
0090 
0091 my $menucode = $q->param('menucode');
0092 
0093 my $runtype = $q->param('runtype');
0094 
0095 my $runrange = $q->param('runrange');
0096 
0097 if ( defined $menucode && defined $runtype && defined $runnumber )
0098   {
0099     # Produces the javascript code
0100     menu_code($runnumber,$runtype);
0101     exit;
0102   }
0103 
0104 if ( defined $runselect ) 
0105   {
0106     # Makes a HTML page to select a run
0107     select_run($runrange);
0108     exit;
0109   }
0110 
0111 if ( defined $runnumber && defined $runtype )
0112   {
0113     # Main entry point to show a run.
0114     show_run($runnumber,$runtype);
0115     exit;
0116   }
0117 
0118 if ( defined $contacts || $photo eq 'Hide faces' )
0119   {
0120     show_contacts(0);
0121     exit;
0122   }
0123 
0124 if ( $photo eq 'Show faces' )
0125   {
0126     show_contacts(1);
0127     exit;
0128   }
0129 
0130 help();
0131 
0132 exit;
0133 
0134 #_____________________________________________________________________________
0135 #_____________________________________________________________________________
0136 #_____________________________________________________________________________
0137 
0138 #_____________________________________________________________________________
0139 sub dirlist {
0140 
0141   my $dir = shift;
0142   my $runrange = shift;
0143 
0144   my $dirname = basename($dir);
0145 
0146   print "<h1 class=\"dir\">$dirname</h1>";
0147 
0148 if (! -d $dir)
0149 {
0150 print "$dir does not exist\n";
0151 }
0152   opendir DIR,$dir or die "couldn't open $dir : $!";
0153 
0154   my $first = 1;
0155 
0156   foreach my $file ( reverse sort readdir(DIR) )
0157     {
0158       if ($file=~/^run/) {
0159     my $runrangename = runrangeName($file);
0160     print "<a class=\"dir\" href=\"mon.cgi?runselect=1&runrange=$file\">$runrangename</a><br>\n";
0161     if ( (! defined $runrange) && $first == 1 ) 
0162       {
0163         $first = 0;
0164         runlist("$dir/$file");
0165       }
0166     if ( defined $runrange && $runrange eq $file ) {
0167       runlist("$dir/$file");
0168     }
0169       }
0170     }
0171 
0172   closedir(DIR);
0173 }
0174 
0175 #_____________________________________________________________________________
0176 sub html_doctype {
0177 
0178   my $type = shift;
0179 
0180   if ( $type eq "Frameset" ) 
0181     {
0182       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">\n";
0183     }
0184   elsif ( $type eq "Strict" )
0185     {
0186       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
0187     }
0188   elsif ( $type eq "Transitional" ) 
0189     {
0190       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
0191     }
0192   else
0193     {
0194       die "Unknown DOCTYPE $type";
0195     }
0196 }
0197 
0198 #_____________________________________________________________________________
0199 sub include_script {
0200   my $name = shift;
0201   print "<script type=\"text/javascript\" src=\"$name\"></script>\n";
0202 }
0203 
0204 #_____________________________________________________________________________
0205 sub help {
0206 
0207   print "<h2>Quick help for the ".$q->url()." script</h2><HR>";
0208   print "This script is intended to navigate Run4 Online Monitoring Results <BR>\n";
0209   print "...more help text needed here... <hr><BR>";
0210   print "User accessible usage:<ul>";
0211   print "<li>help=1 : this page";
0212   print "<li>runtype=type&amp;runnumber=integer : gets the results for a given run";
0213   print "<li>runselect=1 : enter run selection mode. Only most recent run ranges are fully expanded (expanded means you see the run numbers belonging to this run range). Other might be expanded by clicking on them.";
0214   print "<li>runselect=1&runrange=run_xxxxxxxxxx_yyyyyyyyyy : enter run selection mode and expands only the given run range.";
0215   print "<li>contacts=1 : names of the developpers";
0216   print "<li>contacts=1&photo=1 : names and faces of the developpers";
0217   print "</ul>";
0218 
0219   print "<hr>";
0220   print "<p>A small note on runtypes. You probably know/understand what eventdata (real stuff), calibdata (also real stuff in some sense ;-) ) or junkdata (test stuff only) means, but what about unknowndata ? Well, this is just a temporary measure, until we get a clean way of figuring out the runtype at the moment html generation is taking place. For the moment this information is not readily available, so we tag all runs as unknowndata. Do not bother too much about this, it will be fixed!";
0221 
0222   print "<hr>Other possible usage, but not for users (for the script itself)";
0223   print "<ul>";
0224   print "<li>runtype=type&amp;runnumber=integer&amp;menucode=1 : (not meant for users) : used to create the javascript code to output the menu (only valid within a definite frameset, not to be used directly from the url selection bar in the browser)";
0225   print "</ul";
0226   print "<HR>";  
0227 }
0228 
0229 #_____________________________________________________________________________
0230 sub makemenucode {
0231 
0232   #
0233   # From the "menu" file, produced the javascript code
0234   # that will output a tree menu.
0235   #
0236 
0237   my $run = shift;
0238   my $runtype = shift;
0239 
0240   my $dir = rundir($run,$runtype);
0241   my $menudescription = "$dir/menu";
0242 
0243   print "<script type=\"text/javascript\">\n";
0244 
0245   print "runnumber=$runnumber;\n";
0246 
0247   my @list = readfile($menudescription);
0248 
0249   my %dirlist; # will contain the names of all the directories
0250   # found in menu file.
0251 
0252   foreach my $l ( @list ) 
0253     {
0254       my $pos = rindex($l,"/");
0255       $pos = rindex(substr($l,0,$pos),"/");
0256       my $dir = substr($l,0,$pos);
0257       my @parts = split "/",$dir;
0258       foreach ( @parts )
0259     {
0260       # be sure that we have all levels at least once 
0261       # (only once in fact as we use a hash list).
0262       my $d = join "/",@parts;
0263       $dirlist{$d}=1;
0264       pop @parts;
0265     }
0266     }
0267 
0268   # Now loop on all the directories, and associate
0269   # entries in menu file to those directories, to produce
0270   # the makeOnlMenu javascript function.
0271 
0272   print "function makeOnlMenu(menu)\n";
0273   print "{\n";
0274 
0275   if ( scalar keys %dirlist == 0 ) {
0276       print "  menu.addItem(\"RUN NOT FOUND\",\"runnotfound.html\")\n";
0277     }
0278   else {
0279     foreach my $d ( sort keys %dirlist )
0280       {
0281     my $var = $d;
0282     $var =~ tr/\//_/;
0283     print "  var $var = null;\n";
0284     print "  $var = new MTMenu;\n";
0285     my @parts = split "/",$d;      
0286     my $n = $#parts;
0287     my $parent = join "_",@parts[0 .. $n-1];
0288     print "  $parent.addItem(\"$parts[$n]\");\n";
0289     foreach my $v ( @list )
0290       {
0291         my $p1 = rindex($v,"/");
0292         my $p2 = rindex(substr($v,0,$p1),"/");
0293         if ( substr($v,0,$p2) eq $d )
0294           {
0295         my $name = substr($v,$p2+1,$p1-$p2-1);
0296         my $link = "$dir/".substr($v,$p1+1);
0297         print "  $var.addItem(\"$name\",\"$link\");\n";
0298           }
0299       }
0300     my $isMenuFullyExpanded = "false";
0301     print "  $parent.makeLastSubmenu($var,$isMenuFullyExpanded);\n";
0302       }
0303   }
0304 
0305 #  print " menu.addItem(\"RunControl\",\"http://www.sphenix-intra.bnl.gov:7815/cgi-bin/run_details.py?run=$runnumber\",\"text\",\"See what runcontrol have to say about this run\",\"link.gif\");\n";
0306   print "}\n";
0307   print "</script>\n";
0308 }
0309 
0310 #_____________________________________________________________________________
0311 sub menu_code {
0312 
0313   my $runnumber=shift;
0314   my $runtype=shift;
0315 
0316   print_code_1();
0317 
0318   makemenucode($runnumber,$runtype);
0319 
0320   print_code_2();
0321 }
0322 
0323 #_____________________________________________________________________________
0324 sub print_code_1 {
0325 
0326   print html_doctype("Strict");
0327   print "<html><head>\n";
0328   print_copyright();
0329   print "<script type=\"text/javascript\">\n";
0330   print " // Framebuster script to relocate browser when MSIE bookmarks this\n";
0331   print "  // page instead of the parent frameset.  Set variable relocateURL to\n";
0332   print "  // the index document of your website (relative URLs are ok):\n";
0333   print "  var relocateURL = \"/\";\n";
0334   print "  if(parent.frames.length == 0) {\n";
0335   print "    if(document.images) {\n";
0336   print "      location.replace(relocateURL);\n";
0337   print "    } else {\n";
0338   print "      location = relocateURL;\n";
0339   print "    }\n";
0340   print "  }\n";
0341   print "</script>\n";
0342 
0343   include_script("mtmcode.js");
0344   include_script("mtmtrack.js");
0345 }
0346 
0347 #_____________________________________________________________________________
0348 sub print_code_2 {
0349 
0350   print "<script type=\"text/javascript\">\n";
0351   # General setup 
0352 
0353   print "MTMSSHREF = \"$css\";\n";
0354   print "MTMLinkedSS = true;\n";
0355   print "MTMDefaultTarget = \"text\";\n";
0356   print "MTMRootIcon = \"menu_root.gif\";\n";
0357   print "MTMenuText = \"RUN \"+runnumber.toString();\n";
0358 
0359   # Icons setup
0360 
0361   print "var MTMIconList = null;\n";
0362   print "MTMIconList = new IconList();\n";
0363   print "MTMIconList.addIcon(new MTMIcon(\"menu_link_external.gif\", \"http://\", \"pre\"));\n";
0364   print "MTMIconList.addIcon(new MTMIcon(\"menu_link_com.gif\", \".gif\", \"post\"));\n";
0365   print "MTMIconList.addIcon(new MTMIcon(\"iconhelp1.gif\", \"help\", \"pre\"));\n";
0366 
0367   # Menu setup
0368 
0369   print "var menu = null;\n";
0370   print "menu = new MTMenu();\n";
0371   print "makeOnlMenu(menu);\n";
0372 
0373   print "menu.addItem(\"RunSelect\",\"mon.cgi?runselect=1\",\"text\",\"Go here to select a given run\",\"select.gif\");\n";
0374   print "menu.addItem(\"Contacts\",\"mon.cgi?contacts=1\",\"text\",\"The humans behind the code\",\"iconemail3.gif\");\n";
0375 
0376   print "menu.addItem(\"Help\",\"mon.cgi?help=1\",\"text\",\"Get some help here\",\"help.gif\");\n";
0377   # Closures
0378   print "</script></head>\n";
0379   print "<body class=\"menu\" onload=\"MTMStartMenu(true)\">\n";
0380   print "</body></html>\n";
0381 }
0382 
0383 #_____________________________________________________________________________
0384 sub print_copyright {
0385   print "<!--\n";
0386   print "// This script is a part of:\n";
0387   print "// Morten's JavaScript Tree Menu\n";
0388   print "// version 2.3.2-macfriendly, dated 2002-06-10\n";
0389   print "// http://www.treemenu.com/\n";
0390   print "// Copyright (c) 2001-2002, Morten Wang & contributors\n";
0391   print "// All rights reserved.\n";
0392   print "// This software is released under the BSD License which should accompany\n";
0393   print "// it in the file \"COPYING\".  If you do not have this file you can access\n";
0394   print "// the license through the WWW at http://www.treemenu.com/license.txt\n\n";
0395   print "-->\n";
0396 }
0397 
0398 #_____________________________________________________________________________
0399 sub print_start_1 {
0400 
0401   my $run = shift;
0402 
0403   print html_doctype("Frameset");
0404   print "<html>\n";
0405   print "<head>\n";
0406   print "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">\n";
0407   print "<title>sPHENIX Online Monitoring HTML Output for Run $run</title>\n";
0408 
0409   print_copyright();
0410 
0411   include_script("mtmcode.js");
0412   include_script("mtmtrack.js");
0413 
0414   print "<script type=\"text/javascript\">\n\n";
0415   print "  var MTMUsableBrowser = false;\n";
0416   print "  // browser sniffing routine\n";
0417   print "  browserName = navigator.appName;\n";
0418   print "  browserVersion = parseInt(navigator.appVersion);\n";
0419   print "  if (browserName == \"Netscape\" && browserVersion >= 3) {\n";
0420   print "    MTMUsableBrowser = (navigator.userAgent.indexOf(\"Opera\") == -1) ? true : false;\n";
0421   print "  } else if (browserName == \"Microsoft Internet Explorer\" && browserVersion >= 4) {\n";
0422   print "    MTMUsableBrowser = true;\n";
0423   print "  } else if(browserName == \"Opera\" && browserVersion >= 5) {\n";
0424   print "    MTMUsableBrowser = true;\n";
0425   print "  }\n";
0426   print "  if ( !MTMUsableBrowser ) {\n";
0427   print "    document.write(\"<P>Cannot work with this browser. Sorry.\");\n";
0428   print "  }\n";
0429   print "</script>\n\n";
0430   print "</head>\n";
0431 
0432   print "<!-- frameset creation -->\n\n";
0433   my $heading_height = 70;
0434 
0435   print "<FRAMESET cols=\"*\" rows=\"$heading_height,*\">\n";
0436   print "  <FRAME marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" src=\"heading.html\" name=\"heading\" noresize scrolling=\"no\">\n";
0437 }
0438 
0439 #_____________________________________________________________________________
0440 sub print_start_2 {
0441 
0442   my $run = shift;
0443   my $runtype = shift;
0444 
0445   print "  <FRAME marginwidth=\"5\" marginheight=\"5\" src=\"mon.cgi?runselect=1\" name=\"text\" noresize frameborder=\"0\">\n";
0446 
0447   print "  </FRAMESET>\n";
0448 
0449   my $link = rundir($run,$runtype);
0450   $link .= "/menu.html";
0451 
0452   print "  <NOFRAMES>\n";
0453   print "  <P>This document uses frames. If you don't have them, you may try";
0454   print "     the plain <A HREF=\"$link\">HTML menu</A>\n";
0455   print "  </NOFRAMES>\n";
0456   print "</FRAMESET>\n";
0457 
0458   print "</html>\n";
0459 }
0460 
0461 #_____________________________________________________________________________
0462 sub readfile {
0463 
0464   my $file = shift;
0465 
0466   my @list;
0467 
0468   open FILE,$file or return @list;
0469 
0470   while (<FILE>)
0471     {
0472       chomp;
0473       if ( length $_ > 0 ) 
0474     {
0475       push @list, "menu/$_";
0476     }
0477     }
0478   close FILE;
0479 
0480   return @list;
0481 }
0482 
0483 #_____________________________________________________________________________
0484 sub rundir {
0485   # From the runtype and the runnumber, construct the directory name
0486   # where the menu and menu.html files are to be found.
0487   my $runnumber = shift;
0488   my $runtype = shift;
0489   my $range = runrange($runnumber);
0490   return "$runtype/$range/$runnumber";
0491 }
0492 
0493 #_____________________________________________________________________________
0494 sub runlist {
0495 
0496   my $dir = shift;
0497   my $dirname = basename($dir);
0498   my $path = dirname($dir);
0499 
0500   opendir RDIR,$dir or die "couldn't open $dir : $!";
0501 
0502   my $n = 0;
0503 
0504   foreach my $run ( sort readdir(RDIR) )
0505     {
0506       if ( (!($run=~/^\./)) && int $run > 0 ) {
0507     print "<a href=\"", $q->url(-relative=>1), 
0508       "?runnumber=$run&amp;runtype=$path\" target=\"_top\" class=\"$path\">",
0509         $run,"</a>&nbsp;";
0510     ++$n;
0511     if ( $n % 5 == 0 ) {
0512       print "&nbsp;<br>\n";
0513     }
0514       }
0515     }
0516 
0517   closedir RDIR;
0518 
0519   if ( $n % 5 != 0 ) 
0520     {
0521       print "<BR>\n";
0522     }
0523 }
0524 
0525 #_____________________________________________________________________________
0526 sub runrange {
0527   my $run = shift;
0528   my $start = int $run/1000;
0529   my $range = sprintf("run_%010d_%010d",$start*1000,($start+1)*1000);
0530   return $range;
0531 }
0532 
0533 #_____________________________________________________________________________
0534 sub runrangeName {
0535   my $rr = shift;
0536   # From a $rr=run_XXXXXXXXXX_YYYYYYYYYY runrangedir, 
0537   # produces an easier to read
0538   # string
0539 
0540   my $n1 = int substr($rr,4,10);
0541   my $n2 = int substr($rr,15,10);
0542 
0543   return "$n1->$n2";
0544 }
0545 
0546 #_____________________________________________________________________________
0547 sub select_run {
0548 
0549   my $runrange = shift;
0550 
0551   print html_doctype("Transitional");
0552   print "<html>\n<head>\n";
0553   print "<link rel=\"stylesheet\" href=\"mon.css\" type=\"text/css\">\n";
0554   print "<title>sPHENIX OnlMon HTML Output : Run Selection</title>\n";
0555   print "</head>\n<body class=\"runselect\">\n";
0556 
0557   print "<P>Please click on a run range below to expand it (by default the latest runs are expanded), and then click on a run number to browse it.\n";
0558 
0559   print "<table border=\"1\">\n";
0560   print "<tr valign=\"top\">\n";
0561 
0562   if (-d "physics")
0563   {
0564       print "<td>\n";
0565       dirlist("physics",$runrange);
0566       print "</td>\n";
0567   }
0568   if (-d "beam")
0569   {
0570       print "<td>\n";
0571       dirlist("beam",$runrange);
0572       print "</td>\n";
0573   }
0574   if (-d "cosmics")
0575   {
0576       print "<td>\n";
0577       dirlist("cosmics",$runrange);
0578       print "</td>\n";
0579   }
0580   if (-d "calib")
0581   {
0582       print "<td>\n";
0583       dirlist("calib",$runrange);
0584       print "</td>\n";
0585   }
0586   if (-d "junk")
0587   {
0588       print "<td>\n";
0589       dirlist("junk",$runrange);
0590       print "</td>\n";
0591   }
0592   if (-d "laser")
0593   {
0594       print "<td>\n";
0595       dirlist("laser",$runrange);
0596       print "</td>\n";
0597   }
0598   if (-d "led")
0599   {
0600       print "<td>\n";
0601       dirlist("led",$runrange);
0602       print "</td>\n";
0603   }
0604   if (-d "local_junk")
0605   {
0606       print "<td>\n";
0607       dirlist("local_junk",$runrange);
0608       print "</td>\n";
0609   }
0610   if (-d "pedestal")
0611   {
0612       print "<td>\n";
0613       dirlist("pedestal",$runrange);
0614       print "</td>\n";
0615   }
0616   if (-d "pulser")
0617   {
0618       print "<td>\n";
0619       dirlist("pulser",$runrange);
0620       print "</td>\n";
0621   }
0622   if (-d "unknown_runtype")
0623   {
0624       print "<td>\n";
0625       dirlist("unknown_runtype",$runrange);
0626       print "</td>\n";
0627   }
0628   print "</table>\n";
0629 
0630   print "</body>\n</html>\n";
0631 }
0632 
0633 #_____________________________________________________________________________
0634 sub show_contacts {
0635 
0636     my $show_photo = shift;
0637 
0638     print html_doctype("Transitional");
0639     print "<html>\n<head>\n";
0640     print "<link rel=\"stylesheet\" href=\"mon.css\" type=\"text/css\">\n";
0641     print "<title>The humans behind the sPHENIX Online Monitoring</title>\n";
0642     print "</head>\n<body class=\"contacts\">\n";
0643 
0644     print "<P>The humans behind the sPHENIX Online Monitoring...<BR><HR>";
0645 
0646     my %list = (
0647     "Master of the beast, html" => {
0648         name => "Chris Pinkenburg",
0649         email => "pinkenburg\@bnl.gov",
0650         photo => "pinkenburg_chris.jpg",
0651     },
0652     "MVTX" => {
0653         name => "Jakub Kvapil",
0654         email => "jakub.kvapil\@lanl.gov",
0655         photo => "kvapil_jakub.jpg"
0656     },
0657     "INTT" => {
0658         name => "Joseph Bertaux",
0659         email => "jbertau\@purdue.edu",
0660         photo => "bertaux_joseph.jpg"
0661     },
0662     "TPC" => {
0663         name => "Charles Hughes",
0664         email => "chughes2\@iastate.edu",
0665         photo => "sphenix-logo-white-bg.png"
0666     },
0667     "TPOT" => {
0668         name => "Hugo Pereira Da Costa",
0669         email => "hugo.pereira-da-costa\@lanl.gov",
0670         photo => "sphenix-logo-white-bg.png"
0671     },
0672     "CEMC" => {
0673         name => "Vincent Andrieux",
0674         email => "andrieux\@illinois.edu",
0675         photo => "sphenix-logo-white-bg.png"
0676     },
0677     "HCAL" => {
0678         name => "Shuhang Li",
0679         email => "sl4859\@columbia.edu",
0680         photo => "sphenix-logo-white-bg.png"
0681     },
0682     "MBD" => {
0683         name => "Mickey Chiu",
0684         email => "chiu\@bnl.gov",
0685         photo => "chiu_mickey.jpg"
0686     },
0687     "SEPD" => {
0688         name => "Ron Belmont",
0689         email => "belmonrj\@gmail.com",
0690         photo => "sphenix-logo-white-bg.png"
0691     },
0692     "ZDC" => {
0693         name => "Ejiro Umaka",
0694         email => "ejironaomiumaka\@gmail.com",
0695         photo => "umaka_ejiro.jpg"
0696     },
0697     "DAQ" => {
0698         name => "JaeBeom Park",
0699         email => "jpark4\@bnl.gov",
0700         photo => "sphenix-logo-white-bg.png"
0701     },
0702     "LL1" => {
0703         name => "Daniel Lis",
0704         email => "Daniel.Lis\@colorado.edu",
0705         photo => "sphenix-logo-white-bg.png"
0706     },
0707     "Spin" => {
0708         name => "Devon Loomis",
0709         email => "dloom\@umich.edu",
0710         photo => "sphenix-logo-white-bg.png"
0711     }
0712     );
0713 
0714     print "<table>\n";
0715     my $photodir = "./photos";
0716 
0717     foreach my $l ( sort keys %list )
0718     {
0719     my $d = \%{$list{$l}};
0720     my $component = $l;
0721 
0722     my @name = split ',',$$d{"name"};
0723     my @email = split ",", $$d{"email"};
0724     my @photo = split ",",$$d{"photo"};
0725 
0726     for ( my $i = 0; $i < $#name+1; ++$i ) {
0727         my $name = $name[$i];
0728         my $email = $email[$i];
0729         my $photo = $photo[$i];
0730         print "<TR><TD class=\"devcomponent\">$component",
0731         "<td><A class=\"devmail\" HREF=\"mailto:$email\">$name</a>";
0732         if ( $show_photo == 1 )
0733         {
0734         print "<td><img src=\"$photodir/$photo\" width=\"115\" height=\"115\">\n";
0735         }
0736     }
0737     }
0738 
0739     print "<tr><td>&nbsp;<td>";
0740 
0741     print $q->start_form("post");#,"./mon.cgi?contacts=1&photo=1");
0742     if ( $show_photo == 0 )
0743     {
0744     print $q->submit(-name=>'photo',-label=>'Show faces');
0745     }
0746     else
0747     {
0748     print $q->submit(-name=>'photo',-label=>'Hide faces');
0749     }
0750     print $q->endform();
0751 
0752     print "</table>\n";
0753 
0754     print "</body></html>\n";
0755 }
0756 
0757 #_____________________________________________________________________________
0758 sub show_run {
0759 
0760   my $run = shift;
0761   my $runtype = shift;
0762 
0763   print_start_1($run,$runtype);
0764 
0765   my $menu_width = 250;
0766   print "  <FRAMESET cols=\"$menu_width,*\" rows=\"*\">\n";
0767   print "    <FRAMESET rows=\"0,*\">\n";
0768   my $codesrc = $q->url(-relative=>1)."?runnumber=$run&amp;menucode=1&amp;runtype=$runtype";
0769 
0770   print "      <FRAME marginwidth=\"0\" marginheight=\"0\" src=\"$codesrc\" name=\"code\" noresize scrolling=\"no\" frameborder=\"0\">\n";
0771 
0772   print "      <FRAME marginwidth=\"5\" marginheight=\"5\" src=\"menu_empty.html\" name=\"menu\" noresize scrolling=\"auto\" frameborder=\"0\">\n";
0773 
0774   print "    </FRAMESET>\n";
0775 
0776   print_start_2($run,$runtype);
0777 }