Action tabs

A place for users and developers of the Xataface to discuss and receive support.

Postby yusif » Tue Oct 09, 2007 12:27 pm

Hi Steve,
How do I create actions as tabs to appear in the same maner as the relationship tab so that clicking on it gives me the specified template and up submitting another action handler takes care of the submitted info.

Thanks in advance
Yusif
yusif
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Oct 10, 2007 11:20 pm

Hi Yusif,

Dataface decides which actions show up in the relationship tabs (and the view/edit etc.. tabs) using the 'category' directive of the action in the actions.ini file. The relationship tabs category is 'record_tabs' so if you create an action with category 'record_tabs' the action should show up as another tab along side 'view' and 'edit'.

You can see how this works by looking at the 'view' action in the dataface actions.ini file:
Code: Select all
[view]
   label = View
   url = "{$this->url('-action=view&-relationship=')}"
   template = Dataface_View_Record.html
   permission = view
   mode = browse
   category = record_tabs
   selected_condition = "$query['-action'] == 'view'"
   order=-2


There are a few important things to notice:
1. The 'url' directive is necessary to make clicking on the tab go to the correct url. You should be able to copy the url directive from the view record above, only changing 'action=view' to 'action=youractionname'.
2. The mode directive indicates which of the 'details'/'list'/..etc.. tabs will be selected when your action is activated. Options include browse, list, find, and more..
3. The category directive, as I mentioned is how dataface knows to put this action in the record tabs.
4. The selected_condition directive is important for making the tab appear to be selected when you are viewing the template for your action. It is a PHP expression that should resolve to a boolean value. You should be able to easily adapt the value in the view action to suit your purposes.
5. If, when a user clicks on your action, you want it to appear inside the proper tab set as the view tab and all the rest (i.e. you want the tabs to still show up in your action template) your template should inherit from the Dataface_Record_Template.html). You can look at the Dataface_View_Record.html template that is used by the view action as a sample.

The critical thing here is that your template looks something like this:
Code: Select all
{use_macro file="Dataface_Record_Template.html"}
    {fill_slot name="record_content"}

         ... your content goes here ...
    {/fill_slot}
{/use_macro}


If you don't know what this syntax means, please check out the portions of the dataface documentation and tutorials that deal with customizing the dataface look and feel for an explanation.

Hope this helps.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 24 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved