Fossil SCM
Improvements to the log menu.
Commit
b0feaa6955ae9328a709b2d7b23f871a258b788768772b47481405eb7ef1a29e
Parent
88d82553fc3b364…
1 file changed
+46
-25
+46
-25
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -38,26 +38,26 @@ | ||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /* |
| 42 | 42 | ** Output a single entry for a menu generated using an HTML table. |
| 43 | -** If zLink is not NULL or an empty string, then it is the page that | |
| 43 | +** If zLink is neither NULL nor an empty string, then it is the page that | |
| 44 | 44 | ** the menu entry will hyperlink to. If zLink is NULL or "", then |
| 45 | 45 | ** the menu entry has no hyperlink - it is disabled. |
| 46 | 46 | */ |
| 47 | 47 | void setup_menu_entry( |
| 48 | 48 | const char *zTitle, |
| 49 | 49 | const char *zLink, |
| 50 | - const char *zDesc | |
| 50 | + const char *zDesc /* Caution! Rendered using %s. May contain raw HTML. */ | |
| 51 | 51 | ){ |
| 52 | 52 | @ <tr><td valign="top" align="right"> |
| 53 | 53 | if( zLink && zLink[0] ){ |
| 54 | 54 | @ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a> |
| 55 | 55 | }else{ |
| 56 | - @ %h(zTitle) | |
| 56 | + @ <nobr>%h(zTitle)</nobr> | |
| 57 | 57 | } |
| 58 | - @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr> | |
| 58 | + @ </td><td width="5"></td><td valign="top">%s(zDesc)</td></tr> | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | /* |
| @@ -190,10 +190,11 @@ | ||
| 190 | 190 | ** |
| 191 | 191 | ** This page is only accessible by administrators. |
| 192 | 192 | */ |
| 193 | 193 | void setup_logmenu_page(void){ |
| 194 | 194 | Blob desc; |
| 195 | + int bErrLog; /* True if Error Log enabled */ | |
| 195 | 196 | blob_init(&desc, 0, 0); |
| 196 | 197 | |
| 197 | 198 | /* Administrator access only */ |
| 198 | 199 | login_check_credentials(); |
| 199 | 200 | if( !g.perm.Admin ){ |
| @@ -210,44 +211,64 @@ | ||
| 210 | 211 | "The artifact log records when new content is added to the repository.\n" |
| 211 | 212 | "The time and date and origin of the new content is entered into the\n" |
| 212 | 213 | "Log. The artifact log is always on and is stored in the \"rcvfrom\"\n" |
| 213 | 214 | "table of the repository.\n" |
| 214 | 215 | ); |
| 216 | + setup_menu_entry("User Log", "user_log", | |
| 217 | + "The user log is a record of login attempts. The user log is stored\n" | |
| 218 | + "in the \"accesslog\" table of the respository.\n" | |
| 219 | + ); | |
| 215 | 220 | |
| 216 | 221 | blob_appendf(&desc, |
| 217 | 222 | "The error log is a separate text file to which warning and error\n" |
| 218 | 223 | "messages are appended. A single error log can and often is shared\n" |
| 219 | 224 | "across multiple repositories.\n" |
| 220 | 225 | ); |
| 221 | 226 | if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ |
| 222 | - blob_appendf(&desc,"The error log is disabled for this repository."); | |
| 227 | + blob_appendf(&desc,"The error log is disabled. " | |
| 228 | + "To activate the error log "); | |
| 229 | + if( fossil_strcmp(g.zCmdName, "cgi")==0 ){ | |
| 230 | + blob_appendf(&desc, | |
| 231 | + "make an entry like \"errorlog: <i>FILENAME</i>\"" | |
| 232 | + " in the CGI script at %h", | |
| 233 | + P("SCRIPT_FILENAME") | |
| 234 | + ); | |
| 235 | + }else{ | |
| 236 | + blob_appendf(&desc, | |
| 237 | + " add the \"--errorlog <i>FILENAME</i>\" option to the" | |
| 238 | + "\"%h %h\" command that launched this server.", | |
| 239 | + g.argv[0], g.zCmdName | |
| 240 | + ); | |
| 241 | + } | |
| 242 | + bErrLog = 0; | |
| 223 | 243 | }else{ |
| 224 | 244 | blob_appendf(&desc,"In this repository, the error log is in the file" |
| 225 | 245 | "named \"%s\".", g.zErrlog); |
| 246 | + bErrLog = 1; | |
| 226 | 247 | } |
| 227 | - setup_menu_entry("Error Log", "errorlog", blob_str(&desc)); | |
| 248 | + setup_menu_entry("Error Log", bErrLog ? "errorlog" : 0, blob_str(&desc)); | |
| 228 | 249 | blob_reset(&desc); |
| 229 | 250 | |
| 230 | - setup_menu_entry("Panic Log", "paniclog", | |
| 231 | - "The panic log is a filtering of the Error Log that shows only the\n" | |
| 232 | - "most important messages - assertion faults, segmentation faults, and\n" | |
| 233 | - "similar malfunctions." | |
| 234 | - ); | |
| 235 | - | |
| 236 | - setup_menu_entry("User Log", "user_log", | |
| 237 | - "The user log is a record of login attempts. The user log is stored\n" | |
| 238 | - "in the \"accesslog\" table of the respository.\n" | |
| 239 | - ); | |
| 240 | - | |
| 241 | - setup_menu_entry("Hack Log", "hacklog", | |
| 242 | - "All 418 hack attempts" | |
| 243 | - ); | |
| 244 | - | |
| 245 | - setup_menu_entry("Non-Hack Log", "hacklog?not", | |
| 246 | - "All log messages that are not hack attempts" | |
| 247 | - ); | |
| 248 | - | |
| 251 | + @ <tr><td><td><td> | |
| 252 | + @ —— | |
| 253 | + @ <i>The remaining links are subsets of the Error Log</i> | |
| 254 | + @ —— | |
| 255 | + @ </td> | |
| 256 | + | |
| 257 | + setup_menu_entry("Panic Log", bErrLog ? "paniclog" : 0, | |
| 258 | + "Only the most important messages in the Error Log:\n" | |
| 259 | + "assertion faults, segmentation faults, and similar malfunctions.\n" | |
| 260 | + ); | |
| 261 | + | |
| 262 | + | |
| 263 | + setup_menu_entry("Hack Log", bErrLog ? "hacklog" : 0, | |
| 264 | + "All code-418 hack attempts in the Error Log" | |
| 265 | + ); | |
| 266 | + | |
| 267 | + setup_menu_entry("Non-Hack Log", bErrLog ? "hacklog?not" : 0, | |
| 268 | + "All log messages that are not code-418 hack attempts" | |
| 269 | + ); | |
| 249 | 270 | |
| 250 | 271 | @ </table> |
| 251 | 272 | style_finish_page(); |
| 252 | 273 | } |
| 253 | 274 | |
| 254 | 275 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -38,26 +38,26 @@ | |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | ** Output a single entry for a menu generated using an HTML table. |
| 43 | ** If zLink is not NULL or an empty string, then it is the page that |
| 44 | ** the menu entry will hyperlink to. If zLink is NULL or "", then |
| 45 | ** the menu entry has no hyperlink - it is disabled. |
| 46 | */ |
| 47 | void setup_menu_entry( |
| 48 | const char *zTitle, |
| 49 | const char *zLink, |
| 50 | const char *zDesc |
| 51 | ){ |
| 52 | @ <tr><td valign="top" align="right"> |
| 53 | if( zLink && zLink[0] ){ |
| 54 | @ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a> |
| 55 | }else{ |
| 56 | @ %h(zTitle) |
| 57 | } |
| 58 | @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr> |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | /* |
| @@ -190,10 +190,11 @@ | |
| 190 | ** |
| 191 | ** This page is only accessible by administrators. |
| 192 | */ |
| 193 | void setup_logmenu_page(void){ |
| 194 | Blob desc; |
| 195 | blob_init(&desc, 0, 0); |
| 196 | |
| 197 | /* Administrator access only */ |
| 198 | login_check_credentials(); |
| 199 | if( !g.perm.Admin ){ |
| @@ -210,44 +211,64 @@ | |
| 210 | "The artifact log records when new content is added to the repository.\n" |
| 211 | "The time and date and origin of the new content is entered into the\n" |
| 212 | "Log. The artifact log is always on and is stored in the \"rcvfrom\"\n" |
| 213 | "table of the repository.\n" |
| 214 | ); |
| 215 | |
| 216 | blob_appendf(&desc, |
| 217 | "The error log is a separate text file to which warning and error\n" |
| 218 | "messages are appended. A single error log can and often is shared\n" |
| 219 | "across multiple repositories.\n" |
| 220 | ); |
| 221 | if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ |
| 222 | blob_appendf(&desc,"The error log is disabled for this repository."); |
| 223 | }else{ |
| 224 | blob_appendf(&desc,"In this repository, the error log is in the file" |
| 225 | "named \"%s\".", g.zErrlog); |
| 226 | } |
| 227 | setup_menu_entry("Error Log", "errorlog", blob_str(&desc)); |
| 228 | blob_reset(&desc); |
| 229 | |
| 230 | setup_menu_entry("Panic Log", "paniclog", |
| 231 | "The panic log is a filtering of the Error Log that shows only the\n" |
| 232 | "most important messages - assertion faults, segmentation faults, and\n" |
| 233 | "similar malfunctions." |
| 234 | ); |
| 235 | |
| 236 | setup_menu_entry("User Log", "user_log", |
| 237 | "The user log is a record of login attempts. The user log is stored\n" |
| 238 | "in the \"accesslog\" table of the respository.\n" |
| 239 | ); |
| 240 | |
| 241 | setup_menu_entry("Hack Log", "hacklog", |
| 242 | "All 418 hack attempts" |
| 243 | ); |
| 244 | |
| 245 | setup_menu_entry("Non-Hack Log", "hacklog?not", |
| 246 | "All log messages that are not hack attempts" |
| 247 | ); |
| 248 | |
| 249 | |
| 250 | @ </table> |
| 251 | style_finish_page(); |
| 252 | } |
| 253 | |
| 254 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -38,26 +38,26 @@ | |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | ** Output a single entry for a menu generated using an HTML table. |
| 43 | ** If zLink is neither NULL nor an empty string, then it is the page that |
| 44 | ** the menu entry will hyperlink to. If zLink is NULL or "", then |
| 45 | ** the menu entry has no hyperlink - it is disabled. |
| 46 | */ |
| 47 | void setup_menu_entry( |
| 48 | const char *zTitle, |
| 49 | const char *zLink, |
| 50 | const char *zDesc /* Caution! Rendered using %s. May contain raw HTML. */ |
| 51 | ){ |
| 52 | @ <tr><td valign="top" align="right"> |
| 53 | if( zLink && zLink[0] ){ |
| 54 | @ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a> |
| 55 | }else{ |
| 56 | @ <nobr>%h(zTitle)</nobr> |
| 57 | } |
| 58 | @ </td><td width="5"></td><td valign="top">%s(zDesc)</td></tr> |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | /* |
| @@ -190,10 +190,11 @@ | |
| 190 | ** |
| 191 | ** This page is only accessible by administrators. |
| 192 | */ |
| 193 | void setup_logmenu_page(void){ |
| 194 | Blob desc; |
| 195 | int bErrLog; /* True if Error Log enabled */ |
| 196 | blob_init(&desc, 0, 0); |
| 197 | |
| 198 | /* Administrator access only */ |
| 199 | login_check_credentials(); |
| 200 | if( !g.perm.Admin ){ |
| @@ -210,44 +211,64 @@ | |
| 211 | "The artifact log records when new content is added to the repository.\n" |
| 212 | "The time and date and origin of the new content is entered into the\n" |
| 213 | "Log. The artifact log is always on and is stored in the \"rcvfrom\"\n" |
| 214 | "table of the repository.\n" |
| 215 | ); |
| 216 | setup_menu_entry("User Log", "user_log", |
| 217 | "The user log is a record of login attempts. The user log is stored\n" |
| 218 | "in the \"accesslog\" table of the respository.\n" |
| 219 | ); |
| 220 | |
| 221 | blob_appendf(&desc, |
| 222 | "The error log is a separate text file to which warning and error\n" |
| 223 | "messages are appended. A single error log can and often is shared\n" |
| 224 | "across multiple repositories.\n" |
| 225 | ); |
| 226 | if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ |
| 227 | blob_appendf(&desc,"The error log is disabled. " |
| 228 | "To activate the error log "); |
| 229 | if( fossil_strcmp(g.zCmdName, "cgi")==0 ){ |
| 230 | blob_appendf(&desc, |
| 231 | "make an entry like \"errorlog: <i>FILENAME</i>\"" |
| 232 | " in the CGI script at %h", |
| 233 | P("SCRIPT_FILENAME") |
| 234 | ); |
| 235 | }else{ |
| 236 | blob_appendf(&desc, |
| 237 | " add the \"--errorlog <i>FILENAME</i>\" option to the" |
| 238 | "\"%h %h\" command that launched this server.", |
| 239 | g.argv[0], g.zCmdName |
| 240 | ); |
| 241 | } |
| 242 | bErrLog = 0; |
| 243 | }else{ |
| 244 | blob_appendf(&desc,"In this repository, the error log is in the file" |
| 245 | "named \"%s\".", g.zErrlog); |
| 246 | bErrLog = 1; |
| 247 | } |
| 248 | setup_menu_entry("Error Log", bErrLog ? "errorlog" : 0, blob_str(&desc)); |
| 249 | blob_reset(&desc); |
| 250 | |
| 251 | @ <tr><td><td><td> |
| 252 | @ —— |
| 253 | @ <i>The remaining links are subsets of the Error Log</i> |
| 254 | @ —— |
| 255 | @ </td> |
| 256 | |
| 257 | setup_menu_entry("Panic Log", bErrLog ? "paniclog" : 0, |
| 258 | "Only the most important messages in the Error Log:\n" |
| 259 | "assertion faults, segmentation faults, and similar malfunctions.\n" |
| 260 | ); |
| 261 | |
| 262 | |
| 263 | setup_menu_entry("Hack Log", bErrLog ? "hacklog" : 0, |
| 264 | "All code-418 hack attempts in the Error Log" |
| 265 | ); |
| 266 | |
| 267 | setup_menu_entry("Non-Hack Log", bErrLog ? "hacklog?not" : 0, |
| 268 | "All log messages that are not code-418 hack attempts" |
| 269 | ); |
| 270 | |
| 271 | @ </table> |
| 272 | style_finish_page(); |
| 273 | } |
| 274 | |
| 275 |