Table of Contents

Dokubookmark - Website Tagger

This bookmarklet takes the URL and title of the current page in your web-browser, plus any selected text on that page and sends it to DokuWiki to make a new wiki-page about it, using the current date/time as page-name.

The dokubookmark plugin as been released on the DokuWiki website.

News

2011/Dec/20: hatred has jumped aboard and updated the plugin to be compatible with latest dokuwiki. The plugin now uses the standard edit-form and the previously included tagentry plugin is now standalone.

Plugin usage

DokuWiki bookmarklet in action on http://apps.linuxaudio.org

Use this symlink to the latest version: dokubookmark.zip with the Plugin-manager. Development is kept in a git repository: download a snapshot from dokubookmark-devel.tgz.

To install the bookmarklet: drag this link to your bookmarks and edit the hostname afterwards.

Usage:

The browser opens a popup-window connecting to DokuWiki..

  1. [optionally] choose a Preset or simply edit the page-id/name by hand
  2. edit/adjust the wiki-page text
  3. save/preview

Notes: Presets come in handy to quickly change the namespace or apply templates.

Direct-saving needs to be enabled in the configuration, it is identical to DokuWiki save (it even checks sectok) yet it is intended to close the popup-window after a successful save and redirect to edit/preview/draft-merge if some concurrency or permission error occurs.

Plugin Configuration Options

see the DokuWiki built-in help in the configuration panel:

Placeholders (replaced in wiki-page-name and wiki-page-template:

If a _template.txt exists in the namespace of the page, the default DokuWiki placeholders (@PAGE@, etc ) are also available for those wiki-pages.

Bookmarklet

Add a new bookmark in your browser with the text below. Edit it to match the hostname and protocol to match your DokuWiki server.

This bookmarklet will work with methods (2), (3) and (4) mentioned below.

javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('https://your.hostname/doku.php?do=bookmarklet&te='+encodeURIComponent(Q)+'&ur='+encodeURIComponent(location.href)+'&ti='+encodeURIComponent(document.title),'dokuwikiadd','scrollbars=yes,resizable=yes,toolbars=yes,width=600,height=300,left=200,top=200,status=yes'));

TODO

devel background information

There are a few options to semi-automatically interact with DokuWiki using a Bookmarklet.

Calling the bookmark could do either of

  1. directly POST to DokuWiki
  2. have a server generate javascript that makes your browser POST to DokuWiki
  3. load an intermediate page that will submit a POST to DokuWiki with your browser.
  4. interact with a 3rd party server that will submit a POST to DokuWiki from it's server.

Each of those variants has it's merits.

All the examples here are based on Dokuwiki-Weblog, which implements method (4) and thus offers no possibility of authentication (unless provided by a 3rd party)

see bookmarklet for a method that does not require additional PHP code. it's a rather lengthy bookmarklet to directly http-post (1). - The DokuWiki hostname, namespace and wiki-template are all hardcoded in the bookmarklet.

(2) is a workaround for IE, which limits the maximum length of a bookmark. basically it just loads and execute method (1). - however some tasks (fi. filling in date+time and wiki-page-template) can be done by the server when generating the JavaScript.

(3) is an interesting solution because it is very flexible: interact with a bookmark-properties webpage which submits to DokuWiki (either as “fire and forget” save or followed by preview/edit) using the standard DokuWiki authentication mechanism.