Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

 
Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: actions.ini_file

actions.ini_file

[Permalink]

actions.ini file Reference

The actions.ini file stores information about the various action?s that can be performed by your application. An action may be manifested in two ways:

  1. As a web page
  2. As a menu item

And there is no reason why an action cannot serve in both capacities simultaneously. All menu items and functions that Xataface performs are defined in the Xataface actions.ini file (in the root of the Xataface installation dirctory). You can also create an actions.ini file in your application's root directory to override existing Xataface actions, or to create your own. If you want to modify an existing action instead of overriding it, you can use this syntax.

[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?.

Syntax

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.

Directives

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

PHP Expression Context

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 The name of the current table (i.e. the value of the "-table" request parameter" all
$query An associative array of the current query variables. all
$app A reference to the current Dataface_Application object. Alias of "$this" all
$resultSet A reference to the Dataface_QueryTool object for the current query. all
$record? A reference to the current Dataface_Record object. all
$context? An associative array of context variables that are passed to the action from the context in which the action is called. all
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2017 All rights reserved