diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-08-03 16:58:16 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-08-03 16:58:16 -0400 |
commit | 1a37848346fd4853e8961e81d576906f4a5cab78 (patch) | |
tree | 0abff67be176831c69603fc9f46d596212028547 | |
parent | b7d6a49be4a5e1d9c94219392179c14dba40034a (diff) | |
download | ikiwiki-1a37848346fd4853e8961e81d576906f4a5cab78.tar ikiwiki-1a37848346fd4853e8961e81d576906f4a5cab78.tar.gz |
move plugin toggles to before config setting again
-rw-r--r-- | IkiWiki/Plugin/websetup.pm | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 4c9367410..dec360d68 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -82,17 +82,35 @@ sub showfields ($$$@) { #{{{ push @show, $key, \%info; } + my $section=defined $plugin ? $plugin." ".gettext("plugin") : "main"; + my %enabledfields; + my $shownfields=0; + my $plugin_forced=defined $plugin && (! $plugininfo{safe} || (exists $config{websetup_force_plugins} && grep { $_ eq $plugin } @{$config{websetup_force_plugins}})); if ($plugin_forced && ! $enabled) { # plugin is forced disabled, so skip its configuration @show=(); } + # show plugin toggle + if (defined $plugin && (! $plugin_forced || $config{websetup_advanced})) { + my $name="enable.$plugin"; + $form->field( + name => $name, + label => "", + type => "checkbox", + options => [ [ 1 => sprintf(gettext("enable %s?"), $plugin) ] ], + value => $enabled, + fieldset => $section, + ); + if ($plugin_forced) { + $form->field(name => $name, disabled => 1); + } + else { + $enabledfields{$name}=[$name, \%plugininfo]; + } + } - my %shownfields; - my %skippedfields; - my $section=defined $plugin ? $plugin." ".gettext("plugin") : "main"; - while (@show) { my $key=shift @show; my %info=%{shift @show}; @@ -164,33 +182,21 @@ sub showfields ($$$@) { #{{{ if (! $info{safe}) { $form->field(name => $name, disabled => 1); - $skippedfields{$name}=1; } else { - $shownfields{$name}=[$key, \%info]; + $enabledfields{$name}=[$key, \%info]; } + $shownfields++; } - - if (defined $plugin && (! $plugin_forced || $config{websetup_advanced})) { - my $name="enable.$plugin"; - $section="plugins" unless %shownfields || (%skippedfields && $config{websetup_advanced}); - $form->field( - name => $name, - label => "", - type => "checkbox", - options => [ [ 1 => sprintf(gettext("enable %s?"), $plugin) ] ], - value => $enabled, - fieldset => $section, - ); - if ($plugin_forced) { - $form->field(name => $name, disabled => 1); - } - else { - $shownfields{$name}=[$name, \%plugininfo]; - } + + # if no fields were shown for the plugin, drop it into the + # plugins fieldset + if (defined $plugin && (! $plugin_forced || $config{websetup_advanced}) && + ! $shownfields) { + $form->field(name => "enable.$plugin", fieldset => "plugins"); } - return %shownfields; + return %enabledfields; } #}}} sub showform ($$) { #{{{ |