108 string name = request.
GetEntry(
"AttrName");
109 if ( !name.empty() ) {
122 for (
const auto& name :
names) {
135 string session_label;
136 string self_url =
ctx.GetSelfURL();
141 for (
const auto& name : attrs) {
142 table->Cell(row,0)->AppendPlainText(name);
144 table->Cell(row,2)->AppendChild(
new CHTML_submit(
"Delete_" + name,
"Delete Attribute"));
148 session_label =
"Session ID: " + session.
GetId();
153 session_label =
"Session has been deleted";
176 Head->
AppendChild(
new CHTML_title(
"Sample CGI Session config file"));
194 table->SetAttribute(
"border",
"1");
195 table->SetAttribute(
"width",
"600");
196 table->SetAttribute(
"cellspacing",
"0");
197 table->SetAttribute(
"cellpadding",
"2");
198 table->SetColumnWidth(0,
"20%");
199 table->SetColumnWidth(1,
"65%");
200 table->HeaderCell(0,0)->AppendPlainText(
"Name");
201 table->HeaderCell(0,1)->AppendPlainText(
"Value");
202 table->HeaderCell(0,2)->AppendPlainText(
"Action");
210 const string& form_url,
211 const string& session_label)
215 Head->
AppendChild(
new CHTML_title(
"Sample CGI Session"));
223 Form->AppendChild(
new CHTML_submit(
"DeleteSession",
"Delete Session"));
224 Form->AppendChild(
new CHTML_submit(
"CreateSession",
"Create New Session"));
226 Form->AppendChild(
table);
228 Form->AppendPlainText(
"Set Attribute:");
230 Form->AppendChild(
new CHTML_p);
231 Form->AppendPlainText(
"Name: ");
232 Form->AppendChild(
new CHTML_text(
"AttrName"));
233 Form->AppendPlainText(
" Value: ");
234 Form->AppendChild(
new CHTML_text(
"AttrValue"));
235 Form->AppendChild(
new CHTML_p);
236 Form->AppendChild(
new CHTML_submit(
"SUBMIT",
"Submit"));
240 string::size_type pos = s.find(
'?');
241 if (pos != string::npos) {
242 s = form_url.substr(0,pos);
244 Form->AppendChild(
new CHTML_a(s +
"?showconfig=1",
"Show config file"));
static CNodeRef s_CreateHTMLPage(CRef< CHTML_table > table, const string &form_url, const string &session_label)
int NcbiSys_main(int argc, ncbi::TXChar *argv[])
static CRef< CHTML_table > s_CreateHTMLTable()
virtual ICgiSessionStorage * GetSessionStorage(CCgiSessionParameters &) const
Get storage for CGI session data.
virtual int ProcessRequest(CCgiContext &ctx)
This is the method you should override.
void x_ShowConfigFile(CCgiResponse &response)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
static const struct name_t names[]
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
const string & GetConfigPath(void) const
Get the full path to the configuration file (if any) we ended up using.
CNcbiOstream & out(void) const
Get output stream. Throw exception if GetOutput() is NULL.
CCgiSession & GetSession(ESessionCreateMode mode=eCreateIfNotExist) const
Get session.
CNcbiOstream & WriteHeader(void) const
Write HTTP response header to the output stream.
const CCgiEntry & GetEntry(const string &name, bool *is_found=0) const
Get entry value by name.
string GetAttribute(const string &name) const
Get attribute data as string.
void DeleteSession(void)
Delete current session.
TNames GetAttributeNames(void) const
Retrieve names of all attributes attached to this session.
void CreateNewSession(void)
Create new session.
const string & GetSessionIdName(void) const
Get name for session ID.
void RemoveAttribute(const string &name)
Remove attribute from the session.
const string & GetId(void) const
Get session ID.
CNcbiOstream & GetAttrOStream(const string &name)
Get output stream to write an attribute's data to.
EStatus GetStatus(void) const
Get current status of the session.
@ eDeleted
The session is deleted.
CNCBINode * AppendChild(CNCBINode *child)
virtual CNcbiOstream & Print(CNcbiOstream &out, TMode mode=eHTML)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.