CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
Select Class Reference

#include <Select.h>

Inheritance diagram for Select:
WebElement

Public Member Functions

void printHTML (xgi::Output *out)
 
 Select (std::string the_url, std::string top, std::string left, std::string the_requestID, std::string the_name)
 
void setOptionsVector (std::vector< std::string > the_options_v)
 
 ~Select ()
 
- Public Member Functions inherited from WebElement
std::string get_pix_left ()
 
std::string get_pix_top ()
 
std::string get_url ()
 
 WebElement (std::string the_url, std::string top, std::string left)
 
virtual ~WebElement ()
 

Private Attributes

std::string name
 
std::vector< std::string > options_v
 
std::string requestID
 

Detailed Description

This is the class that should be instantiated in case the user wants to have a select menu, the elements of which, submit a request when clicked on.

Definition at line 14 of file Select.h.

Constructor & Destructor Documentation

Select::Select ( std::string  the_url,
std::string  top,
std::string  left,
std::string  the_requestID,
std::string  the_name 
)
inline

Definition at line 25 of file Select.h.

References name, and requestID.

27  : WebElement(the_url, top, left)
28  {
29  name = the_name;
30  requestID = the_requestID;
31  }
WebElement(std::string the_url, std::string top, std::string left)
Definition: WebElement.h:21
std::string name
Definition: Select.h:18
std::string requestID
Definition: Select.h:19
Select::~Select ( )
inline

Definition at line 33 of file Select.h.

34  {
35  }

Member Function Documentation

void Select::printHTML ( xgi::Output out)
virtual

Implements WebElement.

Definition at line 4 of file Select.cc.

References WebElement::get_pix_left(), WebElement::get_pix_top(), WebElement::get_url(), name, options_v, position, requestID, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, and asciidump::table.

5 {
6  std::string position = "position:absolute; left:" + get_pix_left() + "; top:" + get_pix_top();
7 
8  // the javascript function makeSelectRequest expects the url of the request and the id of the widget
9  // Example: makeSelectRequest('http://[ApplicationURL]/Request?RequestID=MyCustomRequest', 'select menu 1');
10  std::string applicationURL = get_url();
11  std::string requestName = "RequestID=" + requestID;
12  std::string js_command = "makeSelectRequest('" + applicationURL + "/Request?" + requestName + "'" +
13  ", '" + name + "')";
14 
15  *out << cgicc::div().set("style", position.c_str()) << std::endl;
16 
17  // The id of the form is the name of the select menu + " Form".
18  *out << cgicc::form().set("name", name + " Form").set("id", name + " Form") << std::endl;
19 
20  *out << cgicc::table() << std::endl;
21  *out << cgicc::tr() << std::endl
22  << cgicc::td() << std::endl
23  << name << ":" << std::endl
24  << cgicc::td() << std::endl;
25 
26 
27  *out << cgicc::td() << std::endl;
28  *out << cgicc::select().set("name", name).set("id", name).set("onchange", js_command) << std::endl;
29  *out << cgicc::option().set("value", "").set("selected") << cgicc::option() << std::endl;
30  for (std::vector<std::string>::iterator it = options_v.begin(); it != options_v.end(); it++)
31  {
32  *out << cgicc::option().set("value", *it) << *it << cgicc::option() << std::endl;
33  }
34  *out << cgicc::select() << std::endl;
35  *out << cgicc::td() << std::endl;
36 
37  *out << cgicc::tr() << std::endl;
38 
39  *out << cgicc::table() << std::endl;
40 
41  *out << cgicc::form() << std::endl;
42  *out << cgicc::div() << std::endl;
43 }
std::string get_pix_left()
Definition: WebElement.h:38
list table
Definition: asciidump.py:386
std::string get_url()
Definition: WebElement.h:32
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
std::string name
Definition: Select.h:18
std::string requestID
Definition: Select.h:19
std::vector< std::string > options_v
Definition: Select.h:21
tuple out
Definition: dbtoconf.py:99
std::string get_pix_top()
Definition: WebElement.h:37
void Select::setOptionsVector ( std::vector< std::string >  the_options_v)
inline

Definition at line 37 of file Select.h.

References options_v.

38  {
39  options_v = the_options_v;
40  }
std::vector< std::string > options_v
Definition: Select.h:21

Member Data Documentation

std::string Select::name
private
std::vector<std::string> Select::options_v
private

Definition at line 21 of file Select.h.

Referenced by printHTML(), and setOptionsVector().

std::string Select::requestID
private

Definition at line 19 of file Select.h.

Referenced by printHTML(), and Select().