add advanced and basic modes

master
Joey Hess 2008-08-03 14:57:24 -04:00
parent 5c0f539950
commit 4405cebd0a
6 changed files with 81 additions and 26 deletions

View File

@ -137,6 +137,7 @@ sub getsetup () { #{{{
type => "string", type => "string",
default => "$installdir/share/ikiwiki/templates", default => "$installdir/share/ikiwiki/templates",
description => "location of template files", description => "location of template files",
advanced => 1,
safe => 0, # path safe => 0, # path
rebuild => 1, rebuild => 1,
}, },
@ -144,6 +145,7 @@ sub getsetup () { #{{{
type => "string", type => "string",
default => "$installdir/share/ikiwiki/basewiki", default => "$installdir/share/ikiwiki/basewiki",
description => "base wiki source location", description => "base wiki source location",
advanced => 1,
safe => 0, # path safe => 0, # path
rebuild => 0, rebuild => 0,
}, },
@ -214,6 +216,7 @@ sub getsetup () { #{{{
type => "string", type => "string",
default => '%c', default => '%c',
description => "strftime format string to display date", description => "strftime format string to display date",
advanced => 1,
safe => 1, safe => 1,
rebuild => 1, rebuild => 1,
}, },
@ -222,6 +225,7 @@ sub getsetup () { #{{{
default => undef, default => undef,
example => "en_US.UTF-8", example => "en_US.UTF-8",
description => "UTF-8 locale to use", description => "UTF-8 locale to use",
advanced => 1,
safe => 0, safe => 0,
rebuild => 1, rebuild => 1,
}, },
@ -229,6 +233,7 @@ sub getsetup () { #{{{
type => "boolean", type => "boolean",
default => 0, default => 0,
description => "only send cookies over SSL connections?", description => "only send cookies over SSL connections?",
advanced => 1,
safe => 1, safe => 1,
rebuild => 0, rebuild => 0,
}, },
@ -251,6 +256,7 @@ sub getsetup () { #{{{
type => "boolean", type => "boolean",
default => 0, default => 0,
description => "attempt to hardlink source files? (optimisation for large files)", description => "attempt to hardlink source files? (optimisation for large files)",
advanced => 1,
safe => 0, # paranoia safe => 0, # paranoia
rebuild => 0, rebuild => 0,
}, },
@ -259,6 +265,7 @@ sub getsetup () { #{{{
description => "", description => "",
example => "022", example => "022",
description => "force ikiwiki to use a particular umask", description => "force ikiwiki to use a particular umask",
advanced => 1,
safe => 0, # paranoia safe => 0, # paranoia
rebuild => 0, rebuild => 0,
}, },
@ -267,6 +274,7 @@ sub getsetup () { #{{{
default => "", default => "",
example => "$ENV{HOME}/.ikiwiki/", example => "$ENV{HOME}/.ikiwiki/",
description => "extra library and plugin directory", description => "extra library and plugin directory",
advanced => 1,
safe => 0, # directory safe => 0, # directory
rebuild => 0, rebuild => 0,
}, },
@ -282,6 +290,7 @@ sub getsetup () { #{{{
default => undef, default => undef,
example => '\.wav$', example => '\.wav$',
description => "regexp of source files to ignore", description => "regexp of source files to ignore",
advanced => 1,
safe => 0, # regexp safe => 0, # regexp
rebuild => 1, rebuild => 1,
}, },

View File

@ -50,6 +50,7 @@ sub getsetup () { #{{{
type => "string", type => "string",
example => '%X, %B %o, %Y', example => '%X, %B %o, %Y',
description => "format to use to display date", description => "format to use to display date",
advanced => 1,
safe => 1, safe => 1,
rebuild => 1, rebuild => 1,
}, },

View File

@ -28,6 +28,7 @@ sub getsetup () { #{{{
type => "string", type => "string",
example => "3", example => "3",
description => "Text::Typography attributes value", description => "Text::Typography attributes value",
advanced => 1,
safe => 1, safe => 1,
rebuild => 1, rebuild => 1,
}, },

View File

