DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:docimporter

This is an old revision of the document!


docimporter Plugin

Compatible with DokuWiki

Weatherwax

plugin Import your word documents (.doc and .docx) into DokuWiki

Last updated on
2013-11-17
Provides
Action
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with doc, docx, import, word

This plugin imports your Microsoft Word documents (.doc or .docx) into Dokuwiki and preserve the following properties of the word document :

  • Basic layout : italic, bold, underlined text.
  • Bullet and numbered list with sublevels.
  • The table of content will be generated correctly if the word document uses the right headings formats.
  • Pictures are imported in their native size but displayed in the height and width specified in the word document.
  • Tables are imported.
  • Footnotes are imported.

Installation

Install this plugin at your own risk, there is absolutely no guarantee that it will work correctly and will not make gremlins eat you alive.

Please note that this plugin has been developped on Linux (Ubuntu/Debian) and is not tested on MS Windows or any other OS. I have absolutely no plans to support any other OS than Linux.

:!: External requirements: This plugin requires the following additional components that must be installed separately, they are given as ubuntu packages name :

  • php-pear
  • libreoffice-writer
  • libreoffice-wiki-publisher

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

You will also need to create the file :

 /usr/bin/convert_to_mediawiki 

That must contain the following :

 #/bin/bash
 soffice --nofirststartwizard --headless --convert-to html:"HTML" $1
 soffice --nofirststartwizard --headless --convert-to txt:"MediaWiki" $1

You must also make it executable :

 sudo chmod +x /usr/bin/convert_to_mediawiki
 

Finally, the plugin uses the XML-RPC remote API, therefore you need to enable it and specify a username and a password. For more information on how to do that, please refer to https://www.dokuwiki.org/devel:xmlrpc.

Once the remote API is enabled for a given username and password, fill in the corresponding fields into the options of the plugin in the configuration settings of Dokuwiki.

Now you can add a button and a form to your template to be able to upload new documents. Here is an example for the “dokuwiki” template.

Edit the file

 lib/tpl/dokuwiki/tpl_header.php
 

And add the following lines between the “<ul>” and “</ul>” tags just below the comment <!-- SITE TOOLS -->:

 <?php if ( auth_quickaclcheck( $ID ) >= AUTH_EDIT ): ?>
                <li><input class="btn" value="Import a new document" onclick="var el=document.getElementById('import_form');el.style.display=(el.style.display!='none'?'none':'' );" /></li>
 <?php endif ?>

And add the following lines just before the comment <!-- BREADCRUMBS --> :

 <?php if ( auth_quickaclcheck( $ID ) >= AUTH_EDIT ): ?>
    <div style="display:none;margin-top:50px;padding-top:20px;padding-bottom:20px;" id="import_form">
      <form method="POST" action="" enctype="multipart/form-data"><br>
         <label>Wiki page title : </label> <input type="text" name="title"><br>
         <label>Wiki name space : </label> <input type="text" name="ns"><br>
         <label>Word document : </label> <input type="file" name="doc"><br>
         <input type="hidden" name="id" value="".$ID.""/>
         <input type="hidden" name="do" value="doc2dw"/>
         <input type="submit" class="btn " value="Import to the wiki">
      </form>
    </div>
 <?php endif ?>
 

Usage

Users who can edit or create documents will see the button “Import a new document”. A click on it shows the form with the following fields :

  • Wiki page title (mandatory) : the title of the page once imported.
  • Wiki name space (mandatory) : the namespace, ex “wiki”.
  • Word document (mandatory) : select the file you want to import.

Then click on “Import to the wiki” and wait to be redirected to the newly created page.

Change Log

This is an early release, there will be some bugs left in it. Please check https://github.com/marginweb/dokuwiki-docimporter for current development.

ToDo/Wish List

  • Better error handling.
  • Give more feedback to the user in case of errors.

Support

This plugin is provided as is, no personal help will be provided. On the other hand, genuine bug reports are welcome, please post them on github.

Commercial support can be provided on demand, please contact us at www.marginweb.com with your request.

Discussion

No Change to xmlrpc.php

The tpl_header.php has been updated and then restarted apache. The page still only shows:

XML-RPC server accepts POST requests only.

no page created

After importing a docx document, the page is redirected to the new pagelink, but the page is empty and not yet created.

I installed docimporter with your above hints.

For my debian vserver the following worked:

added to /etc/apt/sources.list: (http://www.debian.org/News/2011/20110623.de.html)

deb http://backports.debian.org/debian-backports squeeze-backports main

installed libreoffice modules (https://wiki.debian.org/LibreOffice)

apt-get install -t squeeze-backports uno-libs3 # removes openoffice.org-*
        (don't know if necessary)
apt-get install -t squeeze-backports libreoffice-writer
apt-get install -t squeeze-backports libreoffice-wiki-publisher

I did all the other stuff (/usr/bin/convert_to_mediawiki, chmod etc.)

Any idea how to find out what is going wrong? Joe, 07.12.2013

Response to Joe - no page created

In my case i onliest need to create a link /var/www/dokuwiki because i use /var/www/wiki and it works. Bruno Emanuel. 11.02.2014

plugin/docimporter.1408444063.txt.gz · Last modified: 2014-08-19 12:27 by 62.225.141.75

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki