PMWikiDraw

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


Goal

Please note PMWikiDraw is no longer being developed for PmWiki1. Please see the cookbook for PmWiki2 in order to see the latest version of PMWikiDraw

Provide a mechanism for quick diagrams to be shared amongst a team within the wiki environment. Allowing rapid editing of the diagram in-situ.

Solution

TWiki already has a good solution to this problem in the form of their TWikiDrawPlugin rather than re-invent the wheel, this plugin could be ported to the PmWiki environment.

Discussion

It should be noted that this code was originally written for the TWiki project and as such is subject to any Copyright that is held by them please see below for the relevant copyright notices.

You should be aware you could cause harm to your current PmWiki installation if you follow these procedures.

Any questions should be directed to ciaranj@gmail.com

Setup & Installation

  1. Download the following file, it contains all you need.
  1. You can now extract this zip file directly into the pmwiki folder, however if you're using a non-standard configuration, then please follow the following steps:
    1. Extract these files to somewhere safe.
    2. Place the .jar file into a subdirectory 'drawing' underneath your current public directory. For my configuration my public directory is 'pub' underneath the pmwiki folder on the webserver.
    3. Place the pmwikidraw.php file into the 'local' configuration folder.
  2. Open up config.php
  • Add include_once("local/pmwikidraw.php");
  1. In order to stop the postUpload action from forwarding the stream back to the original page (the normal behaviour when uploading manually) we need to override this.
  • To do this we need to modify the behaviour of the post-load action so that it does not redirect if a parameter 'noredirect' is given.
Therefore in the uploads.php file within the scripts directory replace
 
     Redirect($pagename,
       '$PageUrl?action=upload&upname='.urlencode($UploadName)."&$result");

with
  
     $noredirect ="";
     $noredirect = @$_POST['noredirect'];
     if($noredirect == "" || !isset($noredirect)) {
       Redirect($pagename,
         '$PageUrl?action=upload&upname='.urlencode($UploadName)."&$result");
     }

These lines should be found at the end of the HandlePostUpload function.

If you're *very* lucky you should now be able to embed [[Drawing:fish]] where fish is the name of your choice in your pages and you will see a 'Create Image' link, click this to be taken to the image editor. After you've saved your first image the 'Create Image' link will be replaced by this image and click the image to edit it again :)

When it asks you for a password, this password is the password you have set in your usual PmWiki upload attribute passwords for that particular page.

Good luck :) And please let me know how you get on.

To-Do

  • Provide width/height attributes.
  • Provide ability to 'inline' applet.

Bugs/Known Issues/Features

PmWikiDrawBugsAndFeatures

Demo system

Have a look at the sandbox over on my site: http://www.wombatinvasion.com/pmwiki/pmwiki.php/Main.WikiSandbox

Source code

The sourcecode is available here http://www.wombatinvasion.com/files/PmWikiDraw_src.zip

Comments

Any comments, anybody ? :)

Copyright

  • PMWikiDraw is very very closely based on TWikiDrawPlugin for what limited modifications I have made, I guess I hold the copyright on 2004, Ciaran Jessup (ciaranj@gmailPlEASEDONTSPAMME.com)
  • TWikiDrawPlugin is based on Erich Gamma's JHotDraw 5.1. (JHotDraw is copyright 1996, 1997 by IFA Informatik and Erich Gamma, erich_gamma@acmSTOPSPAM.org . It is hereby granted that this software can be used, copied, modified, and distributed without fee provided that this copyright notice appears in all copies. )
  • TWikiDrawPlugin uses ACME Labs' GifEncoder to convert a drawing into a GIF file format. (GifEncoder is Copyright ©1996,1998 by Jef Poskanzer, jef@acmeSTOPSPAM.com . All rights reserved. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. )
  • TWikiDrawPlugin uses some ideas of KmWiki drawing applet.
  • Copyright 2000 by Peter Thoeny, Peter@ThoenySTOPSPAM.com. It is hereby granted that this software can be used, copied, modified, and distributed without fee provided that this copyright notice appears in all copies.
  • Modifications Copyright © 2001 Motorola. All Rights Reserved.
  • Modifications © 2003-2004 Copyright Crawford Currie http://www.c-dot.co.uk

pmwiki-2.2.143 -- Last modified by {{wolle}}?

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