if(($ACT == 'edit' || $ACT == 'preview') && $INFO['editable']){ ?> } else { ?> } ?>
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.
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.
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..
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.
see the DokuWiki built-in help in the configuration panel:
Placeholders (replaced in wiki-page-name and wiki-page-template:
@T@
- title of the bookmarked page (as shown in browser title bar)@U@
- the URL of the page to bookmark@D@
- timestamp, now@S@
- text that was selected.@F@
- foo - the user who is making the change or 'anonymous'@N@
- title/page-name. Same as @S
if it is a single word, otherwise @T@
. In both cases the value is stripped of non-alphanumerical characters and space is replaced with underscore.
If a _template.txt exists in the namespace of the page, the default DokuWiki placeholders (@PAGE@
, etc ) are also available for those wiki-pages.
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'));
There are a few options to semi-automatically interact with DokuWiki using a Bookmarklet.
Calling the bookmark could do either of
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.