Extension talk:AnyWikiDraw

Alignment of Images
Awesome tool - I really like it.

Please consider the following wishes/ideas for future enhancements: --Jorgo 13:29, 23 July 2009 (UTC)
 * Add alignment option (right left center) as typical Image:Link would do. My workaround is to frame the #drawing-tag with div-container and float-style.
 * Add display option as thumbnail.
 * Add option or guide to edit picture on Image:page With this, the wiki pages would not be disturbed by the frame and "edit"-link (using Image:link instead) but editing is still possible on the Image:page.


 * Hi Jorgo. These are excellent suggestions. I will consider them for future updates of AnyWikiDraw.
 * --Rawcoder 07:49, 1 August 2009 (UTC)

Image Embedding with original aspect ratio
Greetings: Additional ideas for further releases from Jorgo ...

When embedding clipart as bitmaps, I'd like to This would be an excellent solution for commenting bitmaps in SVG files with graphical objects.
 * embed in original pixel size
 * preserve the aspect ratio from original bitmap
 * zoom with preserved aspect ratio

--Jorgo 12:45, 11 September 2009 (UTC)


 * For AnyWikiDraw 0.14 I have added the following actions to the popup menu: "Set to image size", "Adjust height to image aspect", "Adjust width to image aspect". These actions are shown, when the popup menu is opened over a bitmap image which does not have its original size. I hope this does the trick. I will add support for scaling with preserved aspect ratio in a future release.
 * --Rawcoder 12:49, 21 October 2009 (UTC)

Unable to save images
After I edit images the changes are not saved, and new images are not created.

I'm using a fresh apt-get installed mediawiki in ubuntu — that is, mediawiki 1.13.3. I enabled image upload and imagemagick. I can successfully upload images. I have tried creating new svg's and jpg's, and editing existing jpg's; none can save changes. What step have I missed?


 * What error message do you get from the applet?
 * --Rawcoder 19:44, 5 August 2009 (UTC)
 * I don't get one as far as I can tell. Where should I be looking?207.241.137.115 20:09, 8 August 2009 (UTC)


 * Well. The applet should display a red error symbol and a message if it can not save the drawing. What exactly happens when you click the save button? Does the applet display a message that saving is in progress? What happens next?
 * --Rawcoder 08:16, 9 August 2009 (UTC)

I am also unable to save images. We are using mediawiki 1.15. I did install ImageMagick. When I try to save an SVG image, it says

Couldn't save the drawing: Upload address: /wiki/index.php/Special:AnyWikiDraw Error message: 403 Forbidden You are not allowed to change this drawing: badaccess-groups  Users, emailconfirmed 2  confirmedittext

Try Google Chrome seems like the java in it works. Also try IE. I had the same issue you have with Mozilla.

Alangley 18:57, 23 October 2009 (UTC)


 * In order to save a drawing, you need to be logged into your Wiki. Anonymous users usually don't have enough permissions to upload a file to the Wiki.
 * AnyWikiDraw shouldn't display the edit link, when a user is not logged in though. I will look into this for a future release of AnyWikiDraw.
 * --Rawcoder 06:15, 27 October 2009 (UTC)

403 Forbidden error, cause: undefined index "DrawingData"
I'm running Mediawiki 1.15.1. I've setup Batik to handle SVG since I'm running on Windows. I can create a drawing, edit it, but when I save it, I get a 403 Forbidden error, much like what Alangley sees. However, mine is throwing an error complaining about the "DrawingData" not being a defined index, which shows up in the error message returned.

In the code, it is referencing the array index 'DrawingData', but is not able to find it. This would be file "AnyWikiDraw.body.php".

