[Pmwiki-users] Re: Re: PmWikiDraw and multiple editors?

Ciaran ciaranj
Fri Dec 17 00:18:52 CST 2004


Sorry for my delay in responding this issue takes considerable time to
think about ;)

On Thu, 16 Dec 2004 14:48:38 +0100, chr at home.se <chr at home.se> wrote:
> On Thu, 16 Dec 2004, Ciaran wrote:
> 
> > In PmWiki2 its somewhat better, the changes are merged.
> 
> I'd say it is *much* better in PmWiki 2. Not only are you informed that
> someone else edited and saved the page while you were working on it, you
> are also immediately shown what they did. In addition, the system is
> supposed to automatically merge the changes so that you don't have to do
> anything manually... this is the theory anyway, I haven't had any
> experience with it yet.
> 
> > I'm not convinced that there is *any* way with the current uploads
> > interface I can achieve similar behaviour.
> 
> Well, I think we basically only need something in pmwiki that returns a
> timestamp that says when a file was 'last modified'. This can then be used
> to determine if someone else has saved the drawing while you were editing
> it. If no one else has edited it, pmwikidraw can go ahead and upload the
> file.
Rather than modify PmWiki to provide timestamps, Could I not get away
with adding a Drawing 'Iteration/Change No./Revision Id' to the
drawing file.  Which is automatically incremented each time a drawing
is saved ? So slightly modifying your previous steps:
1 The user clicks on an edit link and DRAW (=PmWikiDraw) starts.
2 DRAW downloads the drawing, and notes its revision id.
3 The user modifies the drawing and presses save.
4 DRAW begins to re-download the drawing from the server.  Just to
check its current revision id.
5 If the revision id is the same as it was when it originally
downloaded the drawing then it uploads the new drawing.
6 If the revision id is different.  Draw notes this revision id. Then
DRAW presents the user with a panel displaying their current drawing,
and the drawing currently on the server and informs them that it has
changed since they began drawing, so they can drag/drop/modify their
current drawing to take into account these changes.
7. The user modifies their drawing to take into account any changes
and re-submits the drawing, which takes us back to step 4 this time
comparing the id against the one we saw most recently on the server. 
If it hasn't changed then we finally upload the drawing.

Now, I'm *fully* aware that without a lock in place it's possible that
someone else could upload between step 4+5 and 6+7 and lose their
changes, but I really can't see how we can  have an 'automatic' lock
concept without modifying pmwiki in someway, which to be honest  is
one of my primary goals:  to have a drop and run PmWikiDraw, no
modifications to PmWiki required (other than including the relevant
script) .... Pm May well have some ideas about this [hopefully]



> 
> Here's one way it could work, the process below could definitely be
> improved though:
> * The user clicks on an edit link and DRAW (=PmWikiDraw) starts.
> * DRAW retrieves the drawing's timestamp (through some extra mechanism)
> * DRAW downloads the drawing
> * DRAW retrieves the drawing's timestamp again, to verify it is
>   unchanged compared to when you started downloading it.
> * The user modifies the drawing and press the save button
> * DRAW asks for a temporary lock (one that'll automatically vanish within
>   a minute or so)
> * DRAW retrieves the timpstamp and compares it to the old timestamp:
> ** If the timestamp is different, this means someone else has saved
>    a new version of the drawing. => Go ask the user for what to do.
> ** If the timestamp is the same, DRAW goes ahead and uploads the changes,
> * DRAW releases the lock
> 
> The extra mechanisms that'd be needed in PmWiki here are:
> * Retrieve timestamp of an uploaded file => requires adding an action
> * Be able to create a lock with an automatic timeout => requires adding a
>   modified upload mechanism that only uploads if so allowed by the lock
> 
> > The best I hope to offer is the version history, which would enable a
> > user to see there were multiple changes made.
> 
> Eh.. how could you detect this?

> 
> > I can't see Pm modifying PmWiki to allow for this requirement but if you
> > both want to discuss it and come up with a way in which PmWikiDraw can
> > use it, then I'm happy to spend some time (and believe me it will take a
> > fair amount of effort) to get it working.  And a change like this would
> > definately break backwards compatibility!
> 
> In my experience Patrick allows most anything to go into cookbooks... I've
> written my own extended upload version for instance (I wanted a directory
> structure). So I don't think that'd be a major problem.
> 
> Time/effort is a problem of course... my suggestion is that we initially
> just discuss what we'd like, possibly specifying different solutions such
> as:
> * Version history
We will get this, most of the code is in place for this, I just
haven't gotten around to it, in a similar fashion to page history. 
The user will see a 'list' of all the previous drawings that have been
saved, and have a mechanism to 'restore' that drawing.

> * Detection of multiple editing
??

> * Automatic merging
It is my *opinion* that this task is close to impossible.  It is
merely difficult ensuring that two merged drawings are *valid* in the
sense of the file format, but it is a whole different level of
complexity ensuring that the meaning i.e. appearance of the final
merged file makes sense in respect to the original drawings.  If
someone would like to spend some time figuring this one out, then I
would happily integrate their algorithm and set it up so the 'merged'
drawing was presented to the user to ascertain if this was 'good
enough'.  But automating it I think would successfully destroy both
images, rather than just the unluck first saver <g>


> 
> Btw... would it be possible to use a wiki page as the source of a drawing?
> That way maybe we could take advantage of existing solutions?
Not really no, it could do I guess but that would rather break the
current implementation as it would have to extract the file from the
page and write it back, they're not wonderfully nice to look at, and
they cannot just be merged in the same way as blocks of text as the
drawing expects a certain structure :) Sorry

- Ciaran
> 
> /Christian
> 
> --
> Christian Ridderstr?m, +46-8-768 39 44               http://www.md.kth.se/~chr
> 
> --
> Pmwiki-users mailing list
> Pmwiki-users at pmichaud.com
> http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com
> 


-- 
- Ciaran



More information about the pmwiki-users mailing list