Fossil SCM

Improvements to the WWW interface.

drh 2007-07-23 19:52 trunk
Commit 66f4caa379d2bf03ea15eee5ec96bac9044e4db2
+2 -2
--- src/info.c
+++ src/info.c
@@ -116,11 +116,11 @@
116116
Stmt q;
117117
int rid;
118118
char cType;
119119
char *zType;
120120
121
- style_header();
121
+ style_header("Version Information");
122122
rid = name_to_rid(g.zExtra);
123123
if( rid==0 ){
124124
@ No such object: %h(g.argv[2])
125125
style_footer();
126126
return;
@@ -276,11 +276,11 @@
276276
if( zV2==0 ){
277277
cgi_redirect("index");
278278
}
279279
vid2 = uuid_to_rid(zV2, 0);
280280
p2 = record_from_rid(vid2);
281
- style_header();
281
+ style_header("File Diff");
282282
if( zV1==0 ){
283283
zV1 = db_text(0,
284284
"SELECT uuid FROM record WHERE rid="
285285
" (SELECT a FROM link WHERE typecode='P' AND b=%d)", vid2);
286286
}
287287
--- src/info.c
+++ src/info.c
@@ -116,11 +116,11 @@
116 Stmt q;
117 int rid;
118 char cType;
119 char *zType;
120
121 style_header();
122 rid = name_to_rid(g.zExtra);
123 if( rid==0 ){
124 @ No such object: %h(g.argv[2])
125 style_footer();
126 return;
@@ -276,11 +276,11 @@
276 if( zV2==0 ){
277 cgi_redirect("index");
278 }
279 vid2 = uuid_to_rid(zV2, 0);
280 p2 = record_from_rid(vid2);
281 style_header();
282 if( zV1==0 ){
283 zV1 = db_text(0,
284 "SELECT uuid FROM record WHERE rid="
285 " (SELECT a FROM link WHERE typecode='P' AND b=%d)", vid2);
286 }
287
--- src/info.c
+++ src/info.c
@@ -116,11 +116,11 @@
116 Stmt q;
117 int rid;
118 char cType;
119 char *zType;
120
121 style_header("Version Information");
122 rid = name_to_rid(g.zExtra);
123 if( rid==0 ){
124 @ No such object: %h(g.argv[2])
125 style_footer();
126 return;
@@ -276,11 +276,11 @@
276 if( zV2==0 ){
277 cgi_redirect("index");
278 }
279 vid2 = uuid_to_rid(zV2, 0);
280 p2 = record_from_rid(vid2);
281 style_header("File Diff");
282 if( zV1==0 ){
283 zV1 = db_text(0,
284 "SELECT uuid FROM record WHERE rid="
285 " (SELECT a FROM link WHERE typecode='P' AND b=%d)", vid2);
286 }
287
+13 -6
--- src/login.c
+++ src/login.c
@@ -107,11 +107,11 @@
107107
zCookie, zIpAddr, expires, uid
108108
);
109109
cgi_redirect(zGoto);
110110
}
111111
}
112
- style_header();
112
+ style_header("Login/Logout");
113113
@ %s(zErrMsg)
114114
@ <form action="login" method="POST">
115115
if( P("g") ){
116116
@ <input type="hidden" name="nxp" value="%h(P("g"))">
117117
}
@@ -244,19 +244,26 @@
244244
case 's': g.okSetup = g.okDelete = 1;
245245
case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okQuery =
246246
g.okRdWiki = g.okWrWiki =
247247
g.okNewTkt = g.okPassword = 1;
248248
case 'i': g.okRead = g.okWrite = 1; break;
249
- case 'd': g.okDelete = 1; break;
250
- case 'j': g.okRdWiki = 1; break;
251
- case 'k': g.okWrWiki = g.okRdWiki = 1; break;
252
- case 'n': g.okNewTkt = 1; break;
253249
case 'o': g.okRead = 1; break;
250
+
251
+ case 'd': g.okDelete = 1; break;
254252
case 'p': g.okPassword = 1; break;
255253
case 'q': g.okQuery = 1; break;
254
+
255
+ case 'j': g.okRdWiki = 1; break;
256
+ case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
257
+ case 'm': g.okApndWiki = 1; break;
258
+ case 'f': g.okNewWiki = 1; break;
259
+
256260
case 'r': g.okRdTkt = 1; break;
257
- case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt = 1; break;
261
+ case 'n': g.okNewTkt = 1; break;
262
+ case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
263
+ g.okApndTkt = 1; break;
264
+ case 'c': g.okApndTkt = 1; break;
258265
}
259266
}
260267
}
261268
262269
/*
263270
--- src/login.c
+++ src/login.c
@@ -107,11 +107,11 @@
107 zCookie, zIpAddr, expires, uid
108 );
109 cgi_redirect(zGoto);
110 }
111 }
112 style_header();
113 @ %s(zErrMsg)
114 @ <form action="login" method="POST">
115 if( P("g") ){
116 @ <input type="hidden" name="nxp" value="%h(P("g"))">
117 }
@@ -244,19 +244,26 @@
244 case 's': g.okSetup = g.okDelete = 1;
245 case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okQuery =
246 g.okRdWiki = g.okWrWiki =
247 g.okNewTkt = g.okPassword = 1;
248 case 'i': g.okRead = g.okWrite = 1; break;
249 case 'd': g.okDelete = 1; break;
250 case 'j': g.okRdWiki = 1; break;
251 case 'k': g.okWrWiki = g.okRdWiki = 1; break;
252 case 'n': g.okNewTkt = 1; break;
253 case 'o': g.okRead = 1; break;
 
 
254 case 'p': g.okPassword = 1; break;
255 case 'q': g.okQuery = 1; break;
 
 
 
 
 
 
256 case 'r': g.okRdTkt = 1; break;
257 case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt = 1; break;
 
 
 
258 }
259 }
260 }
261
262 /*
263
--- src/login.c
+++ src/login.c
@@ -107,11 +107,11 @@
107 zCookie, zIpAddr, expires, uid
108 );
109 cgi_redirect(zGoto);
110 }
111 }
112 style_header("Login/Logout");
113 @ %s(zErrMsg)
114 @ <form action="login" method="POST">
115 if( P("g") ){
116 @ <input type="hidden" name="nxp" value="%h(P("g"))">
117 }
@@ -244,19 +244,26 @@
244 case 's': g.okSetup = g.okDelete = 1;
245 case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okQuery =
246 g.okRdWiki = g.okWrWiki =
247 g.okNewTkt = g.okPassword = 1;
248 case 'i': g.okRead = g.okWrite = 1; break;
 
 
 
 
249 case 'o': g.okRead = 1; break;
250
251 case 'd': g.okDelete = 1; break;
252 case 'p': g.okPassword = 1; break;
253 case 'q': g.okQuery = 1; break;
254
255 case 'j': g.okRdWiki = 1; break;
256 case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
257 case 'm': g.okApndWiki = 1; break;
258 case 'f': g.okNewWiki = 1; break;
259
260 case 'r': g.okRdTkt = 1; break;
261 case 'n': g.okNewTkt = 1; break;
262 case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
263 g.okApndTkt = 1; break;
264 case 'c': g.okApndTkt = 1; break;
265 }
266 }
267 }
268
269 /*
270
+4 -1
--- src/main.c
+++ src/main.c
@@ -87,13 +87,16 @@
8787
int okRead; /* xfer outbound */
8888
int okWrite; /* xfer inbound */
8989
int okSetup; /* use Setup screens on web interface */
9090
int okRdTkt; /* view tickets via web */
9191
int okWrTkt; /* make changes to tickets via web */
92
+ int okNewTkt; /* create new tickets */
93
+ int okApndTkt; /* append to tickets via the web */
9294
int okRdWiki; /* view wiki via web */
9395
int okWrWiki; /* edit wiki via web */
94
- int okNewTkt; /* create new tickets */
96
+ int okNewWiki; /* create new wiki via web */
97
+ int okApndWiki; /* append to wiki via web */
9598
int okPassword; /* change password */
9699
int okAdmin; /* administrative permission */
97100
int okDelete; /* delete wiki or tickets */
98101
int okQuery; /* create new reports */
99102
100103
--- src/main.c
+++ src/main.c
@@ -87,13 +87,16 @@
87 int okRead; /* xfer outbound */
88 int okWrite; /* xfer inbound */
89 int okSetup; /* use Setup screens on web interface */
90 int okRdTkt; /* view tickets via web */
91 int okWrTkt; /* make changes to tickets via web */
 
 
92 int okRdWiki; /* view wiki via web */
93 int okWrWiki; /* edit wiki via web */
94 int okNewTkt; /* create new tickets */
 
