Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:54

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   opendir DIR,$dir or die "couldn't open $dir : $!";
0149 
0150   my $first = 1;
0151 
0152   foreach my $file ( reverse sort readdir(DIR) )
0153     {
0154       if ($file=~/^run/) {
0155     my $runrangename = runrangeName($file);
0156     print "<a class=\"dir\" href=\"mon.cgi?runselect=1&runrange=$file\">$runrangename</a><br>\n";
0157     if ( (! defined $runrange) && $first == 1 ) 
0158       {
0159         $first = 0;
0160         runlist("$dir/$file");
0161       }
0162     if ( defined $runrange && $runrange eq $file ) {
0163       runlist("$dir/$file");
0164     }
0165       }
0166     }
0167 
0168   closedir(DIR);
0169 }
0170 
0171 #_____________________________________________________________________________
0172 sub html_doctype {
0173 
0174   my $type = shift;
0175 
0176   if ( $type eq "Frameset" ) 
0177     {
0178       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">\n";
0179     }
0180   elsif ( $type eq "Strict" )
0181     {
0182       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
0183     }
0184   elsif ( $type eq "Transitional" ) 
0185     {
0186       return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
0187     }
0188   else
0189     {
0190       die "Unknown DOCTYPE $type";
0191     }
0192 }
0193 
0194 #_____________________________________________________________________________
0195 sub include_script {
0196   my $name = shift;
0197   print "<script type=\"text/javascript\" src=\"$name\"></script>\n";
0198 }
0199 
0200 #_____________________________________________________________________________
0201 sub help {
0202 
0203   print "<h2>Quick help for the ".$q->url()." script</h2><HR>";
0204   print "This script is intended to navigate Run4 Online Monitoring Results <BR>\n";
0205   print "...more help text needed here... <hr><BR>";
0206   print "User accessible usage:<ul>";
0207   print "<li>help=1 : this page";
0208   print "<li>runtype=type&amp;runnumber=integer : gets the results for a given run";
0209   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.";
0210   print "<li>runselect=1&runrange=run_xxxxxxxxxx_yyyyyyyyyy : enter run selection mode and expands only the given run range.";
0211   print "<li>contacts=1 : names of the developpers";
0212   print "<li>contacts=1&photo=1 : names and faces of the developpers";
0213   print "</ul>";
0214 
0215   print "<hr>";
0216   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!";
0217 
0218   print "<hr>Other possible usage, but not for users (for the script itself)";
0219   print "<ul>";
0220   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)";
0221   print "</ul";
0222   print "<HR>";  
0223 }
0224 
0225 #_____________________________________________________________________________
0226 sub makemenucode {
0227 
0228   #
0229   # From the "menu" file, produced the javascript code
0230   # that will output a tree menu.
0231   #
0232 
0233   my $run = shift;
0234   my $runtype = shift;
0235 
0236   my $dir = rundir($run,$runtype);
0237   my $menudescription = "$dir/menu";
0238 
0239   print "<script type=\"text/javascript\">\n";
0240 
0241   print "runnumber=$runnumber;\n";
0242 
0243   my @list = readfile($menudescription);
0244 
0245   my %dirlist; # will contain the names of all the directories
0246   # found in menu file.
0247 
0248   foreach my $l ( @list ) 
0249     {
0250       my $pos = rindex($l,"/");
0251       $pos = rindex(substr($l,0,$pos),"/");
0252       my $dir = substr($l,0,$pos);
0253       my @parts = split "/",$dir;
0254       foreach ( @parts )
0255     {
0256       # be sure that we have all levels at least once 
0257       # (only once in fact as we use a hash list).
0258       my $d = join "/",@parts;
0259       $dirlist{$d}=1;
0260       pop @parts;
0261     }
0262     }
0263 
0264   # Now loop on all the directories, and associate
0265   # entries in menu file to those directories, to produce
0266   # the makeOnlMenu javascript function.
0267 
0268   print "function makeOnlMenu(menu)\n";
0269   print "{\n";
0270 
0271   if ( scalar keys %dirlist == 0 ) {
0272       print "  menu.addItem(\"RUN NOT FOUND\",\"runnotfound.html\")\n";
0273     }
0274   else {
0275     foreach my $d ( sort keys %dirlist )
0276       {
0277     my $var = $d;
0278     $var =~ tr/\//_/;
0279     print "  var $var = null;\n";
0280     print "  $var = new MTMenu;\n";
0281     my @parts = split "/",$d;      
0282     my $n = $#parts;
0283     my $parent = join "_",@parts[0 .. $n-1];
0284     print "  $parent.addItem(\"$parts[$n]\");\n";
0285     foreach my $v ( @list )
0286       {
0287         my $p1 = rindex($v,"/");
0288         my $p2 = rindex(substr($v,0,$p1),"/");
0289         if ( substr($v,0,$p2) eq $d )
0290           {
0291         my $name = substr($v,$p2+1,$p1-$p2-1);
0292         my $link = "$dir/".substr($v,$p1+1);
0293         print "  $var.addItem(\"$name\",\"$link\");\n";
0294           }
0295       }
0296     my $isMenuFullyExpanded = "false";
0297     print "  $parent.makeLastSubmenu($var,$isMenuFullyExpanded);\n";
0298       }
0299   }
0300 
0301   print " menu.addItem(\"RunControl\",\"http://logbook.phenix.bnl.gov/runcontrol/RunSummary.php?RunNumber=$runnumber\",\"text\",\"See what runcontrol have to say about this run\",\"link.gif\");\n";
0302   print "}\n";
0303   print "</script>\n";
0304 }
0305 
0306 #_____________________________________________________________________________
0307 sub menu_code {
0308 
0309   my $runnumber=shift;
0310   my $runtype=shift;
0311 
0312   print_code_1();
0313 
0314   makemenucode($runnumber,$runtype);
0315 
0316   print_code_2();
0317 }
0318 
0319 #_____________________________________________________________________________
0320 sub print_code_1 {
0321 
0322   print html_doctype("Strict");
0323   print "<html><head>\n";
0324   print_copyright();
0325   print "<script type=\"text/javascript\">\n";
0326   print " // Framebuster script to relocate browser when MSIE bookmarks this\n";
0327   print "  // page instead of the parent frameset.  Set variable relocateURL to\n";
0328   print "  // the index document of your website (relative URLs are ok):\n";
0329   print "  var relocateURL = \"/\";\n";
0330   print "  if(parent.frames.length == 0) {\n";
0331   print "    if(document.images) {\n";
0332   print "      location.replace(relocateURL);\n";
0333   print "    } else {\n";
0334   print "      location = relocateURL;\n";
0335   print "    }\n";
0336   print "  }\n";
0337   print "</script>\n";
0338 
0339   include_script("mtmcode.js");
0340   include_script("mtmtrack.js");
0341 }
0342 
0343 #_____________________________________________________________________________
0344 sub print_code_2 {
0345 
0346   print "<script type=\"text/javascript\">\n";
0347   # General setup 
0348 
0349   print "MTMSSHREF = \"$css\";\n";
0350   print "MTMLinkedSS = true;\n";
0351   print "MTMDefaultTarget = \"text\";\n";
0352   print "MTMRootIcon = \"menu_root.gif\";\n";
0353   print "MTMenuText = \"RUN \"+runnumber.toString();\n";
0354 
0355   # Icons setup
0356 
0357   print "var MTMIconList = null;\n";
0358   print "MTMIconList = new IconList();\n";
0359   print "MTMIconList.addIcon(new MTMIcon(\"menu_link_external.gif\", \"http://\", \"pre\"));\n";
0360   print "MTMIconList.addIcon(new MTMIcon(\"menu_link_com.gif\", \".gif\", \"post\"));\n";
0361   print "MTMIconList.addIcon(new MTMIcon(\"iconhelp1.gif\", \"help\", \"pre\"));\n";
0362 
0363   # Menu setup
0364 
0365   print "var menu = null;\n";
0366   print "menu = new MTMenu();\n";
0367   print "makeOnlMenu(menu);\n";
0368 
0369   print "menu.addItem(\"RunSelect\",\"mon.cgi?runselect=1\",\"text\",\"Go here to select a given run\",\"select.gif\");\n";
0370   print "menu.addItem(\"Contacts\",\"mon.cgi?contacts=1\",\"text\",\"The humans behind the code\",\"iconemail3.gif\");\n";
0371 
0372   print "menu.addItem(\"Help\",\"mon.cgi?help=1\",\"text\",\"Get some help here\",\"help.gif\");\n";
0373   # Closures
0374   print "</script></head>\n";
0375   print "<body class=\"menu\" onload=\"MTMStartMenu(true)\">\n";
0376   print "</body></html>\n";
0377 }
0378 
0379 #_____________________________________________________________________________
0380 sub print_copyright {
0381   print "<!--\n";
0382   print "// This script is a part of:\n";
0383   print "// Morten's JavaScript Tree Menu\n";
0384   print "// version 2.3.2-macfriendly, dated 2002-06-10\n";
0385   print "// http://www.treemenu.com/\n";
0386   print "// Copyright (c) 2001-2002, Morten Wang & contributors\n";
0387   print "// All rights reserved.\n";
0388   print "// This software is released under the BSD License which should accompany\n";
0389   print "// it in the file \"COPYING\".  If you do not have this file you can access\n";
0390   print "// the license through the WWW at http://www.treemenu.com/license.txt\n\n";
0391   print "-->\n";
0392 }
0393 
0394 #_____________________________________________________________________________
0395 sub print_start_1 {
0396 
0397   my $run = shift;
0398 
0399   print html_doctype("Frameset");
0400   print "<html>\n";
0401   print "<head>\n";
0402   print "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">\n";
0403   print "<title>PHENIX Online Monitoring HTML Output for Run $run</title>\n";
0404 
0405   print_copyright();
0406 
0407   include_script("mtmcode.js");
0408   include_script("mtmtrack.js");
0409 
0410   print "<script type=\"text/javascript\">\n\n";
0411   print "  var MTMUsableBrowser = false;\n";
0412   print "  // browser sniffing routine\n";
0413   print "  browserName = navigator.appName;\n";
0414   print "  browserVersion = parseInt(navigator.appVersion);\n";
0415   print "  if (browserName == \"Netscape\" && browserVersion >= 3) {\n";
0416   print "    MTMUsableBrowser = (navigator.userAgent.indexOf(\"Opera\") == -1) ? true : false;\n";
0417   print "  } else if (browserName == \"Microsoft Internet Explorer\" && browserVersion >= 4) {\n";
0418   print "    MTMUsableBrowser = true;\n";
0419   print "  } else if(browserName == \"Opera\" && browserVersion >= 5) {\n";
0420   print "    MTMUsableBrowser = true;\n";
0421   print "  }\n";
0422   print "  if ( !MTMUsableBrowser ) {\n";
0423   print "    document.write(\"<P>Cannot work with this browser. Sorry.\");\n";
0424   print "  }\n";
0425   print "</script>\n\n";
0426   print "</head>\n";
0427 
0428   print "<!-- frameset creation -->\n\n";
0429   my $heading_height = 70;
0430 
0431   print "<FRAMESET cols=\"*\" rows=\"$heading_height,*\">\n";
0432   print "  <FRAME marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" src=\"heading.html\" name=\"heading\" noresize scrolling=\"no\">\n";
0433 }
0434 
0435 #_____________________________________________________________________________
0436 sub print_start_2 {
0437 
0438   my $run = shift;
0439   my $runtype = shift;
0440 
0441   print "  <FRAME marginwidth=\"5\" marginheight=\"5\" src=\"mon.cgi?runselect=1\" name=\"text\" noresize frameborder=\"0\">\n";
0442 
0443   print "  </FRAMESET>\n";
0444 
0445   my $link = rundir($run,$runtype);
0446   $link .= "/menu.html";
0447 
0448   print "  <NOFRAMES>\n";
0449   print "  <P>This document uses frames. If you don't have them, you may try";
0450   print "     the plain <A HREF=\"$link\">HTML menu</A>\n";
0451   print "  </NOFRAMES>\n";
0452   print "</FRAMESET>\n";
0453 
0454   print "</html>\n";
0455 }
0456 
0457 #_____________________________________________________________________________
0458 sub readfile {
0459 
0460   my $file = shift;
0461 
0462   my @list;
0463 
0464   open FILE,$file or return @list;
0465 
0466   while (<FILE>)
0467     {
0468       chomp;
0469       if ( length $_ > 0 ) 
0470     {
0471       push @list, "menu/$_";
0472     }
0473     }
0474   close FILE;
0475 
0476   return @list;
0477 }
0478 
0479 #_____________________________________________________________________________
0480 sub rundir {
0481   # From the runtype and the runnumber, construct the directory name
0482   # where the menu and menu.html files are to be found.
0483   my $runnumber = shift;
0484   my $runtype = shift;
0485   my $range = runrange($runnumber);
0486   return "$runtype/$range/$runnumber";
0487 }
0488 
0489 #_____________________________________________________________________________
0490 sub runlist {
0491 
0492   my $dir = shift;
0493   my $dirname = basename($dir);
0494   my $path = dirname($dir);
0495 
0496   opendir RDIR,$dir or die "couldn't open $dir : $!";
0497 
0498   my $n = 0;
0499 
0500   foreach my $run ( sort readdir(RDIR) )
0501     {
0502       if ( (!($run=~/^\./)) && int $run > 0 ) {
0503     print "<a href=\"", $q->url(-relative=>1), 
0504       "?runnumber=$run&amp;runtype=$path\" target=\"_top\" class=\"$path\">",
0505         $run,"</a>&nbsp;";
0506     ++$n;
0507     if ( $n % 5 == 0 ) {
0508       print "&nbsp;<br>\n";
0509     }
0510       }
0511     }
0512 
0513   closedir RDIR;
0514 
0515   if ( $n % 5 != 0 ) 
0516     {
0517       print "<BR>\n";
0518     }
0519 }
0520 
0521 #_____________________________________________________________________________
0522 sub runrange {
0523   my $run = shift;
0524   my $start = int $run/1000;
0525   my $range = sprintf("run_%010d_%010d",$start*1000,($start+1)*1000);
0526   return $range;
0527 }
0528 
0529 #_____________________________________________________________________________
0530 sub runrangeName {
0531   my $rr = shift;
0532   # From a $rr=run_XXXXXXXXXX_YYYYYYYYYY runrangedir, 
0533   # produces an easier to read
0534   # string
0535 
0536   my $n1 = int substr($rr,4,10);
0537   my $n2 = int substr($rr,15,10);
0538 
0539   return "$n1->$n2";
0540 }
0541 
0542 #_____________________________________________________________________________
0543 sub select_run {
0544 
0545   my $runrange = shift;
0546 
0547   print html_doctype("Transitional");
0548   print "<html>\n<head>\n";
0549   print "<link rel=\"stylesheet\" href=\"mon.css\" type=\"text/css\">\n";
0550   print "<title>PHENIX OnlMon HTML Output : Run Selection</title>\n";
0551   print "</head>\n<body class=\"runselect\">\n";
0552 
0553   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";
0554 
0555   print "<table border=\"1\">\n";
0556   print "<tr valign=\"top\">\n";
0557 
0558   print "<td>\n";
0559   dirlist("eventdata",$runrange);
0560   print "</td>\n";
0561 
0562   print "<td>\n";
0563   dirlist("calibdata",$runrange);
0564   print "</td>\n";
0565 
0566   print "<td>\n";
0567   dirlist("zerofielddata",$runrange);
0568   print "</td>\n";
0569 
0570   print "<td>\n";
0571   dirlist("pedestaldata",$runrange);
0572   print "</td>\n";
0573 
0574   print "<td>\n";
0575   dirlist("vernierscandata",$runrange);
0576   print "</td>\n";
0577 
0578   print "<td>\n";
0579   dirlist("localpoldata",$runrange);
0580   print "</td>\n";
0581 
0582   print "<td>\n";
0583   dirlist("junkdata",$runrange);
0584   print "</td>\n";
0585 
0586   print "<td>\n";
0587   dirlist("prejecteddata",$runrange);
0588   print "</td>\n";
0589 
0590   print "<td>\n";
0591   dirlist("crejecteddata",$runrange);
0592   print "</td>\n";
0593 
0594   print "<td>\n";
0595   dirlist("pedrejecteddata",$runrange);
0596   print "</td>\n";
0597 
0598   print "<td>\n";
0599   dirlist("unknowndata",$runrange);
0600   print "</td>\n";
0601 
0602   print "</table>\n";
0603 
0604   print "</body>\n</html>\n";
0605 }
0606 
0607 #_____________________________________________________________________________
0608 sub show_contacts {
0609 
0610   my $show_photo = shift;
0611 
0612   print html_doctype("Transitional");
0613   print "<html>\n<head>\n";
0614   print "<link rel=\"stylesheet\" href=\"mon.css\" type=\"text/css\">\n";
0615   print "<title>The humans behind the PHENIX Online Monitoring</title>\n";
0616   print "</head>\n<body class=\"contacts\">\n";
0617 
0618   print "<P>The humans behind the PHENIX Online Monitoring...<BR><HR>";
0619 
0620   my %list = ( 
0621           "Master of the beast, Daq, Mcr, packet size, html" => {
0622                name => "Chris Pinkenburg",
0623                email => "pinkenburg\@bnl.gov",
0624                photo => "pinkenburg_chris.jpg",
0625               },
0626           "Aerogel, TofE (1)" => {
0627                 name => "Hiroshi Nakagomi",
0628                 email => "hiro_n\@rcf.rhic.bnl.gov",
0629                 photo => "nakagomi_hiroshi.jpg"
0630                },
0631           "Aerogel, TofE (2)" => {
0632              name => "Hiroki Yamamoto",
0633              email => "s1420259\@u.tsukuba.ac.jp",
0634              photo => "yamamoto_hiroki.jpg"
0635             },
0636           "Bbc (1)" => {
0637             name => "Kazuya Nagashima",
0638             email => "nagashima\@hepl.hiroshima-u.ac.jp",
0639             photo => "nagashima_kazuya.jpg"
0640                },
0641           "Bbc (2)" => {
0642             name => "Yosuke Ueda",
0643             email => "ueda\@hepl.hiroshima-u.ac.jp",
0644             photo => "ueda_yosuke.jpg"
0645                },
0646           "Bbclvl1, Gl1, Muidlvl1, Zdclvl1" => {
0647              name => "John Lajoie",
0648              email => "lajoie\@iastate.edu",
0649              photo => "lajoie_john.jpg"
0650             },
0651           "Dch (1)" => {
0652              name => "Dmitry Kotov",
0653              email => "dmitriy.kotov\@gmail.com",
0654              photo => "kotov_dmitry.jpg"
0655             },
0656           "Dch (2)" => {
0657              name => "Victor Riabov",
0658              email => "riabovvg\@gmail.com",
0659              photo => "riabov_viktor.jpg"
0660             },
0661           "Emc" => {
0662               name => "Andrey Yanovich",
0663               email => "yanovich\@bnl.gov",
0664               photo => "yanovich_andrey.jpg"
0665              },
0666           "Ertlvl1" => {
0667              name => "Milap Patel",
0668              email => "mrpind\@iastate.edu",
0669              photo => "patel_milap.jpg"
0670             },
0671           "ErtMask" => {
0672              name => "TBA",
0673              email => "pinkenburg\@bnl.gov",
0674              photo => "confused_baby.jpg"
0675             },
0676           "Fvtx" => {
0677               name => "Haiwang Yu",
0678               email => "yuhw.pku\@gmail.com",
0679               photo => "yu_haiwang.jpg"
0680              },
0681           "LocalPol, Zdc (1)" => {
0682               name => "Minjung Kim",
0683               email => "keimj0703\@gmail.com",
0684               photo => "kim_minjung.jpg"
0685              },
0686           "LocalPol, Zdc (2)" => {
0687               name => "Junsang Park",
0688               email => "parkjunsang0405\@gmail.com",
0689               photo => "park_junsang.jpg"
0690              },
0691           "Mpc" => {
0692               name => "Mickey Chiu",
0693               email => "chiu\@bnl.gov",
0694               photo => "chiu_mickey.jpg"
0695              },
0696           "Mpc-Ex" => {
0697               name => "Jaehyeon Do",
0698               email => "jaehyeon.do\@gmail.com",
0699               photo => "do_jaehyeon.jpg"
0700              },
0701           "MuId" => {
0702              name => "David Silvermyr",
0703              email => "silvermy\@bnl.gov",
0704              photo => "silvermyr_david.jpg"
0705             },
0706           "Mutr" => {
0707               name => "Xiaodong Jiang",
0708               email => "jiang\@jlab.org",
0709               photo => "jiang_xiaodong.jpg"
0710              },
0711           "MuTrig" => {
0712               name => "Sanghwa Park",
0713               email => "sanghwa\@snu.ac.kr",
0714               photo => "park_sanghwa.jpg"
0715              },
0716           "MuTrigLvl1" => {
0717               name => "Josh Perry",
0718               email => "jpperry\@iastate.edu",
0719               photo => "perry_joshua.jpg"
0720              },
0721           "Pad" => {
0722              name => "Damian Reynolds",
0723              email => "dlreynol\@rcf.rhic.bnl.gov",
0724              photo => "reynolds_damian.jpg"
0725             },
0726           "PbGlU" => {
0727              name => "Andrey Kazantsev",
0728              email => "stkav\@rcf.rhic.bnl.gov",
0729              photo => "kazantsev_andrey"
0730             },
0731           "Rich" => {
0732              name => "Yorito Yamaguchi",
0733              email => "yorito\@cns.s.u-tokyo.ac.jp",
0734              photo => "yamaguchi_yorito.jpg"
0735             },
0736           "Spin" => {
0737              name => "Katherine DeBlasio",
0738              email => "deblasio.katherine\@gmail.com",
0739              photo => "deblasio_katherine.jpg"
0740             },
0741           "TofW" => {
0742              name => "Shengli Huang",
0743              email => "shengli.huang\@vanderbilt.edu",
0744              photo => "huang_shengli.jpg"
0745             },
0746           "Vtx" => {
0747              name => "Zack Rowan",
0748              email => "zfxrowan\@gmail.com",
0749              photo => "rowan_zachary.jpg"
0750             }
0751          );
0752 
0753   print "<table>\n";
0754   my $photodir = "http://www.phenix.bnl.gov/WWW/run/all_faces";
0755 
0756   foreach my $l ( sort keys %list )
0757   {
0758     my $d = \%{$list{$l}};
0759     my $component = $l;
0760 
0761     my @name = split ',',$$d{"name"};
0762     my @email = split ",", $$d{"email"};
0763     my @photo = split ",",$$d{"photo"};
0764 
0765     for ( my $i = 0; $i < $#name+1; ++$i ) {
0766       my $name = $name[$i];
0767       my $email = $email[$i];
0768       my $photo = $photo[$i];
0769       print "<TR><TD class=\"devcomponent\">$component",
0770       "<td><A class=\"devmail\" HREF=\"mailto:$email\">$name</a>";
0771       if ( $show_photo == 1 )
0772     {
0773       print "<td><img src=\"$photodir/$photo\" width=\"115\" height=\"115\">\n";
0774     }
0775     }
0776   }
0777 
0778   print "<tr><td>&nbsp;<td>";
0779 
0780   print $q->start_form("post");#,"./mon.cgi?contacts=1&photo=1");
0781   if ( $show_photo == 0 )
0782     {
0783       print $q->submit(-name=>'photo',-label=>'Show faces');
0784     }
0785   else
0786     {
0787       print $q->submit(-name=>'photo',-label=>'Hide faces');
0788     }
0789   print $q->endform();
0790 
0791   print "</table>\n";
0792 
0793   print "</body></html>\n";
0794 }
0795 
0796 #_____________________________________________________________________________
0797 sub show_run {
0798 
0799   my $run = shift;
0800   my $runtype = shift;
0801 
0802   print_start_1($run,$runtype);
0803 
0804   my $menu_width = 250;
0805   print "  <FRAMESET cols=\"$menu_width,*\" rows=\"*\">\n";
0806   print "    <FRAMESET rows=\"0,*\">\n";
0807   my $codesrc = $q->url(-relative=>1)."?runnumber=$run&amp;menucode=1&amp;runtype=$runtype";
0808 
0809   print "      <FRAME marginwidth=\"0\" marginheight=\"0\" src=\"$codesrc\" name=\"code\" noresize scrolling=\"no\" frameborder=\"0\">\n";
0810 
0811   print "      <FRAME marginwidth=\"5\" marginheight=\"5\" src=\"menu_empty.html\" name=\"menu\" noresize scrolling=\"auto\" frameborder=\"0\">\n";
0812 
0813   print "    </FRAMESET>\n";
0814 
0815   print_start_2($run,$runtype);
0816 }