DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:tplmod

tplmod Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" yes
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" unknown

plugin Modify template features based on ACL, IP-addresses, days of week. Features include page and site tools, logos, taglines, wiki titles. Adds optional sidebar toggle. Currently works in the DokuWiki template and its derivatives.

Last updated on
2017-09-04
Provides
Action
Repository
Source

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin.

Usage

This plugin enables you to modify the Dokuwiki template based on IP address, ACL level of the user, and day of the week. The wiki logo (image), tagline, and the wiki name can be rotated by day or changed based on the IP address of the user. The links and buttons at top 1) and side 2) of the template can be changed based on the ACL level of the user.

Some rationales

Being able to make these kinds of changes based on IP address makes it possible to run a site which caters to more than one entity and to give each one its own tools, logo, etc. Changing by date makes it possible to freshen the appearance of a page for repeat visitors. The ability to restrict the kinds of tools users have access to can have use for sites that want to fine-tune access.

Template Compatiblities

This plugin is compatible with the current dokuwiki template and with templates modeled on it. It also has built-in accommodations for the monochrome template.

Logo and Lists

When the logo image is rotated by the plugin, it is in effect replacing the default logo image. This will be found in one of three directories, as specified here: changing_the_logo. Your own replacement images will be assumed to be in the same directory as the default logo. When the template loads the default logo, it also specifies the width of the image. Therefore, if your image is a different size from the default, then you will want to specify its width. The replacement images are specified in the Configuration Options as a comma-separated list of the image names with the widths separated from the the name by a space:

  img1.png 64,img2.png 128,img3.png 256,img4.png, . . .    

The images must be listed in the order in which they will be accessed. That is, if you choose to rotate them by days of the week, then the first image must be the Sunday image, the second Monday, etc. If you do not have enough images for the seven days, then the first image (Sunday) will act as the replacement. The same principle holds true if you are rotating the logos by IP address. The images and the IP addresses must be listed in the same order as you want them accessed. If there are more IP addresses than images, then the first image in your list will be used.

There is a transparent logo.png included in the distribution. Using that as your default logo will eliminate the momentary lag between the appearance of the default image and its replacement.

Rotating Tag Lines and Wiki Names

The same principle for rotation applies to rotating tag lines and wiki names, as described above for the logos. The lists of tag lines and wiki names must be in the order in which you want them accessed by either date or IP address. Sunday will access the first tag line or wiki name, the first IP address in your list or IPs will access the first tag line or wiki name. The default replacement tag or name will be the first in its list.

In order to implement tagline replacement, you have to set a Dokuwiki tagline in Dokuwiki's configuration settings. The tplmod plugin supports one level of HTML markup. For instance, you can set the Configuration tagline as <b>My thoughts about things</b> and the plugin will leave the HTML in place and replace “My thoughts about things” with a new tagline. You could in fact set the Configuration tagline as follows: <b></b>, then all of the taglines will automatically be bold.

The Date Tagline

if the tag_date_format is set, then a formatted date string will be output as the tag. The formatting uses a php date string. For instance:

  \T\o\d\a\y \i\s l F jS Y

This will output Today is Tuesday July 4th 2017 (or whatever the date is). Notice that all the text which is not part of the actual date itself is escaped: \T\o\d\a\y \i\s. Not every character has to be escaped, only those which wll be interpreted as formatting characters. The date tagline takes precedence over the rotating taglines, so you cannot have both a date tagline and rotating tagline. As with the rotating taglines, a Dokuwiki tagline must be set in the Configuration Manager.

ACL controls

There are two major groups of template tools, treated as groups in the Configuration Manager, and two additional tools treated individually:

  1. The Site tools. These appear at the top of the Dokuwiki template and include Recent Changes, Media Manager, and Sitemap.
  2. The Page tools. These are displayed as icons at the right of the template and include Edit, Old Revisions, Backlinks, and Subscribe.
  3. User Profile
  4. Search Box

If a user is not eligible to use a tool, the tool will not be displayed.

You control access to these tools by selecting from the Configuration Manager which of these tools you want to control and by setting the cut-off ACL level using the acl_all configuration option. If, for instance, you set acl_all at EDIT then users with ACL of EDIT or lower will not have access to the selected tools. For tools which are not included in the Dokuwiki core and appear in the Page tools, you can add them to the Page tools input box in the form of a key word from the url of the tool. For example, in the case of the overlay, entering the word overlay in the input box would prevent the overlay window from appearing to users who do not have access.

Page Tools 'All' Setting

If the Page tools All option is selected, then all page tools will be hidden from users who fall under the acl_all setting. If, however, you would like to exclude certain core tools from this blanket prohibition, you do this using the ptools_xcl option.

The sidebar toggle mechanism is enabled by setting the toggle_sidebar configuration option to true. See mturner.org for an example of its use. The toggle is an action link at the top right of the page.

Background Color Setting

The background_color setting makes it possible to set the color of the browser area which surrounds the wiki. This can often be done using the “Template Style Settings” in the Admin panel. But there are some cases where this setting can be useful, as in the monochrome template, where the background color fills the entire browser area before the wiki page color is activated. This may cause a choppy effect as the background color for the wiki sections replace the browser color. The solution is to set the background color of the template to the page color in the “Template Style Settings”. Then the entire page is loaded using this background color, after which tplmod will set the surrounding background color. In the pattern set down by the current Dokuwiki template, the wiki page color is white (#ffffff) and the template background setting is background_alt. For this to work you have to check off default, which is the only option, and will trigger background_alt or else enter the color code for the background color which you prefer.

Configuration and Settings

Option Description
logos Comma separated list of image names for home page logo: names only, not paths
ips Comma separated list of IPs for rotation by IP. Rotations follow sequence of IPs
sitetools Site Tools
Remove the selected site tools. In the Dokuwiki template Site Tools are located at the top of the template.
pagetools Page Tools
Remove the selected page tools. In the Dokuwiki template these are located along the right-hand side of the template. You can remove non-standard tools, using the input box: enter them as a comma separated list of unique words from their query strings or urls.
profile Remove User Profile link
search Remove Search box
taglines Comma separated list of taglines
tag_date_format A PHP date format string. If present, this date string will be output as your tagline
acl_all The acl level at which sitetoools and pagetools removals take effect.
dateorip Rotate logos, tag lines, and wiki names by ip address or days of the week. Select NEITHER if you do not want rotation.
rotatewhich If rotating the logo and/or tagline, select which to rotate. You have a choice of NONE, LOGO,TAG, BOTH.
ptools_xcl If pagetools is set to All, you can retain selected tools by entering a comma separated list of unique words from their urls in this text box
rotate_title Rotate the wiki name (title)
wiki_names Comma separated list of wiki names
toggle_sidebar Display a toggle link at the top of the page to page to hide and show the sidebar. Defaults to false.
background_color The browser background color, i.e. surrounding the wiki page. See background_color_setting

Development

1)
Site tools
2)
Page tools
plugin/tplmod.txt · Last modified: 2017-10-01 02:13 by turnermm