remove cansave plugin, now replaced by Joey's checkcontent one
authorintrigeri <intrigeri@boum.org>
Mon, 19 Jan 2009 18:53:32 +0000 (19:53 +0100)
committerintrigeri <intrigeri@boum.org>
Mon, 19 Jan 2009 18:53:32 +0000 (19:53 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/editpage.pm
IkiWiki/Plugin/po.pm
IkiWiki/Plugin/skeleton.pm.example
doc/plugins/write.mdwn

index 4540b55d058624743d7c6a31be6b31612211f47c..cfed51afde08fa40461866f9e0f951b167d5b9f2 100644 (file)
@@ -117,33 +117,6 @@ sub check_content (@) {
        return defined $ok ? $ok : 1;
 }
 
-sub check_cansave ($$$$) {
-       my $page=shift;
-       my $content=shift;
-       my $q=shift;
-       my $session=shift;
-
-       my $cansave;
-       run_hooks(cansave => sub {
-               return if defined $cansave;
-               my $ret=shift->($page, $content, $q, $session);
-               if (defined $ret) {
-                       if ($ret eq "") {
-                               $cansave=1;
-                       }
-                       elsif (ref $ret eq 'CODE') {
-                               $ret->();
-                               $cansave=0;
-                       }
-                       else {
-                               error($ret);
-                               $cansave=0;
-                       }
-               }
-       });
-       return $cansave;
-}
-
 sub cgi_editpage ($$) {
        my $q=shift;
        my $session=shift;
@@ -439,7 +412,6 @@ sub cgi_editpage ($$) {
                }
                
                my $content=$form->field('editcontent');
-               check_cansave($page, $content, $q, $session);
                check_content(content => $content, page => $page,
                        cgi => $q, session => $session,
                        subject => $message);
index 0a970284cdc41fbc831f4cd809d34f41dbc63b43..daac95eb1ca6a11022058433fd79cbd86489669e 100644 (file)
@@ -49,7 +49,7 @@ sub import {
        hook(type => "rename", id => "po", call => \&renamepages, first => 1);
        hook(type => "delete", id => "po", call => \&mydelete);
        hook(type => "change", id => "po", call => \&change);
-       hook(type => "cansave", id => "po", call => \&cansave);
+       hook(type => "checkcontent", id => "po", call => \&checkcontent);
        hook(type => "canremove", id => "po", call => \&canremove);
        hook(type => "canrename", id => "po", call => \&canrename);
        hook(type => "editcontent", id => "po", call => \&editcontent);
@@ -436,11 +436,11 @@ sub change(@) {
        }
 }
 
-sub cansave ($$$$) {
-       my ($page, $content, $cgi, $session) = (shift, shift, shift, shift);
+sub checkcontent (@) {
+       my %params=@_;
 
-       if (istranslation($page)) {
-               my $res = isvalidpo($content);
+       if (istranslation($params{page})) {
+               my $res = isvalidpo($params{content});
                if ($res) {
                        return undef;
                }
index 7506816f19481afd9812cdde1acd9d81e64f19a2..59503a462ef81c64399e4cd4bda658543994388d 100644 (file)
@@ -30,7 +30,6 @@ sub import {
        hook(type => "auth", id => "skeleton", call => \&auth);
        hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
        hook(type => "canedit", id => "skeleton", call => \&canedit);
-       hook(type => "cansave", id => "skeleton", call => \&cansave);
        hook(type => "checkcontent", id => "skeleton", call => \&checkcontent);
        hook(type => "editcontent", id => "skeleton", call => \&editcontent);
        hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
@@ -182,15 +181,6 @@ sub canedit ($$$) {
        debug("skeleton plugin running in canedit");
 }
 
-sub cansave ($$$$) {
-       my $page=shift;
-       my $content=shift;
-       my $cgi=shift;
-       my $session=shift;
-
-       debug("skeleton plugin running in cansave");
-}
-
 sub canremove ($$$) {
        my $page=shift;
        my $cgi=shift;
index 7ba01ae53f1d796bf31677183492a82d485849a0..05dfc5d09dae984b360f79ac22da67ab3d136655 100644 (file)
@@ -321,21 +321,6 @@ This hook should avoid directly redirecting the user to a signin page,
 since it's sometimes used to test to see which pages in a set of pages a
 user can edit.
 
-### cansave
-
-       hook(type => "cansave", id => "foo", call => \&cansave);
-
-This hook can be used to implement arbitrary access methods to control
-when a page being edited can be saved using the web interface (commits
-from revision control bypass it).
-
-When a page is about to be saved, each registered cansave hook is
-called in turn, and passed the page name, the edited content, a CGI
-object and a session object.
-
-The return value of a cansave hook is interpreted the same as for the
-canedit hook.
-
 ### canremove
 
        hook(type => "canremove", id => "foo", call => \&canremove);