progrecss plugin by Luis Machuca Bezzaza
Create CSS-based progress bars.
Last updated on 2010-02-08. Provides Syntax.
No compatibility info given!
Similar to progressbar.
Welcome to progrecss, a DokuWiki plugin to create CSS-based progress bars. No background images, no transparency dependence, no external files needed. Just CSS.
I'm Luis Machuca, username ryan.chappelle, a DokuWiki fan who's collaborated with some templates and plugins before, making suggestions and the like. This is my first attempt at an actual, more direct, collaboration in the form of a Syntax Plugin.
Feel free to use and comment (see ⇒Discussion).
Just do, either inline or in a line of its own:
<progrecss number% options... />
Or if you are more comfortable with fractions/recipes:
<progrecss x/y options... />
Details:
progrecss is the actual plugin's name, the “c” is intentional as this plugin combines “progress” and “css”.number% is an actual percentage value, that is any integer from 0 to 100 followed by the character ”%”. This parameter is mandatory.x/y is two integer numbers separated by a literal slash, eg.: “3/5”. This parameter is mandatory./> has to be separated from the last parameter by a space. This is mandatory.param=value;, where:param is a parameter name as explained in the table below.\;. | Parameter Name | Structure | Effect |
|---|---|---|
| percentage | [0..100]% | Progress in percentage (from 0% to 100%, only integer percentages). |
| fraction | <number1>/<number2> | Progress in fraction (where number1 ≤ number2, for example: “15/21”). |
| Caption | caption=text | The progress bar caption. Beginning from version 1.4, it accepts some limited forms of wiki syntax (in particular, text formatting modes are supported). This may or may not be displayed in accordance with the “style” parameter, though. It is also used to provide each progress bar a somewhat unique ID. |
| Style | style=<stylename> | The CSS style used to present the progress bar. This style must exist in a valid DokuWiki CSS file (including userstyle.conf if available) in the form .progrecss_stylename. |
| Width | width=<widthvalue> | Any valid CSS width value, including measures in pixels (px) or ems (em).This sets up the total progress bar width. Depending on the actual “style” parameter used, this may effect the progress bar positioning. |
| Order | Reserved for future use (as of 2008.06) | |
| PDisplay | Reserved for future use (as of 2008.06) | |
| Marker | Reserved for future use (as of 2008.06) |
Download and install the plugin using the Plugin Manager using the URL given above. Refer to Plugins on how to install plugins manually.
The plugin comes with three (3) default styles included (in the accompanying CSS file). With the use of the “style” parameter you can choose which style do you want: default, inline or gauge1).
The “default” style is just a default, no big deal, which shows a box containing the percentage display in a colour theme that matches that one used for tables in your template. The “gauge” style shows the same box, with the difference it is made rounded, with another colour scheme, and the caption is shown as a tooltip (hover your mouse over the gauge). The “inline” style is intended for inline display, that is, to run alongside text.
Here come some usage examples:
<progrecss 25% />
Just a progress bar, quarter task done. No big deal.
<progrecss 1/7 /> Another simple progress bar, maybe indicating only one day of the week has passed. <code> <progrecss 50% caption=One to go; />
just like before, but this progress bar shows half progress done, and also shows with a caption below.
<progrecss 50% caption=One down\;One to go; />
just like the above, but with a semicolon as part of the parameters. Note that it is escaped in a C-like fashion.
<progrecss 50% caption=One-to-go;style=gauge; />
the same bar, a different style, the caption is shown aside increasing the width of the object. If your browser supports it you'll see a round gauge and a minor shadow effect inside the actual progress indicator.
Some text ... <progrecss 99% style=inline;caption=Almost_Done;width=200px; /> some more text...
will show an almost complete progress bar, which will, depending on browser, display inline (alongside with text). The percentage number has a font size relative to paragraph text size. The caption, however, will not be shown.
Now with limited wikitext supported:
<progrecss 50% caption=If this //doesn't// work, we should [[Google>progrecss plugin|consult Google]]. ;style=gauge; />
Support for wikitext is limited at the moment. Underline, monospace, bold, italics and strikethrough work fine, and both internal and external links do work albeit they render strangely. Other syntax elements are untested.
Because of their structure, footnotes, lists, headings, other plugin calls, and macros such as ~~NOCACHE~~ will most probably not be supported.
| |
|---|
| Style displays of the progrecss plugin, with Firefox 2 |
No Plugin Manager? Cease screaming and running around in circles! Just download the plugin from the location above and follow these steps:
lib/plugins directory in your DokuWiki installation.progrecss directory with the contents of the plugin.
Demo site is up! (as of Dec 24, 2008).
Note language is Spanish but online translators shall do a good job with it.
Depending on the browser used, presentation of the plugin demo may vary. Check Browser Support!
A quick warning before you use this plugin:
Due to the box model used by DokuWiki, enabling use of wikitext inside the progress bar caption now makes the code to output non-W3C conformant code!. In particular, <div>s will be outputted interrupting the normal flow of <p> blocks. Presentation-wise, there is no discernible effect, unless your code depends on selectors like p:first or p:last. But syntactically speaking, code using this plugin no longer conforms to XHTML… You are warned.
Because of the styles used, perfect or at least “acceptable” presentation may be a challenge for some browsers, in particular
when using the inline style. My web development tests are based on Opera 9.6 and Firefox 3.0; results may greatly vary depending on your browser. Note that also because of the styles used, using this plugin will
report your wikipage breaks with CSS conformance (for example, most CSS validators do not recognize -moz-* keys, text-spacing, or radius properties yet).
<p>s.To be done
Unzipping the file from the download link above will give you a folder containing two files: syntax.php and style.css.
The stylesheets used are in the available style.css file. You can add your own styles just copying one of the style sets to your userstyle.conf and editing as needed. Be aware, however, about Browser Support. The structure of the elements goes as follows:
progrecss_stylename. The box contains the gauge, then the caption. The box itself is given a somewhat unique ID.width indicated as parameter. Be aware of using display:inline or float: … attributes here may break the presentation. Do not use width or min-width here as this is provided from the PHP side.percentage relative to the width of the border box. This is what you style in order to show progress. Do not use width or min-width here as this is provided from the PHP side.<span> element that contains the object's caption. May or may not be visible depending on style used (inline, for example, sets it non-visible).
The original idea I don't know where did it come from, but I got it first from David Anaxagoras's site. He's explicitly given authorization to “do whatever we want” with it. Credits are due in the included syntax.php file.
Also I required a deal of explaining on the current strategies for box rounding and inline background filling with CSS which took me to several CSS forums and pages including A List Apart and Quirksmode.org. Thanks to those people I feel I've advanced since my college CSS class.
| Other Plugins by Luis Machuca B.: | plugin:progrecss plugin:tooltip plugin:clock plugin:countdown plugin:divalign2 plugin:gil plugin:hide plugin:noiewarning |
|---|
Any
will be welcome. As well as suggestions.
Please enable WikiSynthax inside captions!
Something like: <progrecss 100% width=5em;caption=✓ - Download {{:todo:presentation.zip|Presentation}}; />
I'm in the process of learning how to use the Plugins “parse modes”. I have had a hard time testing them… but I'll surely keep working on that. Thanks. – — 'Ryan Chappelle' 2008/11/02 21:45Already implemented, albeit in a limited manner. I would be glad if you can test it. — Luis Machuca B. 2008/12/25 03:55
Thanks, your Plugin is great! No problem, good things take time.
—
OK, I feel like a moron right now. I had not realized there is something very simple called
p_render which can be used, apparently, to make the plugin accept wiki syntax inside the caption. So I'm now working on it
and I'll have news soon. Before the end of the year. Also I have to correct a bug with Firefox and Safari I was not aware of. Peace. Out. — 'Ryan Chappelle' 2008/12/02 09:53
Uploaded new version 1.4, with limited support for wikisyntax, as of Xmas 2008. Merry that Holiday!