Use of MidCOM toolbars
Henri Bergius <henri.bergius-ZpG/[email protected]> Tue, 14 Feb 2006 10:37:58 +0200
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
To make the life of layout developers easier I would like to propose
some guidelines on how to use toolbars in components. I'm posting it
here for discussion first, and will later turn it either to mRFC or
simply a documentation page.
The basis of all this is the midcom_helper_toolbars class originally
written for Aegir toolbar handling.
## Using toolbars in components
The toolbars class provides a static toolbar instance (i.e. one set
of toolbars that all components of a HTTP request can manipulate).
First you need to get it by:
$toolbars = &midcom_helper_toolbars::get_instance();
Inside this object you have four midcom_helper_toolbar instances that
you can populate by adding buttons:
* top
* bottom
* aegir_menu
* aegir_location
Buttons are added in the following way:
$toolbars->top->add_item(
array
(
// Normal toolbar item array
)
);
## Displaying the toolbars
Site layout can display the toolbar in the following way:
$toolbars = &midcom_helper_toolbars::get_instance();
if (count($toolbars->top->items) > 0)
{
echo $toolbars->top->render();
}
## Why use these toolbars?
If all components use the toolbars in consistent ways, it is much
easier for layout template writers to place and style the toolbars in
consistent and fitting manner.
It also means that all components will have more or less consistent UI.
## What should go into each toolbar
I would propose the toolbars to be used in the following fashion:
* `top`: actions user can take, including "Create article", "Report
as spam"
* `bottom`: different views of the same object or listing, including
"Edit", "Delete", "Revisions"
* `aegir_menu`: Global actions like "Help" and "Logout" (help should
be contextual help using the midcom.admin.help component)
Please comment.
/Bergie
Henri Bergius
Consultant Partner, Nemein
henri.bergius-ZpG/[email protected]
Midgard CMS
www.midgard-project.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFD8ZbSNkT8k497k9IRAoEtAKCsKl7E9h1Bvi5fLRnZlIhXTnyydQCePVHm
RH7YC/VDumYYl7QPX9n20nM=
=02E2
-----END PGP SIGNATURE-----