CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DQM/TrackerCommon/src/Select.cc

Go to the documentation of this file.
00001 #include "DQM/TrackerCommon/interface/Select.h"
00002 
00003 
00004 void Select::printHTML(xgi::Output * out)
00005 {
00006   std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top();
00007 
00008   // the javascript function makeSelectRequest expects the url of the request and the id of the widget
00009   // Example: makeSelectRequest('https://[ApplicationURL]/Request?RequestID=MyCustomRequest', 'select menu 1');
00010   std::string applicationURL = get_url();
00011   std::string requestName    = "RequestID=" + requestID;
00012   std::string js_command = "makeSelectRequest('" + applicationURL + "/Request?" + requestName + "'" + 
00013     ", '" + name + "')";
00014 
00015   *out << cgicc::div().set("style", position.c_str()) << std::endl;
00016 
00017   // The id of the form is the name of the select menu + " Form".
00018   *out << cgicc::form().set("name", name + " Form").set("id", name + " Form") << std::endl;
00019 
00020   *out << cgicc::table() << std::endl;
00021   *out << cgicc::tr() << std::endl
00022        << cgicc::td() << std::endl
00023        << name << ":" << std::endl
00024        << cgicc::td() << std::endl;
00025 
00026 
00027   *out << cgicc::td() << std::endl;
00028   *out << cgicc::select().set("name", name).set("id", name).set("onchange", js_command) << std::endl; 
00029   *out << cgicc::option().set("value", "").set("selected") << cgicc::option() << std::endl;
00030   for (std::vector<std::string>::iterator it = options_v.begin(); it != options_v.end(); it++)
00031     {
00032       *out <<  cgicc::option().set("value", *it) << *it << cgicc::option() << std::endl;
00033     }
00034   *out << cgicc::select() << std::endl;
00035   *out << cgicc::td() << std::endl;
00036 
00037   *out << cgicc::tr() << std::endl;
00038 
00039   *out << cgicc::table() << std::endl;
00040 
00041   *out << cgicc::form() << std::endl;
00042   *out << cgicc::div() << std::endl;
00043 }
00044 
00045