Page 1 of 1

PostPosted: Tue May 15, 2007 6:08 pm
by bobfelts
Hi. When I view details of a sample Db I am setting up for a proposal, I get this message when I go to Detail View. There is also a graphic of a *very* large question mark on the left side of the page. (To the left of the detail view information.) I tried a bulk update to all records in this table, rewriting the date of a field, but all records still show last update as 1995 weeks ago, dated 12-31-1969. Any ideas where I went south here?

Bob # (The record name)
Bob
Last updated Wednesday, December 31, 1969 - 1995 weeks ago

Version Dataface 0.7 dev 4
Ubantu Linux 6.06.1 LTS
FireFox 2.x
PHP5.1.2
MySQL 5.0.22-Debian_0ubuntu

Thanks,
Bob

PostPosted: Wed May 16, 2007 7:00 am
by Markus
Hi Bob, hi Steve,

I can see a similar view in details of the 0.71 version of DF when I am changing from list to detail view. I think the big question mark should maybe symbolize a placeholder for a possible Image in detail view. How can I put in an Image in there for each record?

The Last update statement in fact looks not quite right. In my app : Last updated Thursday, January 1, 1970 - 1943 weeks ago Maybe not ba big bug...

Markus

PostPosted: Wed May 16, 2007 8:13 am
by shannah

The question mark is a placeholder when the record doesn't have an image field.Ê If the record has a blob field or a container field that stores an image, the image will be displayed here.Ê Alternatively you can specify any image to be a logo field by adding logo=1 in the fields.ini file section for that field (then make sure that you implement the %fieldname%__htmlValue() method to return an tag).

You can hide this image altogether using the hide_record_view_logo preference setting ( seeÊ http://framework.weblite.ca/documentation/manual/conf_ini/prefs for info about preferences).

As for the last updated section.Ê Dataface has some logic to try to figure out the last updated time for a record was.Ê It looks at the names of the fields in the table to see if there is one that looks like a last modified field.Ê It will use this field's value as the last modified time.Ê You can also implement a method in the delegate class called getLastModified(&$record) to return a string representing the last modified time as a string.

e.g.

function getLastModified(&$record){
ÊÊÊ return date('Y-m-d H:i:s');
}

will always return the current time as last modified.

or perhaps

function getLastModified(&$record){
ÊÊÊ return $record->strval('mtime');
}

if you are storing the modification time in the mtime field.

If your dates are looking weird here, that means that either you don't have a datetime/timestamp field in your record or dataface isn't recognizingÊ it.ÊÊ What are the names of your modification fields if you have them, so that I can try to adjust the DatafaceÊ guessing function to handle more cases?

Best regards

Steve


PostPosted: Fri Jun 01, 2007 2:42 pm
by bobfelts
Hi Steve. Regarding the image display using a blob field:

"If the record has a blob field or a container field that stores an image, the image will be displayed here."

I have placed a blob in the Db, on one of the tables I am using. My image simply will not show up. After I modified the table to include the blob field, I deleted my application folders and re ran makesite to recreate the DataFace info. Do I still need to implement the %fieldname%__htmlValue() code, and, if so, how specifically do I do this? I have looked for a howto or tutorial on that last, and have not found it if there is one. I do get a hot link (view field content in new window) to display the image outside of DataFace when looking at the details view within DataFace.

Thanks again,
Bob

PostPosted: Fri Jun 01, 2007 3:18 pm
by shannah

Hi Bob,

When using a blob field it is a good idea to also have a field to store the mimetype.Ê That way dataface can discern whether or not the blob is an image file.Ê If you create a column with the same name as the blob field but with ('_mimetype') at the end, Dataface will know what to do with it.
e.g. if your blob field is named 'myfile', then the corresponding mimetype column should be called 'myfile_mimetype'.
An alternative is to designate the column as a "logo" in the fields.ini file by adding the logo attribute
e.g.
[myfile]
logo=1
If you do this you shouldn't have to implement the %fieldname%__htmlValue() method.
However for your information, you can implement the %fieldname%__htmlValue() method in your delegate class as follows.Ê Suppose youÊ have a text field where users can enter a full URL to their portrait.Ê Assume this field is named 'portait'.Ê If you want this to be displayed as an image in details view (and not just the string url), then you would implement the portrait__htmlValue() method as follows:
function portait__htmlValue(&$record){
ÊÊÊ return 'Portrait';
}
Hope this helps.
-Steve

PostPosted: Mon Jun 04, 2007 2:52 am
by bobfelts
Hi Steve. I have both implemented the portrait_mimetype, (Varchar, Null, Default .jpg) and the fields.ini methods with no luck. The _mimetype produces no change, the question mark placeholder remains. The fields.ini method replaces the question mark placeholder with a link to display the image in a new window. Any help is appreciated as always.

Thanks,
Bob

PostPosted: Mon Jun 04, 2007 8:00 am
by shannah

Hi Bob,

This may be a bug that needs to be fixed, but you can work around it for the time being by implementing a portrait__htmlValue() method in your delegate class like the one I described in my previous post.
For my debugging purposes, when you look at the data in the record in quesiton, what is the value in the portrait_mimetype field?
Thanks
Steve

PostPosted: Tue Jun 05, 2007 1:44 pm
by bobfelts
Hi Steve.

I just ran across the File Upload how-to. Let me work through that before I ask any more questions regarding the Blob displaying as an image. One thing to note, both the portrait_mimetype and portrait_filename will not display under the View or Edit pages. They simply don't seem to exist even though they are in the MySQL table. The mimetype you asked about is set as ".jpg" no quotes.

Thanks,
Bob

PostPosted: Tue Jun 05, 2007 1:57 pm
by shannah

Yes.. Dataface treats the filename and mimetype fields as metadata and by default doesn't display them in the view tab.Ê The mimetype field should store something like:

image/gif

or

image/jpeg

This is gathered when the image is uploaded initially.Ê If you uploaded the image into the blob field before creating the mimetype field then Dataface won't recognize it as an image unfortunately.ÊÊ Try re-uploading it now that you have a mimetype field.

-Steve