* converted to autoconf and began port to Digital UNIX
[citadel.git] / webcit / mainmenu.c
1 /* $Id$ */
2
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <stdio.h>
6 #include <ctype.h>
7 #include <string.h>
8 #include <errno.h>
9 #include "webcit.h"
10 #include "child.h"
11
12
13 /* 
14  * menu of commands (just the menu html itself)
15  */
16
17 void embed_main_menu(void) {
18         wprintf("<CENTER><TABLE border=0><TR>");
19
20         wprintf("<TD>");        /* start of first column */
21
22         wprintf("<UL>");
23         wprintf("<LI><B><A HREF=\"/knrooms\">\n");
24         wprintf("List known rooms</B></A><BR>\n");
25         wprintf("Where can I go from here?</LI>\n");
26         
27         wprintf("<LI><B><A HREF=\"/gotonext\" TARGET=\"top\">\n");
28         wprintf("Goto next room</B></A><BR>\n");
29         wprintf("...with <EM>unread</EM> messages</LI>\n");
30         
31         wprintf("<LI><B><A HREF=\"/skip\" TARGET=\"top\">\n");
32         wprintf("Skip to next room</B></A><BR>\n");
33         wprintf("(come back here later)</LI>\n");
34         
35         if ( (strlen(ugname)>0) && (strcasecmp(ugname,wc_roomname)) ) {
36                 wprintf("<LI><B><A HREF=\"/ungoto\" TARGET=\"top\">\n");
37                 wprintf("Ungoto</B></A><BR>\n");
38                 wprintf("(oops! Back to %s)</LI>\n",ugname);
39                 }
40         
41         wprintf("</UL>\n");
42         
43         wprintf("</TD><TD>\n"); /* start of second column */
44         
45         wprintf("<UL>");
46         wprintf("<LI><B><A HREF=\"/readnew\">\n");
47         wprintf("Read new messages</B></A><BR>...in this room</LI>\n");
48         
49         wprintf("<LI><B><A HREF=\"/readfwd\">\n");
50         wprintf("Read all messages</B></A><BR>...old <EM>and</EM> new</LI>\n");
51
52         wprintf("<LI><B><A HREF=\"/display_enter\">\n");
53         wprintf("Enter a message</B></A><BR>(post in this room)</LI>");
54         wprintf("</UL>\n");
55
56         wprintf("</TD><TD>"); /* start of third column */
57
58         wprintf("<UL>");
59         wprintf("<LI><B><A HREF=\"/whobbs\">\n");
60         wprintf("Who is online?</B></A><BR>(users <EM>currently</EM> logged on)</LI>\n");
61         
62         wprintf("<LI><B><A HREF=\"/userlist\">\n");
63         wprintf("User list</B></A><BR>(all registered users)</LI>\n");
64
65         wprintf("<LI><B><A HREF=\"/advanced\">\n");
66         wprintf("Advanced options</B></A><BR>...and maintenance</LI>\n");
67
68         wprintf("<LI><B><A HREF=\"/termquit\" TARGET=\"_top\">\n");
69         wprintf("Log off</B></A><BR>Bye!</LI>\n");
70         wprintf("</UL>\n");
71
72         wprintf("</TR></TABLE>\n");
73
74         wprintf("</CENTER>\n");
75         }
76
77 /*
78  * advanced options
79  */
80 void embed_advanced_menu(void) {
81
82 wprintf("<TABLE WIDTH=100%><TR VALIGN=TOP><TD>");
83
84
85 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
86 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
87 wprintf("<B>Interaction</B>\n");
88 wprintf("</FONT></TD></TR></TABLE>\n");
89
90 wprintf("<UL>");
91 wprintf("<LI><A HREF=\"/display_page\">\n");
92 wprintf("Page another user</A>\n");
93
94 wprintf("<LI><A HREF=\"/chat\">");
95 wprintf("Chat with other online users</A>\n");
96
97 wprintf("</UL>\n");
98
99 wprintf("</TD><TD>");
100
101 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
102 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
103 wprintf("<B>Your info</B>\n");
104 wprintf("</FONT></TD></TR></TABLE>\n");
105
106 wprintf("<UL>");
107 wprintf("<LI><A HREF=\"/display_editbio\">\n");
108 wprintf("Enter your 'bio' (a few words about yourself)</A>\n");
109
110 wprintf("<LI><A HREF=\"/display_editpic\">\n");
111 wprintf("Edit your online photo</A>\n");
112
113 wprintf("<LI><A HREF=\"/display_reg\">\n");
114 wprintf("Re-enter your registration info (name, address, etc.)</A>\n");
115
116 wprintf("<LI><A HREF=\"/display_changepw\">\n");
117 wprintf("Change your password</A>\n");
118
119 wprintf("</UL>\n");
120
121
122 wprintf("</TD></TR><TR VALIGN=TOP><TD>");
123
124 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
125 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
126 wprintf("<B>Advanced room commands</B>\n");
127 wprintf("</FONT></TD></TR></TABLE>\n");
128
129 wprintf("<UL>");
130 wprintf("<LI><A HREF=\"/display_private\">\n");
131 wprintf("Go to a 'hidden' room</A>\n");
132
133 wprintf("<LI><A HREF=\"/display_entroom\">");
134 wprintf("Create a new room</A>\n");
135
136 wprintf("<LI><A HREF=\"/display_zap\">");
137 wprintf("Zap (forget) this room (%s)</A>\n", wc_roomname);
138
139 wprintf("<LI><A HREF=\"/zapped_list\">");
140 wprintf("List all forgotten rooms</A>\n");
141
142 wprintf("</UL>\n");
143
144 wprintf("</TD><TD>");
145
146 if ((axlevel>=6) || (is_room_aide)) {
147         wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007777><TR><TD>");
148         wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
149         wprintf("<B>Administrative functions</B>\n");
150         wprintf("</FONT></TD></TR></TABLE>\n");
151
152         wprintf("<UL>");
153         wprintf("<LI><A HREF=\"/display_editroom\">\n");
154         wprintf("Edit this room</A>\n");
155         
156         wprintf("<LI><A HREF=\"/confirm_delete_room\">\n");
157         wprintf("Delete this room</A>\n");
158         
159         wprintf("<LI><A HREF=\"/display_editroompic\">\n");
160         wprintf("Set or change the graphic for this room's banner</A>\n");
161
162         wprintf("<LI><A HREF=\"/display_editinfo\">\n");
163         wprintf("Edit this room's Info file</A>\n");
164
165         if (axlevel>=6) {
166                 wprintf("<LI><A HREF=\"/validate\">\n");
167                 wprintf("Validate new users</A>\n");
168
169                 wprintf("<LI><A HREF=\"/display_editfloorpic\">\n");
170                 wprintf("Set or change a floor label graphic</A>\n");
171
172                 wprintf("<LI><A HREF=\"/display_netconf\">\n");
173                 wprintf("Configure networking with other systems</A>\n");
174                 }
175
176         wprintf("</UL>\n");
177         }
178
179 wprintf("</TD></TR></TABLE>");
180
181 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
182 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
183 wprintf("<B>Basic commands</B>\n");
184 wprintf("</FONT></TD></TR></TABLE>\n");
185
186         }
187
188
189
190
191 /*
192  * menu of commands (as a page)
193  */
194 void display_main_menu(void) {
195         printf("HTTP/1.0 200 OK\n");
196         output_headers();
197         wprintf("<HTML><HEAD><TITLE>WebCit main menu</TITLE></HEAD><BODY>\n");
198         embed_main_menu();
199         wprintf("</BODY></HTML>\n");
200         wDumpContent();
201         }
202
203
204 void display_advanced_menu(void) {
205         printf("HTTP/1.0 200 OK\n");
206         output_headers();
207         wprintf("<HTML><HEAD><TITLE>WebCit main menu</TITLE></HEAD><BODY>\n");
208         embed_advanced_menu();
209         embed_main_menu();
210         wprintf("</BODY></HTML>\n");
211         wDumpContent();
212         }