ConcurrentEditing

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Description

This module changes the way PmWiki handles concurrent or simultaneous editing of wiki pages. It checks whether a page has been changed by other authors while somebody was editing it and allows that user to accept or decline unexpected changes.

Installation

Simply copy concur-041029.php as concur.php into the 'local/' subdirectory or some other suitable place and then add the following line to your local/config.php:

    include_once('local/concur.php');

Note that this module replaces standard 'edit' action, what may lead to problems with other modules which do the same thing.

It is recommended to add following lines into your skin .css-file:

    #concurrent { border: 1px dotted gray; margin-top: 5px; margin-bottom: 5px; }
    #concurrent .concurtitle { background: #F0F0F0; display: block; font-size: x-small; }

Usage

Under normal editing, you won't notice any changes from the standard 'edit' action. Concurrent editing typically occurs very rarely, except in some Intranet applications. However, if someone else has made changes to the page since you began editing it, the edit process will be different.

Firstly, after pressing the 'Save' button, you'll notice that you're still in the edit mode. A message will be presented to you indicated that page text has been changed. And the worst - your text will be all messed up :)

But don't panic. The markup you see added to the page text is designed to prevent any damage to either version of the page. Both versions are merged into one and marked by visible separators. At this point you need to remember what you have done to the original text and what you have not.

There are three types of markup. The first is for added text:

    -ce-a---------------------------------- added:
    This text was written by you or existed originally.
    -ce-f-----------------------------------------

That means that you submitted text that wasn't in the page version that another person had submitted. There are two possibilities:

  • You have added this text to the original page. Then you would probably want this text to remain in the final version.
  • Some evil person had removed this text while you were typing yours. There's a chance that it must not appear in final version. Delete it.

After reviewing a fragment and probably deleting inner text, separators should be deleted also. They take the whole line, so the deletion procedure should not be too hard. If you leave separators in the final version (for example, when you click 'Save' button twice, ignoring the warning message), somebody else may finish fixing the page later.

There are two other markups that the merge function produces. Let's review what can cause them:

    -ce-a-------------------------------- deleted:
    %color=red%This text may have been written by someone else!
    -ce-f-----------------------------------------
  • Some good person spent the whole 30 seconds to make up the paragraph or two, and you haven't. Society will probably suffer if you will delete this piece of text. Leave it.
  • You deleted this text. Delete it again.
    -ce-c--------------------------- changed from:
    This text is not yet modified.
    -ce-t------------------------------------- to:
    This text has now been modified.
    -ce-f-----------------------------------------
  • You have changed the original page text, probably fixing typos and grammar. You probably need to leave the text between ce-t and ce-f separators.
  • Somebody did the same, but you didn't, so you should leave the text between ce-c and ce-t and delete the rest.

Configuration

There is not much to configure. Actually you can't change anything but i18n strings and two variables that don't really need tuning.

Variables

$MergeLineWidth
Length of service lines added to merged text output.
$ConcurrentEditFmt
Informational message that is displayed when a concurrent editing has occured.

Internationalization

Several strings in default values are made i18nable, and some of those strings interfer with the standard ones. I think this is not critical because the meaning is the same. The strings are:

  • The page text has been changed while you were editing it.
  • added:
  • deleted:
  • changed from:
  • to:

History

Oct 29, 2004

  • original version.

Comments & Bugs

It'd be great to have variables for the markup that appears, so the rather cryptic tags (e.g. ce-t) could be easily changed to something friendlier. Thanks for writing this, though!

Author

I'm Ilya Zverev, you can mail to zverik at int.spb.ru if you are experiencing problems with this script. I'm also subscribed to Pmwiki-users list: use it if you think that the question (and the answer) may be interesting to others. pmwiki-2.3.38 -- Last modified by {{Ben}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons