Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » attn uncle cheese - dataObjectManager bug?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4
Go to End
Author Topic: 4083 Views
  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    With Firebug , I see:

    http://localhost/ss/admin/EditForm/field/ImageAttachments/add 404 NOT found

    with response

    I can't handle sub-URLs of a CMSMain object.

    and

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it" lang="it">
    <head>
    <title>Oggetto non trovato!</title>
    <link rev="made" href="mailto:admin@localhost" />
    <style type="text/css"><!--/*--><![CDATA[/*><!--*/
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
    /*]]>*/--></style>
    </head>

    <body>
    <h1>Oggetto non trovato!</h1>
    <p>

    L'URL richiesto non esiste su questo server.

    Il link della
    <a href="http://localhost/ss/admin/%3flocale=en_US">pagina da cui
    sei arrivato</a> potrebbe essere errato o non essere pi&ugrave; valido.
    Per favore, informa dell'errore l'autore della
    <a href="http://localhost/ss/admin/%3flocale=en_US">pagina</a>.

    </p>
    <p>
    Se pensi che questo sia un errore del server, per favore contatta il
    <a href="mailto:admin@localhost">webmaster</a>.

    </p>

    <h2>Error 404</h2>
    <address>
    <a href="/">localhost</a><br />

    <span>07/08/09 14:36:14<br />
    Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9</span>
    </address>
    </body>
    </html>

  • UncleCheese
    Avatar
    4085 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    Weird. I have seen this issue before, but it's when I'm testing adding new features. I didn't think it was in the stable release. Post your code?

  • UncleCheese
    Avatar
    4085 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    In your code, you're using a CTF. Does this happen with both CTF and DOM?

  • UncleCheese
    Avatar
    4085 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    Did that solve the problem?

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    If I put URL http://localhost/ss/admin/EditForm/field/ImageAttachments/add,

    I receive from browser :

    I can't handle sub-URLs of a CMSMain object.

    ImageAttachments and Resize_Image class:

    class ImageAttachment extends DataObject {
    static $db = array(
    'Name' => 'Text'
    );
    static $has_one = array(
    'Image' => 'Resize_Image'
    );

    static $field_names = array('Name' => 'Name');

    function getCMSFields_forPopup() {
    $fields = new FieldSet();
    $fields->push(new TextField('Name', 'Name'));
    $fields->push(new ImageField('Image', 'Image'));

    return $fields;
    }

    }

    class Resize_Image extends Image {
    static $db = null;

    function generateThumbnail($gd) {
    $gd->setQuality(80);
    return $gd->paddedResize(140,100);
    }

    function generateContentImage($gd) {
    $gd->setQuality(90);
    return $gd->resizeByWidth(200);
    }

    function generateLargeImage($gd) {
    $gd->setQuality(90);
    return $gd->resizeByWidth(600);
    }

    }

    and Product class

    class Product extends Page {
       
       static $add_action = 'a Product Page';

       static $casting = array();

       static $default_parent = 'ProductGroup';

       static $icon = 'cms/images/treeicons/book';

       static $db = array(
          'Price' => 'Currency',
          'Weight' => 'Decimal(9,2)',
          'Manufacter' => 'Varchar',
          'Model' => 'Varchar',
          'FeaturedProduct' => 'Boolean',
          'AllowPurchase' => 'Boolean',
          "InternalItemID" => "Varchar(30)",
       );

       /**
        * Image Support
        */
    static $has_one = array(
    'ImageThumbnail' => 'Product_Image',
    'Image' => 'Image'
    );
       

    static $has_many = array(
    'ImageAttachments' => 'ImageAttachment'
    );

       
       static $defaults = array(
          'AllowPurchase' => false
       );

       protected $cart;

       /**
        * Allows this product to know which
        * order it has been added to
        */
       function setCart($cart) {
          $this->cart = $cart;
       }

       /**
        * Create the fields for a product within the CMS
        */
       function getCMSFields() {
          $fields = parent::getCMSFields();

       
          $my_imagetable = new ComplexTableField(
             $this,
             'ImageAttachments',
             'ImageAttachment',
             ImageAttachment::$field_names,
             ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
    "ProductID = {$this->ID}", // a filter to only display item associated with this page
    "Name ASC" // Sort by name
          );
        $fields->addFieldToTab('Root.Content.Additional Images', $my_imagetable);
       
          return $fields;
       }
       

    function ImageAttachment() {
    if($obj = DataObject::get('ImageAttachment', "ProductID = $this->ID")) {
    return $obj;
    } else {
    return false;
    }
    }

    I wrote here http://www.silverstripe.org/upgrading-silverstripe/show/256509?showPost=264360#post264360&flush=1 also.

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    Yes , I use ComplexTableField.

    How Do you mean with DOM?

  • UncleCheese
    Avatar
    4085 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    DataObjectManager (DOM). This forum is for DataObjectManager support, not ComplexTableField.

  • UncleCheese
    Avatar
    4085 Posts

    Re: attn uncle cheese - dataObjectManager bug? Link to this post

    I'm able to run a ImageDOM beside a DOM without a problem. Can you try removing one of the DOMs, so it's just a single DOM and a single ImageDOM?

    4083 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.