95 int okPassword; /* change password */
96 int okAdmin; /* administrative permission */
97 int okDelete; /* delete wiki or tickets */
98 int okQuery; /* create new reports */
99
100
--- src/main.c
+++ src/main.c
@@ -87,13 +87,16 @@
87 int okRead; /* xfer outbound */
88 int okWrite; /* xfer inbound */
89 int okSetup; /* use Setup screens on web interface */
90 int okRdTkt; /* view tickets via web */
91 int okWrTkt; /* make changes to tickets via web */
92 int okNewTkt; /* create new tickets */
93 int okApndTkt; /* append to tickets via the web */
94 int okRdWiki; /* view wiki via web */
95 int okWrWiki; /* edit wiki via web */
96 int okNewWiki; /* create new wiki via web */
97 int okApndWiki; /* append to wiki via web */
98 int okPassword; /* change password */
99 int okAdmin; /* administrative permission */
100 int okDelete; /* delete wiki or tickets */
101 int okQuery; /* create new reports */
102
103
+35 -32
--- src/setup.c
+++ src/setup.c
@@ -57,13 +57,11 @@
5757
login_check_credentials();
5858
if( !g.okSetup ){
5959
login_needed();
6060
}
6161
62
- style_header();
63
-
64
- @ <h2>Setup</h2>
62
+ style_header("Setup");
6563
@ <dl id="setup">
6664
menu_entry("Users", "setup_ulist",
6765
"Grant privileges to individual users.");
6866
menu_entry("Access", "setup_access",
6967
"Control access settings.");
@@ -89,13 +87,11 @@
8987
login_needed();
9088
return;
9189
}
9290
9391
style_submenu_element("Add", "Add User", "setup_uedit");
94
- style_header();
95
- @ <h2>List Of Users</h2>
96
- @ <hr>
92
+ style_header("User List");
9793
@ <table align="left" hspace="10" border="1" cellpadding="10"><tr><td>
9894
@ <table cellspacing=0 cellpadding=0 border=0>
9995
@ <tr>
10096
@ <th align="right">User&nbsp;ID</th>
10197
@ <th>&nbsp;&nbsp;&nbsp;Capabilities&nbsp;&nbsp;&nbsp;</th>
@@ -157,11 +153,11 @@
157153
** WEBPAGE: /setup_uedit
158154
*/
159155
void user_edit(void){
160156
const char *zId, *zLogin, *zInfo, *zCap;
161157
char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap ;
162
- char *oak, *oad, *oaq;
158
+ char *oak, *oad, *oaq, *oac, *oaf, *oam;
163159
int doWrite;
164160
int uid;
165161
int higherUser = 0; /* True if user being edited is SETUP and the */
166162
/* user doing the editing is ADMIN. Disallow editing */
167163
@@ -206,20 +202,28 @@
206202
int ap = P("ap")!=0;
207203
int aq = P("aq")!=0;
208204
int ar = P("ar")!=0;
209205
int as = g.okSetup && P("as")!=0;
210206
int aw = P("aw")!=0;
207
+ int ac = P("ac")!=0;
208
+ int af = P("af")!=0;
209
+ int am = P("am")!=0;
210
+#if 0
211211
if( as ) aa = 1;
212212
if( aa ) ai = aw = ap = 1;
213213
if( aw ) an = ar = 1;
214214
if( ai ) ao = 1;
215215
if( ak ) aj = 1;
216
+#endif
216217
if( aa ){ zCap[i++] = 'a'; }
218
+ if( ac ){ zCap[i++] = 'c'; }
217219
if( ad ){ zCap[i++] = 'd'; }
220
+ if( af ){ zCap[i++] = 'f'; }
218221
if( ai ){ zCap[i++] = 'i'; }
219222
if( aj ){ zCap[i++] = 'j'; }
220223
if( ak ){ zCap[i++] = 'k'; }
224
+ if( am ){ zCap[i++] = 'm'; }
221225
if( an ){ zCap[i++] = 'n'; }
222226
if( ao ){ zCap[i++] = 'o'; }
223227
if( ap ){ zCap[i++] = 'p'; }
224228
if( aq ){ zCap[i++] = 'q'; }
225229
if( ar ){ zCap[i++] = 'r'; }
@@ -233,11 +237,11 @@
233237
}
234238
zLogin = P("login");
235239
if( uid>0 &&
236240
db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid)
237241
){
238
- style_header();
242
+ style_header("User Creation Error");
239243
@ <font color="red">Login "%h(zLogin)" is already used by a different
240244
@ user.</font>
241245
@
242246
@ <p><a href="setup_uedit?id=%d(uid))>[Bummer]</a></p>
243247
style_footer();
@@ -255,20 +259,24 @@
255259
/* Load the existing information about the user, if any
256260
*/
257261
zLogin = "";
258262
zInfo = "";
259263
zCap = "";
260
- oaa = oad = oai = oaj = oak = oan = oao = oap = oaq = oar = oas = oaw = "";
264
+ oaa = oac = oad = oaf = oai = oaj = oak = oam =
265
+ oan = oao = oap = oaq = oar = oas = oaw = "";
261266
if( uid ){
262267
zLogin = db_text("", "SELECT login FROM user WHERE uid=%d", uid);
263268
zInfo = db_text("", "SELECT info FROM user WHERE uid=%d", uid);
264269
zCap = db_text("", "SELECT cap FROM user WHERE uid=%d", uid);
265270
if( strchr(zCap, 'a') ) oaa = " checked";
271
+ if( strchr(zCap, 'c') ) oac = " checked";
266272
if( strchr(zCap, 'd') ) oad = " checked";
273
+ if( strchr(zCap, 'f') ) oaf = " checked";
267274
if( strchr(zCap, 'i') ) oai = " checked";
268275
if( strchr(zCap, 'j') ) oaj = " checked";
269276
if( strchr(zCap, 'k') ) oak = " checked";
277
+ if( strchr(zCap, 'm') ) oam = " checked";
270278
if( strchr(zCap, 'n') ) oan = " checked";
271279
if( strchr(zCap, 'o') ) oao = " checked";
272280
if( strchr(zCap, 'p') ) oap = " checked";
273281
if( strchr(zCap, 'q') ) oaq = " checked";
274282
if( strchr(zCap, 'r') ) oar = " checked";
@@ -277,15 +285,14 @@
277285
}
278286
279287
/* Begin generating the page
280288
*/
281289
style_submenu_element("Cancel", "Cancel", "setup_ulist");
282
- style_header();
283290
if( uid ){
284
- @ <h2>Edit User %h(zLogin)</h2>
291
+ style_header(mprintf("Edit User %h", zLogin));
285292
}else{
286
- @ <h2>Add A New User</h2>
293
+ style_header("Add A New User");
287294
}
288295
@ <table align="left" hspace="20" vspace="10"><tr><td>
289296
@ <form action="%s(g.zPath)" method="POST">
290297
@ <table>
291298
@ <tr>
@@ -305,24 +312,27 @@
305312
@ <td><input type="text" name="info" size=40 value="%h(zInfo)"></td>
306313
@ </tr>
307314
@ <tr>
308315
@ <td align="right" valign="top">Capabilities:</td>
309316
@ <td>
310
- @ <input type="checkbox" name="aa"%s(oaa)>Admin</input><br>
311
- @ <input type="checkbox" name="ad"%s(oad)>Delete</input><br>
312
- @ <input type="checkbox" name="ai"%s(oai)>Check-In</input><br>
313
- @ <input type="checkbox" name="aj"%s(oaj)>Read Wiki</input><br>
314
- @ <input type="checkbox" name="ak"%s(oak)>Write Wiki</input><br>
315
- @ <input type="checkbox" name="an"%s(oan)>New Tkt</input><br>
316
- @ <input type="checkbox" name="ao"%s(oao)>Check-Out</input><br>
317
- @ <input type="checkbox" name="ap"%s(oap)>Password</input><br>
318
- @ <input type="checkbox" name="aq"%s(oaq)>Query</input><br>
319
- @ <input type="checkbox" name="ar"%s(oar)>Read</input><br>
320317
if( g.okSetup ){
321318
@ <input type="checkbox" name="as"%s(oas)>Setup</input><br>
322319
}
323
- @ <input type="checkbox" name="aw"%s(oaw)>Write</input>
320
+ @ <input type="checkbox" name="aa"%s(oaa)>Admin</input><br>
321
+ @ <input type="checkbox" name="ad"%s(oad)>Delete</input><br>
322
+ @ <input type="checkbox" name="ap"%s(oap)>Password</input><br>
323
+ @ <input type="checkbox" name="aq"%s(oaq)>Query</input><br>
324
+ @ <input type="checkbox" name="ai"%s(oai)>Check-In</input><br>
325
+ @ <input type="checkbox" name="ao"%s(oao)>Check-Out</input><br>
326
+ @ <input type="checkbox" name="aj"%s(oaj)>Read Wiki</input><br>
327
+ @ <input type="checkbox" name="af"%s(oaf)>New Wiki</input><br>
328
+ @ <input type="checkbox" name="am"%s(oam)>Append Wiki</input><br>
329
+ @ <input type="checkbox" name="ak"%s(oak)>Write Wiki</input><br>
330
+ @ <input type="checkbox" name="ar"%s(oar)>Read Tkt</input><br>
331
+ @ <input type="checkbox" name="an"%s(oan)>New Tkt</input><br>
332
+ @ <input type="checkbox" name="ac"%s(oac)>Append Tkt</input><br>
333
+ @ <input type="checkbox" name="aw"%s(oaw)>Write Tkt</input>
324334
@ </td>
325335
@ </tr>
326336
@ <tr>
327337
@ <td align="right">Password:</td>
328338
@ <td><input type="password" name="pw" value=""></td>
@@ -341,15 +351,10 @@
341351
@ User %h(zId) has Setup privileges and you only have Admin privileges
342352
@ so you are not permitted to make changes to %h(zId).
343353
@ </p></li>
344354
@
345355
}
346
- @ <li><p>
347
- @ The <b>Read</b> and <b>Write</b> privileges give the user the ability
348
- @ to read and write tickets. The <b>New Tkt</b> capability means that
349
- @ the user is able to create new tickets.
350
- @ </p></li>
351356
@
352357
@ <li><p>
353358
@ The <b>Delete</b> privilege give the user the ability to erase
354359
@ wiki, tickets, and atttachments that have been added by anonymous
355360
@ users. This capability is intended for deletion of spam.
@@ -450,13 +455,12 @@
450455
login_check_credentials();
451456
if( !g.okSetup ){
452457
login_needed();
453458
}
454459
455
- style_header();
460
+ style_header("Access Control Settings");
456461
db_begin_transaction();
457
- @ <h2>Access Control Settings</h2>
458462
@ <form action="%s(g.zBaseURL)/setup_access" method="POST">
459463
460464
@ <hr>
461465
onoff_attribute("Require password for local access",
462466
"authenticate-localhost", "localauth", 1);
@@ -491,13 +495,12 @@
491495
login_check_credentials();
492496
if( !g.okSetup ){
493497
login_needed();
494498
}
495499
496
- style_header();
500
+ style_header("WWW Configuration");
497501
db_begin_transaction();
498
- @ <h2>WWW Configuration</h2>
499502
@ <form action="%s(g.zBaseURL)/setup_config" method="POST">
500503
501504
@ <hr>
502505
entry_attribute("Home page", 60, "homepage", "hp", "");
503506
@ <p>The name of a wiki file that is the homepage for the website.
504507
--- src/setup.c
+++ src/setup.c
@@ -57,13 +57,11 @@
57 login_check_credentials();
58 if( !g.okSetup ){
59 login_needed();
60 }
61
62 style_header();
63
64 @ <h2>Setup</h2>
65 @ <dl id="setup">
66 menu_entry("Users", "setup_ulist",
67 "Grant privileges to individual users.");
68 menu_entry("Access", "setup_access",
69 "Control access settings.");
@@ -89,13 +87,11 @@
89 login_needed();
90 return;
91 }
92
93 style_submenu_element("Add", "Add User", "setup_uedit");
94 style_header();
95 @ <h2>List Of Users</h2>
96 @ <hr>
97 @ <table align="left" hspace="10" border="1" cellpadding="10"><tr><td>
98 @ <table cellspacing=0 cellpadding=0 border=0>
99 @ <tr>
100 @ <th align="right">User&nbsp;ID</th>
101 @ <th>&nbsp;&nbsp;&nbsp;Capabilities&nbsp;&nbsp;&nbsp;</th>
@@ -157,11 +153,11 @@
157 ** WEBPAGE: /setup_uedit
158 */
159 void user_edit(void){
160 const char *zId, *zLogin, *zInfo, *zCap;
161 char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap ;
162 char *oak, *oad, *oaq;
163 int doWrite;
164 int uid;
165 int higherUser = 0; /* True if user being edited is SETUP and the */
166 /* user doing the editing is ADMIN. Disallow editing */
167
@@ -206,20 +202,28 @@
206 int ap = P("ap")!=0;
207 int aq = P("aq")!=0;
208 int ar = P("ar")!=0;
209 int as = g.okSetup && P("as")!=0;
210 int aw = P("aw")!=0;
 
 
 
 
211 if( as ) aa = 1;
212 if( aa ) ai = aw = ap = 1;
213 if( aw ) an = ar = 1;
214 if( ai ) ao = 1;
215 if( ak ) aj = 1;
 
216 if( aa ){ zCap[i++] = 'a'; }
 
217 if( ad ){ zCap[i++] = 'd'; }
 
218 if( ai ){ zCap[i++] = 'i'; }
219 if( aj ){ zCap[i++] = 'j'; }
220 if( ak ){ zCap[i++] = 'k'; }
 
221 if( an ){ zCap[i++] = 'n'; }
222 if( ao ){ zCap[i++] = 'o'; }
223 if( ap ){ zCap[i++] = 'p'; }
224 if( aq ){ zCap[i++] = 'q'; }
225 if( ar ){ zCap[i++] = 'r'; }
@@ -233,11 +237,11 @@
233 }
234 zLogin = P("login");
235 if( uid>0 &&
236 db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid)
237 ){
238 style_header();
239 @ <font color="red">Login "%h(zLogin)" is already used by a different
240 @ user.</font>
241 @
242 @ <p><a href="setup_uedit?id=%d(uid))>[Bummer]</a></p>
243 style_footer();
@@ -255,20 +259,24 @@
255 /* Load the existing information about the user, if any
256 */
257 zLogin = "";
258 zInfo = "";
259 zCap = "";
260 oaa = oad = oai = oaj = oak = oan = oao = oap = oaq = oar = oas = oaw = "";
 
261 if( uid ){
262 zLogin = db_text("", "SELECT login FROM user WHERE uid=%d", uid);
263 zInfo = db_text("", "SELECT info FROM user WHERE uid=%d", uid);
264 zCap = db_text("", "SELECT cap FROM user WHERE uid=%d", uid);
265 if( strchr(zCap, 'a') ) oaa = " checked";
 
266 if( strchr(zCap, 'd') ) oad = " checked";
 
267 if( strchr(zCap, 'i') ) oai = " checked";
268 if( strchr(zCap, 'j') ) oaj = " checked";
269 if( strchr(zCap, 'k') ) oak = " checked";
 
270 if( strchr(zCap, 'n') ) oan = " checked";
271 if( strchr(zCap, 'o') ) oao = " checked";
272 if( strchr(zCap, 'p') ) oap = " checked";
273 if( strchr(zCap, 'q') ) oaq = " checked";
274 if( strchr(zCap, 'r') ) oar = " checked";
@@ -277,15 +285,14 @@
277 }
278
279 /* Begin generating the page
280 */
281 style_submenu_element("Cancel", "Cancel", "setup_ulist");
282 style_header();
283 if( uid ){
284 @ <h2>Edit User %h(zLogin)</h2>
285 }else{
286 @ <h2>Add A New User</h2>
287 }
288 @ <table align="left" hspace="20" vspace="10"><tr><td>
289 @ <form action="%s(g.zPath)" method="POST">
290 @ <table>
291 @ <tr>
@@ -305,24 +312,27 @@
305 @ <td><input type="text" name="info" size=40 value="%h(zInfo)"></td>
306 @ </tr>
307 @ <tr>
308 @ <td align="right" valign="top">Capabilities:</td>
309 @ <td>
310 @ <input type="checkbox" name="aa"%s(oaa)>Admin</input><br>
311 @ <input type="checkbox" name="ad"%s(oad)>Delete</input><br>
312 @ <input type="checkbox" name="ai"%s(oai)>Check-In</input><br>
313 @ <input type="checkbox" name="aj"%s(oaj)>Read Wiki</input><br>
314 @ <input type="checkbox" name="ak"%s(oak)>Write Wiki</input><br>
315 @ <input type="checkbox" name="an"%s(oan)>New Tkt</input><br>
316 @ <input type="checkbox" name="ao"%s(oao)>Check-Out</input><br>
317 @ <input type="checkbox" name="ap"%s(oap)>Password</input><br>
318 @ <input type="checkbox" name="aq"%s(oaq)>Query</input><br>
319 @ <input type="checkbox" name="ar"%s(oar)>Read</input><br>
320 if( g.okSetup ){
321 @ <input type="checkbox" name="as"%s(oas)>Setup</input><br>
322 }
323 @ <input type="checkbox" name="aw"%s(oaw)>Write</input>
 
 
 
 
 
 
 
 
 
 
 
 
 
324 @ </td>
325 @ </tr>
326 @ <tr>
327 @ <td align="right">Password:</td>
328 @ <td><input type="password" name="pw" value=""></td>
@@ -341,15 +351,10 @@
341 @ User %h(zId) has Setup privileges and you only have Admin privileges
342 @ so you are not permitted to make changes to %h(zId).
343 @ </p></li>
344 @
345 }
346 @ <li><p>
347 @ The <b>Read</b> and <b>Write</b> privileges give the user the ability
348 @ to read and write tickets. The <b>New Tkt</b> capability means that
349 @ the user is able to create new tickets.
350 @ </p></li>
351 @
352 @ <li><p>
353 @ The <b>Delete</b> privilege give the user the ability to erase
354 @ wiki, tickets, and atttachments that have been added by anonymous
355 @ users. This capability is intended for deletion of spam.
@@ -450,13 +455,12 @@
450 login_check_credentials();
451 if( !g.okSetup ){
452 login_needed();
453 }
454
455 style_header();
456 db_begin_transaction();
457 @ <h2>Access Control Settings</h2>
458 @ <form action="%s(g.zBaseURL)/setup_access" method="POST">
459
460 @ <hr>
461 onoff_attribute("Require password for local access",
462 "authenticate-localhost", "localauth", 1);
@@ -491,13 +495,12 @@
491 login_check_credentials();
492 if( !g.okSetup ){
493 login_needed();
494 }
495
496 style_header();
497 db_begin_transaction();
498 @ <h2>WWW Configuration</h2>
499 @ <form action="%s(g.zBaseURL)/setup_config" method="POST">
500
501 @ <hr>
502 entry_attribute("Home page", 60, "homepage", "hp", "");
503 @ <p>The name of a wiki file that is the homepage for the website.
504
--- src/setup.c
+++ src/setup.c
@@ -57,13 +57,11 @@
57 login_check_credentials();
58 if( !g.okSetup ){
59 login_needed();
60 }
61
62 style_header("Setup");
 
 
63 @ <dl id="setup">
64 menu_entry("Users", "setup_ulist",
65 "Grant privileges to individual users.");
66 menu_entry("Access", "setup_access",
67 "Control access settings.");
@@ -89,13 +87,11 @@
87 login_needed();
88 return;
89 }
90
91 style_submenu_element("Add", "Add User", "setup_uedit");
92 style_header("User List");
 
 
93 @ <table align="left" hspace="10" border="1" cellpadding="10"><tr><td>
94 @ <table cellspacing=0 cellpadding=0 border=0>
95 @ <tr>
96 @ <th align="right">User&nbsp;ID</th>
97 @ <th>&nbsp;&nbsp;&nbsp;Capabilities&nbsp;&nbsp;&nbsp;</th>
@@ -157,11 +153,11 @@
153 ** WEBPAGE: /setup_uedit
154 */
155 void user_edit(void){
156 const char *zId, *zLogin, *zInfo, *zCap;
157 char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap ;
158 char *oak, *oad, *oaq, *oac, *oaf, *oam;
159 int doWrite;
160 int uid;
161 int higherUser = 0; /* True if user being edited is SETUP and the */
162 /* user doing the editing is ADMIN. Disallow editing */
163
@@ -206,20 +202,28 @@
202 int ap = P("ap")!=0;
203 int aq = P("aq")!=0;
204 int ar = P("ar")!=0;
205 int as = g.okSetup && P("as")!=0;
206 int aw = P("aw")!=0;
207 int ac = P("ac")!=0;
208 int af = P("af")!=0;
209 int am = P("am")!=0;
210 #if 0
211 if( as ) aa = 1;
212 if( aa ) ai = aw = ap = 1;
213 if( aw ) an = ar = 1;
214 if( ai ) ao = 1;
215 if( ak ) aj = 1;
216 #endif
217 if( aa ){ zCap[i++] = 'a'; }
218 if( ac ){ zCap[i++] = 'c'; }
219 if( ad ){ zCap[i++] = 'd'; }
220 if( af ){ zCap[i++] = 'f'; }
221 if( ai ){ zCap[i++] = 'i'; }
222 if( aj ){ zCap[i++] = 'j'; }
223 if( ak ){ zCap[i++] = 'k'; }
224 if( am ){ zCap[i++] = 'm'; }
225 if( an ){ zCap[i++] = 'n'; }
226 if( ao ){ zCap[i++] = 'o'; }
227 if( ap ){ zCap[i++] = 'p'; }
228 if( aq ){ zCap[i++] = 'q'; }
229 if( ar ){ zCap[i++] = 'r'; }
@@ -233,11 +237,11 @@
237 }
238 zLogin = P("login");
239 if( uid>0 &&
240 db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid)
241 ){
242 style_header("User Creation Error");
243 @ <font color="red">Login "%h(zLogin)" is already used by a different
244 @ user.</font>
245 @
246 @ <p><a href="setup_uedit?id=%d(uid))>[Bummer]</a></p>
247 style_footer();
@@ -255,20 +259,24 @@
259 /* Load the existing information about the user, if any
260 */
261 zLogin = "";
262 zInfo = "";
263 zCap = "";
264 oaa = oac = oad = oaf = oai = oaj = oak = oam =
265 oan = oao = oap = oaq = oar = oas = oaw = "";
266 if( uid ){
267 zLogin = db_text("", "SELECT login FROM user WHERE uid=%d", uid);
268 zInfo = db_text("", "SELECT info FROM user WHERE uid=%d", uid);
269 zCap = db_text("", "SELECT cap FROM user WHERE uid=%d", uid);
270 if( strchr(zCap, 'a') ) oaa = " checked";
271 if( strchr(zCap, 'c') ) oac = " checked";
272 if( strchr(zCap, 'd') ) oad = " checked";
273 if( strchr(zCap, 'f') ) oaf = " checked";
274 if( strchr(zCap, 'i') ) oai = " checked";
275 if( strchr(zCap, 'j') ) oaj = " checked";
276 if( strchr(zCap, 'k') ) oak = " checked";
277 if( strchr(zCap, 'm') ) oam = " checked";
278 if( strchr(zCap, 'n') ) oan = " checked";
279 if( strchr(zCap, 'o') ) oao = " checked";
280 if( strchr(zCap, 'p') ) oap = " checked";
281 if( strchr(zCap, 'q') ) oaq = " checked";
282 if( strchr(zCap, 'r') ) oar = " checked";
@@ -277,15 +285,14 @@
285 }
286
287 /* Begin generating the page
288 */
289 style_submenu_element("Cancel", "Cancel", "setup_ulist");
 
290 if( uid ){
291 style_header(mprintf("Edit User %h", zLogin));
292 }else{
293 style_header("Add A New User");
294 }
295 @ <table align="left" hspace="20" vspace="10"><tr><td>
296 @ <form action="%s(g.zPath)" method="POST">
297 @ <table>
298 @ <tr>
@@ -305,24 +312,27 @@
312 @ <td><input type="text" name="info" size=40 value="%h(zInfo)"></td>
313 @ </tr>
314 @ <tr>
315 @ <td align="right" valign="top">Capabilities:</td>
316 @ <td>
 
 
 
 
 
 
 
 
 
 
317 if( g.okSetup ){
318 @ <input type="checkbox" name="as"%s(oas)>Setup</input><br>
319 }
320 @ <input type="checkbox" name="aa"%s(oaa)>Admin</input><br>
321 @ <input type="checkbox" name="ad"%s(oad)>Delete</input><br>
322 @ <input type="checkbox" name="ap"%s(oap)>Password</input><br>
323 @ <input type="checkbox" name="aq"%s(oaq)>Query</input><br>
324 @ <input type="checkbox" name="ai"%s(oai)>Check-In</input><br>
325 @ <input type="checkbox" name="ao"%s(oao)>Check-Out</input><br>
326 @ <input type="checkbox" name="aj"%s(oaj)>Read Wiki</input><br>
327 @ <input type="checkbox" name="af"%s(oaf)>New Wiki</input><br>
328 @ <input type="checkbox" name="am"%s(oam)>Append Wiki</input><br>
329 @ <input type="checkbox" name="ak"%s(oak)>Write Wiki</input><br>
330 @ <input type="checkbox" name="ar"%s(oar)>Read Tkt</input><br>
331 @ <input type="checkbox" name="an"%s(oan)>New Tkt</input><br>
332 @ <input type="checkbox" name="ac"%s(oac)>Append Tkt</input><br>
333 @ <input type="checkbox" name="aw"%s(oaw)>Write Tkt</input>
334 @ </td>
335 @ </tr>
336 @ <tr>
337 @ <td align="right">Password:</td>
338 @ <td><input type="password" name="pw" value=""></td>
@@ -341,15 +351,10 @@
351 @ User %h(zId) has Setup privileges and you only have Admin privileges
352 @ so you are not permitted to make changes to %h(zId).
353 @ </p></li>
354 @
355 }
 
 
 
 
 
