A place for users and developers of the Xataface to discuss and receive support.
by spacelab » Mon May 26, 2008 5:18 am
Hi,
I was wondering if it was possible to disable the 'last updated' feature on the the details page? I don't need it and it is showing an incorrect value (as in I haven't setup any time stamps). Thanks for any help anyone can offer.
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by shannah » Mon May 26, 2008 11:59 am
The easiest way to hide these is with CSS:
- Code: Select all
.dataface-view-status { display: none; }
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by spacelab » Wed May 28, 2008 9:22 am
That's great thanks!
Sorry to bug you again, but I have a weird issue with another part of my application. I created a related table and it works fine but it created an expandable table within the body of the record named after the related table which is messing up the detail view. Did I do something wrong here. I am using Xataface 0.7.1. See image below as I'm sure this is a useless description!
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by shannah » Wed May 28, 2008 10:16 am
Strange. Looks like a stylesheets issue. What browser are you using? Any chance you can provide a URL for me to check it out?
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by spacelab » Wed May 28, 2008 10:50 am
PM'd you about this. Thanks again,
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by shannah » Wed May 28, 2008 5:20 pm
Yes. This is a stylesheet issue. It has been corrected in Xataface 1.0 by changing the view tab layout to use tables.
In 0.7 you may have to make some CSS declarations. E.g. you could hide the left column of the view tab with the following:
- Code: Select all
.dataface-sections-left { display: none; }
You can probably come up with a nicer solution if you look into it for a while (or you could just update to xataface 1.0).
-Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by spacelab » Thu May 29, 2008 2:24 am
That's great thanks. Worked a treat.
I have one final issue with this which I can't seem to fix (dumb n00b). I would like the images that we use in this database to not display inline i.e. it would be nice if it was simply a link with 'display in new window'. This works fine in another part of the site which uses pdfs. But using mimetype fields etc just displays images inline unless I go in and change the record in the database to something like application/jpg.
So, to sum up, Is there any way to force xataface to display a link rather than the image itself? I have looked around the forum and is the htmlValue delegate class the way to go? I tried putting anchor tags in this but it didn't seem to do anything.
A final really useful thing would be to display these related images on the details page of the main record, rather than in a separate table. Is this possible using delegate classes as well (or perhaps a table join?)
Sorry for all these questions. I really think xataface is great, and thanks for such a great tool. It has saved my bacon!
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by shannah » Sat May 31, 2008 8:58 am
not display inline i.e. it would be nice if it was simply a link with 'display in new window'.
Perhaps try to override the HTML representation of your image field by implementing the fieldname__htmlValue() method in the delegate class. e.g. If the image field is named 'image', then your delegate method might look like: - Code: Select all
function image__htmlValue(&$record){ return '<a href="'.$record->display('image').'" target="_blank">Open in new window</a>'; }
final really useful thing would be to display these related images on the details page of the main record,
You can create custom sections to be displayed in the view tab by implementing methods of the form section__%SECTION_NAME% in the delegate class. e.g. you might do something like: - Code: Select all
function section__images(&$record){ $images = $record->getRelatedRecordObjects('images'); $content = '<ul>'; foreach ($images as $image){ $content .= '<li>'.$image->htmlValue().'</li>'; } $content .= '</ul>';
return array( 'label' => 'Images', 'class' => 'main', // Section is in the main column 'content' => $content, 'order' => 10 // Play with this order to find the right position ); }
}
Last edited by shannah on Sat May 31, 2008 12:27 pm, edited 1 time in total.
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by spacelab » Sat May 31, 2008 9:57 am
This is great! I'll have a go at this and let you know how I get on.
Thanks again for all the help.
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by spacelab » Sun Jun 01, 2008 4:50 am
Sorry to be a pain! I'm afraid I seem to be getting error messages with these delegate classes.
The first, for displaying an 'Open in New Window' returns this:
- Code: Select all
12 Last updated Wednesday, December 31, 1969 - 2049 weeks ago
Fatal error: Cannot use object of type PEAR_Error as array in /home/thenorva/public_html/atmresearch/xataface2/Dataface/Table.php on line 2485 Image ID 12
The second class produces this error: - Code: Select all
Warning: Missing argument 1 for Dataface_RelatedRecord::htmlValue(), called in /home/thenorva/public_html/atmresearch/tables/tblFileCardCombo/tblFileCardCombo.php on line 8 and defined in /home/thenorva/public_html/atmresearch/xataface2/Dataface/RelatedRecord.php on line 297
Fatal error: Attempt to get value for fieldname '' that does not exist in related record of relationship 'Images'. Acceptable values include {ImageID, FileCardID, Image, Image_mimetype}. On line 256 of file /home/thenorva/public_html/atmresearch/xataface2/Dataface/RelatedRecord.php in function printStackTrace() On line 298 of file /home/thenorva/public_html/atmresearch/xataface2/Dataface/RelatedRecord.php in function getValue() On line 8 of file /home/thenorva/public_html/atmresearch/tables/tblFileCardCombo/tblFileCardCombo.php in function htmlValue() On line of file in function section__images(Dataface_Record Object) On line 49 of file /home/thenorva/public_html/atmresearch/xataface2/Dataface/RecordView.php in function call_user_func(array(tables_tblFileCardCombo Object,section__images),Dataface_Record Object) On line 383 of file /home/thenorva/public_html/atmresearch/xataface2/Dataface/SkinTool.php in function Dataface_RecordView(Dataface_Record Object) On line 15 of file /home/thenorva/pu in /home/thenorva/public_html/atmresearch/xataface2/Dataface/RelatedRecord.php on line 256
I think I have changed any field names etc. that need to be changed. In this second class it looks like there is a line missing from the code. I looked up the delegate class reference but didn't find an entry for getRelatedRecordObjects. I changed the line: - Code: Select all
$content .= '<li>'.$image->htmlValue().'</li>';
to this: - Code: Select all
$content .= '<li>'.$image->htmlValue(&$record).'</li>';
But it simply displayed another error message: - Code: Select all
Catchable fatal error: Object of class Dataface_Record could not be converted to string in /home/thenorva/public_html/atmresearch/xataface2/Dataface/RelatedRecord.php on line 245
I'm sorry about this, most likely some sort of brainfade on my part!
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by shannah » Mon Jun 02, 2008 8:27 am
I made a typo in my example.
The htmlValue() method takes a parameter: the name of the field.
e.g.
if you want to get the html value of the 'image' field you would call:
$record->htmlValue('image').
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by spacelab » Thu Jun 05, 2008 12:35 am
Thanks again, this worked great and it resolved both issues.
Now for the fun part...data entry!
Robert
-
spacelab
-
- Posts: 10
- Joined: Mon May 12, 2008 12:27 pm
by njw » Sun Jun 22, 2008 8:00 am
Where do you put the CSS code please? I have multiple databases with different user groups, so I would prefer to have it attached to a specific database implementation.
Many thanks
Neil
-
njw
-
- Posts: 280
- Joined: Wed Dec 31, 1969 5:00 pm
by shannah » Mon Jun 23, 2008 8:21 am
Hi Neil,
You have a lot of different options for where you can attach the css code. The easiest place (in my opinion), is to implement the block__custom_stylesheets() method in the application delegate class and include your stylesheet there.
- Code: Select all
function block__custom_stylesheets(){ echo '<link>'; }
-
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 32 guests
|