This DokuWiki plugin provides functionality to assign tags to a wiki-page using checkboxes.
The tagentry plugin displays a set of tag-name checkboxes just below the edit form and automatically adds or modifies {{tag>}} in the wiki-text using JavaScript when a checkbox is activated.
This plugin can be installed standalone, but makes only sense in combination with a recent version (later than summer 2008) of the tag plugin.
There are a few configuration options available, accesible via the configuration-manager.
tagsrc | choose which tags to display. The default is to display all tags known to the tag plugin's index. Alternatively you can use the ID s of existing pages in a dedicated namespace (by default the tag plugin's namespace) |
---|---|
namespace | IFF tagsrc is set to custom; search this namespace. |
table | Format checkboxes using a HTML <table> instead of just pushing them into a <div> |
limit | Maximum number of tags to list - 0:unlimited |
blacklist | Space separated list of tags to hide from the assignment-bar |
height | specify maximum height of the box in float(em,px,pt) format.>0 : fixed value (eg. 50px ); 0 or empty: use CSS; <0 : scale with number of entries (fi. -1em should get you rid of the scroll-bar, -0.05em is a sane value for sites with many tags.) |
tablerowcnt | when using <table> formatting, this allows to specify the number of tags per table-row. (default:5) |
Note: the default max-height is currently defined in lib/plugins/tagentry/style.css as 5em
.
ToDo:
<div>
wrapper is still written; but the <label>
will not be printed if $alltags
is empty. check this when finishing layouting. META
or some custom command similar to DRAFT
on the Tag's -page)alert()
messages translatable or remove them.helper.php
in order to make them available for other plugins (fi. plugins:dokubookmark). As always: Comments, suggestions and patches or feedback of any kind is more than welcome. Put them here while I update the trac.
The plugin does not work for me (dokuwiki-2010-11-07 freshly installed with recent tags plugin), unless I disable the code at line 58 of action.php: if ( !empty($event→data→_hidden['prefix']) || !empty($event→data→_hidden['suffix'])) return; No other non-standard plugins (except tags, of course) were active.
EDIT: found out the code was wrong. Line 261 should read: if ($i%$options['tablerowcnt']==0 && $i!=0) {
fixed in 0.3.2 (2009-09-18) - Thanks for pointing this out.
Fact remains that I can not set the tablerowcnt from the config manager.. I've added that to the config manager, as well.
Answer: As for your alternative approach: You can already make the checkboxes float. They're wrapped in a <label> environment which allows for width and float CSS paramters.
The CSS would look like this:
#plugin__tagentry_wrapper div.taglist label { width: 50px; overflow: hidden; float:left; }
I'm having a devil of a time configuring tagentry. What I desire is to limit what tags are listed by the namespace. Take the following example of namespaces:
namespace1:page1 namespace1:page2 namespace2:page1
When creating or editing pages in namespace1, I only want to display the tags specific to that namespace. I am unsure how to configure the tagentry plugin to do this. Up to this point the only way I get any tagentry checkboxes to display is to configure “Select which tags will be available” to “All tags” otherwise no checkboxes are displayed.
Answer: This is beyond the capabilities of this plugin. The feature you are requesting would require support from the tag plugin itself to group tags by namespace.
The tagentry-namespace configuration option is there for backwards compatibility with the old tag-plugin, which created pages in a specific namespace for each tag. The latest version of the tag-plugin still supports this, but does not create the pages automatically.
PS. There's is already a feature-request on http://www.dokuwiki.org/plugin%3Atag#limit_tag_list_by_namespace for that purpose.
Warning: Invalid argument supplied for foreach() in [wiki path]/lib/plugins/tagentry/action.php on line 170
Answer: That was a bug which occurred if there are were no tags defined on the system. - Cheers for reporting this.
A: per default it uses the tag plugin's topic.idx
. Rebuild your tag index (available from Admin menu) to clean out old tags.
long Answer: Older versions of the tag-plugin required to create wiki pages for each tag, later versions use a '?do=showtag' action. The new version displays the page with the tag-name if it exists and else generates a topic listing.
Maybe you have older tags still sitting around as pages?
As for the scrollbar: there is no configuration option for that yet. You can edit set the lib/tpl/tagentry/style.css
and adjust or remove the max-height
parameter. You can also override it in your site's template. The number of tags per line is also still fixed and hardcoded to five. Well, this plugin's barely 3 days old; but we'll get there.height
configuration option (available from v0.2.5 or later) to -1em
. That adds one line per displayed tag to the max-height style parameter of the box. Horizontal scrolling - related to limiting the displayed tag-name - will be made configurable in a later version.
Fixed in version 0.3.0 (2009-01-30).
Answer: That sounds like the javascript of the plugin is not loaded or you've disabled Javascript in your browser. Try to flush the cache:
conf/dokuwiki.php
` It worked, thx a lot!
Answer: Scrollbars are already automatically added if there's more than 6 lines of tags. The style.css
defines:
overflow:auto; max-height:6em;
Simply modify the 'max-height' parameter (in …/lib/plugins/tagentry/style.css
) with a text-editor to your preferences (eg. max-height:40px;
)
Note: older versions of IE do not support max-height
! Use height:6em;
, but then the box will then always be fixed at this height and never shrink.
Here's a screenshot: http://imgur.com/rsF3w.png
Answer: I'll look into it. It is not trivial to make this work consistently: It depends on other plugins which modify the edit-button area (fi. Captcha) as well as the template in use and even worse: the browser (table vs. div rendering in a floating section).
A quick fix for the mess is to add div.license{clear:both;}
to the stylesheet (either lib/plugins/tagentry/style.css
or in lib/tpl/?/design.css
).
Another workaround would be to move the tagentry-div out of the floating area. That can be accomplished by adding
$pos = $event->data->findElementByAttribute('class','editButtons');
in line 127 of lib/plugins/tagentry/action.php
; just before the insertElement()
call.
I'm in need for a brilliant idea how to solve this issue myself :) Suggestions are very welcome.
Answer: The first two suggestions are rather welcome. The plugin will need a bit of a rewrite in order to be used in the menu-bar but it is in need for a re-design, anyway. A quick solution would simply use an expandable fold to 'hide/show' large large lists of tags. I might do that first, because I have little time to spare at the moment.
As for the “edit section” problem: That is more or less intentional; if you're editing only part of a page, this part may not include the {{tag>}} wiki-tag which needs to be modified. Of course the plugin could be smarter (eg. display the tag-assignment-box when tag-syntax exists in that part or even lock the tag-syntax-section and allow to assign tags anyway; either way these features are not trivial to implement and may cause more harm than good in conjunction with other plugins that hook into the edit-page call.)
As programmer let me tell you that everything is possible with the constraint that one can at best get only two the following three: fast, cheap and high quality (-; stay tuned.
Question: Is it possible to limit the list of tags to the tags which are used in the actual page/namespace and its sup-pages/namespces? Joachim 2011-09-12
Answer: Alas, no. This is not possible with dokuwiki's implementation of how tags are stored. (Note: It would be possible to implement it by searching all tags in all pages in the a given namespace every time a page is edited, but that is an exhaustive search and does not scale).
This plugin inspired by dokubookmark, generalizing the idea of graphically assigning tags on page-creation.
see also: