jDraw

jDraw is a plug-in for DokuWiki. It allows to create and edit diagrams in a web browser and embed them to DokuWiki pages. jDraw also provides an off-line diagram editor with diagram file format compatible with the on-line editor.

License

Free for non-commercial use.

Release date

2010/06/16

Requirements

jDraw is an applet. It was tested in FireFox 3.6 with Java 6 and DokuWiki 2009-12-25c.

Resources and downloads

Download and Installation

Download and install the plugin using the Plugin Manager and the URL (http://www.hammurapi.com/products/jdraw/jdraw.zip) given above.

You should manually add mxe text/xml to mime.conf file.

The applet attempts to download some resources dynamically. Therefore, the applet codebase is set /somenonexistingcodebase because the web server must return proper error code for the applet to work correctly. If this attribute is not set, codebase defaults to page location. In this case DokuWiki returns “Page does not exist” with status code 200 and the applet fails.

If your server doesn't return proper error codes for non-existing resources but rather some customized pages, you should configure some URL on the server to return proper error codes and point applet's codebase to that location.

Syntax and Usage

DokuWiki Syntax:

{{jdraw>[namespace:]name}}

Examples:

{{jdraw>mynamespace:mydiagram}}
{{jdraw>mydiagram}}

For users with appropriate privileges a little [Edit] box appears next to the diagram image1).

  • Click on Edit opens a new window/tab with the diagram editor applet.
  • Create a diagram in the applet and click “Save”, scale it appropriately before saving.
  • Refresh the page with the diagram to see changes.
  • When you are done editing - close the editor window/tab.

To prevent displaying of the diagram Edit button to unauthorized users, disable page caching by adding ~~NOCACHE~~ directive to the page.

Demos

  • Diagram editing - Coming soon.

How it works

The plug-in operates with two files in the media directory - <diagram name>.mxe file is the diagram file and <diagram name>.gif is the diagram image.

Currently the plug-in does not auto-refresh the page with diagram upon diagram saving - you should do it manually (F5).

The diagram below demonstrates how jDraw works. The diagram was created with jDraw.  [diagram]

Diagram size

The plug-in generates diagram image on save of the same size as it appears on screen. To change size of diagram images, scale diagram in the editor to appropriate size before saving.

DokuWiki permissions

The [Edit] button is available to users with Delete permission.

Applet permissions

Although applet jars are signed, for some reason some permissions shall be explicitly granted.

Proxy

The plug-in works through proxy if you grant

  • NetPermission (java.net.NetPermission), with target getProxySelector
  • SocketPermission with the target of your proxy server and port and actions connect, resolve to <dokuwiki host>/<dokuwiki path>/lib/plugins/jdraw/lib//- 2) codebase with Java policytool.

Other permissions

On Java 6 update 20 the plug-in requires granting java.awt.AWTPermission accessClipboard. Some users reported Java.Security AccessControlException:access denied (java.lang.RuntimePermission accessDeclaredMembers). The solution, if you get a security exception, open policy tool and grant required permission. Some exceptions don't show up in error dialogs. If you think the applet doesn't work as it should - open Java Console and look for exceptions.

Off-line editor

You can use off-line editor to create mxe and gif files and then upload these files to your Wiki with the Media Manager. After that you can include {{jdraw>...}} tag in you pages referencing the files and edit them in the applet. You can also download mxe file created by the applet, edit it in the offline editor and then upload the mxe file and image (gif) file to Wiki.

Installation

There are two ways to install and use the offline editor

Java Web Start

Manual installation

  • Download the zip file.
  • Extract the zip.
  • Execute jgrahpx-examples.jar from the lib folder by either double-clicking it or using java -jar jgraphx-examples.jar command line.

TO-DO List

  • Auto-refresh of the page with diagram upon saving the diagram.
  • Save & Close action in the applet.
  • Namespace resolution. Currently the plug-in uses absolute namespaces and if namespace is not set, then files are stored in the root namespace. This behavior shall be changed to be compatible with the image syntax.
  • Pasting of images (e.g. screenshots) from the system clipboard into diagrams. The applet shall be granted proper permissions. Code snippets.
  • If user has edit privileges, then either the diagram image shall link to the .mxe file, or there should be a button “Download MXE” next to Edit.
  • Indented serialization of MXE files - to simplify diff-ing of diagrams.
  • Check for authorization in jdraw.php to prevent possibility of editing using direct links.
1) Initially there is no image, but a word [diagram] instead
2) e.g. http://doc.hammurapi.com/dokuwiki/lib/plugins/jdraw/lib/-
Last modified: 2010/07/08 15:21 by Pavel Vlasov
   
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Locations of visitors to this page
Hammurapi Group