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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Bug Reports


Go to End
Reply


297 Posts   50838 Views

Avatar
mattclegg

Community Member, 56 Posts

6 September 2010 at 5:09am

Hey Uncle Cheese,

I thought Id try running; /dev/tests/all to check my code and received this error;

Fatal error: Class 'Image_Uploader' not found in swfupload/code/SWFUploadFileIFrameField.php on line 47

Im guessing the class was left in from an earlier build. Can the class 'SWFUploadFileIFrameField_Uploader' be removed?

Avatar
UncleCheese

Forum Moderator, 4092 Posts

6 September 2010 at 9:18am

SWFUpload has been sunsetted in favor of the Uploadify Module

http://www.leftandmain.com/silverstripe-modules/2010/08/26/uploadify/

----------
Silverstripe tips, tutorials, screencasts, and more: http://www.leftandmain.com

Avatar
dendeffe

Community Member, 135 Posts

9 September 2010 at 2:30am

Edited: 09/09/2010 2:30am

SilverStripe 2.4.1
DOM and SWFUpload 485(?) from your SVN today.

The sortable image checkbox (Dutch) label doesn't fit in the box: http://skitch.com/dendeffe/dii2d/silverstripe-cms-pagina-inhoud

I always have to change .sort-control in dataobject_manager.css when I update.

Avatar
UncleCheese

Forum Moderator, 4092 Posts

9 September 2010 at 2:40am

Could you post the change you have to make?

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
dendeffe

Community Member, 135 Posts

9 September 2010 at 2:49am

Edited: 09/09/2010 2:50am

I change line 92 of dataobject_manager.css to this:

.sort-control {width:100%;float:left;padding:8px 0 0 5px;}

instead of this:

.sort-control {width:16em;float:left;padding:8px 0 0 5px;}

Avatar
Nimblor

Community Member, 1 Post

16 September 2010 at 5:31pm

Found an issue with ManyManyDataObjectManager - when working with objects that have no sortable properties, and no default sort behaviour defined, the popup window fails to open (shows a query error)

The query error is due to DataObjectManager adding an ORDER BY clause to the query, when it has no field to sort by. Because the 'sort' value is coming from $_REQUEST, even though it was NULL on the server, its received as an empty string, and so checking for a sort condition with isset() returns true.

The fix seems quite simple, change line 104 of ManyManyDataObjectManager.php from:

elseif(isset($_REQUEST['ctf'][$this->Name()]['sort'])){


To:

elseif(!empty($_REQUEST['ctf'][$this->Name()]['sort'])){

The same issue may occur with the other types (ie HasManyDataObjectManager), I haven't looked into them since we aren't using them for anything ;)

Avatar
MarijnKampf

Community Member, 164 Posts

17 September 2010 at 2:00am

I'm trying to use a variable that has many Images for a page banner using the code below:

BannerFile.php:

class BannerFile extends Image {

   static $has_one = array (
      'Pages' => 'Page'
   );

}

Page.php

   public static $has_many = array(
      'BannerFiles' => 'BannerFile'
   );

   function getCMSFields() {
      $fields = parent::getCMSFields();

$fields->addFieldToTab("Root.Content.Thumbnail", new FileUploadField('Thumbnail', 'Thumbnail'));

      $fields->addFieldToTab("Root.Content.Banners", new MultipleImageUploadField('BannerFiles','Upload several banner files'));
//...
   return $fields;
   }

On seemingly random pages I get the error:

[User Error] Couldn't run query: SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "BannerFile"."PagesID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" LEFT JOIN "BannerFile" ON "BannerFile"."ID" = "File"."ID" WHERE ("File"."ClassName" IN ('Image','BannerFile','Image_Cached')) AND (ID = '22') ORDER BY SortOrder ASC LIMIT 1 Column 'ID' in where clause is ambiguous
GET /site/3d-scanners/accessories/?flush=1

Line 536 in G:\localhost\site\sapphire\core\model\MySQLDatabase.php

The images are shown correctly for the test pages where I assigned images too. On random other pages (both with and without banner images added) I get the above error.

If I change Image to File in the BannerFile class the error disappears.

BannerFile.php:

class BannerFile extends File {

   static $has_one = array (
      'Pages' => 'Page'
   );

}

Can I only use the File class and not the Image class with the new Uploadify Class? Or is there a bug somewhere else?

Avatar
mattclegg

Community Member, 56 Posts

17 September 2010 at 1:31pm

I think you might need your relation to be;

public static $has_many = array(
'BannerFile' => 'BannerFile'
);

Go to Top