====
We’re gonna use some [[plugin:wrap#syntax|Wrap syntax]].
---- datatable ----
cols : %pageid%, first name, last name
headers : ..., First Name, Last Name
filter : type = employee
and : last name !=
sort : last name
----
---- datatable ----
cols : position, birthday, room, room phone, office mobile, office email_mail, office im, personal mobile, personal home phone, personal email_mail, personal im, personal url_url, personal area
headers : Position, Birthday, Room, Int Phone, Office Mobile, Office E-mail, Office IM, Personal Mobile, Home Phone, Personal E-mail, Personal IM, Website or Blog, Area of Residence
filter : type = employee
and : last name !=
sort : last name
----
* Capital %%WRAPs%% are used to produce ''%%
%%'' elements.
* Those ''employees'', ''employees_fixed'' and ''employees_scrolling'' are CSS classes that can be styled from your CSS file.
* The actual CSS classes will be called ''.wrap_employees'', ''.wrap_employees_fixed'' and ''.wrap_employees_scrolling''.
* And some guidelines for users an a link to create a new employee.
==== Applying the CSS ====
Open (or create) the ''userstyle.css'' file, located in thr ''conf'' folder of your DokuWiki installation.
Add the following:
/* EMPLOYEES TABLE */
/* BOTH parts of employees table */
.wrap_employees {
white-space: nowrap; /* prevent word wraps */
font-size: 0.7em; /* making the font smaller */
}
/* FIXED part of employees table */
.wrap_employees_fixed {
float: left; /* make it apper to the left of the scrolling part */
}
/* SCROLLING part of employees table */
.wrap_employees_scrolling {
overflow-x: scroll; /* do the scrolling magic*/
}
/* Opera browser Hack */
.wrap_employees th {
height: 2.3em; /* pevents table headers have different height */
}
Now much better.
===== Add more employees and see the result! =====
{{ https://img-fotki.yandex.ru/get/11/85226599.c/0_b4744_3c9d59bf_orig.png?recache |List of employees}}
There’s an unfortunate glitch in Firefox: the “''overflow: scroll''” css style removes the top border of the scrolling table. :-(
IE, Opera and Chrome are fine.
===== Pagename drawbacks dealt with =====
One problem is that each employee must have a unique combination of first and last name. If a collision occurs, you’ll have add unwanted characters to either first or last name of a namesake. This is because the names of employees’ pages are composed of first an last names an DokuWiki requires all pagenames within a namespace to be unique.
This issue can be easily solved by including date of birth into pagenames. But then you’ll have to set the birthday field required. To do that, remove the exclamation mark next to the birthday field in [[#Creating the form of adding new employees|your bureaucracy template]].
Another problem is that the [[config:useheading|useheading]] option of DokuWiki must be set to display headers instead of pagenames in link names in page content. Links should be replaced with heading due to the following unfortunate combination of headings:
* in the table of employees, **data** uses pagenames as names of links to employees’ pages;
* **data** doesn’t let you provide custom link names;
* pagenames consist of employees’ full names;
* we’ve already got first and last names in the table and don’t want the names to be duplicated in links.
You will not run into either of the problems if you’re going to store unique login names or nicknames of employees. Just use login names as pagenames!
===== Author, license =====
[[user>lolmaus|Andrey ‘lolmaus’ Mikhaylov]]
Published under: http://creativecommons.org/licenses/by-nc-sa/3.0/