Changeset 515 for trunk/gsdl/src/recpt/tipaction.cpp
- Timestamp:
- 1999-09-02T12:29:27+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/tipaction.cpp
r421 r515 12 12 /* 13 13 $Log$ 14 Revision 1.3 1999/09/02 00:29:27 rjmcnab 15 added cgi argument "st" - show tips 16 14 17 Revision 1.2 1999/07/30 02:24:45 sjboddie 15 18 added collectinfo argument to some functions … … 26 29 27 30 31 tipaction::tipaction () { 32 // "st" show tips - "0"=no, "1"=yes 33 cgiarginfo arg_ainfo; 34 arg_ainfo.shortname = "st"; 35 arg_ainfo.longname = "show tips"; 36 arg_ainfo.multiplechar = true; 37 arg_ainfo.defaultstatus = cgiarginfo::weak; 38 arg_ainfo.argdefault = "1"; 39 arg_ainfo.savedarginfo = cgiarginfo::must; 40 argsinfo.addarginfo (NULL, arg_ainfo); 41 } 42 28 43 void tipaction::define_external_macros (const ColInfoResponse_t &/*collectinfo*/, displayclass &disp, 29 cgiargsclass & /*args*/, recptproto */*collectproto*/,44 cgiargsclass &args, recptproto */*collectproto*/, 30 45 ostream &logout) { 31 32 46 // define_external_macros sets the following macros: 33 47 34 // _tip:thistip_ 35 36 // get the maximum tip number (_tip:tipmax_) 37 text_t tipmax_str; 38 disp.expandstring ("tip", "_tipmax_", tipmax_str); 39 if (tipmax_str.empty()) { 40 logout << "Warning: _tip:tipmax_ not set. This macro is needed for displaying tips.\n"; 41 return; 48 // _tip:thistip_ - a random tip (defined if st == "1") 49 50 if (args["st"].getint()) { 51 // get the maximum tip number (_tip:tipmax_) 52 text_t tipmax_str; 53 disp.expandstring ("tip", "_tipmax_", tipmax_str); 54 if (tipmax_str.empty()) { 55 logout << "Warning: _tip:tipmax_ not set. This macro is needed for displaying tips.\n"; 56 return; 57 } 58 59 int tipmax = tipmax_str.getint(); 60 if (tipmax < 1) { 61 logout << "Warning: _tip:tipmax_ was less than 1. No tips were set.\n"; 62 return; 63 } 64 65 disp.setmacro("thistip", "tip", "_tip" + text_t((rand()%tipmax) + 1) + "_"); 42 66 } 43 44 int tipmax = tipmax_str.getint();45 if (tipmax < 1) {46 logout << "Warning: _tip:tipmax_ was less than 1. No tips were set.\n";47 return;48 }49 50 disp.setmacro("thistip", "tip", "_tip" + text_t((rand()%tipmax) + 1) + "_");51 67 } 52 68
Note:
See TracChangeset
for help on using the changeset viewer.