Custom action - tab not highlighted
Archived from the Xataface Users forum.
aytonk — Wed Apr 25, 2012 11:09 am
Hi all! As a noob to Xataface (although an experienced programmer), first can I apologise if this is a dumb question. Please be gentle with me
I’ve set up a database and let Xataface create the default forms etc, and I’ve done a bit of tailoring - all dead easy.
What I’m trying to do now is add an extra item to the View / Edit tabs in the Details view. What I’ve done is:
- Added a new item in my site actions.ini file:
[sitebuild]
label = “Site Build”
url = “{$this->url(‘-action=sitebuild’)}”
order = 20
category = record_tabs
template = LOPC_SiteBuild.html
- Created the LOPC_SiteBuildhtml file in
/templates directory {use\_macro file="Dataface\_Record\_Template.html"} {fill\_slot name="record\_content"}
LOPC Site Build
Sorry - still under development - please try again later
{/fill_slot}
{/use_macro}
When I went to a table’s details page, sure enough the new tab was there after View / Edit, and when I click on it, I get the right html displayed.
But the ‘sitedetails’ tab doesn’t get highlighted to show that’s what is selected - when the mouse moves away the highlight goes off.
What do I need to do to fix this?
Thanks
Kevin
aytonk — Wed Apr 25, 2012 12:07 pm
Sorry, bad practice to follow up your own post, I know, but I’ve just noticed that when I select my new ‘site build’ tab, in the level above the selection changes from ‘details’ to ‘list’.
Is this causing my non-selction problem? And how do I fix it?
Thanks
Kevin
shannah — Sat Apr 28, 2012 10:00 pm
You need to make use of the selected_condition directive in your action. As an example, consider the “view” action definition:
- 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
The selected_condition action is a PHP expression that tells xataface when the action should be selected. Your selected_condition directive would probably be:
- Code: Select all
selected_condition = "$query['-action'] == 'sitebuild'"
-Steve
aytonk — Wed May 02, 2012 1:29 am
Steve - thanks for the info. I knew it had to be somethign pretty simple - just had to find it.
Kevin