[Home]WikiPatches/CancelEditButton

UseModWiki | WikiPatches | RecentChanges | Preferences

This patch does something our users wanted: When they click Edit this page they don't all feel comfortable backing out of this. With this, they can press a Cancel Edit button, which also releases the lock on the page.

DirkJanssen


This is a ''diff -c'' against Usemod 0.92

*** wiki.org	Sun Apr 22 02:44:10 2001
--- wiki.pl	Sun Feb 16 01:22:30 2003
***************
*** 2607,2612 ****
--- 2607,2613 ----
      print T($EditNote) . '<br>';  # Allow translation
    }
    print $q->submit(-name=>'Save', -value=>T('Save')), "\n";
+   print " ";
    $userName = &GetParam("username", "");
    if ($userName ne "") {
      print ' (', T('Your user name is'), ' ',
***************
*** 2614,2620 ****
--- 2615,2624 ----
    } else {
      print ' (', Ts('Visit %s to set your user name.', &GetPrefsLink()), ') ';
    }
+   print " ";
    print $q->submit(-name=>'Preview', -value=>T('Preview')), "\n";
+   print " ";
+   print $q->submit(-name=>'wantCancel', -value=>T('Cancel Edit')), "\n";
  
    if ($isConflict) {
      print "\n<br><hr><p><strong>", T('This is the text you submitted:'),
***************
*** 3195,3200 ****
--- 3199,3205 ----
    my $summary = &GetParam("summary", "");
    my $oldtime = &GetParam("oldtime", "");
    my $oldconflict = &GetParam("oldconflict", "");
+   my $wantCancel = (&GetParam("wantCancel", "") ne "");
    my $isEdit = 0;
    my $editTime = $Now;
    my $authorAddr = $ENV{REMOTE_ADDR};
***************
*** 3203,3208 ****
--- 3208,3219 ----
      # This is an internal interface--we don't need to explain
      &ReportError(Ts('Editing not allowed for %s.', $id));
      return;
+   }
+ 
+   if ($wantCancel) {
+     &ReleaseLock();
+     &ReBrowsePage($id, "", 1);
+     return;    
    }
  
    if (($id eq 'SampleUndefinedPage') || ($id eq T('SampleUndefinedPage'))) {

Interesting patch, but a newbie-question, why

+ my $wantCancel = (&GetParam("wantCancel", "") ne "");

instead of

+ my $wantCancel = &GetParam("wantCancel", ""); ?

Thanks.

--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 6, 2009 9:56 pm by JuanmaMP (diff)
Search: