Fossil SCM

fix confusing behaviour around WIKIASSOC_MENU_READ and WIKIASSOC_MENU_WRITE

jkosche 2025-01-17 11:17 ticket-wiki
Commit 66ece81274c6dc7c62a333a66f1f13f5bc56a9e12f91820f30b02be003a2052f
1 file changed +16 -2
+16 -2
--- src/wiki.c
+++ src/wiki.c
@@ -2566,17 +2566,30 @@
25662566
}
25672567
25682568
/*
25692569
** Add an "Wiki" button in a submenu that links to the read-wiki page.
25702570
*/
2571
-static void wiki_submenu_to_edit_wiki(
2571
+static void wiki_submenu_to_read_wiki(
25722572
const char *zPrefix, /* "branch", "tag", or "checkin" */
25732573
const char *zName, /* Name of the object */
25742574
unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
25752575
){
25762576
if( g.perm.RdWiki && (mFlags & WIKIASSOC_MENU_READ)!=0 ){
2577
- style_submenu_element("Wiki", "%R/wikiedit?name=%s/%t", zPrefix, zName);
2577
+ style_submenu_element("Wiki", "%R/wiki?name=%s/%t", zPrefix, zName);
2578
+ }
2579
+}
2580
+
2581
+/*
2582
+** Add an "Edit Wiki" button in a submenu that links to the edit-wiki page.
2583
+*/
2584
+static void wiki_submenu_to_edit_wiki(
2585
+ const char *zPrefix, /* "branch", "tag", or "checkin" */
2586
+ const char *zName, /* Name of the object */
2587
+ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2588
+){
2589
+ if( g.perm.WrWiki && (mFlags & WIKIASSOC_MENU_WRITE)!=0 ){
2590
+ style_submenu_element("Edit Wiki", "%R/wikiedit?name=%s/%t", zPrefix, zName);
25782591
}
25792592
}
25802593
25812594
/*
25822595
** Check to see if there exists a wiki page with a name zPrefix/zName.
@@ -2616,10 +2629,11 @@
26162629
if( blob_size(&title) ){
26172630
@ <div class="section accordion">%h(blob_str(&title))</div>
26182631
}else{
26192632
wiki_section_label(zPrefix, zName, mFlags);
26202633
}
2634
+ wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
26212635
wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
26222636
@ <div class="accordion_panel">
26232637
safe_html_context(DOCSRC_WIKI);
26242638
safe_html(&tail);
26252639
convert_href_and_output(&tail);
26262640
--- src/wiki.c
+++ src/wiki.c
@@ -2566,17 +2566,30 @@
2566 }
2567
2568 /*
2569 ** Add an "Wiki" button in a submenu that links to the read-wiki page.
2570 */
2571 static void wiki_submenu_to_edit_wiki(
2572 const char *zPrefix, /* "branch", "tag", or "checkin" */
2573 const char *zName, /* Name of the object */
2574 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2575 ){
2576 if( g.perm.RdWiki && (mFlags & WIKIASSOC_MENU_READ)!=0 ){
2577 style_submenu_element("Wiki", "%R/wikiedit?name=%s/%t", zPrefix, zName);
 
 
 
 
 
 
 
 
 
 
 
 
 
2578 }
2579 }
2580
2581 /*
2582 ** Check to see if there exists a wiki page with a name zPrefix/zName.
@@ -2616,10 +2629,11 @@
2616 if( blob_size(&title) ){
2617 @ <div class="section accordion">%h(blob_str(&title))</div>
2618 }else{
2619 wiki_section_label(zPrefix, zName, mFlags);
2620 }
 
2621 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2622 @ <div class="accordion_panel">
2623 safe_html_context(DOCSRC_WIKI);
2624 safe_html(&tail);
2625 convert_href_and_output(&tail);
2626
--- src/wiki.c
+++ src/wiki.c
@@ -2566,17 +2566,30 @@
2566 }
2567
2568 /*
2569 ** Add an "Wiki" button in a submenu that links to the read-wiki page.
2570 */
2571 static void wiki_submenu_to_read_wiki(
2572 const char *zPrefix, /* "branch", "tag", or "checkin" */
2573 const char *zName, /* Name of the object */
2574 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2575 ){
2576 if( g.perm.RdWiki && (mFlags & WIKIASSOC_MENU_READ)!=0 ){
2577 style_submenu_element("Wiki", "%R/wiki?name=%s/%t", zPrefix, zName);
2578 }
2579 }
2580
2581 /*
2582 ** Add an "Edit Wiki" button in a submenu that links to the edit-wiki page.
2583 */
2584 static void wiki_submenu_to_edit_wiki(
2585 const char *zPrefix, /* "branch", "tag", or "checkin" */
2586 const char *zName, /* Name of the object */
2587 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2588 ){
2589 if( g.perm.WrWiki && (mFlags & WIKIASSOC_MENU_WRITE)!=0 ){
2590 style_submenu_element("Edit Wiki", "%R/wikiedit?name=%s/%t", zPrefix, zName);
2591 }
2592 }
2593
2594 /*
2595 ** Check to see if there exists a wiki page with a name zPrefix/zName.
@@ -2616,10 +2629,11 @@
2629 if( blob_size(&title) ){
2630 @ <div class="section accordion">%h(blob_str(&title))</div>
2631 }else{
2632 wiki_section_label(zPrefix, zName, mFlags);
2633 }
2634 wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
2635 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2636 @ <div class="accordion_panel">
2637 safe_html_context(DOCSRC_WIKI);
2638 safe_html(&tail);
2639 convert_href_and_output(&tail);
2640

Keyboard Shortcuts

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