| | @@ -57,13 +57,11 @@ |
| 57 | 57 | login_check_credentials(); |
| 58 | 58 | if( !g.okSetup ){ |
| 59 | 59 | login_needed(); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | | - style_header(); |
| 63 | | - |
| 64 | | - @ <h2>Setup</h2> |
| 62 | + style_header("Setup"); |
| 65 | 63 | @ <dl id="setup"> |
| 66 | 64 | menu_entry("Users", "setup_ulist", |
| 67 | 65 | "Grant privileges to individual users."); |
| 68 | 66 | menu_entry("Access", "setup_access", |
| 69 | 67 | "Control access settings."); |
| | @@ -89,13 +87,11 @@ |
| 89 | 87 | login_needed(); |
| 90 | 88 | return; |
| 91 | 89 | } |
| 92 | 90 | |
| 93 | 91 | style_submenu_element("Add", "Add User", "setup_uedit"); |
| 94 | | - style_header(); |
| 95 | | - @ <h2>List Of Users</h2> |
| 96 | | - @ <hr> |
| 92 | + style_header("User List"); |
| 97 | 93 | @ <table align="left" hspace="10" border="1" cellpadding="10"><tr><td> |
| 98 | 94 | @ <table cellspacing=0 cellpadding=0 border=0> |
| 99 | 95 | @ <tr> |
| 100 | 96 | @ <th align="right">User ID</th> |
| 101 | 97 | @ <th> Capabilities </th> |
| | @@ -157,11 +153,11 @@ |
| 157 | 153 | ** WEBPAGE: /setup_uedit |
| 158 | 154 | */ |
| 159 | 155 | void user_edit(void){ |
| 160 | 156 | const char *zId, *zLogin, *zInfo, *zCap; |
| 161 | 157 | char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap ; |
| 162 | | - char *oak, *oad, *oaq; |
| 158 | + char *oak, *oad, *oaq, *oac, *oaf, *oam; |
| 163 | 159 | int doWrite; |
| 164 | 160 | int uid; |
| 165 | 161 | int higherUser = 0; /* True if user being edited is SETUP and the */ |
| 166 | 162 | /* user doing the editing is ADMIN. Disallow editing */ |
| 167 | 163 | |
| | @@ -206,20 +202,28 @@ |
| 206 | 202 | int ap = P("ap")!=0; |
| 207 | 203 | int aq = P("aq")!=0; |
| 208 | 204 | int ar = P("ar")!=0; |
| 209 | 205 | int as = g.okSetup && P("as")!=0; |
| 210 | 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 | 211 | if( as ) aa = 1; |
| 212 | 212 | if( aa ) ai = aw = ap = 1; |
| 213 | 213 | if( aw ) an = ar = 1; |
| 214 | 214 | if( ai ) ao = 1; |
| 215 | 215 | if( ak ) aj = 1; |
| 216 | +#endif |
| 216 | 217 | if( aa ){ zCap[i++] = 'a'; } |
| 218 | + if( ac ){ zCap[i++] = 'c'; } |
| 217 | 219 | if( ad ){ zCap[i++] = 'd'; } |
| 220 | + if( af ){ zCap[i++] = 'f'; } |
| 218 | 221 | if( ai ){ zCap[i++] = 'i'; } |
| 219 | 222 | if( aj ){ zCap[i++] = 'j'; } |
| 220 | 223 | if( ak ){ zCap[i++] = 'k'; } |
| 224 | + if( am ){ zCap[i++] = 'm'; } |
| 221 | 225 | if( an ){ zCap[i++] = 'n'; } |
| 222 | 226 | if( ao ){ zCap[i++] = 'o'; } |
| 223 | 227 | if( ap ){ zCap[i++] = 'p'; } |
| 224 | 228 | if( aq ){ zCap[i++] = 'q'; } |
| 225 | 229 | if( ar ){ zCap[i++] = 'r'; } |
| | @@ -233,11 +237,11 @@ |
| 233 | 237 | } |
| 234 | 238 | zLogin = P("login"); |
| 235 | 239 | if( uid>0 && |
| 236 | 240 | db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid) |
| 237 | 241 | ){ |
| 238 | | - style_header(); |
| 242 | + style_header("User Creation Error"); |
| 239 | 243 | @ <font color="red">Login "%h(zLogin)" is already used by a different |
| 240 | 244 | @ user.</font> |
| 241 | 245 | @ |
| 242 | 246 | @ <p><a href="setup_uedit?id=%d(uid))>[Bummer]</a></p> |
| 243 | 247 | style_footer(); |
| | @@ -255,20 +259,24 @@ |
| 255 | 259 | /* Load the existing information about the user, if any |
| 256 | 260 | */ |
| 257 | 261 | zLogin = ""; |
| 258 | 262 | zInfo = ""; |
| 259 | 263 | 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 = ""; |
| 261 | 266 | if( uid ){ |
| 262 | 267 | zLogin = db_text("", "SELECT login FROM user WHERE uid=%d", uid); |
| 263 | 268 | zInfo = db_text("", "SELECT info FROM user WHERE uid=%d", uid); |
| 264 | 269 | zCap = db_text("", "SELECT cap FROM user WHERE uid=%d", uid); |
| 265 | 270 | if( strchr(zCap, 'a') ) oaa = " checked"; |
| 271 | + if( strchr(zCap, 'c') ) oac = " checked"; |
| 266 | 272 | if( strchr(zCap, 'd') ) oad = " checked"; |
| 273 | + if( strchr(zCap, 'f') ) oaf = " checked"; |
| 267 | 274 | if( strchr(zCap, 'i') ) oai = " checked"; |
| 268 | 275 | if( strchr(zCap, 'j') ) oaj = " checked"; |
| 269 | 276 | if( strchr(zCap, 'k') ) oak = " checked"; |
| 277 | + if( strchr(zCap, 'm') ) oam = " checked"; |
| 270 | 278 | if( strchr(zCap, 'n') ) oan = " checked"; |
| 271 | 279 | if( strchr(zCap, 'o') ) oao = " checked"; |
| 272 | 280 | if( strchr(zCap, 'p') ) oap = " checked"; |
| 273 | 281 | if( strchr(zCap, 'q') ) oaq = " checked"; |
| 274 | 282 | if( strchr(zCap, 'r') ) oar = " checked"; |
| | @@ -277,15 +285,14 @@ |
| 277 | 285 | } |
| 278 | 286 | |
| 279 | 287 | /* Begin generating the page |
| 280 | 288 | */ |
| 281 | 289 | style_submenu_element("Cancel", "Cancel", "setup_ulist"); |
| 282 | | - style_header(); |
| 283 | 290 | if( uid ){ |
| 284 | | - @ <h2>Edit User %h(zLogin)</h2> |
| 291 | + style_header(mprintf("Edit User %h", zLogin)); |
| 285 | 292 | }else{ |
| 286 | | - @ <h2>Add A New User</h2> |
| 293 | + style_header("Add A New User"); |
| 287 | 294 | } |
| 288 | 295 | @ <table align="left" hspace="20" vspace="10"><tr><td> |
| 289 | 296 | @ <form action="%s(g.zPath)" method="POST"> |
| 290 | 297 | @ <table> |
| 291 | 298 | @ <tr> |
| | @@ -305,24 +312,27 @@ |
| 305 | 312 | @ <td><input type="text" name="info" size=40 value="%h(zInfo)"></td> |
| 306 | 313 | @ </tr> |
| 307 | 314 | @ <tr> |
| 308 | 315 | @ <td align="right" valign="top">Capabilities:</td> |
| 309 | 316 | @ <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 | 317 | if( g.okSetup ){ |
| 321 | 318 | @ <input type="checkbox" name="as"%s(oas)>Setup</input><br> |
| 322 | 319 | } |
| 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> |
| 324 | 334 | @ </td> |
| 325 | 335 | @ </tr> |
| 326 | 336 | @ <tr> |
| 327 | 337 | @ <td align="right">Password:</td> |
| 328 | 338 | @ <td><input type="password" name="pw" value=""></td> |
| | @@ -341,15 +351,10 @@ |
| 341 | 351 | @ User %h(zId) has Setup privileges and you only have Admin privileges |
| 342 | 352 | @ so you are not permitted to make changes to %h(zId). |
| 343 | 353 | @ </p></li> |
| 344 | 354 | @ |
| 345 | 355 | } |
| 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 | 356 | @ |
| 352 | 357 | @ <li><p> |
| 353 | 358 | @ The <b>Delete</b> privilege give the user the ability to erase |
| 354 | 359 | @ wiki, tickets, and atttachments that have been added by anonymous |
| 355 | 360 | @ users. This capability is intended for deletion of spam. |
| | @@ -450,13 +455,12 @@ |
| 450 | 455 | login_check_credentials(); |
| 451 | 456 | if( !g.okSetup ){ |
| 452 | 457 | login_needed(); |
| 453 | 458 | } |
| 454 | 459 | |
| 455 | | - style_header(); |
| 460 | + style_header("Access Control Settings"); |
| 456 | 461 | db_begin_transaction(); |
| 457 | | - @ <h2>Access Control Settings</h2> |
| 458 | 462 | @ <form action="%s(g.zBaseURL)/setup_access" method="POST"> |
| 459 | 463 | |
| 460 | 464 | @ <hr> |
| 461 | 465 | onoff_attribute("Require password for local access", |
| 462 | 466 | "authenticate-localhost", "localauth", 1); |
| | @@ -491,13 +495,12 @@ |
| 491 | 495 | login_check_credentials(); |
| 492 | 496 | if( !g.okSetup ){ |
| 493 | 497 | login_needed(); |
| 494 | 498 | } |
| 495 | 499 | |
| 496 | | - style_header(); |
| 500 | + style_header("WWW Configuration"); |
| 497 | 501 | db_begin_transaction(); |
| 498 | | - @ <h2>WWW Configuration</h2> |
| 499 | 502 | @ <form action="%s(g.zBaseURL)/setup_config" method="POST"> |
| 500 | 503 | |
| 501 | 504 | @ <hr> |
| 502 | 505 | entry_attribute("Home page", 60, "homepage", "hp", ""); |
| 503 | 506 | @ <p>The name of a wiki file that is the homepage for the website. |
| 504 | 507 | |