1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * pageaction.cpp --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: pageaction.cpp 160 1999-02-12 02:40:18Z sjboddie $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 | /*
|
---|
13 | $Log$
|
---|
14 | Revision 1.1 1999/02/12 02:40:17 sjboddie
|
---|
15 |
|
---|
16 | Added page action
|
---|
17 |
|
---|
18 | */
|
---|
19 |
|
---|
20 |
|
---|
21 | #include "pageaction.h"
|
---|
22 |
|
---|
23 |
|
---|
24 | pageaction::pageaction () {
|
---|
25 | disabled = true;
|
---|
26 | recpt = NULL;
|
---|
27 |
|
---|
28 | // this action uses cgi variables "a" and "p"
|
---|
29 | cgiarginfo arg_ainfo;
|
---|
30 | arg_ainfo.shortname = "a";
|
---|
31 | arg_ainfo.longname = "action";
|
---|
32 | arg_ainfo.multiplechar = true;
|
---|
33 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
34 | arg_ainfo.argdefault = "status";
|
---|
35 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
36 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
37 |
|
---|
38 | arg_ainfo.shortname = "p";
|
---|
39 | arg_ainfo.longname = "page";
|
---|
40 | arg_ainfo.multiplechar = true;
|
---|
41 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
42 | arg_ainfo.argdefault = "about";
|
---|
43 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
44 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
45 |
|
---|
46 | }
|
---|
47 |
|
---|
48 | pageaction::~pageaction () {
|
---|
49 | }
|
---|
50 |
|
---|
51 | bool pageaction::check_cgiargs (cgiargsclass &/*args*/, ostream &/*logout*/) {
|
---|
52 | // don't want to check anything yet.
|
---|
53 | return true;
|
---|
54 | }
|
---|
55 |
|
---|
56 | void pageaction::get_cgihead_info (cgiargsclass &/*args*/, response_t &response,
|
---|
57 | text_t &response_data, ostream &/*logout*/) {
|
---|
58 | response = content;
|
---|
59 | response_data = "text/html";
|
---|
60 | }
|
---|
61 |
|
---|
62 | bool pageaction::do_action (cgiargsclass &args, outconvertclass &outconvert,
|
---|
63 | ostream &textout, ostream &logout) {
|
---|
64 |
|
---|
65 | textout << outconvert << "<html>\n";
|
---|
66 | textout << outconvert << "<head><title>Page action</title></head>\n";
|
---|
67 | textout << outconvert << "<body><h2>Page action</h2>\n";
|
---|
68 | textout << outconvert << "a: " << args["a"] << " p: " << args["p"] << "\n";
|
---|
69 | textout << outconvert << "</body>\n";
|
---|
70 | textout << outconvert << "</html>\n";
|
---|
71 |
|
---|
72 | return true;
|
---|
73 | }
|
---|
74 |
|
---|
75 | void pageaction::configure (const text_t &key, const text_tarray &cfgline) {
|
---|
76 | if ((key == "page") && (cfgline.size() == 1) &&
|
---|
77 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
78 | disabled = false;
|
---|
79 | } else {
|
---|
80 | // call the parent class to deal with the things which
|
---|
81 | // are not dealt with here
|
---|
82 | action::configure (key, cfgline);
|
---|
83 | }
|
---|
84 | }
|
---|