Taxonomies, Panels and Component Help (oh my!)
Three burning new features as we work towards getting Fakoli ready for its public debut.
Taxonomies
The new taxonomy component enables the construction of arbitrary taxonomies of terms. These can then be associated with any DataItems that register themselves with the taxonomy manager. Once registered, the taxonomies can be seamlessly added in to AutoForms allowing generic data objects to be classified on a configurable, per application basis.
To register your DataItem as supporting taxonomy classification, just add an event handler for the "RegisterTaxonomyClasses" event. Your DataItem class will then be presented as a classification target in the form when creating or editing a taxonomy.
To add the configured taxonomy field renderers into one of your AutoForms, you would use the line:
TaxonomyManager::addTaxonomyFieldRenderers($form);
Everything is then handled automatically through the standard AutoForm engine. You can make pretty much anything classifiable by taxonomy. For now, most of the generic CMS data classes such as Page, Article, Document and ImageRecord have been registered in this way.
This is just the first step for the taxonomy component. Taxonomies will soon be integrated into advanced site search, displayable as lists of terms, and used to highlight terms within content like our old 'glossarizer' component.
Panels
The Panel class is a new PHP class that can be used to tie a block of content within a generated page to a particular action handler. This part of the page can then be updated via an asynchronous AJAX request. For example, suppose you had a table on your page that could be updated via a modal dialog box on the same page. To simplify this code using panels you would write the table definition within an action handler, then create a Panel, like so:
$panel = new Panel("my_panel", "/action/my_component/draw_table?table_id=1");
$panel->draw();
where draw_table is the action handler on your component and you want to pass it a table_id parameter. This code would then call the action handler via local dispatch (inline as part of the current page request) and wrap it in a div like so:
<div id='my_panel' data-url='/action/my_component/draw_table?table_id=1'> ... your generated table ... </div>
The data-url attribute is a custom HTML 5 data- attribute. On page load a MooTools shim picks these attributes up and attaches a reload() method to the div's DOM object. When you want to update the table as the result of some user interaction you would just call
document.id('my_panel').reload();
from your Javascript, optionally passing a function to be called once the reload is complete. Yes, this is very cool. Thank you.
Component Help
Components can now provide online documentation for the admin section as a simple collection of include files. To get started, just add a "help" folder to your component's directory structure. Each .inc file within this folder will get pulled in as a file in the online help, and should contain an HTML fragment providing the documentation (no <head> or <body> tags required). If the .inc file matches an admin page provided by your component then clicking on the new Help link in the admin interface will navigate the help popup right to the associated help page.
The help viewer will do its best to organize files by their name and component, but you can provide custom details by adding a help map in a file called help.inc within your help directory. Help maps look like this (this example is from the 'component' component).
$help_map = array("default" => "index",
"title" => "Component Management",
"pages" => array(
"index" => "How Fakoli Manages Components",
"components" => "The Component List",
"component_pages" => "Component Pages",
"component_page_form" => "The Component Page Form",
"component_page_modules" => "Mapping Component Page Modules"));
The goal is to have components be pretty much self-documented. Feel free to add developer notes, design requirements, code tips, how to use the forms, whatever you feel is useful.
Simplified DataItems and Calculated Fields » « Progressive Search Field Renderer
