Xataface HTML Reports Module 0.2
HTML Reports Module for Xataface
|
So far we have refrained from saving our report and have instead just been using the report preview function. This is not because saving a report template is complicated (it's not - you just click save). It is rather because I want to go over what each of the fields on the template creation form does.
The HTML Reports module makes use of Xataface's Dataface_ActionTool class to help embed reports into the application's user interface. Dataface_ActionTool keeps an inventory of all of the actions defined in the application (via actions.ini files) and makes these actions available in different contexts. Ultimately most of these actions are manifested as buttons or links somewhere in the user interface of the application.
Actions can be grouped by their category directive. This simple directive allows the Action Tool to determine which actions should show up in which section of the user interface. For example, actions with the table_tabs category, will appear as a tab along with details, list, and , etc... whereas if an action has a category of "result_list_actions", it will be displayed in the upper right of the list view along with the "Export CSV" and "Export XML" actions.
Some of the more common action categories and their corresponding purposes are listed below:
Category | Render Location |
---|---|
table_tabs | The tabs wrapping around the table options. E.g. find, list, . |
table_actions | The links/buttons that appear just below the table tabs. These actions generally operate on the table or the entire found set. E.g. "New Record", "Update Set", "Delete Set", etc.. |
result_list_actions | Displayed before and after the list view. These are intended to either operate on the result set or present a different view of the data presented in the result set. E.g. "Export CSV", "Export XML", "RSS Feed", etc.. |
record_actions | Displayed just under the record tabs in the Details tab. These are intended to operate on a single record or present a different view of the current record. E.g. "Export Record as XML", "RSS of Current Record" |
related_list_actions | Similar to the result_list_actions except these are displayed before and after related record lists. |
record_tabs | The tabs that are displayed in details mode for each record. E.g. View, Edit, and the relationship tabs. |
personal_tools | The personal management links accessible to the user. Usually displayed in the top right corner of the interface. E.g. "My Profile", "Control Panel", etc... |
management_actions | Actions that appear in the control panel. |
selected_result_actions | Actions that can act on selected rows in list view. E.g. "Update Selected", "Delete Selected", "Copy Selected", etc...
|
selected_related_result_actions | Similar to selected_result_actions except that this operates on related lists. |
The "Report Name" field is where you specify a unique ID for this report (as far as the Action Tool is concerned. This should contain only letters, numbers, and underscores (i.e. no spaces or special characters). If you do not specify a report label, then this value will be used as the label also.
For our continued "Hello World" example, we'll just insert "hello_world" here.
The "Report Label" field stores the human readable label that will be associated with your report. This is what will be displayed in the user interface for your report. This value is not subject to the same constraints as the "Report Name" field. It can contain any character.
For our example, we'll enter "Hello World" here.
The "Report Category" field is where we specify the action category for our report (i.e. where it will be displayed in the user interface). For this example, let's select "table_actions".
There are 3 possible formats that can be used to render reports using your template:
For our initial example, we are going to select List
Finally we can save our report. Simply click the Save button at the bottom of the form.
Now we can navigate to the table in our application that we chose in the "Tablename" field of our report template. You should notice a new option amongst the table actions (next to "New Record") called "Hello World".
Click on this link, and you should see the current found set rendered using the template we just created.