diff -ru twiki/lib/TWiki/Func.pm twiki.forcenewrevision/lib/TWiki/Func.pm --- twiki/lib/TWiki/Func.pm Sun Aug 29 04:14:37 2004 +++ twiki.forcenewrevision/lib/TWiki/Func.pm Tue Sep 14 23:14:02 2004 @@ -747,7 +747,7 @@ # ========================= =pod ----+++ saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) ==> $oopsUrl +---+++ saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify, $forceNewRevision ) ==> $oopsUrl | Description: | Save topic text, typically obtained by readTopicText(). Topic data usually includes meta data; the file attachment meta data is replaced by the meta data from the topic file if it exists. | | Parameter: =$web= | Web name, e.g. ="Main"=, or empty | @@ -755,6 +755,7 @@ | Parameter: =$text= | Topic text to save, assumed to include meta data | | Parameter: =$ignorePermissions= | Set to ="1"= if checkAccessPermission() is already performed and OK | | Parameter: =$dontNotify= | Set to ="1"= if not to notify users of the change | +| Parameter: =$forceNewRevision= | Set to ="1"= to force a new (rcs) revision, even if the edit lock time hasn't expired | | Return: =$oopsUrl= | Empty string if OK; the =$oopsUrl= for calling redirectCgiQuery() in case of error | | Since: | TWiki::Plugins::VERSION 1.010 (31 Dec 2002) | @@ -785,7 +786,7 @@ # ------------------------- sub saveTopicText { - my( $web, $topic, $text, $ignorePermissions, $dontNotify ) = @_; + my( $web, $topic, $text, $ignorePermissions, $dontNotify, $forceNewRevision ) = @_; my( $mirrorSite, $mirrorViewURL ) = TWiki::readOnlyMirrorWeb( $web ); return TWiki::getOopsUrl( $web, $topic, "oopsmirror", $mirrorSite, $mirrorViewURL ) if( $mirrorSite ); @@ -807,7 +808,7 @@ $meta->copyFrom( $oldMeta, "FILEATTACHMENT" ); # save topic - my $error = TWiki::Store::saveTopic( $web, $topic, $text, $meta, "", 0, $dontNotify ); + my $error = TWiki::Store::saveTopic( $web, $topic, $text, $meta, "", 0, $dontNotify, my $dontLogSave = '', my $forceDate = '', $forceNewRevision ); return TWiki::getOopsUrl( $web, $topic, "oopssaveerr", $error ) if( $error ); return ""; } diff -ru twiki/lib/TWiki/Store.pm twiki.forcenewrevision/lib/TWiki/Store.pm --- twiki/lib/TWiki/Store.pm Thu Jul 22 04:43:40 2004 +++ twiki.forcenewrevision/lib/TWiki/Store.pm Wed Sep 15 00:07:53 2004 @@ -667,7 +667,7 @@ =pod ----++ sub saveTopicNew ( $web, $topic, $text, $metaData, $saveCmd, $doUnlock, $dontNotify, $dontLogSave ) +---++ sub saveTopicNew ( $web, $topic, $text, $metaData, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceNewRevision ) Not yet documented. @@ -675,16 +675,16 @@ sub saveTopicNew { - my( $web, $topic, $text, $metaData, $saveCmd, $doUnlock, $dontNotify, $dontLogSave ) = @_; + my( $web, $topic, $text, $metaData, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceNewRevision ) = @_; my $attachment = ""; my $meta = TWiki::Meta->new(); $meta->readArray( @$metaData ); - saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify ); + saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $forceNewRevision ); } =pod ----++ sub saveTopic ( $web, $topic, $text, $meta, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceDate ) +---++ sub saveTopic ( $web, $topic, $text, $meta, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceDate, $forceNewRevision ) Not yet documented. @@ -692,7 +692,7 @@ sub saveTopic { - my( $web, $topic, $text, $meta, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceDate ) = @_; + my( $web, $topic, $text, $meta, $saveCmd, $doUnlock, $dontNotify, $dontLogSave, $forceDate, $forceNewRevision ) = @_; my $attachment = ""; my $comment = ""; @@ -702,7 +702,7 @@ $meta = TWiki::Meta->remove(); # remove all meta data $text = $meta->read( $text ); # restore meta data - my $error = saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $comment, $forceDate ); + my $error = saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $comment, $forceDate, $forceNewRevision ); $text = $meta->write( $text ); # add meta data for Plugin callback TWiki::Plugins::afterSaveHandler( $text, $topic, $web, $error ); return $error; @@ -743,7 +743,7 @@ =pod ----++ sub save ( $web, $topic, $text, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate ) +---++ sub save ( $web, $topic, $text, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate, $forceNewRevision ) Not yet documented. @@ -751,13 +751,13 @@ sub save { - my( $web, $topic, $text, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate ) = @_; + my( $web, $topic, $text, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate, $forceNewRevision ) = @_; # FIXME get rid of this routine my $meta = TWiki::Meta->new(); - return saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate ); + return saveNew( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate, $forceNewRevision ); } @@ -785,7 +785,7 @@ =pod ----++ sub saveNew ( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate ) +---++ sub saveNew ( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate, $forceNewRevision ) Return non-null string if there is an (RCS) error.
FIXME: does rev info from meta work if user saves a topic with no change? @@ -794,7 +794,7 @@ sub saveNew { - my( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate ) = @_; + my( $web, $topic, $text, $meta, $saveCmd, $attachment, $dontLogSave, $doUnlock, $dontNotify, $theComment, $forceDate, $forceNewRevision ) = @_; my $time = time(); my $tmp = ""; my $rcsError = ""; @@ -831,7 +831,7 @@ my $mtime2 = time(); # how close time stamp of existing file to now? - if( abs( $mtime2 - $mtime1 ) < $TWiki::editLockTime ) { + if( ( abs( $mtime2 - $mtime1 ) < $TWiki::editLockTime ) && !$forceNewRevision ) { # FIXME no previous topic? my( $date, $user ) = getRevisionInfo( $web, $topic, $currentRev, $attachment, $topicHandler ); # TWiki::writeDebug( "Store::save date = $date" ); diff -ru twiki/lib/TWiki/UI/Preview.pm twiki.forcenewrevision/lib/TWiki/UI/Preview.pm --- twiki/lib/TWiki/UI/Preview.pm Sat May 29 02:51:35 2004 +++ twiki.forcenewrevision/lib/TWiki/UI/Preview.pm Wed Sep 15 00:08:58 2004 @@ -25,6 +25,7 @@ my $skin = $query->param( "skin" ); my $changeform = $query->param( 'submitChangeForm' ) || ""; my $dontNotify = $query->param( "dontnotify" ) || ""; + my $forceNewRevision = $query->param( "forcenewrevision" ) || ""; my $saveCmd = $query->param( "cmd" ) || ""; my $theParent = $query->param( 'topicparent' ) || ""; my $formTemplate = $query->param( "formtemplate" ); @@ -56,6 +57,8 @@ # get view template, standard view or a view with a different skin $tmpl = &TWiki::Store::readTemplate( "preview", $skin ); $tmpl =~ s/%DONTNOTIFY%/$dontNotify/go; + $tmpl =~ s/%FORCENEWREVISIONCHECKBOX%/checked="checked"/go if $forceNewRevision; + if( $saveCmd ) { return unless TWiki::UI::userIsAdmin( $webName, $topic, $wikiUserName ); $tmpl =~ s/\(preview\)/\(preview cmd=$saveCmd\)/go; diff -ru twiki/lib/TWiki/UI/Save.pm twiki.forcenewrevision/lib/TWiki/UI/Save.pm --- twiki/lib/TWiki/UI/Save.pm Sun Aug 8 08:58:08 2004 +++ twiki.forcenewrevision/lib/TWiki/UI/Save.pm Wed Sep 15 00:10:19 2004 @@ -41,6 +41,7 @@ | =text= | target text for the topic | | =unlock= | if defined, unlock the written topic | | =dontnotify= | if defined, suppress change notification | +| =forcenewrevision= | if defined, force a new (rcs) revision, even if the edit lock time hasn't expired | | =submitChangeForm= | | | =topicparent= | | | =formtemplate= | if define, use the named template for the form | @@ -74,6 +75,7 @@ my $unlock = $query->param( "unlock" ) || ""; my $dontNotify = $query->param( "dontnotify" ) || ""; + my $forceNewRevision = $query->param( "forcenewrevision" ) || ""; my $changeform = $query->param( 'submitChangeForm' ) || ""; my $theParent = $query->param( 'topicparent' ) || ""; my $formTemplate = $query->param( "formtemplate" ); @@ -138,7 +140,7 @@ $text = TWiki::Prefs::updateSetFromForm( $meta, $text ); } - my $error = TWiki::Store::saveTopic( $webName, $topic, $text, $meta, $saveCmd, $unlock, $dontNotify ); + my $error = TWiki::Store::saveTopic( $webName, $topic, $text, $meta, $saveCmd, $unlock, $dontNotify, my $dontLogSave="", my $forceDate="", $forceNewRevision ); if( $error ) { TWiki::UI::oops( $webName, $topic, "saveerr", $error ); return 0; diff -ru twiki/templates/edit.pattern.tmpl twiki.forcenewrevision/templates/edit.pattern.tmpl --- twiki/templates/edit.pattern.tmpl Wed Sep 15 00:13:04 2004 +++ twiki.forcenewrevision/templates/edit.pattern.tmpl Tue Sep 14 23:28:00 2004 @@ -134,6 +134,7 @@  
  help
+   help
  help
  diff -ru twiki/templates/preview.pattern.tmpl twiki.forcenewrevision/templates/preview.pattern.tmpl --- twiki/templates/preview.pattern.tmpl Wed Aug 25 02:36:16 2004 +++ twiki.forcenewrevision/templates/preview.pattern.tmpl Tue Sep 14 23:28:48 2004 @@ -49,6 +49,7 @@
  help
+   help
  help