-} #}}}
-
-sub formbuilder_setup (@) { #{{{
- my %params=@_;
-
- # XXX deprecated, should be removed eventually
- my $form=$params{form};
- if ($form->title eq "preferences") {
- my $session=$params{session};
- my $cgi=$params{cgi};
- my $user_name=$session->param("name");
-
- $form->field(name => "locked_pages", size => 50,
- fieldset => "admin",
- comment => "deprecated; please move to locked_pages in setup file"
- );
- if (! IkiWiki::is_admin($user_name)) {
- $form->field(name => "locked_pages", type => "hidden");
- }
- if (! $form->submitted) {
- my $value=IkiWiki::userinfo_get($user_name, "locked_pages");
- if (length $value) {
- $form->field(name => "locked_pages", force => 1, value => $value);
- }
- else {
- $form->field(name => "locked_pages", type => "hidden");
- }
- }
- if ($form->submitted && $form->submitted eq 'Save Preferences') {
- if (defined $form->field("locked_pages")) {
- IkiWiki::userinfo_set($user_name, "locked_pages",
- $form->field("locked_pages")) ||
- error("failed to set locked_pages");
- if (! length $form->field("locked_pages")) {
- $form->field(name => "locked_pages", type => "hidden");
- }
- }
- }
- }
-} #}}}