Fossil SCM
On the /docdir page, omit the submenu and other page decorations.
Commit
0313f0f90d6410de9fa0f95801fff63a2cde32f5df7cffc44d2d7a8a78ed63e1
Parent
5d7e153ff7cf87a…
1 file changed
+26
-15
+26
-15
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -120,15 +120,20 @@ | ||
| 120 | 120 | |
| 121 | 121 | /* |
| 122 | 122 | ** WEBPAGE: docdir |
| 123 | 123 | ** |
| 124 | 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. | |
| 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. | |
| 130 | 135 | ** |
| 131 | 136 | ** Query parameters: |
| 132 | 137 | ** |
| 133 | 138 | ** ci=LABEL Show only files in this check-in. If omitted, the |
| 134 | 139 | ** "trunk" directory is used. |
| @@ -153,11 +158,11 @@ | ||
| 153 | 158 | ** name=PATH Directory to display. Optional. Top-level if missing |
| 154 | 159 | ** re=REGEXP Show only files matching REGEXP |
| 155 | 160 | ** type=TYPE TYPE=flat: use this display |
| 156 | 161 | ** TYPE=tree: use the /tree display instead |
| 157 | 162 | ** 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 | |
| 159 | 164 | */ |
| 160 | 165 | void page_dir(void){ |
| 161 | 166 | char *zD = fossil_strdup(P("name")); |
| 162 | 167 | int nD = zD ? strlen(zD)+1 : 0; |
| 163 | 168 | int mxLen; |
| @@ -237,11 +242,13 @@ | ||
| 237 | 242 | url_initialize(&sURI, "dir"); |
| 238 | 243 | cgi_check_for_malice(); |
| 239 | 244 | cgi_query_parameters_to_url(&sURI); |
| 240 | 245 | |
| 241 | 246 | /* Compute the title of the page */ |
| 242 | - if( zD ){ | |
| 247 | + if( bDocDir ){ | |
| 248 | + zPrefix = zD ? mprintf("%s/",zD) : ""; | |
| 249 | + }else if( zD ){ | |
| 243 | 250 | Blob dirname; |
| 244 | 251 | blob_init(&dirname, 0, 0); |
| 245 | 252 | hyperlinked_path(zD, &dirname, zCI, "dir", "", 0); |
| 246 | 253 | @ <h2>Files in directory %s(blob_str(&dirname)) \ |
| 247 | 254 | blob_reset(&dirname); |
| @@ -251,11 +258,13 @@ | ||
| 251 | 258 | }else{ |
| 252 | 259 | @ <h2>Files in the top-level directory \ |
| 253 | 260 | zPrefix = ""; |
| 254 | 261 | } |
| 255 | 262 | 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 ){ | |
| 257 | 266 | @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a>\ |
| 258 | 267 | @ %s(zMatch)</h2> |
| 259 | 268 | }else if( isBranchCI ){ |
| 260 | 269 | @ from the %z(href("%R/info?name=%T",zCI))latest check-in</a> \ |
| 261 | 270 | @ of branch %z(href("%R/timeline?r=%T",zCI))%h(zCI)</a>\ |
| @@ -267,30 +276,32 @@ | ||
| 267 | 276 | if( bDocDir ){ |
| 268 | 277 | zSubdirLink = mprintf("%R/docdir?ci=%T&name=%T", zCI, zPrefix); |
| 269 | 278 | }else{ |
| 270 | 279 | zSubdirLink = mprintf("%R/dir?ci=%T&name=%T", zCI, zPrefix); |
| 271 | 280 | } |
| 272 | - if( nD==0 ){ | |
| 281 | + if( nD==0 && !bDocDir ){ | |
| 273 | 282 | style_submenu_element("File Ages", "%R/fileage?name=%T", zCI); |
| 274 | 283 | } |
| 275 | 284 | }else{ |
| 276 | 285 | @ in any check-in</h2> |
| 277 | 286 | zSubdirLink = mprintf("%R/dir?name=%T", zPrefix); |
| 278 | 287 | } |
| 279 | - if( linkTrunk ){ | |
| 288 | + if( linkTrunk && !bDocDir ){ | |
| 280 | 289 | style_submenu_element("Trunk", "%s", |
| 281 | 290 | url_render(&sURI, "ci", "trunk", 0, 0)); |
| 282 | 291 | } |
| 283 | - if( linkTip ){ | |
| 292 | + if( linkTip && !bDocDir ){ | |
| 284 | 293 | style_submenu_element("Tip", "%s", url_render(&sURI, "ci", "tip", 0, 0)); |
| 285 | 294 | } |
| 286 | - if( zD ){ | |
| 295 | + if( zD && !bDocDir ){ | |
| 287 | 296 | style_submenu_element("History","%R/timeline?chng=%T/*", zD); |
| 288 | 297 | } |
| 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 | + } | |
| 292 | 303 | |
| 293 | 304 | /* Compute the temporary table "localfiles" containing the names |
| 294 | 305 | ** of all files and subdirectories in the zD[] directory. |
| 295 | 306 | ** |
| 296 | 307 | ** Subdirectory names begin with "/". This causes them to sort |
| 297 | 308 |
| --- 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 |