-
Notifications
You must be signed in to change notification settings - Fork 57
actions.ini file
The actions.ini file stores information about the various actions that can be performed by your application. An action may be manifested in two ways:
- As a web page
- As a menu item
[browse > browse]
label = Browse
The > symbol simply means to inherit from the existing browse action. All the attributes are the same, and we just override the label to Browse (originally was Details)
Additionally, for actions that pertain only to a single table, an actions.ini file may be placed in any table configuration directory.
As with the fields.ini file and the valuelists.ini file, the actions.ini file uses the simple INI file syntax to define its actions. Each action is defined in its own section, and can have a number of directives to specify the action's behavior.
Here is a snippet from the Xataface actions.ini file to give you an idea:
;; Show the details of the current record
[browse]
label = Details
category = table_tabs
url = "{$this->url('-action=view')}"
accessKey = "b"
mode = browse
permission = view
order=0
;; Show a list of the records in the current found set
[list]
label = List
category = table_tabs
url = "{$this->url('-action=list')}"
accessKey = "l"
mode = list
template = Dataface_List_View.html
permission = list
order=0.5
;; Show a "Find Record Form"
[find]
label = Find
category = table_tabs
url = "{$this->url('-action=find')}"
accessKey = "f"
mode = find
permission = find
template = Dataface_Find_View.html
order=0.75
This snippet shows the definition of the browse, list, and find actions - three of the most central actions in a Xataface application. Notice how each action has its own section (according to INI file syntax) with a number of directives which specify how the action behaves. For instance, each action has a "category" value of "table_tabs", which tells Xataface to display the actions as part of the table tabs in the user interface.
Name | Description | Version |
---|---|---|
allow_override | An optional directive to indicate that this action can be overridden by more specific directives in another ini file. Currently there is only support for a value of "relationships.ini" indicating that the settings can be overridden in the relationships.ini file. In order for this to work, related=1 must also be set. | 1.3rc4 |
label | The label to display if the action is used as a menu item. | all |
category | The name of the action's category which can be used to group this action together with other similar actions to be used in a menu in the user interface. | all |
url | If the action appears as a menu item, this is the URL that the menu item points to. This may contain PHP expressions inside curly braces. | all |
accessKey | The key code to automatically select this action if it is included as a menu item. I.e. ALT+accessKey calls the action. | all |
mode | This indicates which tab of the table tabs (find, details, list, etc...) that this action should appear to be part of when the action is viewed as a web page. If this is left undefined, or it does not match any existing visible action in the table tabs, then no tab will appear to be selected. | all |
permission | The name of a permission required to both see the action as part of a menu and to access the action as a web page. | all |
visible | A boolean value indicating whether the action should be visible as a menu item. | all |
condition | A boolean value or a PHP expression evaluating to a boolean value to indicate whether the action should be visible as a menu item. | all |
url_condition | A PHP expression evaluating to a boolean value to indicate whether the URL directive should be evaluated. This basically checks to make sure that its OK to evaluate the "url" expression, just in case the current state of affairs would cause it to throw a fatal error. | all |
order | A numeric value indicating the order in which the action should be displayed as part of a menu. Low numbers result in higher placement in the menu. | all |
icon | The path to an icon that should be used when the action appears as a menu item. | all |
template | The path to the template that should be used when the action is displayed as a web page. | all |
description | Mouseover text for the action (when displayed as a menu item). | all |
Notice that the url, condition, and url_condition directives allow you to use a PHP expression for their values. In order for this to be helpful, you should know a little bit about the context and environment in which these expressions will be executed. All expressions are evaluated immediately prior to being rendered, so the same action can be displayed multiple times in the same page, but have very different resulting values for their urls and conditions.
These expressions are all executed within the context of the Dataface_Application::parseString() method, with the following variables loaded in the local symbol table (i.e. you can use the following variables in your expressions).
Name | Description | Version |
---|---|---|
$site_url | The URL to the current application's directory (not including "index.php") | all |
$site_href | The URL to the current application including "index.php" | all |
$dataface_url | The URL to the xataface installation directory. | all |
$table |