Changeset 173 for trunk/gsdl/src/recpt/pageaction.cpp
- Timestamp:
- 1999-03-01T09:00:19+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/pageaction.cpp
r172 r173 12 12 /* 13 13 $Log$ 14 Revision 1.4 1999/02/28 20:00:14 rjmcnab 15 16 17 Fixed a few things. 18 14 19 Revision 1.3 1999/02/25 21:58:58 rjmcnab 15 20 … … 67 72 bool pageaction::do_action (cgiargsclass &args, recptproto */*collectproto*/, 68 73 displayclass &disp, outconvertclass &outconvert, 69 ostream &textout, ostream & logout) {70 text_t pageparams; 74 ostream &textout, ostream &/*logout*/) { 75 71 76 text_t &arg_p = args["p"]; 72 73 bool first = true;74 if (!args["c"].empty()) {75 pageparams += "collection=" + args["c"]; first = false;}76 if (args.getintarg("u") == 1)77 if (first) {pageparams += "style=htmlonly"; first = false;}78 else pageparams += ",style=htmlonly";79 if (args.getintarg("v") == 1)80 if (first) {pageparams += "version=text"; first = false;}81 else pageparams += ",version=text";82 if (args.getintarg("f") == 1)83 if (first) {pageparams += ",queryversion=big"; first = false;}84 else pageparams += ",queryversion=big";85 if (args["l"] != "en")86 if (first) pageparams += ",language=" + args["l"];87 else pageparams += ",language=" + args["l"];88 89 disp.openpage(pageparams, MACROPRECEDENCE);90 define_internal_macros (disp, args, logout);91 77 92 78 textout << outconvert << disp << ("_" + arg_p + ":header_\n") … … 96 82 return true; 97 83 } 98 99 100 // define all the macros which are related to pages generated101 // by this action102 void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,103 ostream &logout) {104 105 // not sure which macros should be defined where - what is difference between106 // define_internal_macros and define_external_macros107 // urlsafequerystring and querystring macros need some kind of cgisafe and108 // htmlsafe functions (maybe to be defined in htmlutils.cpp?)109 110 // the following macros are also defined in libinterface, some of them I'm not111 // sure how to define from here and some I don't think are required anymore112 // httpprefix113 // numdocs114 // collection115 // istitle and pagedest -- these don't occur anywhere in the macro files116 117 // I don't know what structure has replaced what used to be cfg_info118 // so haven't defined the selection macros _hselection_, _jselection_119 // and _nselection_ (these should be set in define_query_macros)120 121 // _imagethispage_ needs to be set for any browse pages but I guess122 // browse pages will be generated by a different action123 124 // not sure what to do with any collection specific macros - these125 // used to be defined in define_collection_macros although there126 // wasn't much collection specific stuff left I don't think127 128 // disp.setmacro ("gwcgi", "Global", recpt->get_gwcgi());129 // disp.setmacro ("httpimg", "Global", recpt->get_httpimg());130 // disp.setmacro("compressedoptions", "Global", recpt->get_compressed_arg(args));131 132 // disp.setmacro("urlsafequerystring", "Global", cgisafe(outconvert.convert(args["q"])));133 // disp.setmacro("querystring", "Global", htmlsafe(outconvert.convert(args["q"]))));134 135 // define the macro for the "g" argument136 disp.setmacro("g", "Global", args["g"]);137 138 // this gets set unless page has been detached by the 'detach' button.139 if (args.getintarg("x") == 0) disp.setmacro("notdetached", "Global", "1");140 141 // not sure if home and about pages will both need query macros defined142 if ((args["p"] == "query") || (args["p"] == "home") || (args["p"] == "about"))143 define_query_macros (disp, args, logout);144 145 if (args["p"] == "preferences")146 define_pref_macros (disp, args, logout);147 148 }149 150 void pageaction::define_query_macros (displayclass &disp, cgiargsclass &args,151 ostream &/*logout*/) {152 153 // some/all query type selection154 text_t qtselect = "<select name=\"t\">\n";155 qtselect += "<option value=\"1\"";156 if (args.getintarg("t") == 1) qtselect += " selected";157 qtselect += ">_query:textsome_\n";158 qtselect += "<option value=\"0\"";159 if (args.getintarg("t") == 0) qtselect += " selected";160 qtselect += ">_query:textall_\n";161 qtselect += "</select>\n";162 disp.setmacro("querytypeselection", "query", qtselect);163 164 165 }166 167 void pageaction::define_pref_macros (displayclass &disp, cgiargsclass &args,168 ostream &/*logout*/) {169 170 // the caseoption macro171 text_t caseoption;172 int arg_k = args.getintarg("k");173 174 caseoption += "\n<input type=radio name=k value=1";175 if (arg_k) caseoption += " checked";176 caseoption += ">_textignorecase_<br>\n";177 caseoption += "<input type=radio name=k value=0";178 if (!arg_k) caseoption += " checked";179 caseoption += ">_textmatchcase_\n";180 181 disp.setmacro ("caseoption", "preferences", caseoption);182 183 // the stemoption macro184 text_t stemoption;185 int arg_s = args.getintarg("s");186 187 stemoption += "\n<input type=radio name=s value=1";188 if (arg_s) stemoption += " checked";189 stemoption += ">_textstem_<br>\n";190 stemoption += "<input type=radio name=s value=0";191 if (!arg_s) stemoption += " checked";192 stemoption += ">_textnostem_\n";193 194 disp.setmacro ("stemoption", "preferences", stemoption);195 196 197 // the encodingoption198 text_t encodingoption;199 const text_t &arg_w = args["w"];200 201 encodingoption += "\n<select name=\"nw\">\n";202 encodingoption += " <option value=\"w\"";203 if (arg_w == "w") encodingoption += " selected";204 encodingoption += ">Western (ISO-8859-1)\n";205 encodingoption += " <option value=\"g\"";206 if (arg_w == "g") encodingoption += " selected";207 encodingoption += ">Simplified Chinese (GB2312)\n";208 encodingoption += " <option value=\"8\"";209 if (arg_w == "8") encodingoption += " selected";210 encodingoption += ">Unicode (UTF-8)\n";211 encodingoption += "</select>\n";212 213 disp.setmacro ("encodingoption", "preferences", encodingoption);214 215 // the maxdocoption216 text_t maxdocoption;217 int arg_m = args.getintarg("m");218 219 maxdocoption += "\n<select name=m>\n";220 maxdocoption += " <option value=\"50\"";221 if (arg_m < 100) maxdocoption += " selected";222 maxdocoption += ">50\n";223 maxdocoption += " <option value=\"100\"";224 if (arg_m >= 100 && arg_m < 200) maxdocoption += " selected";225 maxdocoption += ">100\n";226 maxdocoption += " <option value=\"200\"";227 if (arg_m >= 200 && arg_m < 500) maxdocoption += " selected";228 maxdocoption += ">200\n";229 maxdocoption += " <option value=\"500\"";230 if (arg_m >= 500) maxdocoption += " selected";231 maxdocoption += ">500\n";232 maxdocoption += "</select>\n";233 234 disp.setmacro ("maxdocoption", "preferences", maxdocoption);235 236 // the hitsperpageoption237 text_t hitsoption;238 int arg_o = args.getintarg("o");239 240 hitsoption += "\n<select name=o>\n";241 hitsoption += " <option value=\"10\"";242 if (arg_o < 20) hitsoption += " selected";243 hitsoption += ">10\n";244 hitsoption += " <option value=\"20\"";245 if (arg_o >= 20 && arg_o < 50) hitsoption += " selected";246 hitsoption += ">20\n";247 hitsoption += " <option value=\"50\"";248 if (arg_o >= 50 && arg_o < 100) hitsoption += " selected";249 hitsoption += ">50\n";250 hitsoption += " <option value=\"100\"";251 if (arg_o >= 100 && arg_o < 500) hitsoption += " selected";252 hitsoption += ">100\n";253 hitsoption += " <option value=\"500\"";254 if (arg_o >= 500) hitsoption += " selected";255 hitsoption += ">all\n";256 hitsoption += " </select>\n";257 258 disp.setmacro ("hitsperpageoption", "preferences", hitsoption);259 }260
Note:
See TracChangeset
for help on using the changeset viewer.