Giter VIP home page Giter VIP logo

Comments (15)

yohtm avatar yohtm commented on July 26, 2024

I have the same problem.

I also intially had trouble accessing pre-made diagrams but it ended up working by uploading a file name like the following: Drawio_[Filename].xml

By the way thanks for the extension, I've been thinking/wanting of doing something similar for months!

from wiki_drawio.

crest55 avatar crest55 commented on July 26, 2024

I also have this problem,

@yohtm, could I ask you what do you mean of "uploading a file name like the following: Drawio_[Filename].xml"

from wiki_drawio.

yohtm avatar yohtm commented on July 26, 2024

@crest55, basically I created a diagram on DrawIO, downloaded it, gave the name "Drawio_Test.xml" to my file and then uploaded it to my Wiki. Then, in the page editor, I used "{{#drawio:Test}}". That allowed me to have my pre-existing diagram accessible on the wiki. I still can't see the preview or save it though.

from wiki_drawio.

crest55 avatar crest55 commented on July 26, 2024

Thank you @yohtm, I understand now.

from wiki_drawio.

tosher avatar tosher commented on July 26, 2024

In current version tmp dir is defined like:

$tmp_name = $_SERVER["DOCUMENT_ROOT"] . "/tmp/tmp_".rand(0,1000).rand(0,1000).".".$ext;

If this path is not available and not writable for wiki engine, we have an error with uploading data to wiki.
Version in pull request using tmp dir based on $wgTmpDirectory variable, for example (LocalSettings.php):

$wgTmpDirectory = "$IP/images/tmp/";

Another problem (for notes or doc..)

For correct generation of drawio images in PDF with mwlib library, the easy way is creation of template like DrawIO

<div class="noprint">
{{#drawio:{{{img}}}}}
</div>

<div class="onlyinprint">
[[Image:Drawio_{{{img}}}.png]]
</div>

Then we can use:

{{DrawIO|img=testup}}
  • For browser: showing image and edit link
  • For PDF generation - correct wiki image link

from wiki_drawio.

SeregaPru avatar SeregaPru commented on July 26, 2024

Thank you, tosher.

I commited some modificstions from your pull request accourding tmp dir.

If you still have errors, you can see and modify function
function getUploadDirectory() {
global $wgUploadDirectory;
return $wgUploadDirectory;
}
in Drawio.body.php

from wiki_drawio.

yohtm avatar yohtm commented on July 26, 2024

Thanks for the updates guys. I still have a problem saving (and therefore displaying) the diagrams. I get 400 bad request reply (see below). Not sure if it's related to the cross-domain iframe, to the ues of https or something else (the editor does appear and I am able to change my diagram). Any ideas?

save-diag-error-1

from wiki_drawio.

tosher avatar tosher commented on July 26, 2024

Because of we have two versions now.. I have a question :)
With version from my fork and defined $wgTmpDirectory variable - the same error?

from wiki_drawio.

yohtm avatar yohtm commented on July 26, 2024

Oh I didn't read it right I thought the branch was merged. It actually works on your branch. Thanks!

from wiki_drawio.

lexsulzer avatar lexsulzer commented on July 26, 2024

Hi guys!

First of all many kudos for launching this extension! Draw.io is fantastic and semi-integrating it into MW is of course a bliss. I am eager to help to make this extension stable and robust.

That said, here are some observations. I am investigating, but thought it would be helpful to let you know up front:

  • I have tried both @SeregaPru's master and @tosher's fork on MW 1.23.11 and 1.26.2 in Chrome, Firefox and Opera.
  • Upon saving a drawing I get a POST http://localhost:20091/main/Special:Drawio 500 (Internal Server Error) in the browser and a corresponding PHP Fatal error: Call to a member function load() on a non-object in /var/www/html/m/includes/upload/UploadBase.php on line 698 on the server.
  • Upon reloading the page, the .png version of the drawing is actually displayed on the page, but:
  • upon clicking "edit", the drawing is not reloaded for edit, but a blank draw.io canvas is shown, and
  • a click on the .png is taking me to http://localhost:20091/index.php/Image:Drawio_hapa%20flowchart%209.png instead of http://localhost:20091/m/index.php/Image:Drawio_hapa%20flowchart%209.png (wgScriptPath is not included)

What do you think? How should we proceed?

from wiki_drawio.

SeregaPru avatar SeregaPru commented on July 26, 2024

Hello.
I think this is the main reason of error - that your MediaWiki is located not in root folder of site.
We have not tested this extension in this case.
If you can, try to move wiki to root folder.

If not - just wait. We need some days to reproduce this case and (I hope) fix it.

from wiki_drawio.

lexsulzer avatar lexsulzer commented on July 26, 2024

Hi

Ok. Great! I'll dedicate today's afternoon to this. Please note that running an MW in site root is not recommended. (https://www.mediawiki.org/wiki/Manual:Wiki_in_site_root_directory, you probably know this link already)

Regards and many thanks for your quick answer!

from wiki_drawio.

lexsulzer avatar lexsulzer commented on July 26, 2024

Hi

Ok. Solved the issues.

About clicking .pngs on wikis not installed in site root:

Drawio.php's line 170 (as filed on Feb 17, 2016 1546 CET)

$output .= '<a href="/index.php/Image:' . $image_name.'">';

should be changed to

$output .= '<a href="'.$wgScriptPath.'/index.php/Image:' . $image_name.'">';

About my experienced save and reload problems

I had xml set as a forbidden file type.

Regards and let me know if I can contribute more.

from wiki_drawio.

SeregaPru avatar SeregaPru commented on July 26, 2024

Thank you for quick fix!
On the days we will try this case, check if will be working ir toor and non-root folders,
and commit fixes.

Description will be corrected about enablixg XML type

from wiki_drawio.

esvorontsov avatar esvorontsov commented on July 26, 2024

Error when MediaWiki is located not in root folder of site fixed

from wiki_drawio.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.