]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - ikiwiki
hmm..
[git.ikiwiki.info.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index e684ce38ae03d0fdc132e6c965d28366e421f616..84c7a2513c417d34c7c8beefd1c9ae673797e186 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -446,13 +446,19 @@ sub rcs_recentchanges ($) { #{{{
                                $state='body';
                        }
                        elsif ($state eq 'body' && /$div/) {
+                               my $committype="web";
                                if (defined $message[0] &&
-                                   $message[0]->{line}=~/^web commit by (\w+)(.*)/) {
-                                       $user="$1 (web)";
+                                   $message[0]->{line}=~/^web commit by (\w+):?(.*)/) {
+                                       $user="$1";
                                        $message[0]->{line}=$2;
                                }
+                               else {
+                                       $committype="svn";
+                               }
                                
-                               push @ret, { rev => $rev, user => $user,
+                               push @ret, { rev => $rev,
+                                       user => htmllink("", $user, 1),
+                                       committype => $committype,
                                        when => $when, message => [@message],
                                        pages => [@pages] } if @pages;
                                return @ret if @ret >= $num;
@@ -715,7 +721,7 @@ sub cgi_recentchanges ($) { #{{{
        print $q->header, $template->output;
 } #}}}
 
-sub userinfo_get ($$) { #{{
+sub userinfo_get ($$) { #{{{
        my $user=shift;
        my $field=shift;
 
@@ -726,9 +732,9 @@ sub userinfo_get ($$) { #{{
                return "";
        }
        return $userdata->{$user}->{$field};
-} #}}
+} #}}}
 
-sub userinfo_set ($$) { #{{
+sub userinfo_set ($$) { #{{{
        my $user=shift;
        my $info=shift;
        
@@ -742,7 +748,7 @@ sub userinfo_set ($$) { #{{
        my $ret=Storable::lock_store($userdata, "$srcdir/.ikiwiki/userdb");
        umask($oldmask);
        return $ret;
-} #}}
+} #}}}
 
 sub cgi_signin ($$) { #{{{
        my $q=shift;
@@ -911,8 +917,10 @@ sub cgi_editpage ($$) { #{{{
                fields => [qw(do from page content comments)],
                header => 1,
                method => 'POST',
-               validate => {},
-               required => [qw{}],
+               validate => {
+                       content => '/.+/',
+               },
+               required => [qw{content}],
                javascript => 0,
                params => $q,
                action => $q->request_uri,
@@ -934,6 +942,10 @@ sub cgi_editpage ($$) { #{{{
        $form->field(name => "content", type => "textarea", rows => 20,
                cols => 80);
        
+       if ($form->submitted eq "Cancel") {
+               print $q->redirect("$url/".htmlpage($page));
+               return;
+       }
        if (! $form->submitted || ! $form->validate) {
                if ($form->field("do") eq "create") {
                        if (exists $pagesources{lc($page)}) {
@@ -981,7 +993,7 @@ sub cgi_editpage ($$) { #{{{
                
                $form->tmpl_param("can_commit", $svn);
                $form->tmpl_param("indexlink", indexlink());
-               print $form->render(submit => ["Save Page"]);
+               print $form->render(submit => ["Save Page", "Cancel"]);
        }
        else {
                # save page
@@ -1021,7 +1033,9 @@ sub cgi_editpage ($$) { #{{{
                        refresh();
                }
                
-               print $q->redirect("$url/".htmlpage($page));
+               # The trailing question mark tries to avoid broken
+               # caches and get the most recent version of the page.
+               print $q->redirect("$url/".htmlpage($page)."?");
        }
 } #}}}