CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/EventFilter/Utilities/src/ServiceWeb.cc

Go to the documentation of this file.
00001 #include "EventFilter/Utilities/interface/ServiceWeb.h"
00002 #include "EventFilter/Utilities/interface/ServiceWebRegistry.h"
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 
00005 #include "xgi/Input.h"
00006 #include "xgi/Output.h"
00007 #include "xgi/Utils.h"
00008 
00009 #include <string>
00010 
00011 
00012 namespace evf{
00013 
00014 ServiceWeb::ServiceWeb(const std::string &serviceName) : serviceName_(serviceName)
00015 {
00016   if(edm::Service<ServiceWebRegistry>())
00017     edm::Service<ServiceWebRegistry>()->registerWeb(serviceName_, this);
00018 }
00019 
00020 void ServiceWeb::defaultWebPage(xgi::Input *in, xgi::Output *out)
00021 {
00022   using std::endl;
00023   std::string path;
00024   std::string urn;
00025   std::string mname;
00026   try 
00027     {
00028       cgicc::Cgicc cgi(in);
00029       if ( xgi::Utils::hasFormElement(cgi,"service") )
00030         mname = xgi::Utils::getFormElement(cgi, "service")->getValue();
00031       cgicc::CgiEnvironment cgie(in);
00032       urn = cgie.getReferrer();
00033       path = cgie.getPathInfo() + "?" + cgie.getQueryString();
00034       
00035     }
00036   catch (const std::exception & e) 
00037     {
00038       // don't care if it did not work
00039     }
00040   
00041 
00042   *out << "<html>"                                                   << endl;
00043   *out << "<head>"                                                   << endl;
00044 
00045   *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> "
00046        << endl; 
00047   *out << "<link type=\"text/css\" rel=\"stylesheet\"";
00048   *out << " href=\"/" <<  urn
00049        << "/styles.css\"/>"                   << endl;
00050 
00051   *out << "<title>" << serviceName_
00052        << " MAIN</title>"                                            << endl;
00053 
00054   *out << "</head>"                                                  << endl;
00055   *out << "<body onload=\"loadXMLDoc()\">"                           << endl;
00056   *out << "<table border=\"0\" width=\"100%\">"                      << endl;
00057   *out << "<tr>"                                                     << endl;
00058   *out << "  <td align=\"left\">"                                    << endl;
00059   *out << "    <img"                                                 << endl;
00060   *out << "     align=\"middle\""                                    << endl;
00061   *out << "     src=\"/evf/images/epicon.jpg\""                      << endl;
00062   *out << "     alt=\"main\""                                        << endl;
00063   *out << "     width=\"64\""                                        << endl;
00064   *out << "     height=\"64\""                                       << endl;
00065   *out << "     border=\"\"/>"                                       << endl;
00066   *out << "    <b>"                                                  << endl;
00067   *out << "<title>" << serviceName_
00068        << " MAIN</title>"                                            << endl;
00069   *out << "    </b>"                                                 << endl;
00070   *out << "  </td>"                                                  << endl;
00071   *out << "  <td width=\"32\">"                                      << endl;
00072   *out << "    <a href=\"/urn:xdaq-application:lid=3\">"             << endl;
00073   *out << "      <img"                                               << endl;
00074   *out << "       align=\"middle\""                                  << endl;
00075   *out << "       src=\"/hyperdaq/images/HyperDAQ.jpg\""             << endl;
00076   *out << "       alt=\"HyperDAQ\""                                  << endl;
00077   *out << "       width=\"32\""                                      << endl;
00078   *out << "       height=\"32\""                                     << endl;
00079   *out << "       border=\"\"/>"                                     << endl;
00080   *out << "    </a>"                                                 << endl;
00081   *out << "  </td>"                                                  << endl;
00082   *out << "  <td width=\"32\">"                                      << endl;
00083   *out << "  </td>"                                                  << endl;
00084   *out << "  <td width=\"32\">"                                      << endl;
00085   *out << "    <a href=\"/" << urn 
00086        << "\">"                                                      << endl;
00087   *out << "      <img"                                               << endl;
00088   *out << "       align=\"middle\""                                  << endl;
00089   *out << "       src=\"/evf/images/epicon.jpg\""                    << endl;
00090   *out << "       alt=\"main\""                                      << endl;
00091   *out << "       width=\"32\""                                      << endl;
00092   *out << "       height=\"32\""                                     << endl;
00093   *out << "       border=\"\"/>"                                     << endl;
00094   *out << "    </a>"                                                 << endl;
00095   *out << "  </td>"                                                  << endl;
00096   *out << "</tr>"                                                    << endl;
00097   *out << "</table>"                                                 << endl;
00098 
00099   *out << "<hr/>"                                                    << endl;
00100 
00101   *out << "</body>"                                                  << endl;
00102   *out << "</html>"                                                  << endl;
00103 }
00104 } //end namespace evf