@ -73,7 +73,9 @@ sub showfields ($$$@) { #{{{
# XXX hashes not handled yet # XXX hashes not handled yet
next if ref $config{$key} && ref $config{$key} eq 'HASH' || ref $info{example} eq 'HASH'; next if ref $config{$key} && ref $config{$key} eq 'HASH' || ref $info{example} eq 'HASH';
# maybe skip unsafe settings # maybe skip unsafe settings
next if ! $info{safe} && ! $config{websetup_show_unsafe}; next if ! $info{safe} && ! ($config{websetup_show_unsafe} && $config{websetup_advanced});
# maybe skip advanced settings
next if $info{advanced} && ! $config{websetup_advanced};
# these are handled specially, so don't show # these are handled specially, so don't show
next if $key eq 'add_plugins' || $key eq 'disable_plugins'; next if $key eq 'add_plugins' || $key eq 'disable_plugins';
@ -228,7 +230,26 @@ sub showform ($$) { #{{{
template => {type => 'div'}, template => {type => 'div'},
stylesheet => IkiWiki::baseurl()."style.css", stylesheet => IkiWiki::baseurl()."style.css",
); );
my $buttons=["Save Setup", "Cancel"];
if ($form->submitted eq 'Basic') {
$form->field(name => "showadvanced", type => "hidden",
value => 0, force => 1);
}
elsif ($form->submitted eq 'Advanced') {
$form->field(name => "showadvanced", type => "hidden",
value => 1, force => 1);
}
my $advancedtoggle;
if ($form->field("showadvanced")) {
$config{websetup_advanced}=1;
$advancedtoggle="Basic";
}
else {
$config{websetup_advanced}=0;
$advancedtoggle="Advanced";
}
my $buttons=["Save Setup", $advancedtoggle, "Cancel"];
IkiWiki::decode_form_utf8($form); IkiWiki::decode_form_utf8($form);
IkiWiki::run_hooks(formbuilder_setup => sub { IkiWiki::run_hooks(formbuilder_setup => sub {

View File

@ -385,6 +385,7 @@ describing the option. For example:
option_foo => { option_foo => {
type => "boolean", type => "boolean",
description => "enable foo", description => "enable foo",
advanced => 1,
safe => 1, safe => 1,
rebuild => 1, rebuild => 1,
}, },
@ -404,6 +405,8 @@ describing the option. For example:
* `description` is a short description of the option. * `description` is a short description of the option.
* `link` is a link to further information about the option. This can either * `link` is a link to further information about the option. This can either
be a wikilink, or an url. be a wikilink, or an url.
* `advanced` can be set to true if the option is more suitable for advanced
users.
* `safe` should be false if the option should not be displayed in unsafe * `safe` should be false if the option should not be displayed in unsafe
configuration methods, such as the web interface. Anything that specifies configuration methods, such as the web interface. Anything that specifies
a command to run, a path on disk, or a regexp should be marked as unsafe. a command to run, a path on disk, or a regexp should be marked as unsafe.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-08-02 15:27-0400\n" "POT-Creation-Date: 2008-08-03 14:48-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -71,7 +71,7 @@ msgstr ""
msgid "You are banned." msgid "You are banned."
msgstr "" msgstr ""
#: ../IkiWiki/CGI.pm:783 ../IkiWiki/CGI.pm:784 ../IkiWiki.pm:1096 #: ../IkiWiki/CGI.pm:783 ../IkiWiki/CGI.pm:784 ../IkiWiki.pm:1108
msgid "Error" msgid "Error"
msgstr "" msgstr ""
@ -173,20 +173,20 @@ msgstr ""
msgid "Failed to delete file from S3: " msgid "Failed to delete file from S3: "
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:46 #: ../IkiWiki/Plugin/attachment.pm:42
#, perl-format #, perl-format
msgid "there is already a page named %s" msgid "there is already a page named %s"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:79 #: ../IkiWiki/Plugin/attachment.pm:75
msgid "prohibited by allowed_attachments" msgid "prohibited by allowed_attachments"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:187 #: ../IkiWiki/Plugin/attachment.pm:183
msgid "bad attachment filename" msgid "bad attachment filename"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:229 #: ../IkiWiki/Plugin/attachment.pm:225
msgid "attachment upload" msgid "attachment upload"
msgstr "" msgstr ""
@ -311,7 +311,7 @@ msgstr ""
msgid "failed to run dot" msgid "failed to run dot"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/lockedit.pm:43 ../IkiWiki/Plugin/lockedit.pm:57 #: ../IkiWiki/Plugin/lockedit.pm:42 ../IkiWiki/Plugin/lockedit.pm:56
#, perl-format #, perl-format
msgid "%s is locked and cannot be edited" msgid "%s is locked and cannot be edited"
msgstr "" msgstr ""
@ -495,15 +495,15 @@ msgstr ""
msgid "%A night" msgid "%A night"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/prettydate.pm:96 #: ../IkiWiki/Plugin/prettydate.pm:97
msgid "at teatime on %A" msgid "at teatime on %A"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/prettydate.pm:100 #: ../IkiWiki/Plugin/prettydate.pm:101
msgid "at midnight" msgid "at midnight"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/prettydate.pm:103 #: ../IkiWiki/Plugin/prettydate.pm:104
msgid "at noon on %A" msgid "at noon on %A"
msgstr "" msgstr ""
@ -707,19 +707,39 @@ msgstr ""
msgid "failed to generate image from code" msgid "failed to generate image from code"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:120 #: ../IkiWiki/Plugin/websetup.pm:85
msgid "you are not logged in as an admin"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:149
msgid "main"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:158
msgid "plugin" msgid "plugin"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:168 #: ../IkiWiki/Plugin/websetup.pm:85
msgid "main"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:170
msgid ""
"Note: Disabled options cannot be configured here, but only by editing the "
"setup file."
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:198
#, perl-format
msgid "enable %s?"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:212
msgid "you are not logged in as an admin"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:266
msgid "other plugins"
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:317
msgid ""
"The configuration changes shown below require a wiki rebuild to take effect."
msgstr ""
#: ../IkiWiki/Plugin/websetup.pm:329
msgid "Setup saved." msgid "Setup saved."
msgstr "" msgstr ""
@ -827,19 +847,19 @@ msgstr ""
msgid "refreshing wiki.." msgid "refreshing wiki.."
msgstr "" msgstr ""
#: ../IkiWiki.pm:417 #: ../IkiWiki.pm:427
msgid "Must specify url to wiki with --url when using --cgi" msgid "Must specify url to wiki with --url when using --cgi"
msgstr "" msgstr ""
#: ../IkiWiki.pm:461 #: ../IkiWiki.pm:471
msgid "cannot use multiple rcs plugins" msgid "cannot use multiple rcs plugins"
msgstr "" msgstr ""
#: ../IkiWiki.pm:1079 #: ../IkiWiki.pm:1091
#, perl-format #, perl-format
msgid "preprocessing loop detected on %s at depth %i" msgid "preprocessing loop detected on %s at depth %i"
msgstr "" msgstr ""
#: ../IkiWiki.pm:1567 #: ../IkiWiki.pm:1579
msgid "yes" msgid "yes"
msgstr "" msgstr ""