Contents
Short description
Add support for the JHotDraw / AnyWikiDraw graphical editor as replacement for the outdated TWikiDraw and name it MoinMoinWikiDraw.
Requirements / Problems
At the moment it seems as if the download on hg.moinmo.in/moin/1.8-svgdraw-jmeier only works with Java 1.6 aka 6.
- You should enable WSGI support on your webserver. This reduces loading and saving time of the applet a lot. I'm pretty sure that this also will work for TWikiDraw.
Bugs
the MoinMoin selection plugin "fckplugin.js" for the GUI editor (FCKeditor) has a problem where it runs in an endless loop in the Internet Explorer. I inserted a timeout which will break after a lot of tries. This workaround seems to work now but isn't beautiful. Seems to be a problem also with TWikiDraw.
the JAVA applet doesn't run under Java Runtime Engine V1.5.0 on Linux. I don't understand why. I always get an exception "ClassNotFoundException".
Sometimes the JAVA applet is slowly running out of memory. This can manually be fixed by starting the garbage collector of Java in the Java console <pressing the key 'g'>. But I will have a look for a fix also.
News
2009-09-02:
Reimar's anywikidraw.py works "out of the box" with the demo AnyWikiDrawForTWiki.jar distributed in the official release of AnyWikiDraw !!! So almost no Java code changes are necessary to get the applet to work with MoinMoin 1.9. As I tried it on Ubuntu I even didn't saw the applet searching for language files which caused so much net traffic and increased startup time. Don't now why but most important: AnyWikiDraw now works with MoinMoin 1.9 !!!!!!2009-09-01:
I'm preparing a distributable package which can be built with Ant. Thus I'm no Linux expert I didn't know that the original distribution of AnyWikiDraw - which was built with the open source NetBeans IDE - already uses Ant build scripts So I have to do nothing but to upload the original distribution of AnyWikiDraw and my modified version for MoinMoin to my online repository. But hey: everything bad has something good in it: Now I have the experience of set up a Ubuntu linux on my own and compiled AnyWikiDraw on it. Ubuntu is cool. Try itCool! Please look into your mail
please see http://hg.moinmo.in/moin/1.9/file/tip/contrib/AnyWikiDraw and it would be nice the filestructure could be compatible to that
anywikidraw plugin at http://hg.moinmo.in/moin/1.9/file/tip/MoinMoin/action/anywikidraw.py
2009-08-26:
I'm in mail contact with the developer of JHotDraw7 and AnyWikiDraw. He will add MoinMoin support to AnyWikiDraw in the next weeks. So we can add the whole package to the MoinMoin distribution if we want. I'm adding AnyWikiDraw support also to the 1.9 in the repo.2009-08-19:
Improved startup time of the MoinMoinDraw applet. I changed the handling of the language files. Instead of calling "ResourceBundle" every time I have a Hash table now where I store the locations of the language files. So "ResourceBundle" must not search for them by always sending HTTP requests to the server.
Sliders for transparent colors only seem to work with Java Runtime Engine 1.6.0. Another reason for not using the old 1.5.0
2009-08-18:
Fixed a bug in MoinFCKeditor/Selection/FCKplugin.js. Internet Explorer had a problem if you edited a page containing a TWikiDraw or MoinMoinWikiDraw image
Samples
The alpha version is working now. Please have a look at: http://hg.moinmo.in/moin/1.8-svgdraw-jmeier/
Look at this demo: Demo of a JHotDraw application for SVG <- Java Applet (accept the dialog which pops up)
Can be extended a lot. Look at the screenshots on the sourceforge project site.
Here are a few screenshots of the MoinMoin implementation:
Click on an object once to see, if it has a yellow handle for special features like here: you can change the edges of the rect:
Click on an object twice (no double click!), and if it get's pink, you can resize and rotate it by grabbing the pink dots:
Workflow for using MoinMoinDraw in MoinMoin
users should be able to include MoinMoinWikiDraw to their pages with the help of a macro.
- This macro could also be handled by the GUI editor.
- the macro is connected to a SVG image (XML content) which is located in the attachments of that or a different page.
- a PNG preview picture is shown on the location of the macro in the page. If there is no previsously editet image, the PNG shows a white background.
- the PNG picture is surounded with a html link. If the picture gets clicked by the user, the html link will reload the page and instead of showing the PNG it will start the JHotDraw image editor applet.
- JHotDraw applet will be shown in place of the macro and loads the SVG image if there is already one.
- User draws images and also image maps.
- after pressing the "sichern" / "save" buttton, three files are stored in the attachment location: the SVG file, a PNG file which was rendered out of the SVG (needed if a browser can't handle SVG images) and a MAP file which contains information for the image map.
- after pressing the "save" button also the html page will be reloaded by the applet. but instead of the applet the (new) PNG image will be shown again.
Steps for implementing the feature "MoinMoinWikiDraw editor"
change the file AttachFile.py in the MoinMoin framework so it will send the MoinMoinWikiDraw applet instead of TWikiDraw
extend the AnyWikiDraw applet for use in MoinMoin
MoinMoinWikiDraw images can coexist with TWikiDraw images. If a SVG image is found on a page, it's handling should be similar to a TWikiDraw drawing.
the finished Java applet should reload the current html page after saving the modified SVG image back to moinmoin and show the rendered PNG picture instead the applet again.
the MoinMoinWikiDraw should show a PNG picture which has an edit icon left over it. A click on this icon should load the MoinMoinWikiDraw applet after that.
- you can be rather sure that there will be a feature request for an option to hide that icon if you keep it that way
- I would suggest you keep it the same way as the old twikidraw does it in moin: just have some kind of clickable border to start editing
a klickable "border" is not optimal if you want to use image maps. I will automatically handle the edit icon with JavaScript in one of the next releases [JosefMeier: 2009-08-19]
the MoinMoinWikiDraw PNG image should have in addition to the edit icon an icon, which shows if the image contains an image map. So the user knows that he can klick on the pictures. If you don't have an image map indicator icon the user might miss the links hidden in the image.
- all unexperienced moin users / visitors maybe won't recognize the meaning of such a "map indicator". But I think if your image is klickable, there usually should be some text telling this and that's far easier than the indicator.
- revision control of old images
If you want to have that, please DON'T hack that into 1.8/1.9 (AttachFile is already ugly enough and it would make just additional work for the 2.0 migration), but just help us with 2.0 and do it there.
- Insert SVG through GUI editor
How to use it?
In text mode (GUI editor not supported yet) add this code:
{{drawingsvg:<name of your picture without the extension>}} Example: {{drawingsvg:MyPic}}
Save your page. Then click on the attachment image. On the Attachment page should the new Java applet be loaded. Edit graphics, save it. Then you will be redirected to your page. There is a PNG version of the graphics. At the top left site over the graphics there is a edit button. Klick it to edit the graphics.
Cool. Isn't it ?
Yeah, definitely! I like it, it is much more powerful than the old twikidraw and .svg output is definitely better than that proprietary .draw. -- ThomasWaldmann 2009-08-17 11:48:22
Background
JHotDraw is a rich framework for graphical editors. There is also a project which adapts JHotDraw for usage in Wikis called AnyWikiDraw.The MoinMoin version of AnyWikiDraw is called MoinMoinWikiDraw.
JHotDraw's current version is 7.2. It's open source and hosted on Sourceforge. One of the programmers was Erich Gamma, the design pattern pope.
BTW: TWikiDraw (current graphical editor for MoinMoin) is based on an old version of HotDraw which is an antecessor of JHotDraw.
Confused? -> HotDraw (old) -> TWikiDraw (old MoinMoin image editor) -> JHotDraw (completely recoded version of HotDraw) -> AnyWikiDraw (modified version of JHotDraw for use in Wikis) -> MoinMoinWikiDraw (modified version of AnyWikiDraw)
License
You can license JHotDraw 7 under the {Lesser GNU Public License (LGPL)} or under the {Creative Commons Attribution (by) 3.0} license.
Discussion
In future Moin versions, attachments and wikipages will be roughly the same (if I have understand this correctly): they are just items. It is very nice, that AnyWikiDraw allows for the editing of svg, png, and also jpg files. Maybe it would be a nice idea to think of some more generic approach of dealing with the editing of items. To edit a wiki page, you just click "edit" in the menu bar. Maybe if you view an item's page (e.g. an image such as http://moinmo.in/FeatureRequests/BetterControlOverIncludedImages/HelpOnInsertingImages?action=AttachFile&do=view&target=link-info.png) and you click "edit" in the menu bar, AnyWikiDraw is launched. So what I want to say is besides having different items and viewing/showing them depending on the mime-type in the browser, there might be also maybe a more basic approach for "editing" of items in Moin. But I am not "up to date" with the latest development going on at http://hg.moinmo.in.de . -- OliverSiemoneit 2009-08-14 18:47:12
It is intended exactly like that. -- ThomasWaldmann 2009-08-16 00:02:02
At the moment I automatically add an edit button on the top left of each picture. A click on this edit button starts the image editor applet also in the case when a big image map lays over the picture. But as Thomas Waldmann wrote, some users couldn't be happy with this solution. Would it better to send a text instead of the icon? In my opinion the "edit button / edit text" should be separated from the picture just for this image map case. -- JosefMeier 2009-08-26 20:27:23
I think AnyWikiDraw should be implemented as action. So that we can call it by current action macro e.g. <<Action(AnyWikiDraw,target=test.svg)>> and later on by link syntax. Afterwards it should be made configurable what action is called for creating an svg file by the drawing markup. -- ReimarBauer 2009-08-27 05:27:26
CHANGES (http://hg.moinmo.in/moin/1.9/file/tip/docs/CHANGES)
- new config variable drawing_action for selecting a action for drawings
- the drawing applet of TWikiDraw refactored to an action.
AnyWikiDraw applet and source added and a new drawing action anywikidraw
AnyWikiDraw
- TWikiDraw
twikidraw plugin at http://hg.moinmo.in/moin/1.9/file/tip/MoinMoin/action/twikidraw.py
SvgEdit (in preparation)
svg-edit in preparation at http://hg.moinmo.in/moin/extensions/file/tip/data/plugin/action/SvgEditor.py
I investigate next a converter for draw to svg.
This anywikidraw feature needs a help page on http://master19.moinmo.in. -- ReimarBauer 2009-09-06 09:23:49