Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Preview: DataObjectManager module


Go to End


379 Posts   95930 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 March 2009 at 3:24am

Interesting. It's a low-level error, so if you turn down your error reporting is should at least allow the script to run. Try this in the meantime

I assume you're using a custom gridLabelField? Add ->XML_val to the return values of the obj() method.

506   public function FileLabel()
507   {
508     if($this->parent->gridLabelField)
509       $label = $this->obj($this->parent->gridLabelField)->XML_val;
510     else if($file = $this->obj($this->parent->fileFieldName))
511       $label = $file->Title->XML_val;
512     else
513       $label = "";
514     return strlen($label) > 30 ? substr($label, 0, 30)."..." : $label;
515   }
516   
517 }
518 

If that works, let me know, then undo all your changes to the class and I'll check in a new version. thanks.

Avatar
somaboy

Community Member, 8 Posts

9 March 2009 at 3:52am

Hi Unclecheese

This would be very useful for me. However, I cant get the UI to work correctly.

I installed from svn and am running your Resource and ResourcePage classes as a test.

I can create ResourcePages in the cms, but when i open the popup to add resources, there's nothing underneath the "Upload Files from my computer" bar. See screenshot.

I'm running Firefox 3.0.7 under Mac OS X 10.5, latest Flash player installed.

Attached Files
Avatar
somaboy

Community Member, 8 Posts

9 March 2009 at 4:13am

thanks for your reply

which version would you consider safe to use?

do you expect these issues to be resolved soon?

thanks!

soma

Avatar
pcbender

Community Member, 20 Posts

9 March 2009 at 6:31am

Great addition to SS. Can you give us an example of how to use this on the public page side? Say for your Resource example. In the mysite/templates/Layout folder I created a ResourcePage.ss file. And just adding $Resources to the ss file creates a nice UL list of resource items but the link's href is empty. I'm sure I have just missed something.

Avatar
Howard

Community Member, 215 Posts

9 March 2009 at 8:39am

That worked :) I'm not using a custom gridLabelField, the ss install is pretty generic. Also, perhaps related, the Title isn't displaying in the grid view of the FileDataObjectManager. I cannot remember if it was displaying before i made the change to FileLabel or not. Attached is what it looks like. The details are all there in the popup :)

Thanks!

Attached Files
Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 March 2009 at 9:09am

@pcbender - All you need is <% control Resources %>. You should read the tutorials on basic DataObject relationships to get started.

@Howard - Try changing this:

511 $label = $file->Title->XML_val;
to this:
511 $label = $file->Title;

Keep track of your changes so i can update the SVN.

@ somaboy - Make sure you can run the demo on this site. http://demo.swfupload.org/v220beta5/applicationdemo/index.php. I'm running Flash Player 10 on OSX without a problem. Let me know if you figure anything out.

Avatar
pcbender

Community Member, 20 Posts

9 March 2009 at 9:20am

A simple example of creating a ResourcePage.ss maybe looks like this?

<div class="typography">

<% if Level(2) %>
<% include BreadCrumbs %>
<% end_if %>

<h1>$Title</h1>

$Content

<% if Resources %>
<ul>
<% control Resources %>
<li><a href="$Attachment.URL">Download $Name</a></li>
<% end_control %>
</ul>
<% end_if %>

$Form
$PageComments

</div>

Thanks for the reply.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 March 2009 at 9:22am

Edited: 09/03/2009 9:23am

You got it!

Also see $Attachement.Size and $Attachement.Type for more display options.

Go to Top