]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge commit 'origin/master' into tova
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 22 Jul 2008 17:17:04 +0000 (13:17 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 22 Jul 2008 17:17:04 +0000 (13:17 -0400)
16 files changed:
IkiWiki/Plugin/attachment.pm
IkiWiki/Plugin/img.pm
IkiWiki/Plugin/remove.pm [new file with mode: 0644]
IkiWiki/Plugin/rename.pm [new file with mode: 0644]
IkiWiki/Rcs/Stub.pm
IkiWiki/Rcs/bzr.pm
IkiWiki/Rcs/git.pm
IkiWiki/Rcs/mercurial.pm
IkiWiki/Rcs/monotone.pm
IkiWiki/Rcs/svn.pm
IkiWiki/Rcs/tla.pm
debian/changelog
doc/plugins/remove.mdwn [new file with mode: 0644]
doc/plugins/rename.mdwn [new file with mode: 0644]
doc/todo/Moving_Pages.mdwn
templates/editpage.tmpl

index 01d0d24784316b7302beee90f5df4d9580a5575d..8f9d7f5a442c7635458c5d0e1591489797b0773c 100644 (file)
@@ -11,6 +11,34 @@ sub import { #{{{
        hook(type => "formbuilder", id => "attachment", call => \&formbuilder);
 } # }}}
 
+sub check_canattach ($$;$) {
+       my $session=shift;
+       my $dest=shift; # where it's going to be put, under the srcdir
+       my $file=shift; # the path to the attachment currently
+
+       # Use a special pagespec to test that the attachment is valid.
+       my $allowed=1;
+       foreach my $admin (@{$config{adminuser}}) {
+               my $allowed_attachments=IkiWiki::userinfo_get($admin, "allowed_attachments");
+               if (defined $allowed_attachments &&
+                   length $allowed_attachments) {
+                       $allowed=pagespec_match($dest,
+                               $allowed_attachments,
+                               file => $file,
+                               user => $session->param("name"),
+                               ip => $ENV{REMOTE_ADDR},
+                       );
+                       last if $allowed;
+               }
+       }
+       if (! $allowed) {
+               error(gettext("attachment rejected")." ($allowed)");
+       }
+       else {
+               return 1;
+       }
+}
+
 sub checkconfig () { #{{{
        $config{cgi_disable_uploads}=0;
 } #}}}
@@ -113,25 +141,8 @@ sub formbuilder (@) { #{{{
                # Check that the user is allowed to edit a page with the
                # name of the attachment.
                IkiWiki::check_canedit($filename, $q, $session, 1);
-               
-               # Use a special pagespec to test that the attachment is valid.
-               my $allowed=1;
-               foreach my $admin (@{$config{adminuser}}) {
-                       my $allowed_attachments=IkiWiki::userinfo_get($admin, "allowed_attachments");
-                       if (defined $allowed_attachments &&
-                           length $allowed_attachments) {
-                               $allowed=pagespec_match($filename,
-                                       $allowed_attachments,
-                                       file => $tempfile,
-                                       user => $session->param("name"),
-                                       ip => $ENV{REMOTE_ADDR},
-                               );
-                               last if $allowed;
-                       }
-               }
-               if (! $allowed) {
-                       error(gettext("attachment rejected")." ($allowed)");
-               }
+               # And that the attachment itself is acceptable.
+               check_canattach($session, $filename, $tempfile);
 
                # Needed for fast_file_copy and for rendering below.
                require IkiWiki::Render;
index 17a9367d3339145170256d44c734663f561e94ec..748d28aceae70a3494b8a9f587c0f2de0595db6c 100644 (file)
@@ -41,6 +41,10 @@ sub preprocess (@) { #{{{
        }
 
        my $file = bestlink($params{page}, $image);
+       my $srcfile = srcfile($file, 1);
+       if (! length $file || ! defined $srcfile) {
+               return htmllink($params{page}, $params{destpage}, $image);
+       }
 
        my $dir = $params{page};
        my $base = IkiWiki::basename($file);
@@ -61,12 +65,12 @@ sub preprocess (@) { #{{{
                
                will_render($params{page}, $imglink);
 
-               if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
+               if (-e $outfile && (-M $srcfile >= -M $outfile)) {
                        $r = $im->Read($outfile);
                        error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r;
                }
                else {
-                       $r = $im->Read(srcfile($file));
+                       $r = $im->Read($srcfile);
                        error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
 
                        $r = $im->Resize(geometry => "${w}x${h}");
@@ -83,7 +87,7 @@ sub preprocess (@) { #{{{
                }
        }
        else {
-               $r = $im->Read(srcfile($file));
+               $r = $im->Read($srcfile);
                error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
                $imglink = $file;
        }
diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm
new file mode 100644 (file)
index 0000000..9b66551
--- /dev/null
@@ -0,0 +1,199 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::remove;
+
+use warnings;
+use strict;
+use IkiWiki 2.00;
+
+sub import { #{{{
+       hook(type => "formbuilder_setup", id => "remove", call => \&formbuilder_setup);
+       hook(type => "formbuilder", id => "remove", call => \&formbuilder);
+       hook(type => "sessioncgi", id => "remove", call => \&sessioncgi);
+
+} # }}}
+
+sub formbuilder_setup (@) { #{{{
+       my %params=@_;
+       my $form=$params{form};
+       my $q=$params{cgi};
+
+       if (defined $form->field("do") && $form->field("do") eq "edit") {
+               # Removal button for the page, and also for attachments.
+               push @{$params{buttons}}, "Remove";
+               $form->tmpl_param("field-remove" => '<input name="_submit" type="submit" value="Remove Attachments" />');
+       }
+} #}}}
+
+sub confirmation_form ($$) { #{{{ 
+       my $q=shift;
+       my $session=shift;
+
+       eval q{use CGI::FormBuilder};
+       error($@) if $@;
+       my $f = CGI::FormBuilder->new(
+               name => "remove",
+               header => 0,
+               charset => "utf-8",
+               method => 'POST',
+               javascript => 0,
+               params => $q,
+               action => $config{cgiurl},
+               stylesheet => IkiWiki::baseurl()."style.css",
+               fields => [qw{do page}],
+       );
+       
+       $f->field(name => "do", type => "hidden", value => "remove", force => 1);
+
+       return $f, ["Remove", "Cancel"];
+} #}}}
+
+sub removal_confirm ($$@) {
+       my $q=shift;
+       my $session=shift;
+       my $attachment=shift;
+       my @pages=@_;
+
+       # Save current form state to allow returning to it later
+       # without losing any edits.
+       # (But don't save what button was submitted, to avoid
+       # looping back to here.)
+       # Note: "_submit" is CGI::FormBuilder internals.
+       $q->param(-name => "_submit", -value => "");
+       $session->param(postremove => scalar $q->Vars);
+       IkiWiki::cgi_savesession($session);
+       
+       my ($f, $buttons)=confirmation_form($q, $session);
+       $f->title(sprintf(gettext("confirm removal of %s"),
+               join(", ", map { IkiWiki::pagetitle($_) } @pages)));
+       $f->field(name => "page", type => "hidden", value => \@pages, force => 1);
+       if (defined $attachment) {
+               $f->field(name => "attachment", type => "hidden",
+                       value => $attachment, force => 1);
+       }
+
+       IkiWiki::showform($f, $buttons, $session, $q);
+       exit 0;
+}
+
+sub postremove ($) {
+       my $session=shift;
+
+       # Load saved form state and return to edit form.
+       my $postremove=CGI->new($session->param("postremove"));
+       $session->clear("postremove");
+       IkiWiki::cgi_savesession($session);
+       IkiWiki::cgi($postremove, $session);
+}
+
+sub formbuilder (@) { #{{{
+       my %params=@_;
+       my $form=$params{form};
+
+       if (defined $form->field("do") && $form->field("do") eq "edit") {
+               my $q=$params{cgi};
+               my $session=$params{session};
+
+               if ($form->submitted eq "Remove") {
+                       removal_confirm($q, $session, 0, $form->field("page"));
+               }
+               elsif ($form->submitted eq "Remove Attachments") {
+                       my @selected=$q->param("attachment_select");
+                       if (! @selected) {
+                               error(gettext("Please select the attachments to remove."));
+                       }
+                       removal_confirm($q, $session, 1, @selected);
+               }
+       }
+} #}}}
+
+sub sessioncgi ($$) { #{{{
+        my $q=shift;
+
+       if ($q->param("do") eq 'remove') {
+               my $session=shift;
+               my ($form, $buttons)=confirmation_form($q, $session);
+               IkiWiki::decode_form_utf8($form);
+
+               if ($form->submitted eq 'Cancel') {
+                       postremove($session);
+               }
+               elsif ($form->submitted eq 'Remove' && $form->validate) {
+                       my @pages=$q->param("page");
+       
+                       # Validate removal by checking that the page exists,
+                       # and that the user is allowed to edit(/remove) it.
+                       my @files;
+                       foreach my $page (@pages) {
+                               # Must be a known source file.
+                               if (! exists $pagesources{$page}) {
+                                       error(sprintf(gettext("%s does not exist"),
+                                       htmllink("", "", $page, noimageinline => 1)));
+                               }
+
+                               # Must exist on disk, and be a regular file.
+                               my $file=$pagesources{$page};
+                               if (! -e "$config{srcdir}/$file") {
+                                       error(sprintf(gettext("%s is not in the srcdir, so it cannot be deleted"), $file));
+                               }
+                               elsif (-l "$config{srcdir}/$file" && ! -f _) {
+                                       error(sprintf(gettext("%s is not a file"), $file));
+                               }
+                               
+                               # Must be editiable.
+                               IkiWiki::check_canedit($page, $q, $session);
+
+                               # This is sorta overkill, but better safe
+                               # than sorry. If a user can't upload an
+                               # attachment, don't let them delete it.
+                               if ($q->param("attachment")) {
+                                       IkiWiki::Plugin::attachment::check_canattach($session, $page, $file);
+                               }
+
+                               push @files, IkiWiki::possibly_foolish_untaint($file);
+                       }
+
+                       # Do removal, and update the wiki.
+                       require IkiWiki::Render;
+                       if ($config{rcs}) {
+                               IkiWiki::disable_commit_hook();
+                               foreach my $file (@files) {
+                                       my $token=IkiWiki::rcs_prepedit($file);
+                                       IkiWiki::rcs_remove($file);
+                                       IkiWiki::rcs_commit($file, gettext("removed"),
+                                               $token, $session->param("name"), $ENV{REMOTE_ADDR});
+                               }
+                               IkiWiki::enable_commit_hook();
+                               IkiWiki::rcs_update();
+                       }
+                       else {
+                               foreach my $file (@files) {
+                                       IkiWiki::prune("$config{srcdir}/$file");
+                               }
+                       }
+                       IkiWiki::refresh();
+                       IkiWiki::saveindex();
+
+                       if ($q->param("attachment")) {
+                               # Attachments were deleted, so redirect
+                               # back to the edit form.
+                               postremove($session);
+                       }
+                       else {
+                               # The page is gone, so redirect to parent
+                               # of the page.
+                               my $parent=IkiWiki::dirname($pages[0]);
+                               if (! exists $pagesources{$parent}) {
+                                       $parent="index";
+                               }
+                               IkiWiki::redirect($q, $config{url}."/".htmlpage($parent));
+                       }
+               }
+               else {
+                       IkiWiki::showform($form, $buttons, $session, $q);
+               }
+
+               exit 0;
+       }
+}
+
+1
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
new file mode 100644 (file)
index 0000000..d3fc768
--- /dev/null
@@ -0,0 +1,194 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::rename;
+
+use warnings;
+use strict;
+use IkiWiki 2.00;
+
+sub import { #{{{
+       hook(type => "formbuilder_setup", id => "rename", call => \&formbuilder_setup);
+       hook(type => "formbuilder", id => "rename", call => \&formbuilder);
+       hook(type => "sessioncgi", id => "rename", call => \&sessioncgi);
+
+} # }}}
+
+sub formbuilder_setup (@) { #{{{
+       my %params=@_;
+       my $form=$params{form};
+       my $q=$params{cgi};
+
+       if (defined $form->field("do") && $form->field("do") eq "edit") {
+               # Rename button for the page, and also for attachments.
+               push @{$params{buttons}}, "Rename";
+               $form->tmpl_param("field-rename" => '<input name="_submit" type="submit" value="Rename Attachment" />');
+       }
+} #}}}
+
+sub rename_form ($$$) { #{{{ 
+       my $q=shift;
+       my $session=shift;
+       my $page=shift;
+
+       eval q{use CGI::FormBuilder};
+       error($@) if $@;
+       my $f = CGI::FormBuilder->new(
+               name => "rename",
+               title => sprintf(gettext("rename %s"), IkiWiki::pagetitle($page)),
+               header => 0,
+               charset => "utf-8",
+               method => 'POST',
+               javascript => 0,
+               params => $q,
+               action => $config{cgiurl},
+               stylesheet => IkiWiki::baseurl()."style.css",
+               fields => [qw{do page new_name attachment}],
+       );
+       
+       $f->field(name => "do", type => "hidden", value => "rename", force => 1);
+       $f->field(name => "page", type => "hidden", value => $page, force => 1);
+       $f->field(name => "new_name", value => IkiWiki::pagetitle($page), size => 60);
+       $f->field(name => "attachment", type => "hidden");
+
+       return $f, ["Rename", "Cancel"];
+} #}}}
+
+sub rename_start ($$$$) {
+       my $q=shift;
+       my $session=shift;
+       my $attachment=shift;
+       my $page=shift;
+
+       # Save current form state to allow returning to it later
+       # without losing any edits.
+       # (But don't save what button was submitted, to avoid
+       # looping back to here.)
+       # Note: "_submit" is CGI::FormBuilder internals.
+       $q->param(-name => "_submit", -value => "");
+       $session->param(postrename => scalar $q->Vars);
+       IkiWiki::cgi_savesession($session);
+       
+       my ($f, $buttons)=rename_form($q, $session, $page);
+       if (defined $attachment) {
+               $f->field(name => "attachment", value => $attachment, force => 1);
+       }
+       
+       IkiWiki::showform($f, $buttons, $session, $q);
+       exit 0;
+}
+
+sub postrename ($;$) {
+       my $session=shift;
+       my $newname=shift;
+
+       # Load saved form state and return to edit form.
+       my $postrename=CGI->new($session->param("postrename"));
+       if (defined $newname) {
+               # They renamed the page they were editing.
+               # Tweak the edit form to be editing the new
+               # page name, and redirect back to it.
+               # (Deep evil here.)
+               error("don't know how to redir back!"); ## FIXME
+       }
+       $session->clear("postrename");
+       IkiWiki::cgi_savesession($session);
+       IkiWiki::cgi($postrename, $session);
+}
+
+sub formbuilder (@) { #{{{
+       my %params=@_;
+       my $form=$params{form};
+
+       if (defined $form->field("do") && $form->field("do") eq "edit") {
+               my $q=$params{cgi};
+               my $session=$params{session};
+
+               if ($form->submitted eq "Rename") {
+                       rename_start($q, $session, 0, $form->field("page"));
+               }
+               elsif ($form->submitted eq "Rename Attachment") {
+                       my @selected=$q->param("attachment_select");
+                       if (@selected > 1) {
+                               error(gettext("Only one attachment can be renamed at a time."));
+                       }
+                       elsif (! @selected) {
+                               error(gettext("Please select the attachment to rename."))
+                       }
+                       rename_start($q, $session, 1, $selected[0]);
+               }
+       }
+} #}}}
+
+sub sessioncgi ($$) { #{{{
+        my $q=shift;
+
+       if ($q->param("do") eq 'rename') {
+               my $session=shift;
+               my ($form, $buttons)=rename_form($q, $session, $q->param("page"));
+               IkiWiki::decode_form_utf8($form);
+
+               if ($form->submitted eq 'Cancel') {
+                       postrename($session);
+               }
+               elsif ($form->submitted eq 'Rename' && $form->validate) {
+                       my $page=$q->param("page");
+
+                       # This untaint is safe because of the checks below.
+                       my $file=IkiWiki::possibly_foolish_untaint($pagesources{$page});
+
+                       # Must be a known source file.
+                       if (! defined $file) {
+                               error(sprintf(gettext("%s does not exist"),
+                               htmllink("", "", $page, noimageinline => 1)));
+                       }
+                               
+                       # Must be editiable.
+                       IkiWiki::check_canedit($page, $q, $session);
+
+                       # Must exist on disk, and be a regular file.
+                       if (! -e "$config{srcdir}/$file") {
+                               error(sprintf(gettext("%s is not in the srcdir, so it cannot be deleted"), $file));
+                       }
+                       elsif (-l "$config{srcdir}/$file" && ! -f _) {
+                               error(sprintf(gettext("%s is not a file"), $file));
+                       }
+
+                       # TODO: check attachment limits
+
+                       my $dest=IkiWiki::titlepage($q->param("new_name"));
+                       # XXX TODO check $dest!
+
+                       # Do rename, and update the wiki.
+                       require IkiWiki::Render;
+                       if ($config{rcs}) {
+                               IkiWiki::disable_commit_hook();
+                               my $token=IkiWiki::rcs_prepedit($file);
+                               IkiWiki::rcs_rename($file, $dest);
+                               IkiWiki::rcs_commit($file, gettext("rename $file to $dest"),
+                                       $token, $session->param("name"), $ENV{REMOTE_ADDR});
+                               IkiWiki::enable_commit_hook();
+                               IkiWiki::rcs_update();
+                       }
+                       else {
+                               if (! rename("$config{srcdir}/$file", "$config{srcdir}/$dest")) {
+                                       error("rename: $!");
+                               }
+                       }
+                       IkiWiki::refresh();
+                       IkiWiki::saveindex();
+
+                       if ($q->param("attachment")) {
+                               postrename($session);
+                       }
+                       else {
+                               postrename($session, $dest);
+                       }
+               }
+               else {
+                       IkiWiki::showform($form, $buttons, $session, $q);
+               }
+
+               exit 0;
+       }
+}
+
+1
index 6b69e65dcdbc2e92ff5e8e725830f4626c6c6a4d..375591c96ce6883a7e4eeadf3862fce768191580 100644 (file)
@@ -33,6 +33,12 @@ sub rcs_add ($) {
        # prepare for it to be checked in when rcs_commit is called.
 }
 
+sub rcs_remove ($) {
+       # Remove a file. The filename is relative to the root of the srcdir.
+       # Note that this should not check the removal in, it should only
+       # prepare for it to be checked in when rcs_commit is called.
+}
+
 sub rcs_recentchanges ($) {
        # Examine the RCS history and generate a list of recent changes.
        # The data structure returned for each change is:
index 0dc456de2c1fc652b48491f1584e17e0341f5b59..ca60190eaa836f85801b4ef3364d21d8f0e315c5 100644 (file)
@@ -89,6 +89,12 @@ sub rcs_add ($) { # {{{
        }
 } #}}}
 
+sub rcs_remove ($) { # {{{
+       my ($file) = @_;
+
+       error("rcs_remove not implemented for bzr"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        my ($num) = @_;
 
index 7fb612a39bdc56c4b7931a48ab9f8a8db76d55ac..b02b286bdc9dc3027fa0daf65b294ece518912e5 100644 (file)
@@ -348,6 +348,14 @@ sub rcs_add ($) { # {{{
        run_or_cry('git', 'add', $file);
 } #}}}
 
+sub rcs_remove ($) { # {{{
+       # Remove file from archive.
+
+       my ($file) = @_;
+
+       run_or_cry('git', 'rm', '-f', $file);
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        # List of recent changes.
 
index bfe6ba49c13edc088b270faee364d94a2dbd7903..1bfcf624224c9532215247977795d4338745b5de 100644 (file)
@@ -101,6 +101,12 @@ sub rcs_add ($) { # {{{
        }
 } #}}}
 
+sub rcs_remove ($) { # {{{
+       my ($file) = @_;
+
+       error("rcs_remove not implemented for mercurial"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        my ($num) = @_;
 
index ce4a2a3ed4d3b10d89b436818b29145b7cd743ff..948edac0af6e217d704b04f18eb14d1e6868dabb 100644 (file)
@@ -370,6 +370,12 @@ sub rcs_add ($) { #{{{
        }
 } #}}}
 
+sub rcs_remove ($) { # {{{
+       my $file = shift;
+
+       error("rcs_remove not implemented for monotone"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        my $num=shift;
        my @ret;
index 6a822e896cd79951d3d0a4fdc1dd3e4a4e9c3b9e..6c15c2ca9b260bda8efd204d0be3d0a4b0f6c8af 100644 (file)
@@ -134,6 +134,23 @@ sub rcs_add ($) { #{{{
        }
 } #}}}
 
+sub rcs_remove ($) { #{{{
+       # filename is relative to the root of the srcdir
+       my $file=shift;
+
+       if (-d "$config{srcdir}/.svn") {
+               my $parent=dirname($file);
+               while (! -d "$config{srcdir}/$parent/.svn") {
+                       $file=$parent;
+                       $parent=dirname($file);
+               }
+               
+               if (system("svn", "rm", "--force", "--quiet", "$config{srcdir}/$file") != 0) {
+                       warn("svn rm failed\n");
+               }
+       }
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        my $num=shift;
        my @ret;
index e7fed9ad8ce9c838da52039e6a117b5b4f6c2c73..29dbd092a0ac67c812f76fdce9f31c1883b5cbdb 100644 (file)
@@ -88,6 +88,12 @@ sub rcs_add ($) { #{{{
        }
 } #}}}
 
+sub rcs_remove ($) { # {{{
+       my $file = shift;
+
+       error("rcs_remove not implemented for tla"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) {
        my $num=shift;
        my @ret;
index 7ab18a2c70eb348e6ec2ceac21ed34fdb4b726f3..b53d846d7e54b3922b7607b399b44b0d10061256 100644 (file)
@@ -1,8 +1,13 @@
 ikiwiki (2.55) UNRELEASED; urgency=low
 
+  * remove: New plugin that adds the ability to remove pages via the web.
+    (Sponsored by The TOVA Company.)
+  * rename: New plugin that adds the ability to rename pages via the web.
+    (Sponsored by The TOVA Company.) (This one's for you, Kyle.)
   * prefix_directives enabled in doc wiki, all preprocessor directives
     converted. (Simon McVittie)
   * editpage: Don't show attachments link when attachments are disabled.
+  * All rcs backends need to implement rcs_remove. (Done for svn, git).
   * tag: Allow tagbase to be overridden by starting a tag with "./" or "/".
     (Simon McVittie)
   * Really fix bug with links to pages with names containing colons. 
diff --git a/doc/plugins/remove.mdwn b/doc/plugins/remove.mdwn
new file mode 100644 (file)
index 0000000..be382e1
--- /dev/null
@@ -0,0 +1,7 @@
+[[!template id=plugin name=remove core=0 author="[[Joey]]"]]
+[[!tag type/useful]]
+
+This plugin allows pages or other files to be removed using the web
+interface.
+
+Users can only remove things that they are allowed to edit or upload.
diff --git a/doc/plugins/rename.mdwn b/doc/plugins/rename.mdwn
new file mode 100644 (file)
index 0000000..f5433ca
--- /dev/null
@@ -0,0 +1,7 @@
+[[!template id=plugin name=rename core=0 author="[[Joey]]"]]
+[[!tag type/useful]]
+
+This plugin allows pages or other files to be renamed using the web
+interface.
+
+Users can only rename things that they are allowed to edit or upload.
index 7485f06fde9d2a74c75c007f258d7fa7979886b9..d93cea0a0a3a4e035550bbc6af437e77b2dcf316 100644 (file)
@@ -395,16 +395,10 @@ is checked too.
 
 ## RCS
 
-Two new optional functions are added to the RCS interface:
+Two new functions are added to the RCS interface:
 
-* `rcs_delete(file, message, rcstoken, user, ipaddr)`
-* `rcs_rename(old, new, message, rcstoken, user, ipaddr)`
-
-The page move/rename code will check if these are not available, and error
-out.
-
-Similar to `rcs_commit` both of these take a rcstoken, which is generated
-by an earlier `rcs_prepedit`.
+* `rcs_remove(file)`
+* `rcs_rename(old, new)`
 
 ## conflicts
 
@@ -413,17 +407,26 @@ Cases that have to be dealt with:
 * Alice clicks "delete" button for a page; Bob makes a modification;
   Alice confirms deletion. Ideally in this case, Alice should get an error
   message that there's a conflict.
+  Update: In my current code, alice's deletion will fail if the file was
+  moved or deleted in the meantime; if the file was modified since alice
+  clicked on the delete button, the modifications will be deleted too. I
+  think this is acceptable.
 * Alice opens edit UI for a page; Bob makes a modification; Alice
   clicks delete button and confirms deletion. Again here, Alice should get
   a conflict error. Note that this means that the rcstoken should be
   recorded when the edit UI is first opened, not when the delete button is
   hit.
+  Update: Again here, there's no conflict, but the delete succeeds. Again,
+  basically acceptible.
 * Alice and Bob both try to delete a page at the same time. It's fine for
   the second one to get a message that it no longer exists. Or just to
   silently fail to delete the deleted page..
+  Update: It will display an error to the second one that the page doesn't
+  exist.
 * Alice deletes a page; Bob had edit window open for it, and saves
   it afterwards. I think that Bob should win in this case; Alice can always
   notice the page has been added back, and delete it again.
+  Update: Bob wins.
 * Alice clicks "rename" button for a page; Bob makes a modification;
   Alice confirms rename. This case seems easy, it should just rename the
   modified page.
index 9875318039190cd955dd9bcba6b4366cd7804ba5..1c30d1d8513a0484c2d6577ac3118e1f9b9cb876 100644 (file)
@@ -71,7 +71,7 @@ Optional comment about this change:<br />
 <tr><td><TMPL_VAR FIELD-SELECT><TMPL_VAR LINK></td><td><TMPL_VAR SIZE></td><td><TMPL_VAR MTIME></td></tr>
 </TMPL_LOOP>
 <TMPL_IF NAME="ATTACHMENT_LIST">
-<tr><td colspan="2"><TMPL_VAR FIELD-LINK><TMPL_VAR FIELD-DELETE><TMPL_VAR FIELD-RENAME></td></tr>
+<tr><td colspan="2"><TMPL_VAR FIELD-LINK><TMPL_VAR FIELD-RENAME><TMPL_VAR FIELD-REMOVE></td></tr>
 </TMPL_IF>
 </table>
 </div>