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

Last change on this file since 357 was 357, checked in by rjmcnab, 25 years ago

Initial revision.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 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 357 1999-07-09 02:18:27Z rjmcnab $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.1 1999/07/09 02:18:27 rjmcnab
15 Initial revision.
16
17
18 */
19
20
21#include "tipaction.h"
22#include <stdlib.h>
23
24
25void tipaction::define_external_macros (displayclass &disp, cgiargsclass &/*args*/,
26 recptproto */*collectproto*/, ostream &logout) {
27
28 // define_external_macros sets the following macros:
29
30 // _tip:thistip_
31
32 // get the maximum tip number (_tip:tipmax_)
33 text_t tipmax_str;
34 disp.expandstring ("tip", "_tipmax_", tipmax_str);
35 if (tipmax_str.empty()) {
36 logout << "Warning: _tip:tipmax_ not set. This macro is needed for displaying tips.\n";
37 return;
38 }
39
40 int tipmax = tipmax_str.getint();
41 if (tipmax < 1) {
42 logout << "Warning: _tip:tipmax_ was less than 1. No tips were set.\n";
43 return;
44 }
45
46 disp.setmacro("thistip", "tip", "_tip" + text_t((rand()%tipmax) + 1) + "_");
47}
48
Note: See TracBrowser for help on using the repository browser.