Custom action - tab not highlighted

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

Custom action - tab not highlighted

Postby 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:

1. 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

2. Created the LOPC_SiteBuildhtml file in <site>/templates directory
{use_macro file="Dataface_Record_Template.html"}
{fill_slot name="record_content"}
<h1>LOPC Site Build</h1>
<p>Sorry - still under development - please try again later</p>
{/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
 
Posts: 7
Joined: Wed Apr 25, 2012 10:36 am

Re: Custom action - tab not highlighted

Postby 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
aytonk
 
Posts: 7
Joined: Wed Apr 25, 2012 10:36 am

Re: Custom action - tab not highlighted

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Custom action - tab not highlighted

Postby 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
aytonk
 
Posts: 7
Joined: Wed Apr 25, 2012 10:36 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 1 guest

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