356 @
357 @ <li><p>
358 @ The <b>Delete</b> privilege give the user the ability to erase
359 @ wiki, tickets, and atttachments that have been added by anonymous
360 @ users. This capability is intended for deletion of spam.
@@ -450,13 +455,12 @@
455 login_check_credentials();
456 if( !g.okSetup ){
457 login_needed();
458 }
459
460 style_header("Access Control Settings");
461 db_begin_transaction();
 
462 @ <form action="%s(g.zBaseURL)/setup_access" method="POST">
463
464 @ <hr>
465 onoff_attribute("Require password for local access",
466 "authenticate-localhost", "localauth", 1);
@@ -491,13 +495,12 @@
495 login_check_credentials();
496 if( !g.okSetup ){
497 login_needed();
498 }
499
500 style_header("WWW Configuration");
501 db_begin_transaction();
 
502 @ <form action="%s(g.zBaseURL)/setup_config" method="POST">
503
504 @ <hr>
505 entry_attribute("Home page", 60, "homepage", "hp", "");
506 @ <p>The name of a wiki file that is the homepage for the website.
507
+9 -4
--- src/style.c
+++ src/style.c
@@ -67,31 +67,36 @@
6767
}
6868
6969
/*
7070
** Draw the header.
7171
*/
72
-void style_header(void){
72
+void style_header(const char *zTitle){
7373
const char *zLogInOut = "Logout";
7474
login_check_credentials();
7575
@ <html>
7676
@ <body bgcolor="white">
7777
@ <hr size="1">
7878
@ <table border="0" cellpadding="0" cellspacing="0" width="100%%">
7979
@ <tr><td valign="top" align="left">
80
- @ <big><big><b>Fossil SCM</b></big></big><br>
80
+ @ <big><big><b>%s(zTitle)</b></big></big><br>
8181
if( g.zLogin==0 || g.zLogin[0]==0 ){
8282
@ <small>not logged in</small>
8383
zLogInOut = "Login";
8484
}else{
8585
@ <small>logged in as %h(g.zLogin)</small>
8686
}
8787
@ </td><td valign="top" align="right">
8888
@ <a href="%s(g.zBaseURL)/index">Home</a>
8989
@ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
90
+ if( g.okRdWiki ){
91
+ @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a>
92
+ }
93
+#if 0
9094
@ | <font color="#888888">Search</font>
9195
@ | <font color="#888888">Ticket</font>
9296
@ | <font color="#888888">Reports</font>
97
+#endif
9398
if( g.okSetup ){
9499
@ | <a href="%s(g.zBaseURL)/setup">Setup</a>
95100
}
96101
if( !g.noPswd ){
97102
@ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
@@ -125,18 +130,18 @@
125130
** WEBPAGE: index
126131
** WEBPAGE: home
127132
** WEBPAGE: not_found
128133
*/
129134
void page_index(void){
130
- style_header();
135
+ style_header("Main Title Page");
131136
@ This will become the title page
132137
style_footer();
133138
}
134139
135140
/*
136141
** WEBPAGE: test_env
137142
*/
138143
void page_test_env(void){
139
- style_header();
144
+ style_header("Environment Test");
140145
cgi_print_all();
141146
style_footer();
142147
}
143148
--- src/style.c
+++ src/style.c
@@ -67,31 +67,36 @@
67 }
68
69 /*
70 ** Draw the header.
71 */
72 void style_header(void){
73 const char *zLogInOut = "Logout";
74 login_check_credentials();
75 @ <html>
76 @ <body bgcolor="white">
77 @ <hr size="1">
78 @ <table border="0" cellpadding="0" cellspacing="0" width="100%%">
79 @ <tr><td valign="top" align="left">
80 @ <big><big><b>Fossil SCM</b></big></big><br>
81 if( g.zLogin==0 || g.zLogin[0]==0 ){
82 @ <small>not logged in</small>
83 zLogInOut = "Login";
84 }else{
85 @ <small>logged in as %h(g.zLogin)</small>
86 }
87 @ </td><td valign="top" align="right">
88 @ <a href="%s(g.zBaseURL)/index">Home</a>
89 @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
 
 
 
 
90 @ | <font color="#888888">Search</font>
91 @ | <font color="#888888">Ticket</font>
92 @ | <font color="#888888">Reports</font>
 
93 if( g.okSetup ){
94 @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
95 }
96 if( !g.noPswd ){
97 @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
@@ -125,18 +130,18 @@
125 ** WEBPAGE: index
126 ** WEBPAGE: home
127 ** WEBPAGE: not_found
128 */
129 void page_index(void){
130 style_header();
131 @ This will become the title page
132 style_footer();
133 }
134
135 /*
136 ** WEBPAGE: test_env
137 */
138 void page_test_env(void){
139 style_header();
140 cgi_print_all();
141 style_footer();
142 }
143
--- src/style.c
+++ src/style.c
@@ -67,31 +67,36 @@
67 }
68
69 /*
70 ** Draw the header.
71 */
72 void style_header(const char *zTitle){
73 const char *zLogInOut = "Logout";
74 login_check_credentials();
75 @ <html>
76 @ <body bgcolor="white">
77 @ <hr size="1">
78 @ <table border="0" cellpadding="0" cellspacing="0" width="100%%">
79 @ <tr><td valign="top" align="left">
80 @ <big><big><b>%s(zTitle)</b></big></big><br>
81 if( g.zLogin==0 || g.zLogin[0]==0 ){
82 @ <small>not logged in</small>
83 zLogInOut = "Login";
84 }else{
85 @ <small>logged in as %h(g.zLogin)</small>
86 }
87 @ </td><td valign="top" align="right">
88 @ <a href="%s(g.zBaseURL)/index">Home</a>
89 @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
90 if( g.okRdWiki ){
91 @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a>
92 }
93 #if 0
94 @ | <font color="#888888">Search</font>
95 @ | <font color="#888888">Ticket</font>
96 @ | <font color="#888888">Reports</font>
97 #endif
98 if( g.okSetup ){
99 @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
100 }
101 if( !g.noPswd ){
102 @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
@@ -125,18 +130,18 @@
130 ** WEBPAGE: index
131 ** WEBPAGE: home
132 ** WEBPAGE: not_found
133 */
134 void page_index(void){
135 style_header("Main Title Page");
136 @ This will become the title page
137 style_footer();
138 }
139
140 /*
141 ** WEBPAGE: test_env
142 */
143 void page_test_env(void){
144 style_header("Environment Test");
145 cgi_print_all();
146 style_footer();
147 }
148
+8 -10
--- src/timeline.c
+++ src/timeline.c
@@ -52,23 +52,21 @@
5252
** WEBPAGE: timeline
5353
*/
5454
void page_timeline(void){
5555
Stmt q;
5656
char zPrevDate[20];
57
- style_header();
57
+ style_header("Timeline");
5858
zPrevDate[0] = 0;
5959
db_prepare(&q,
60
- "SELECT rid, type, uuid, datetime(ctime,'unixepoch','localtime'), comment"
61
- " FROM record"
62
- " WHERE NOT phantom AND NOT cancel"
63
- " AND type IN ('v')"
64
- " ORDER BY ctime DESC"
65
- " LIMIT 100"
60
+ "SELECT uuid, datetime(event.mtime,'localtime'), comment"
61
+ " FROM event, blob"
62
+ " WHERE event.type='ci' AND blob.rid=event.objid"
63
+ " ORDER BY event.mtime DESC"
6664
);
6765
@ <table cellspacing=0 border=0 cellpadding=0>
6866
while( db_step(&q)==SQLITE_ROW ){
69
- const char *zDate = db_column_text(&q, 3);
67
+ const char *zDate = db_column_text(&q, 1);
7068
if( memcmp(zDate, zPrevDate, 10) ){
7169
sprintf(zPrevDate, "%.10s", zDate);
7270
@ <tr><td colspan=3>
7371
@ <table cellpadding=2 border=0>
7472
@ <tr><td bgcolor="#a0b5f4" class="border1">
@@ -79,12 +77,12 @@
7977
@ </td></tr>
8078
}
8179
@ <tr><td valign="top">%s(&zDate[11])</td>
8280
@ <td width="20"></td>
8381
@ <td valign="top" align="left">
84
- hyperlink_to_uuid(db_column_text(&q,2));
85
- @ %s(db_column_text(&q,4))</td>
82
+ hyperlink_to_uuid(db_column_text(&q,0));
83
+ @ %s(db_column_text(&q,2))</td>
8684
}
8785
db_finalize(&q);
8886
@ </table>
8987
style_footer();
9088
}
9189
--- src/timeline.c
+++ src/timeline.c
@@ -52,23 +52,21 @@
52 ** WEBPAGE: timeline
53 */
54 void page_timeline(void){
55 Stmt q;
56 char zPrevDate[20];
57 style_header();
58 zPrevDate[0] = 0;
59 db_prepare(&q,
60 "SELECT rid, type, uuid, datetime(ctime,'unixepoch','localtime'), comment"
61 " FROM record"
62 " WHERE NOT phantom AND NOT cancel"
63 " AND type IN ('v')"
64 " ORDER BY ctime DESC"
65 " LIMIT 100"
66 );
67 @ <table cellspacing=0 border=0 cellpadding=0>
68 while( db_step(&q)==SQLITE_ROW ){
69 const char *zDate = db_column_text(&q, 3);
70 if( memcmp(zDate, zPrevDate, 10) ){
71 sprintf(zPrevDate, "%.10s", zDate);
72 @ <tr><td colspan=3>
73 @ <table cellpadding=2 border=0>
74 @ <tr><td bgcolor="#a0b5f4" class="border1">
@@ -79,12 +77,12 @@
79 @ </td></tr>
80 }
81 @ <tr><td valign="top">%s(&zDate[11])</td>
82 @ <td width="20"></td>
83 @ <td valign="top" align="left">
84 hyperlink_to_uuid(db_column_text(&q,2));
85 @ %s(db_column_text(&q,4))</td>
86 }
87 db_finalize(&q);
88 @ </table>
89 style_footer();
90 }
91
--- src/timeline.c
+++ src/timeline.c
@@ -52,23 +52,21 @@
52 ** WEBPAGE: timeline
53 */
54 void page_timeline(void){
55 Stmt q;
56 char zPrevDate[20];
57 style_header("Timeline");
58 zPrevDate[0] = 0;
59 db_prepare(&q,
60 "SELECT uuid, datetime(event.mtime,'localtime'), comment"
61 " FROM event, blob"
62 " WHERE event.type='ci' AND blob.rid=event.objid"
63 " ORDER BY event.mtime DESC"
 
 
64 );
65 @ <table cellspacing=0 border=0 cellpadding=0>
66 while( db_step(&q)==SQLITE_ROW ){
67 const char *zDate = db_column_text(&q, 1);
68 if( memcmp(zDate, zPrevDate, 10) ){
69 sprintf(zPrevDate, "%.10s", zDate);
70 @ <tr><td colspan=3>
71 @ <table cellpadding=2 border=0>
72 @ <tr><td bgcolor="#a0b5f4" class="border1">
@@ -79,12 +77,12 @@
77 @ </td></tr>
78 }
79 @ <tr><td valign="top">%s(&zDate[11])</td>
80 @ <td width="20"></td>
81 @ <td valign="top" align="left">
82 hyperlink_to_uuid(db_column_text(&q,0));
83 @ %s(db_column_text(&q,2))</td>
84 }
85 db_finalize(&q);
86 @ </table>
87 style_footer();
88 }
89
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -32,9 +32,9 @@
3232
**
3333
** Render the wiki page that is named after the /wiki/ part of
3434
** the url.
3535
*/
3636
void wiki_page(void){
37
- style_header();
37
+ style_header("Wiki");
3838
@ extra=%h(g.zExtra)
3939
style_footer();
4040
}
4141
--- src/wiki.c
+++ src/wiki.c
@@ -32,9 +32,9 @@
32 **
33 ** Render the wiki page that is named after the /wiki/ part of
34 ** the url.
35 */
36 void wiki_page(void){
37 style_header();
38 @ extra=%h(g.zExtra)
39 style_footer();
40 }
41
--- src/wiki.c
+++ src/wiki.c
@@ -32,9 +32,9 @@
32 **
33 ** Render the wiki page that is named after the /wiki/ part of
34 ** the url.
35 */
36 void wiki_page(void){
37 style_header("Wiki");
38 @ extra=%h(g.zExtra)
39 style_footer();
40 }
41

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button