source: trunk/gsdl/src/recpt/tipaction.cpp@ 421

Last change on this file since 421 was 421, checked in by sjboddie, 25 years ago

added collectinfo argument to some functions

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1/**********************************************************************
2 *
3 * tipaction.cpp -- define random tip macros
4 * Copyright (C) 1999 DigiLib Systems Limited, New Zealand
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: tipaction.cpp 421 1999-07-30 02:24:45Z sjboddie $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.2 1999/07/30 02:24:45 sjboddie
15 added collectinfo argument to some functions
16
17 Revision 1.1 1999/07/09 02:18:27 rjmcnab
18 Initial revision.
19
20
21 */
22
23
24#include "tipaction.h"
25#include <stdlib.h>
26
27
28void tipaction::define_external_macros (const ColInfoResponse_t &/*collectinfo*/, displayclass &disp,
29 cgiargsclass &/*args*/, recptproto */*collectproto*/,
30 ostream &logout) {
31
32 // define_external_macros sets the following macros:
33
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;
42 }
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}
52
Note: See TracBrowser for help on using the repository browser.