shithub: werc

Download patch

ref: d62089f983c5d72eea480613385862ed42cbb487
parent: 7f6c14c548db415baf11075d69be60773d1e2a42
author: sl <uriel@engel.se.cat-v.org>
date: Sat Feb 7 19:22:46 EST 2009

Add conf_enable_app to add items to $enabled_apps, used from conf_enable_xxx functions so one doesn't need to both add stuff to $eanbled_apps and then call conf_enable_xxx, and to avoid enabling the same app twice.

New conf_enable_wiki function to follow the interface of other apps.

--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -3,6 +3,7 @@
     blagh_dirs=$*
     if(~ $#blagh_dirs 0)
         blagh_dirs=( . )
+    conf_enable_app blagh
 }
 
 fn blagh_init {
--- a/apps/bridge/app.rc
+++ b/apps/bridge/app.rc
@@ -7,6 +7,7 @@
     }
     enable_comments=yes
     groups_allowed_comments=$*
+    conf_enable_app bridge
 }
 
 fn bridge_init {
--- a/apps/dirdir/app.rc
+++ b/apps/dirdir/app.rc
@@ -1,5 +1,12 @@
+fn conf_enable_wiki {
+    enable_wiki=yes
+    wiki_editors_group=$* 
+    conf_enable_app dirdir
+}
+
+
 fn dirdir_init {
-    if(! ~ $#enable_wiki 0 &&  check_user $wiki_editors_group admin) {
+    if(! ~ $#enable_wiki 0 && check_user $wiki_editors_group) {
         if(test -f $local_path.md)
             ll_add handlers_bar_left  dirdir_controls
 
--- a/bin/wercconf.rc
+++ b/bin/wercconf.rc
@@ -10,3 +10,10 @@
     for(i in $*)
        dirfilter=$dirfilter^'/'^`{echo $i|sed 's!/!\\/!g'}^'/d; '
 }
+
+# Usually will be called from within conf_enable_foo 
+fn conf_enable_app {
+    # Note: maybe we should add test -d apps/$1/?
+    if(! ~ $1 $enabled_apps)
+	enabled_apps=( $enabled_apps $1 )
+}