Consistent table names

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

Consistent table names

Postby titleistfour » Wed Jan 25, 2012 1:42 pm

Hello,

I have what is probably a simple question. I would like to find out the easiest way to standardize the table names we are managing with Xataface across the entire site. More specifically, if I have a table name like 'my_table_name', is there an easy way to label that 'My Table Name' across the entire site?

I know you can do this in the [_tables] section of conf.ini and tabs show the correct names, but I still see a few places where that appears to be ignored.

If I have relationships between 2 tables defined
- add new <table> record link is showing the original table name
- add existing <table> record is also showing the original table name

On the Details tab
- "Found 5 of 6 records in table <table>" shows the original table name

Does that make sense? Thanks for any pointers!

Jay
titleistfour
 
Posts: 18
Joined: Wed Jan 25, 2012 10:12 am

Re: Consistent table names

Postby titleistfour » Wed Jan 25, 2012 1:53 pm

Found another place where the old table name is showing

When viewing relationship records
- "Found 1 Records in relationship <table>"

Thanks,
Jay
titleistfour
 
Posts: 18
Joined: Wed Jan 25, 2012 10:12 am

Re: Consistent table names

Postby titleistfour » Fri Jan 27, 2012 1:57 pm

Been digging around in the code and haven't been able to figure out where to fix this. Wasn't as simple as I originally thought :-)

Jay
titleistfour
 
Posts: 18
Joined: Wed Jan 25, 2012 10:12 am

Re: Consistent table names

Postby shannah » Fri Jan 27, 2012 2:13 pm

I think this is actually fixed in SVN / 2.0 trunk... I haven't applied the changes back to the 1.3.x branch though.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Consistent table names

Postby titleistfour » Fri Jan 27, 2012 9:17 pm

It that code safe to run or would you recommend waiting until it is released stable? Thanks for the update.

Jay
titleistfour
 
Posts: 18
Joined: Wed Jan 25, 2012 10:12 am

Re: Consistent table names

Postby ADobkin » Mon Jan 30, 2012 10:59 am

I resolved this issue in my applications as follows. In each table delegate class, I have an init function:

function init(&$table) {
// Set table label (user friendly name) - overrides _tables array
$table->_atts['label'] = "Table Name";
}

The other reason for doing it this way is because I have some tables which are not listed in the conf.ini file. I don't want them to appear as primary tabs in the navigation bar, but I do want them to have friendly/consistent names when I access them.

Alan
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: Consistent table names

Postby shannah » Mon Jan 30, 2012 11:05 pm

I think in the latest release (1.3rc6) there are still some places where it will use the table name instead of the label. Alan's solution will work for the later branches.

As far as the stability question - the 2.0 api is subject to some modifications, but it should be reasonably stable. The most stable branch to be running is the 1.3.x branch from SVN as this is frozen for features but will keep up with bug fixes.

E.g. this table name issue fix will be back ported to this branch but new directives and features will not be added to this.

I'm hoping to get a 2.0 release out within the next few months.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Consistent table names

Postby titleistfour » Tue Jan 31, 2012 8:54 am

Ah thanks for the info Alan and Steve. I will try that function out and probably checkout from the 1.3.x branch and update from that until 2 comes out.

Thanks,
Jay
titleistfour
 
Posts: 18
Joined: Wed Jan 25, 2012 10:12 am

Re: Consistent table names

Postby m23k » Sun Oct 28, 2012 10:57 am

Hi

Is there any update/progress on this? I tried the code but it has had no effect.

Just to clarify, I want the friendly names for tables to show under the "this record" section on the left and on the view/edit/<table name> tabs on a record.

Apologies if I have missed something.

Thanks
M
m23k
 
Posts: 19
Joined: Sun Oct 28, 2012 10:53 am

Re: Consistent table names

Postby m23k » Mon Oct 29, 2012 2:58 am

Ah ha!

Set action:label = what you want here

in relationships.ini :)
m23k
 
Posts: 19
Joined: Sun Oct 28, 2012 10:53 am

Re: Consistent table names

Postby m23k » Mon Oct 29, 2012 3:01 am

Still shows the table name actually under 'add new <table> record' or 'add existing <table> record'

One step closer though...
m23k
 
Posts: 19
Joined: Sun Oct 28, 2012 10:53 am

Re: Consistent table names

Postby shannah » Mon Oct 29, 2012 8:15 am

An example from the g2 module that might help.

Code: Select all
[add_new_related_record_g2]
   label="New {$relationship->getSingularLabel()}"
   description="Create a new {$relationship->getSingularLabel()} and add it to the {$record->getTitle()}"
   label_condition="$relationship"
   description_condition="$relationship"
   condition="$relationship and $relationship->supportsAddNew()"
   permission="add new related record"
   category=related_list_actions
   url="{$this->url('-action=new_related_record')}"
   order=-1000


Notice that the label references the getSingularLabel() method of Dataface_Relationship. Unfortunately this method doesn't exist in 1.3.x. You can take a look at the Dataface_Relationship class from 2.0 and copy the getSingularLabel() method if you just need this one thing.

http://weblite.ca/svn/dataface/core/tru ... onship.php

-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 19 guests

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