Page 1 of 1
Consistent table names

Posted:
Wed Jan 25, 2012 1:42 pm
by titleistfour
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
Re: Consistent table names

Posted:
Wed Jan 25, 2012 1:53 pm
by titleistfour
Found another place where the old table name is showing
When viewing relationship records
- "Found 1 Records in relationship <table>"
Thanks,
Jay
Re: Consistent table names

Posted:
Fri Jan 27, 2012 1:57 pm
by titleistfour
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
Re: Consistent table names

Posted:
Fri Jan 27, 2012 2:13 pm
by shannah
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.
Re: Consistent table names

Posted:
Fri Jan 27, 2012 9:17 pm
by titleistfour
It that code safe to run or would you recommend waiting until it is released stable? Thanks for the update.
Jay
Re: Consistent table names

Posted:
Mon Jan 30, 2012 10:59 am
by ADobkin
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
Re: Consistent table names

Posted:
Mon Jan 30, 2012 11:05 pm
by shannah
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
Re: Consistent table names

Posted:
Tue Jan 31, 2012 8:54 am
by titleistfour
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
Re: Consistent table names

Posted:
Sun Oct 28, 2012 10:57 am
by m23k
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
Re: Consistent table names

Posted:
Mon Oct 29, 2012 2:58 am
by m23k
Ah ha!
Set action:label = what you want here
in relationships.ini

Re: Consistent table names

Posted:
Mon Oct 29, 2012 3:01 am
by m23k
Still shows the table name actually under 'add new <table> record' or 'add existing <table> record'
One step closer though...
Re: Consistent table names

Posted:
Mon Oct 29, 2012 8:15 am
by shannah
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