function processUpload { global $wgRequest, $wgOut; // Fill in the form data as needed by the upload form $wgRequest->data['wpDestFile'] = $wgRequest->data['DrawingName']; $wgRequest->data['wpIgnoreWarning'] = '1'; $wgRequest->data['wpDestFileWarningAck'] ='1'; $wgRequest->data['wpUploadDescription'] = $wgRequest->data['UploadSummary']; $wgRequest->data['wpUploadFile'] = $wgRequest->data['DrawingData'];         <--- HERE --- $_FILES['wpUploadFile'] = $_FILES['DrawingData']; $wgRequest->data['action'] = $wgRequest->data['Action'];

So what reason would there be that the "DrawingData" index isn't being defined on the data array in the request? Could there be a problem with the Batik image converter setup? I'm able to upload images to my wiki, and I'm logged in as a user, so there's no security issue with image uploads. Let me know, thanks.

Hex2bit 15:05, 6 November 2009 (UTC)


 * Maybe the applet fails to encode the drawing data as an SVG file. I doubt that the Batik image converter has anything to do with it, because it comes only into play, after a drawing has been uploaded. Can you take a look at the Java console in your browser? Maybe there is an error message there which helps me fix this problem.
 * --Rawcoder 12:19, 11 November 2009 (UTC)


 * I just tried it again and now it's working... weird. I didn't change a thing.  Maybe some security element needed a PC restart, I don't know.  I had restarted IIS during testing, but that never fixed it.  If I see the error again in the future, I'll definitely check the Java console.
 * Hex2bit 22:53, 16 November 2009 (UTC)


 * Okay. Its good that it works now. Did you run the web-server and the browser on the same computer? In this case, it is not clear to me, where the problem was (on the server-side or on the client-side).
 * --Rawcoder 20:07, 17 November 2009 (UTC)

Breaks Special:SpecialPages
Seems odd to me, but when I had this extension active over many, many versions from SVN, I've been getting this error: "Fatal error: Cannot redeclare class SpecialUpload in /opt/local/apache2/htdocs/w/includes/specials/SpecialUpload.php on line 635") Niels Olson 01:30, 16 December 2009 (UTC)


 * Hi Nils. I am only testing AnyWikiDraw with releases of MediaWiki.
 * --Rawcoder 16:01, 16 January 2010 (UTC)

Broken in 1.16
An update to mediawiki trunk would be greatly appreciated --Alterego 04:40, 18 February 2010 (UTC)


 * Hi Alterego.
 * MediaWiki 1.16 is not released yet. I won't do fixes based on unstable code in the trunk.
 * --Rawcoder 22:20, 24 February 2010 (UTC)
 * Mediawiki trunk is not unstable. That is the code that is being run on Wikipedia, and that I run on my wikifarm, and that many other people run. We do not experience stability issues. ---Alterego 16:28, 29 May 2010 (UTC)


 * Ah, sorry. I meant unstable in a structural sense, meaning that API's can be changed at any time. --Rawcoder 15:16, 8 June 2010 (UTC)

Java Error.
When I click the edit button above an image, the Java app box says: Error. Click for details. This is in Firefox 3.6 for Windows. The output of the error is: Java Plug-in 1.6.0_17 Using JRE version 1.6.0_17-b04 Java HotSpot(TM) Client VM User home directory = C:\Users\spencer8ab

c:  clear console window f:  finalize objects on finalization queue g:  garbage collect h:  display this help message l:  dump classloader list m:  print memory usage o:  trigger logging q:  hide console r:  reload policy configuration s:  dump system and deployment properties t:  dump thread list v:  dump thread stack x:  clear classloader cache 0-5: set trace level to 

load: class org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class not found. java.lang.ClassNotFoundException: org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.ClassNotFoundException: org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class

I've also tested under Arch Linux and Opensuse, both also in firefox, I get the same result in both. I don't need java on the server, do I? The server currently just has gcj, I do have root access though, so I could install Java if I need too, I followed all of the installation steps, including setting up imagemagick. -- Spencer8ab 19:00, 18 March 2010 (UTC)
 * This is on mediawiki 1.15 by the way. -- Spencer8ab 19:04, 18 March 2010 (UTC)
 * It also doesn't show up on the Special:Version page, despite the drawing tag working, and a java app showing up. -- Spencer8ab 19:16, 18 March 2010 (UTC)


 * The error message indicates that either the file AnyWikiDrawForMediaWiki.jar is missing on your server, or the URL in the "archive" attribute of the applet tag is pointing to the wrong location. If you inspect the HTML code of the page after clicking at "Edit", you should see an applet tag with a "codebase" and an "archive" attribute, like this:


 * &lt;applet codebase="/" archive="/mediawiki-1.15.0/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar" ...


 * (Instead of "/mediawiki-1.15.0" there can be something else).


 * On my installation, the hook for "drawing" is listed under "Parser function hooks" of Special:Version page. AnyWikiDraw has a special page of its own. Try opening the page Special:AnyWikiDraw.


 * --Rawcoder 18:36, 26 May 2010 (UTC)

Created image links to failed page
Not sure where to report bugs / fixes - I found that after creating the page the image displayed fine but then clicking on the image caused problems. Fixed AnyWikiDraw.php by replacing links to ./Image: with index.php?title=Image:

not sure if this is the right way to do this as I'm not a MW expert but it seems to work. Thanks for a good extension! --Rob C 13:08, 1 April 2010 (UTC)


 * Hi Rob. I have implemented a fix for this in AnyWikiDraw 0.17.
 * --Rawcoder 14:41, 29 May 2010 (UTC)

Fatal error: Call to a member function getDescriptionUrl on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188
When pressing Edit link near the image, I see the following error message:
 * Fatal error: Call to a member function getDescriptionUrl on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188

Line 188:

182 183         $output .= ''. 187                                wfMsg(($image === false) ? 'anywikidraw_license_terms_new_work' : 'anywikidraw_license_terms_derived_work', 188                                 ''.wfMsg('copyrightpage').'', 'getDescriptionUrl.'">Image:'.$name.''). 189                                ' '; 190 } else { 191        // Retrieve the page object of the image to determine, whether the user may edit it 192         $filtered = preg_replace ( "/[^".Title::legalChars."]|:/", '-', $name ); 193        $nt = Title::newFromText( $filtered ); 194        if(! is_null( $nt ) ) { 195                $nt =& Title::makeTitle( NS_IMAGE, $nt->getDBkey ); 196        }

What can I do to fix it? Serhii Laskavyi 17:39, 10 June 2010 (UTC)


 * Can you please try whether this problem also occurs in AnyWikiDraw 0.17?
 * Best, --Rawcoder 08:50, 11 June 2010 (UTC)


 * I'm running AnyWikiDraw 0.17 and I'm getting an
 * Fatal error: Call to a member function getDescriptionUrl on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188
 * error message Serhii Laskavyi 16:19, 18 June 2010 (UTC)


 * Here is a fix. Replace the lines 183 through 189 by the code below.
 * --Rawcoder 08:08, 28 June 2010 (UTC)

183          $output .= ''; ...          if ($image !== false) { ...             $output .= wfMsg('anywikidraw_license_terms_derived_work', ...                   ''. ...                   wfMsg('copyrightpage').'', 'getDescriptionUrl.'">Image:'. ...                   $name.''); ...          } else { ...              $output .= wfMsg('anywikidraw_license_terms_new_work'); ...          } 189           $output .= ' ';

drawing creation error
When I try to put in any AnyWikiDraw document I get "Fatal error: Call to undefined method Title::userCanEdit in C:\xampp\htdocs\wiki\extensions\AnyWikiDraw\AnyWikiDraw.php on line 201"

I'm using MediaWiki 1.17alpha and AnyWikiDraw 0.17, cheers.


 * This happens through a API change in rev 50951 (2009-05-24) of MediaWiki: userCanEdit was marked since a longer time as deprecated, then removed
 * --Schwier 23:12, 12 Octobre 2010 (MEZ)

Use this fix (line numbers due to use of Subversion trunk version): 206		$userCanEdit = $wgEnableUploads && 207                   !$isProtected && 208                   (is_null($nt) || $nt->userCan('edit')) && 209                   (is_null($image) || $wgUser->isAllowed( 'reupload' ));

Important change is: $nt->userCanEdit changed to $nt->userCan('edit')

please start at the beginning - can't get MW to recognize AWD tag
First off- this looks like a great tool. Thanks for developing and sharing.

I'm running mediawiki 1.15.4 on a local drive (IIS) with php 5.3.2 and mysql; testing in Firefox 3.5.10.

I downloaded the AnyWikiDraw 0.17 zip file, extracted contents, copied the appropriate AnyWikiDraw folder to my extensions directory. I edited my LocalSettings to allow uploads and jpg file extension and enabled AnyWikiDraw.

I edited a page by inserting the tag as follows "". When I click save, I get nothing. It just displays the tag as plain text. The demo works if I click it directly. What am I missing? Thanks- Phil

UPDATE: I installed the StringFunctions and ParserFunctions extensions. It seems to work now.


 * Hi Phil. Thank you very much for the update on this issue. I didn't know that StringFunctions and ParserFunctions are not installed by default in MediaWiki. I am going to add a note to the install instructions. Thanks. --Rawcoder 07:37, 28 June 2010 (UTC)

MediaWiki 1.16 released
Since 1.16 has been released now it would be really great if this extension could be updated to support it. --Alterego 17:05, 28 July 2010 (UTC)

Saves silently fail
I'm using MediaWiki v1.15.1 and after editing a new or existing image, the Save silently fails. I'm taken back to the 'page' with the original image unchanged (even after refresh/reloads). There are no error entries in Apache's log nor is there any error in the 'messages' log. Where else can I look?


 * Did you log in to MediaWiki before creating or editing a drawing? Only logged in users are permitted to upload files.
 * Did you specify $wgCookieHttpOnly=false in LocalSettings.php? Without it, the applet can not access the current user session.
 * You may also want to look at the Java console window on the client. Maybe an error message is showing up there.
 * --Rawcoder 18:31, 20 August 2010 (UTC)


 * Thanks so much for the pointer to the login - I was already logged in but the problem is login related. "Remember my login on this computer" had to be checked when I login in order for the Save to work properly. Now I need to find out if this can be set to 'checked' by default so my users don't have to remember every time.
 * There were no messages on the Java Console when the saves failed.

Fatal PHP error, by implementing an image
Hi. I installed everything like it is described. Howerver, when I try to implement an editable image, e.g., I receive a blank page when I save the page. The apache_error_log results the following:

PHP Fatal error: Call to undefined method Title::userCanEdit in /srv/www/htdocs/extensions/AnyWikiDraw/AnyWikiDraw.php on line 209

It woult be great, if anyone experienced the same problem and alrredy found a solution for this!


 * MediaWiki 1.16.0


 * PHP 5.3.2 (apache2handler)


 * MySQL 5.1.36-log


 * This happens through a API change in rev 50951 (2009-05-24) of MediaWiki: userCanEdit was marked since a longer time as deprecated, then removed
 * --Schwier 23:12, 12 Octobre 2010 (MEZ)

Use this fix (line numbers due to use of Subversion trunk version): 206		$userCanEdit = $wgEnableUploads && 207                   !$isProtected && 208                   (is_null($nt) || $nt->userCan('edit')) && 209                   (is_null($image) || $wgUser->isAllowed( 'reupload' ));

Important change is: $nt->userCanEdit changed to $nt->userCan('edit')