Interface configuration

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

Postby pwg » Thu May 04, 2006 4:14 am

I now have Dataface running nicely. But I need to modify the interface before allowing users access to the application. I can't figure out how to do a few things:

1. I don't want users updating records at all (for the present) using the 'Details' view. I've used a 'beforeUpdate' trigger to prevent this and to return an alert. But I'd rather turn off the 'save' form altogether. How can I do this? (I've disabled the 'actions' menu).

2. I can't figure out how to use conf.ini to control the APPLICATION array constant (as suggested in the documentation). Can you give me an example? For instance; how can I set 'hide_search' or 'hide_view_tabs' fields to 'true'.

3. Is there a way to configure the display of fields to selectively disable their display in the 'details' and the 'list' views? Or does Dataface always display all the fields?

4. How can I disable a 'tab' or create a new one that contains programmed data -- for example, I'd like to add a tab that shows statistics about the data in the table created 'on the fly' from SQL queries etc.

I'm enthusiastic about Dataface but a user rather than a programmer. My apologies in advance for pesky questions and my thanks for your help.

Peter
pwg
 
Posts: 21
Joined: Wed Dec 31, 1969 5:00 pm

Postby njw » Thu May 04, 2006 5:54 am

I can answer point 3 for you.

To stop the display of a field in details, use

widget:type = hidden

for that field in the fields.ini file.

To stop the display of fields in list view, use

visibility:list = hidden

Neil
njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu May 04, 2006 9:01 am

>I'd rather turn off the 'save' form altogether. How can I do this?

You can do this using permissions. Check out the last part of the Permissions tutorial here http://framework.weblite.ca/documentation/tutorial/getting_started/permissions/view .

> I can't figure out how to use conf.ini to control the APPLICATION array constant
You can set these flags in the top of the conf.ini file before any of the sections.

e.g.,

hide_search = true
...
[_database]
...

> How can I disable a 'tab' or create a new one that contains programmed data

OK.. in the current version there is no way to disable just one tab. However, you can disable "all" of the tabs and provide a custom menu to link to the parts of the application that you need. This can be done as follows:

Add a directory named "templates" to your application directory. Create a file named Dataface_Application_Menu.html to this directory and place some text in it. Reload your application and you'll notice that the contents of this file are displayed in the left column of your application. You can build a menu of all of the pages that the user will need to visit in this menu.

Dataface uses a logical URL scheme to link to its pages, so you should be able to easily specify your links to any part of the application.

Next, for a "custom" tab to contain programmed data.

Create a directory in your application directory named "pages". Any php file that you add to this directory will be treated as a custom action that is accessible by setting "-action=custom_" . E.g., if you were to had a page called home.php to your "pages" directory, then this page could be accessed by setting "-action=custom_home" in the URL for your application.

Hope this helps.

Best regards

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

Postby pwg » Thu May 04, 2006 3:29 pm

Thank you for the quick response Steve (and njw). Much appreciated.
pwg
 
Posts: 21
Joined: Wed Dec 31, 1969 5:00 pm

Postby pwg » Fri May 05, 2006 5:52 am

Hi Steve,

On the issue of disabling the 'save' form: I followed your suggestion and used a much-truncated permission routine in the table's delegate class (making the 'details' form READ_ONLY for everyone). But that STILL left an orphaned 'save' button at the bottom of the page. I've now hacked QuickForm.php to eliminate this.

Since I really don't know what I'm doing, I thought I'd check that this will be robust (not elegant... ). At about Line 895 of QuickForm.php I inserted a conditional that seems to knock out the redundant save button:

if (!Dataface_PermissionsTool::READ_ONLY()){
$this->addElement('submit','submit_new_'.$this->tablename.'_record','Save');
// add the submit button.
}

But I'm not at all confident that this is the right way to check the permissions environment of the $record. Is it?

Thanks again,

Peter
pwg
 
Posts: 21
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri May 05, 2006 7:48 am

Hi Peter,

Thanks for pointing this out.. I'll have to come up with a fix for this issue. You had the right idea in your modification. Just change
if (!Dataface_PermissionsTool::READ_ONLY()){

to

if ( !$this->_new and !Dataface_PermissionsTool::edit($this->_record) ){

That will do the trick properly.

Best regards

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

Postby shannah » Fri May 05, 2006 11:33 am

My mistake, you actually want that contrapositive:
if ( $this->_new or Dataface_PermissionsTool::edit($this->_record) ){
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby pwg » Fri May 05, 2006 4:12 pm

Thanks very much Steve. I'm grateful for the expert support.

Best,

Peter
pwg
 
Posts: 21
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 39 guests

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