]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/websetup.pm
avoid setting default value in websetup_force_plugins
[ikiwiki.git] / IkiWiki / Plugin / websetup.pm
index 2b9240a29dd50269cc08b9a6b985fbe9a016fc8a..94c1b4214919a93a91e2899793777ef80171f0ea 100644 (file)
@@ -12,7 +12,6 @@ my @rcs_plugins=(qw{git svn bzr mercurial monotone tla norcs});
 my @default_force_plugins=(qw{amazon_s3 external});
 
 sub import { #{{{
 my @default_force_plugins=(qw{amazon_s3 external});
 
 sub import { #{{{
-       hook(type => "checkconfig", id => "websetup", call => \&checkconfig);
        hook(type => "getsetup", id => "websetup", call => \&getsetup);
        hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi);
        hook(type => "formbuilder_setup", id => "websetup", 
        hook(type => "getsetup", id => "websetup", call => \&getsetup);
        hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi);
        hook(type => "formbuilder_setup", id => "websetup", 
@@ -30,12 +29,6 @@ sub getsetup () { #{{{
                },
 } #}}}
 
                },
 } #}}}
 
-sub checkconfig () { #{{{
-       if (! exists $config{websetup_force_plugins}) {
-               $config{websetup_force_plugins}=\@default_force_plugins;
-       }
-} #}}}
-
 sub formatexample ($) { #{{{
        my $example=shift;
 
 sub formatexample ($) { #{{{
        my $example=shift;
 
@@ -141,7 +134,16 @@ sub showplugintoggle ($$$$) { #{{{
        my $enabled=shift;
        my $section=shift;
 
        my $enabled=shift;
        my $section=shift;
 
-       return 0 if (grep { $_ eq $plugin } @{$config{websetup_force_plugins}}, @rcs_plugins);
+       if (exists $config{websetup_force_plugins} &&
+           grep { $_ eq $plugin } @{$config{websetup_force_plugins}}, @rcs_plugins) {
+               return 0;
+       }
+       elsif (! exists $config{websetup_force_plugins} &&
+              grep { $_ eq $plugin } @default_force_plugins, @rcs_plugins) {
+               return 0;
+       }
+
+       print STDERR ">>$plugin (@{$config{websetup_force_plugins}})\n";
 
        $form->field(
                name => "enable.$plugin",
 
        $form->field(
                name => "enable.$plugin",
@@ -219,7 +221,7 @@ sub showform ($$) { #{{{
        }
        elsif ($form->submitted eq 'Save Setup' && $form->validate) {
                # TODO
        }
        elsif ($form->submitted eq 'Save Setup' && $form->validate) {
                # TODO
-
+               IkiWiki::Setup::dump("/tmp/s");
                $form->text(gettext("Setup saved."));
        }
 
                $form->text(gettext("Setup saved."));
        }