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