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.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Bulk Uploader Module: Testers needed!


Reply


57 Posts   13093 Views

Avatar
Amir Mostofi

Community Member, 59 Posts

22 January 2009 at 2:41pm

UncleCheese,

Here are my recent tests. In all cases, I did a fresh install of silverstripe-v2.3.0-rc2.tar first without any other modules added.

1. I downloaded and installed bulkuploader0.1.4 obtained from http://www.carlinowebdesign.com/bulk-uploader-field/ . It all works fine, except when I try to delete a page that has images/files attached using bulkuploader, the CMS hangs and the following error pops up in an alert box.

------------
ERROR [Warning]: Bad class value NULL passed to ClassInfo::ancestry()
IN POST /ss/admin/getitem?ID=2&ajax=1
Line 124 in /Users/Amir/Sites/ss/sapphire/core/ClassInfo.php

Source
======
115:    }
116:    
117:    /**
118:     * @todo Improve documentation
119:     */
120:    static function ancestry($class, $onlyWithTables = false) {
121:       global $_ALL_CLASSES;
122:
123:       if(is_object($class)) $class = $class->class;
* 124:       else if(!is_string($class)) user_error("Bad class value " . var_export($class, true) . " passed to
ClassInfo::ancestry()", E_USER_WARNING);
125:
126:       $items = $_ALL_CLASSES['parents'][$class];
127:       $items[$class] = $class;
128:       if($onlyWithTables) foreach($items as $item) {
129:          if(!DataObject::has_own_table($item)) unset($items[$item]);
130:       }

<br />
<b>Catchable fatal error</b>: Method BulkUploaderField::__toString() must return a string value in <b>/Users/Amir/Sites/ss/sapphire/dev/Debug.php</b> on line <b>558</b><br />
------------

2. Next, I downloaded and installed the latest svn files for bulk_uploader, sortable_dataobject and swfupload. Again, I get the same error as above when deleting a page.

Furthermore, I see both an Upload and an Import button on the left. What's Import for, when it is handled by the right section?
Also, when I try to import a file from the right, it says "There are 1 files attached to this page." on the left, but no file actually appears on the left!

I am attaching the 3 php files I have used.

Avatar
dynamite

Community Member, 66 Posts

25 February 2009 at 3:01pm

This module is very helpful, thank you very much.

It did take some "tweaking" for me to get it working properly on my development server, as I run each SS site in a sub-directory of the root/htdocs folder. I think a great improvement would be to either create a configuration option for this, or document what changes need to be made.

Thanks again, and I look forward to seeing any improvements. Keep up the great work!

Avatar
cabby

Community Member, 15 Posts

17 March 2009 at 10:03am

Can anybody tell me if this bulkuploader thingy works with ModelAdmin, too?
I currently use ModelAdmin for a customers section where you can add customers, references that belong to customers and then I want to have multiple Images / Files for a reference:

Customer
|
Reference
|
Files

I think I did everything right, but whenever I try to add Files to a Reference, it is a mess, 'cause there's no mask to add files.
Here are my classes. Please be aware that I don't want to use a pagetype to collect files in it, i just try to extend the following DataObjects with multiple files.

Here are my DataObject classes:

class Customer extends DataObject {

   static $singular_name = 'Customer';
   static $plural_name = 'Customers';

   static $defaults = array(
'active' => 'true',
   );

   static $db = array(
      'Title' => 'Varchar(255)',
      'Active' => 'Boolean',
   );

   static $has_many = array(
      'References' => 'Reference',
   );

}

class Reference extends DataObject {

   static $singular_name = 'Reference';
   static $plural_name = 'References';

   static $defaults = array(
'active' => 'true',
   );

   static $db = array(
      'Title' => 'Varchar(255)',
      'Content' => 'Text',
      'Active' => 'Boolean',
   );

   static $has_one = array(
    'Customer' => 'Customer',
   );

   static $has_many = array(
'Resources' => 'Resource'
);

}

class Resource extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text'
);

static $has_one = array (
'Reference' => 'Reference',
'Logo' => 'File'
);
}

What did I wrong?
I have to find a fast way to add multiple images to a DataObject that I can fill in the backend via ModelAdmin or whatever. Thought bulkuploader would be the best way to realize it, but I can't get it to work. When I try to add images, there's just a mask that lets me input Name, Description, Order and a File field where a text says "You can add files once you have saved for the first time."

Please help me!

Avatar
UncleCheese

4085 Posts

17 March 2009 at 10:28am

This is deprecated in favor of the FileDataObjectManager. Please switch to that as soon as possible. It's much more stable, user-friendly, and feature rich.

SVN:

http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/dataobject_manager
http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/swfupload

More info:
http://www.silverstripe.org/all-other-modules/show/253878#post253878

Docs:
http://doc.silverstripe.com/doku.php?id=modules:dataobjectmanager

Avatar
cabby

Community Member, 15 Posts

17 March 2009 at 12:10pm

Thanks UncleCheese ... I'll give it a go.
Perhaps we need an overview page where all actually good working versions of all those nice modules are written on.
That way many new users (as I am one) wouldn't be so confused on their first days of silverstripe ;-)

Avatar
UncleCheese

4085 Posts

17 March 2009 at 12:24pm

I agree. I've submitted them to Silverstripe, but they haven't shown up on the Modules page yet. :(

Avatar
cabby

Community Member, 15 Posts

17 March 2009 at 12:41pm

Edited: 17/03/2009 12:42pm

Hm, strange problem... can you help me once again,please? I am using Silverstripe 2.3.0

I just copied your actual trunk of dataobject_manager and swfupload.
Just tried out the two new page types ( TestimonialPage and ResourcePage)

Testimonials seem to work pretty good, but ResourcePage Type fails with the following message:
"Error: FileDataObjectManager::__construct() -- could not determine has_one relationship with a File object".
That error appears whenever I try to add a page with type ResourcePage. Hum.

What can I do.
I just like to have a possibility to add multiple Images to a Dataobject (or a page if it has to be) and edit them from the backend.

Avatar
UncleCheese

4085 Posts

17 March 2009 at 12:46pm

First of all, you checked everything out with SVN, right? It's not a straight download.

Second, that error happens because the fourth argument of your FileDataObjectManager construct refers to the name of the file relation on the dataobject you're managing. Your setup should be something like

Page (has many)-> DataObjects (has one) -> File

So if your DataObject class has $has_one = array ('MyFile' => 'File') then you need to use "MyFile" as the the fourth argument of the FileDataObjectManager.

You should probably read the docs. They're pretty clear on how to set it up. It's just one extra argument than a ComplexTableField, really.