====== dokubookmark plugin ======
---- plugin ----
description: bookmarklet to submit content to DokuWiki
author : Robin Gareus
email : robin@gareus.org
type : action helper
lastupdate : 2008-09-30
compatible : 2005-07-01 - 2008-05-05 + devel
depends :
conflicts :
similar :
tags : bookmark blog create
----
^ Download | [[http://mir.dnsalias.com/_media/oss/dokubookmark/dokubookmark.zip|dokubookmark.zip]] |
===== Usage =====
''dokubookmark'' offers an easy way to submit new pages to DokuWiki: Simply add the Bookmarklet below to your browser bookmarks.
- visit any website (that you may want to bookmark or write about)
- [optionally] select some text. (select a single-word: title, select multiple words: description)
- activate the "Bookmarklet" -> Popup browser window.
- [optionally] add a custom description, article, tags or notes.
- preview, fill in CAPTCHA (or log-in) and save
This plugin was inspired by the [[tips]] section's [[tips:weblog_bookmarklet]] article - thanks to Riny.
//dokubookmark// includes [[tag]]-plugin support to easily and quickly tag pages. However the current schema is not suitable for large tag lists. Using the tag-cloud may be nice. Yet more brainstorm and discussion is needed; have fun.
===== Setup =====
Just install the plugin, the default settings will do, but you may want to tweak them to your preferences.
==== Config ====
They're documented - use DokuWiki's //Configuration panel//.
^ config-key ^ default-value ^ description|
| default namespace | ''wiki:weblog:@D@'' | where to save new pages |
| Namespace Presets | ''Private=weblog:@D@;Public=wik..''((too long to post here)) | flexible version of the above. allows to specify multiple namespaces and custom templates|
| Date-time format | ''Y:m_d_His'' | how to [[http://php.net/date|format]] timestamps \\ Note: timestamps (''@D@'') can be used for wiki-page names; a colon separates namespaces. |
| tagbox | 1 | on/off - show available tags - requires the [[tag]] plugin |
| tabboxtable | 1 | on/off - if showing tags, put them in a HTML table |
| wikitemplate | ''...''((too long to post here))| the fallback page-template that is used if no other templates have been specified/found |
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. Identical to''@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.
//Notes//:
Tags are optional (requires the DokuWiki [[tag]] plugin).
Presets come in handy to quickly change the namespace or apply templates.
Direct-saving can be enabled in the configuration, it is identical to DokuWiki //save// (it even checks sectok). It is intended to close the popup-window after a successful save (it does not yet) or redirect the user to edit/preview/draft-merge if some concurrency or permission error occurs.
==== Bookmarklet ====
[[wp>Bookmarklet]]s are //smart// bookmarks. They usually allow one to perform complex task via a single click (web-browser bookmark-toolbar).
Add a new bookmark in your browser with the //Location// text below. Adjust the hostname and protocol to match your DokuWiki server's host-name.
javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('http://MY-HOST-NAME/doku.php?do=dokubookmark&te='+escape(Q)+'&ur='+escape(location.href)+'&ti='+escape(document.title),'dokuwikiadd','scrollbars=yes,resizable=yes,toolbars=yes,width=680,height=520,left=210,top=150,status=yes'));
====== Discussion ======
Any help to improve this plugin is welcome. Feel free to discuss here or drop us a line, contact info comes with the source.
Background information (JavaScript POSTing to DokuWiki) and a development version can be found
[[http://mir.dnsalias.com/wiki/bookmarklet|here]] and [[http://mir.dnsalias.com/wiki/dokubookmark|here]]. A deployed //dokubookmark// is online at [[http://apps.linuxaudio.org/wiki/request|apps.linuxaudio.org]].
--robin & Riny
//tip//: From version 0.3.7 (to be released) you can include the username in the path, which if combined with the [[http://www.chimeric.de/projects/dokuwiki/template/arctic|Arctic template]] and the pagelist plugin, to give every user his own weblog-entry sidebar.
--
//suggestion for future release// Option to disable "show up in 'recent changes'" to prevent clutter up. Could be done by marking as "Minor edit" and skip minor edits in "recent changes"
--
robin suggests to leave the changelog alone and use a customized page-list plugin.
what do you need? "a global changelog without the bookmarks" may translate into a namespace-white/blacklisted changelog or index. Maybe there's an existing solution available, the most close I could find quickly was [[userhistory]], [[recent]] and [[editor]].
--
BTW. I use a patched version of the [[dir]] plugin to show ''~~META:url=~~'' of each page in a namespace-list
(and use ''~~META:url=@U@~~'' in the bookmark-template). I'm currently pondering how to best integrate this with other modules. The [[include]] plugin and friends may also be an option.
--
The plugin doesn't handle international utf8 characters in title,selection.Change escape() to encodeURI() in bookmarklet ,use utf8_unhtml around line 129 action.php,add (,ENT_COMPAT,'UTF-8') in htmlentities calls @ printForm @ helper.php
-- //psofa// email:psofa at gmail
Its me again :) The plugin seemed to depend on pages being created for each tag ( i suppose the tag plugin behaved like this at some point ) in order to create the tag table.
If you have the cloud plugin you can replace the _gettags() function with
function _gettags() {
$tag = plugin_load('helper', 'tag');
$cloudpl = plugin_load('syntax','cloud');
$cloud = $cloudpl->_getTagCloud(50, $min, $max, $tag);
$taglist=array();
foreach ($cloud as $word => $size) {$taglist[]=$word;};
return($taglist);
}
-- //psofa// email:psofa at gmail