Fossil SCM

On the /docdir page, omit the submenu and other page decorations.

drh 2023-08-27 19:01 trunk
Commit 0313f0f90d6410de9fa0f95801fff63a2cde32f5df7cffc44d2d7a8a78ed63e1
1 file changed +26 -15
+26 -15
--- src/browse.c
+++ src/browse.c
@@ -120,15 +120,20 @@
120120
121121
/*
122122
** WEBPAGE: docdir
123123
**
124124
** Show the files and subdirectories within a single directory of the
125
-** source tree. This works like /dir except that links to files go to
126
-** /doc (showing the file content directly, depending on mimetype)
127
-** rather than to /file (which always shows the file embedded in a standard
128
-** Fossil page frame). /docdir is a shorthand for /dir with the "dx"
129
-** query parameter.
125
+** source tree. This works similarly to /dir but with the following
126
+** differences:
127
+**
128
+** * Links to files go to /doc (showing the file content directly,
129
+** depending on mimetype) rather than to /file (which always shows
130
+** the file embedded in a standard Fossil page frame).
131
+**
132
+** * The submenu and the page title is now show. The page is plain.
133
+**
134
+** The /docdir page is a shorthand for /dir with the "dx" query parameter.
130135
**
131136
** Query parameters:
132137
**
133138
** ci=LABEL Show only files in this check-in. If omitted, the
134139
** "trunk" directory is used.
@@ -153,11 +158,11 @@
153158
** name=PATH Directory to display. Optional. Top-level if missing
154159
** re=REGEXP Show only files matching REGEXP
155160
** type=TYPE TYPE=flat: use this display
156161
** TYPE=tree: use the /tree display instead
157162
** noreadme Do not attempt to display the README file.
158
-** dx File links to go to /doc instead of /file or /finfo.
163
+** dx Behave like /docdir
159164
*/
160165
void page_dir(void){
161166
char *zD = fossil_strdup(P("name"));
162167
int nD = zD ? strlen(zD)+1 : 0;
163168
int mxLen;
@@ -237,11 +242,13 @@
237242
url_initialize(&sURI, "dir");
238243
cgi_check_for_malice();
239244
cgi_query_parameters_to_url(&sURI);
240245
241246
/* Compute the title of the page */
242
- if( zD ){
247
+ if( bDocDir ){
248
+ zPrefix = zD ? mprintf("%s/",zD) : "";
249
+ }else if( zD ){
243250
Blob dirname;
244251
blob_init(&dirname, 0, 0);
245252
hyperlinked_path(zD, &dirname, zCI, "dir", "", 0);
246253
@ <h2>Files in directory %s(blob_str(&dirname)) \
247254
blob_reset(&dirname);
@@ -251,11 +258,13 @@
251258
}else{
252259
@ <h2>Files in the top-level directory \
253260
zPrefix = "";
254261
}
255262
if( zCI ){
256
- if( fossil_strcmp(zCI,"tip")==0 ){
263
+ if( bDocDir ){
264
+ /* No header for /docdir. Just give the list of files. */
265
+ }else if( fossil_strcmp(zCI,"tip")==0 ){
257266
@ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\
258267
@ %s(zMatch)</h2>
259268
}else if( isBranchCI ){
260269
@ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
261270
@ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\
@@ -267,30 +276,32 @@
267276
if( bDocDir ){
268277
zSubdirLink = mprintf("%R/docdir?ci=%T&name=%T", zCI, zPrefix);
269278
}else{
270279
zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
271280
}
272
- if( nD==0 ){
281
+ if( nD==0 && !bDocDir ){
273282
style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
274283
}
275284
}else{
276285
@ in any check-in</h2>
277286
zSubdirLink = mprintf("%R/dir?name=%T", zPrefix);
278287
}
279
- if( linkTrunk ){
288
+ if( linkTrunk && !bDocDir ){
280289
style_submenu_element("Trunk", "%s",
281290
url_render(&sURI, "ci", "trunk", 0, 0));
282291
}
283
- if( linkTip ){
292
+ if( linkTip && !bDocDir ){
284293
style_submenu_element("Tip", "%s", url_render(&sURI, "ci", "tip", 0, 0));
285294
}
286
- if( zD ){
295
+ if( zD && !bDocDir ){
287296
style_submenu_element("History","%R/timeline?chng=%T/*", zD);
288297
}
289
- style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0));
290
- style_submenu_element("Tree-View", "%s",
291
- url_render(&sURI, "type", "tree", 0, 0));
298
+ if( !bDocDir ){
299
+ style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0));
300
+ style_submenu_element("Tree-View", "%s",
301
+ url_render(&sURI, "type", "tree", 0, 0));
302
+ }
292303
293304
/* Compute the temporary table "localfiles" containing the names
294305
** of all files and subdirectories in the zD[] directory.
295306
**
296307
** Subdirectory names begin with "/". This causes them to sort
297308
--- src/browse.c
+++ src/browse.c
@@ -120,15 +120,20 @@
120
121 /*
122 ** WEBPAGE: docdir
123 **
124 ** Show the files and subdirectories within a single directory of the
125 ** source tree. This works like /dir except that links to files go to
126 ** /doc (showing the file content directly, depending on mimetype)
127 ** rather than to /file (which always shows the file embedded in a standard
128 ** Fossil page frame). /docdir is a shorthand for /dir with the "dx"
129 ** query parameter.
 
 
 
 
 
130 **
131 ** Query parameters:
132 **
133 ** ci=LABEL Show only files in this check-in. If omitted, the
134 ** "trunk" directory is used.
@@ -153,11 +158,11 @@
153 ** name=PATH Directory to display. Optional. Top-level if missing
154 ** re=REGEXP Show only files matching REGEXP
155 ** type=TYPE TYPE=flat: use this display
156 ** TYPE=tree: use the /tree display instead
157 ** noreadme Do not attempt to display the README file.
158 ** dx File links to go to /doc instead of /file or /finfo.
159 */
160 void page_dir(void){
161 char *zD = fossil_strdup(P("name"));
162 int nD = zD ? strlen(zD)+1 : 0;
163 int mxLen;
@@ -237,11 +242,13 @@
237 url_initialize(&sURI, "dir");
238 cgi_check_for_malice();
239 cgi_query_parameters_to_url(&sURI);
240
241 /* Compute the title of the page */
242 if( zD ){
 
 
243 Blob dirname;
244 blob_init(&dirname, 0, 0);
245 hyperlinked_path(zD, &dirname, zCI, "dir", "", 0);
246 @ <h2>Files in directory %s(blob_str(&dirname)) \
247 blob_reset(&dirname);
@@ -251,11 +258,13 @@
251 }else{
252 @ <h2>Files in the top-level directory \
253 zPrefix = "";
254 }
255 if( zCI ){
256 if( fossil_strcmp(zCI,"tip")==0 ){
 
 
257 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\
258 @ %s(zMatch)</h2>
259 }else if( isBranchCI ){
260 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
261 @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\
@@ -267,30 +276,32 @@
267 if( bDocDir ){
268 zSubdirLink = mprintf("%R/docdir?ci=%T&name=%T", zCI, zPrefix);
269 }else{
270 zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
271 }
272 if( nD==0 ){
273 style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
274 }
275 }else{
276 @ in any check-in</h2>
277 zSubdirLink = mprintf("%R/dir?name=%T", zPrefix);
278 }
279 if( linkTrunk ){
280 style_submenu_element("Trunk", "%s",
281 url_render(&sURI, "ci", "trunk", 0, 0));
282 }
283 if( linkTip ){
284 style_submenu_element("Tip", "%s", url_render(&sURI, "ci", "tip", 0, 0));
285 }
286 if( zD ){
287 style_submenu_element("History","%R/timeline?chng=%T/*", zD);
288 }
289 style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0));
290 style_submenu_element("Tree-View", "%s",
291 url_render(&sURI, "type", "tree", 0, 0));
 
 
292
293 /* Compute the temporary table "localfiles" containing the names
294 ** of all files and subdirectories in the zD[] directory.
295 **
296 ** Subdirectory names begin with "/". This causes them to sort
297
--- src/browse.c
+++ src/browse.c
@@ -120,15 +120,20 @@
120
121 /*
122 ** WEBPAGE: docdir
123 **
124 ** Show the files and subdirectories within a single directory of the
125 ** source tree. This works similarly to /dir but with the following
126 ** differences:
127 **
128 ** * Links to files go to /doc (showing the file content directly,
129 ** depending on mimetype) rather than to /file (which always shows
130 ** the file embedded in a standard Fossil page frame).
131 **
132 ** * The submenu and the page title is now show. The page is plain.
133 **
134 ** The /docdir page is a shorthand for /dir with the "dx" query parameter.
135 **
136 ** Query parameters:
137 **
138 ** ci=LABEL Show only files in this check-in. If omitted, the
139 ** "trunk" directory is used.
@@ -153,11 +158,11 @@
158 ** name=PATH Directory to display. Optional. Top-level if missing
159 ** re=REGEXP Show only files matching REGEXP
160 ** type=TYPE TYPE=flat: use this display
161 ** TYPE=tree: use the /tree display instead
162 ** noreadme Do not attempt to display the README file.
163 ** dx Behave like /docdir
164 */
165 void page_dir(void){
166 char *zD = fossil_strdup(P("name"));
167 int nD = zD ? strlen(zD)+1 : 0;
168 int mxLen;
@@ -237,11 +242,13 @@
242 url_initialize(&sURI, "dir");
243 cgi_check_for_malice();
244 cgi_query_parameters_to_url(&sURI);
245
246 /* Compute the title of the page */
247 if( bDocDir ){
248 zPrefix = zD ? mprintf("%s/",zD) : "";
249 }else if( zD ){
250 Blob dirname;
251 blob_init(&dirname, 0, 0);
252 hyperlinked_path(zD, &dirname, zCI, "dir", "", 0);
253 @ <h2>Files in directory %s(blob_str(&dirname)) \
254 blob_reset(&dirname);
@@ -251,11 +258,13 @@
258 }else{
259 @ <h2>Files in the top-level directory \
260 zPrefix = "";
261 }
262 if( zCI ){
263 if( bDocDir ){
264 /* No header for /docdir. Just give the list of files. */
265 }else if( fossil_strcmp(zCI,"tip")==0 ){
266 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\
267 @ %s(zMatch)</h2>
268 }else if( isBranchCI ){
269 @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \
270 @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\
@@ -267,30 +276,32 @@
276 if( bDocDir ){
277 zSubdirLink = mprintf("%R/docdir?ci=%T&name=%T", zCI, zPrefix);
278 }else{
279 zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix);
280 }
281 if( nD==0 && !bDocDir ){
282 style_submenu_element("File Ages", "%R/fileage?name=%T", zCI);
283 }
284 }else{
285 @ in any check-in</h2>
286 zSubdirLink = mprintf("%R/dir?name=%T", zPrefix);
287 }
288 if( linkTrunk && !bDocDir ){
289 style_submenu_element("Trunk", "%s",
290 url_render(&sURI, "ci", "trunk", 0, 0));
291 }
292 if( linkTip && !bDocDir ){
293 style_submenu_element("Tip", "%s", url_render(&sURI, "ci", "tip", 0, 0));
294 }
295 if( zD && !bDocDir ){
296 style_submenu_element("History","%R/timeline?chng=%T/*", zD);
297 }
298 if( !bDocDir ){
299 style_submenu_element("All", "%s", url_render(&sURI, "ci", 0, 0, 0));
300 style_submenu_element("Tree-View", "%s",
301 url_render(&sURI, "type", "tree", 0, 0));
302 }
303
304 /* Compute the temporary table "localfiles" containing the names
305 ** of all files and subdirectories in the zD[] directory.
306 **
307 ** Subdirectory names begin with "/". This causes them to sort
308

Keyboard Shortcuts

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