X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/29e6ff03b078a0c6abb659c9e81343d523d3b13a..2725887734c318350875501e64561f79b8866dfe:/IkiWiki/CGI.pm diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 6c489df8d..af3bb8a4a 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -89,7 +89,9 @@ sub cgi_recentchanges ($) { #{{{ delete @{$change->{pages}}[10 .. @{$change->{pages}}] if $is_excess; $change->{pages} = [ map { - $_->{link} = htmllink("", "", $_->{page}, 1, 0, pagetitle($_->{page})); + $_->{link} = htmllink("", "", $_->{page}, + noimageinline => 1, + linktext => pagetitle($_->{page})); $_; } @{$change->{pages}} ]; @@ -219,7 +221,7 @@ sub cgi_prefs ($$) { #{{{ $form->field(name => "do", type => "hidden"); $form->field(name => "email", size => 50); $form->field(name => "subscriptions", size => 50, - comment => "(".htmllink("", "", "PageSpec", 1).")"); + comment => "(".htmllink("", "", "PageSpec", noimageinline => 1).")"); $form->field(name => "banned_users", size => 50); my $user_name=$session->param("name"); @@ -252,12 +254,15 @@ sub cgi_prefs ($$) { #{{{ elsif ($form->submitted eq 'Save Preferences' && $form->validate) { foreach my $field (qw(email subscriptions)) { if (defined $form->field($field) && length $form->field($field)) { - userinfo_set($user_name, $field, $form->field($field)) || error("failed to set $field"); + userinfo_set($user_name, $field, $form->field($field)) || + error("failed to set $field"); } } if (is_admin($user_name)) { set_banned_users(grep { ! is_admin($_) } - split(' ', $form->field("banned_users"))); + split(' ', + $form->field("banned_users"))) || + error("failed saving changes"); } $form->text(gettext("Preferences saved.")); } @@ -357,7 +362,7 @@ sub cgi_editpage ($$) { #{{{ $form->tmpl_param("can_commit", $config{rcs}); $form->tmpl_param("indexlink", indexlink()); $form->tmpl_param("helponformattinglink", - htmllink("", "", "HelpOnFormatting", 1)); + htmllink("", "", "HelpOnFormatting", noimageinline => 1)); $form->tmpl_param("baseurl", baseurl()); if (! $form->submitted) { $form->field(name => "rcsinfo", value => rcs_prepedit($file), @@ -487,7 +492,25 @@ sub cgi_editpage ($$) { #{{{ $content=~s/\r\n/\n/g; $content=~s/\r/\n/g; - writefile($file, $config{srcdir}, $content); + + $config{cgi}=0; # avoid cgi error message + eval { writefile($file, $config{srcdir}, $content) }; + $config{cgi}=1; + if ($@) { + $form->field(name => "rcsinfo", value => rcs_prepedit($file), + force => 1); + $form->tmpl_param("failed_save", 1); + $form->tmpl_param("error_message", $@); + $form->field("editcontent", value => $content, force => 1); + $form->field(name => "comments", value => $form->field('comments'), force => 1); + $form->field("do", "edit)"); + $form->tmpl_param("page_select", 0); + $form->field(name => "page", type => 'hidden'); + $form->field(name => "type", type => 'hidden'); + $form->title(sprintf(gettext("editing %s"), $page)); + print $form->render(submit => \@buttons); + return; + } if ($config{rcs}) { my $message=""; @@ -616,7 +639,7 @@ sub cgi (;$$) { #{{{ email => "", password => "", regdate => time, - }); + }) || error("failed adding user"); } } } @@ -688,7 +711,7 @@ sub userlink ($) { #{{{ else { return htmllink("", "", escapeHTML( length $config{userdir} ? $config{userdir}."/".$user : $user - ), 1); + ), noimageinline => 1); } } #}}}