Fossil SCM
Improved interwiki link documentation. Enhance the /intermap page so that it shows the current intermap (read-only) to non-setup users, rather than completely exluding such users.
Commit
baeab56efff03545bd894e127b5508ef30e0e02d9e0b67b9b855824484a2650a
Parent
93c45cd4e04a59c…
2 files changed
+8
-2
+10
-5
+8
-2
| --- src/interwiki.c | ||
| +++ src/interwiki.c | ||
| @@ -310,15 +310,15 @@ | ||
| 310 | 310 | const char *zHash = ""; |
| 311 | 311 | const char *zWiki = ""; |
| 312 | 312 | char *zErr = 0; |
| 313 | 313 | |
| 314 | 314 | login_check_credentials(); |
| 315 | - if( !g.perm.Setup ){ | |
| 315 | + if( !g.perm.Read && !g.perm.RdWiki && ~g.perm.RdTkt ){ | |
| 316 | 316 | login_needed(0); |
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | - if( P("submit")!=0 && cgi_csrf_safe(1) ){ | |
| 319 | + if( g.perm.Setup && P("submit")!=0 && cgi_csrf_safe(1) ){ | |
| 320 | 320 | zTag = PT("tag"); |
| 321 | 321 | zBase = PT("base"); |
| 322 | 322 | zHash = PT("hash"); |
| 323 | 323 | zWiki = PT("wiki"); |
| 324 | 324 | if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){ |
| @@ -381,10 +381,16 @@ | ||
| 381 | 381 | if( n ){ |
| 382 | 382 | @ </ol> |
| 383 | 383 | }else{ |
| 384 | 384 | @ No mappings are currently defined. |
| 385 | 385 | } |
| 386 | + | |
| 387 | + if( !g.perm.Setup ){ | |
| 388 | + /* Do not show intermap editing fields to non-setup users */ | |
| 389 | + style_footer(); | |
| 390 | + return; | |
| 391 | + } | |
| 386 | 392 | |
| 387 | 393 | @ <p>To add a new mapping, fill out the form below providing a unique name |
| 388 | 394 | @ for the tag. To edit an exist mapping, fill out the form and use the |
| 389 | 395 | @ existing name as the tag. To delete an existing mapping, fill in the |
| 390 | 396 | @ tag field but leave the "Base URL" field blank.</p> |
| 391 | 397 |
| --- src/interwiki.c | |
| +++ src/interwiki.c | |
| @@ -310,15 +310,15 @@ | |
| 310 | const char *zHash = ""; |
| 311 | const char *zWiki = ""; |
| 312 | char *zErr = 0; |
| 313 | |
| 314 | login_check_credentials(); |
| 315 | if( !g.perm.Setup ){ |
| 316 | login_needed(0); |
| 317 | return; |
| 318 | } |
| 319 | if( P("submit")!=0 && cgi_csrf_safe(1) ){ |
| 320 | zTag = PT("tag"); |
| 321 | zBase = PT("base"); |
| 322 | zHash = PT("hash"); |
| 323 | zWiki = PT("wiki"); |
| 324 | if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){ |
| @@ -381,10 +381,16 @@ | |
| 381 | if( n ){ |
| 382 | @ </ol> |
| 383 | }else{ |
| 384 | @ No mappings are currently defined. |
| 385 | } |
| 386 | |
| 387 | @ <p>To add a new mapping, fill out the form below providing a unique name |
| 388 | @ for the tag. To edit an exist mapping, fill out the form and use the |
| 389 | @ existing name as the tag. To delete an existing mapping, fill in the |
| 390 | @ tag field but leave the "Base URL" field blank.</p> |
| 391 |
| --- src/interwiki.c | |
| +++ src/interwiki.c | |
| @@ -310,15 +310,15 @@ | |
| 310 | const char *zHash = ""; |
| 311 | const char *zWiki = ""; |
| 312 | char *zErr = 0; |
| 313 | |
| 314 | login_check_credentials(); |
| 315 | if( !g.perm.Read && !g.perm.RdWiki && ~g.perm.RdTkt ){ |
| 316 | login_needed(0); |
| 317 | return; |
| 318 | } |
| 319 | if( g.perm.Setup && P("submit")!=0 && cgi_csrf_safe(1) ){ |
| 320 | zTag = PT("tag"); |
| 321 | zBase = PT("base"); |
| 322 | zHash = PT("hash"); |
| 323 | zWiki = PT("wiki"); |
| 324 | if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){ |
| @@ -381,10 +381,16 @@ | |
| 381 | if( n ){ |
| 382 | @ </ol> |
| 383 | }else{ |
| 384 | @ No mappings are currently defined. |
| 385 | } |
| 386 | |
| 387 | if( !g.perm.Setup ){ |
| 388 | /* Do not show intermap editing fields to non-setup users */ |
| 389 | style_footer(); |
| 390 | return; |
| 391 | } |
| 392 | |
| 393 | @ <p>To add a new mapping, fill out the form below providing a unique name |
| 394 | @ for the tag. To edit an exist mapping, fill out the form and use the |
| 395 | @ existing name as the tag. To delete an existing mapping, fill in the |
| 396 | @ tag field but leave the "Base URL" field blank.</p> |
| 397 |
+10
-5
| --- www/interwiki.md | ||
| +++ www/interwiki.md | ||
| @@ -34,21 +34,21 @@ | ||
| 34 | 34 | |
| 35 | 35 | ## Details |
| 36 | 36 | |
| 37 | 37 | Fossil supports interwiki links in both the |
| 38 | 38 | [Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup |
| 39 | -styles. An interwiki link consists of a tag followed a colon | |
| 39 | +styles. An interwiki link consists of a tag followed by a colon | |
| 40 | 40 | and the link target: |
| 41 | 41 | |
| 42 | 42 | > <i>Tag</i><b>:</b><i>PageName</i> |
| 43 | 43 | |
| 44 | 44 | The Tag must consist of ASCII alphanumeric characters only - no |
| 45 | 45 | punctuation or whitespace or characters greater than U+007A. |
| 46 | 46 | The PageName is the link notation on the target wiki. |
| 47 | 47 | Three different classes of PageNames are recognized by Fossil: |
| 48 | 48 | |
| 49 | - 1. <b>Path Links</b> → the PageName is begins with the "/" character | |
| 49 | + 1. <b>Path Links</b> → the PageName begins with the "/" character | |
| 50 | 50 | or is an empty string. |
| 51 | 51 | |
| 52 | 52 | 2. <b>Hash Links</b> → the PageName is a hexadecimal number with |
| 53 | 53 | at least four digits. |
| 54 | 54 | |
| @@ -62,14 +62,19 @@ | ||
| 62 | 62 | <a name="intermap"></a> |
| 63 | 63 | ## Intermap |
| 64 | 64 | |
| 65 | 65 | The intermap defines a mapping from interwiki Tags to full URLs. The |
| 66 | 66 | Intermap can be viewed and managed using the [fossil interwiki][iwiki] |
| 67 | -command or the [/intermap][imap] webpages. | |
| 67 | +command or the [/intermap][imap] webpages. | |
| 68 | 68 | |
| 69 | 69 | [iwiki]: /help?cmd=interwiki |
| 70 | -[imap]: /help?cmd=/intermap | |
| 70 | +[imap]: /intermap | |
| 71 | + | |
| 72 | +The current intermap for a server is seen on the [/intermap][imap] page | |
| 73 | +(which is read-only for non-Setup users) and at the bottom of the built-in | |
| 74 | +[Fossil Wiki rules](/wiki_rules) and [Markdown rules](/md_rules) | |
| 75 | +documentation pages. | |
| 71 | 76 | |
| 72 | 77 | Each intermap entry stores, at a minimum, the base URL for the remote |
| 73 | 78 | wiki. The intermap entry might also store additional path text that |
| 74 | 79 | is used for Hash and Wiki links. If only the base URL is provided, |
| 75 | 80 | then the intermap will only allow Path style interwiki links. The |
| @@ -92,11 +97,11 @@ | ||
| 92 | 97 | check-in as part of a comment of another check-in, that new check-in |
| 93 | 98 | shows up in the "References" section of the target check-in. |
| 94 | 99 | ([example](31af805348690958). In other words, Fossil tracks not just |
| 95 | 100 | "_source→target_", but it also tracks "_target→source_". |
| 96 | 101 | But backtracking do not work for interwiki links, since the Fossil |
| 97 | - running on the target has no way of knowing scanning the source and | |
| 102 | + running on the target has no way of scanning the source text and | |
| 98 | 103 | hence has no way of knowing that it is a target of a link from the source. |
| 99 | 104 | |
| 100 | 105 | [fcfg]: /help?cmd=config |
| 101 | 106 | |
| 102 | 107 | ## Intermap Storage Details |
| 103 | 108 |
| --- www/interwiki.md | |
| +++ www/interwiki.md | |
| @@ -34,21 +34,21 @@ | |
| 34 | |
| 35 | ## Details |
| 36 | |
| 37 | Fossil supports interwiki links in both the |
| 38 | [Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup |
| 39 | styles. An interwiki link consists of a tag followed a colon |
| 40 | and the link target: |
| 41 | |
| 42 | > <i>Tag</i><b>:</b><i>PageName</i> |
| 43 | |
| 44 | The Tag must consist of ASCII alphanumeric characters only - no |
| 45 | punctuation or whitespace or characters greater than U+007A. |
| 46 | The PageName is the link notation on the target wiki. |
| 47 | Three different classes of PageNames are recognized by Fossil: |
| 48 | |
| 49 | 1. <b>Path Links</b> → the PageName is begins with the "/" character |
| 50 | or is an empty string. |
| 51 | |
| 52 | 2. <b>Hash Links</b> → the PageName is a hexadecimal number with |
| 53 | at least four digits. |
| 54 | |
| @@ -62,14 +62,19 @@ | |
| 62 | <a name="intermap"></a> |
| 63 | ## Intermap |
| 64 | |
| 65 | The intermap defines a mapping from interwiki Tags to full URLs. The |
| 66 | Intermap can be viewed and managed using the [fossil interwiki][iwiki] |
| 67 | command or the [/intermap][imap] webpages. |
| 68 | |
| 69 | [iwiki]: /help?cmd=interwiki |
| 70 | [imap]: /help?cmd=/intermap |
| 71 | |
| 72 | Each intermap entry stores, at a minimum, the base URL for the remote |
| 73 | wiki. The intermap entry might also store additional path text that |
| 74 | is used for Hash and Wiki links. If only the base URL is provided, |
| 75 | then the intermap will only allow Path style interwiki links. The |
| @@ -92,11 +97,11 @@ | |
| 92 | check-in as part of a comment of another check-in, that new check-in |
| 93 | shows up in the "References" section of the target check-in. |
| 94 | ([example](31af805348690958). In other words, Fossil tracks not just |
| 95 | "_source→target_", but it also tracks "_target→source_". |
| 96 | But backtracking do not work for interwiki links, since the Fossil |
| 97 | running on the target has no way of knowing scanning the source and |
| 98 | hence has no way of knowing that it is a target of a link from the source. |
| 99 | |
| 100 | [fcfg]: /help?cmd=config |
| 101 | |
| 102 | ## Intermap Storage Details |
| 103 |
| --- www/interwiki.md | |
| +++ www/interwiki.md | |
| @@ -34,21 +34,21 @@ | |
| 34 | |
| 35 | ## Details |
| 36 | |
| 37 | Fossil supports interwiki links in both the |
| 38 | [Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup |
| 39 | styles. An interwiki link consists of a tag followed by a colon |
| 40 | and the link target: |
| 41 | |
| 42 | > <i>Tag</i><b>:</b><i>PageName</i> |
| 43 | |
| 44 | The Tag must consist of ASCII alphanumeric characters only - no |
| 45 | punctuation or whitespace or characters greater than U+007A. |
| 46 | The PageName is the link notation on the target wiki. |
| 47 | Three different classes of PageNames are recognized by Fossil: |
| 48 | |
| 49 | 1. <b>Path Links</b> → the PageName begins with the "/" character |
| 50 | or is an empty string. |
| 51 | |
| 52 | 2. <b>Hash Links</b> → the PageName is a hexadecimal number with |
| 53 | at least four digits. |
| 54 | |
| @@ -62,14 +62,19 @@ | |
| 62 | <a name="intermap"></a> |
| 63 | ## Intermap |
| 64 | |
| 65 | The intermap defines a mapping from interwiki Tags to full URLs. The |
| 66 | Intermap can be viewed and managed using the [fossil interwiki][iwiki] |
| 67 | command or the [/intermap][imap] webpages. |
| 68 | |
| 69 | [iwiki]: /help?cmd=interwiki |
| 70 | [imap]: /intermap |
| 71 | |
| 72 | The current intermap for a server is seen on the [/intermap][imap] page |
| 73 | (which is read-only for non-Setup users) and at the bottom of the built-in |
| 74 | [Fossil Wiki rules](/wiki_rules) and [Markdown rules](/md_rules) |
| 75 | documentation pages. |
| 76 | |
| 77 | Each intermap entry stores, at a minimum, the base URL for the remote |
| 78 | wiki. The intermap entry might also store additional path text that |
| 79 | is used for Hash and Wiki links. If only the base URL is provided, |
| 80 | then the intermap will only allow Path style interwiki links. The |
| @@ -92,11 +97,11 @@ | |
| 97 | check-in as part of a comment of another check-in, that new check-in |
| 98 | shows up in the "References" section of the target check-in. |
| 99 | ([example](31af805348690958). In other words, Fossil tracks not just |
| 100 | "_source→target_", but it also tracks "_target→source_". |
| 101 | But backtracking do not work for interwiki links, since the Fossil |
| 102 | running on the target has no way of scanning the source text and |
| 103 | hence has no way of knowing that it is a target of a link from the source. |
| 104 | |
| 105 | [fcfg]: /help?cmd=config |
| 106 | |
| 107 | ## Intermap Storage Details |
| 108 |