Fossil SCM

Improvements to the log menu.

drh 2025-02-14 12:53 trunk
Commit b0feaa6955ae9328a709b2d7b23f871a258b788768772b47481405eb7ef1a29e
1 file changed +46 -25
+46 -25
--- src/setup.c
+++ src/setup.c
@@ -38,26 +38,26 @@
3838
}
3939
}
4040
4141
/*
4242
** 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
4444
** the menu entry will hyperlink to. If zLink is NULL or "", then
4545
** the menu entry has no hyperlink - it is disabled.
4646
*/
4747
void setup_menu_entry(
4848
const char *zTitle,
4949
const char *zLink,
50
- const char *zDesc
50
+ const char *zDesc /* Caution! Rendered using %s. May contain raw HTML. */
5151
){
5252
@ <tr><td valign="top" align="right">
5353
if( zLink && zLink[0] ){
5454
@ <a href="%s(zLink)"><nobr>%h(zTitle)</nobr></a>
5555
}else{
56
- @ %h(zTitle)
56
+ @ <nobr>%h(zTitle)</nobr>
5757
}
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>
5959
}
6060
6161
6262
6363
/*
@@ -190,10 +190,11 @@
190190
**
191191
** This page is only accessible by administrators.
192192
*/
193193
void setup_logmenu_page(void){
194194
Blob desc;
195
+ int bErrLog; /* True if Error Log enabled */
195196
blob_init(&desc, 0, 0);
196197
197198
/* Administrator access only */
198199
login_check_credentials();
199200
if( !g.perm.Admin ){
@@ -210,44 +211,64 @@
210211
"The artifact log records when new content is added to the repository.\n"
211212
"The time and date and origin of the new content is entered into the\n"
212213
"Log. The artifact log is always on and is stored in the \"rcvfrom\"\n"
213214
"table of the repository.\n"
214215
);
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
+ );
215220
216221
blob_appendf(&desc,
217222
"The error log is a separate text file to which warning and error\n"
218223
"messages are appended. A single error log can and often is shared\n"
219224
"across multiple repositories.\n"
220225
);
221226
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;
223243
}else{
224244
blob_appendf(&desc,"In this repository, the error log is in the file"
225245
"named \"%s\".", g.zErrlog);
246
+ bErrLog = 1;
226247
}
227
- setup_menu_entry("Error Log", "errorlog", blob_str(&desc));
248
+ setup_menu_entry("Error Log", bErrLog ? "errorlog" : 0, blob_str(&desc));
228249
blob_reset(&desc);
229250
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
+ @ &mdash;&mdash;
253
+ @ <i>The remaining links are subsets of the Error Log</i>
254
+ @ &mdash;&mdash;
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
+ );
249270
250271
@ </table>
251272
style_finish_page();
252273
}
253274
254275
--- 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 @ &mdash;&mdash;
253 @ <i>The remaining links are subsets of the Error Log</i>
254 @ &mdash;&mdash;
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

Keyboard Shortcuts

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