Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Bug Reports

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Go to End
Author Topic: 47616 Views
  • Pike
    Avatar
    Community Member
    40 Posts

    Re: Bug Reports Link to this post

    I then, you'd change in DataObjectManager.php line 500, this code:

    Before:

    new LabelField('show', _t('DataObjectManager.PERPAGESHOW','Show').' '),
    new DropdownField('PerPage','',$map, $value),
    new LabelField('results', ' '._t('DataObjectManager.PERPAGERESULTS','results per page'))

    After:

    new LabelField('show', _t('DataObjectManager.PERPAGESHOW','Show').' ',null,true),
    new DropdownField('PerPage','',$map, $value),
    new LabelField('results', ' '._t('DataObjectManager.PERPAGERESULTS','results per page'),null,true)

    Reason: I sent translation fo cs_CZ and sk_SK. After changes I see string correctly. I cannot send files (images) to be more see-able.

  • MarijnKampf
    Avatar
    Community Member
    164 Posts

    Re: Bug Reports Link to this post

    I'm using Uploadify/DOM 521 and I'm running into an issue with using the same image for multiple purposes. It could be this is a limitation of the SS file system rather than Uploadify/DOM.

    My setup: I've added a Thumbnail Image to the page class, and I'm using DOM + Uploadify to add a list of files (Downloads) to an Example. Multiple examples are displayed on a single page using the Examples page type. The Downloads / Example classes are based on the code provided on the Uploadify documentation page.

    The issue I have is on adding an image as the thumbnail of a page, and then adding the same image as an Example download the Thumbnail disappears from the page. I believe this is due to the fact that the ClassName in the File table is changed from Image to Download.

    Is there a way that allows multiple uses of the same file still using DOM+Uploadify?

    I've included trimmed down test code below.

    mysite/code/Page.php

    <?php
    class Page extends SiteTree {
       public static $has_one = array(
    'Thumbnail' => 'Image',
       );

       function getCMSFields() {
          $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Thumbnail", new FileUploadField('Thumbnail', 'Thumbnail'));
          return $fields;
       }

    }

    class Page_Controller extends ContentController {

    }

    mysite/code/Examples.php

    <?php
    class Examples extends Page {
       static $has_many = array (
          'Examples' => 'Example'
       );

       public function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Examples", new DataObjectManager(
             $this,
             'Examples',
             'Example',
             array('Title' => 'Title', 'Description' => 'Description'),
             'getCMSFields_forPopup'
          ));

          return $fields;
       }
    }

    class Examples_Controller extends Page_Controller {

    }

    mysite/code/Example.php

    <?php
    class Example extends DataObject {
       static $db = array (
          'Title' => 'Text',
          'Description' => 'HTMLText'
       );
       static $has_one = array (
          'ExamplesPage' => 'Examples',
          'Thumbnail' => 'Image'
       );
       static $has_many = array (
          'Downloads' => 'Download'
       );

       public function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Downloads", new MultipleFileUploadField('Downloads','Select downloads'));
          return $fields;
       }

       public function getCMSFields_forPopup() {
          $fields = new FieldSet(
             new TextField('Title','Title'),
             new SimpleHTMLEditorField('Description','Description'),
             new ImageUploadField('Thumbnail','Thumbnail'),
             new MultipleFileUploadField('Downloads','Select download files')
          );
          return $fields;
       }

    }

    mysite/code/Download.php

    <?php
    class Download extends File {
       static $has_one = array(
          'Example' => 'Example'
       );
    }

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    You're using the "choose existing" tab to do that? I think that's going to give you trouble because the classnames are different. You're going to have to upload the same file twice..

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

  • MarijnKampf
    Avatar
    Community Member
    164 Posts

    Re: Bug Reports Link to this post

    That's what I feared, as I suggested uploading the same file twice as a workaround to the user, but I do feel that's a bit counter intuitive. Is there a way to use the same file? Or alternatively limit the assets sub folder that can be selected (to force the user to upload the file again...)

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    Well, what you're describing doesn't make a whole lot of sense. I know for the user it's weird, but if you think about it, you're asking that a single file have two different ClassName fields simultaneously. That's just not going to work.

    Is the thumbnail always the same as the other upload? You could just get rid of that field all together and assign the ThumbnailID on write..

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

  • MarijnKampf
    Avatar
    Community Member
    164 Posts

    Re: Bug Reports Link to this post

    I can see how the SilverStripe DB/file implementation is limiting in this respect.

    The thumbnails are completely independent from the uploads. The issue is that setting an image to an upload breaks the thumbnail on other unrelated pages if it happens to be the same file.

    Two different possible solutions (I think):
    - Download is currently extended from File, could the solution be to extend Download from both File and Image?
    - Is it possible to restrict the assets source folder used in Uploadify?

  • fabeat
    Avatar
    Community Member
    2 Posts

    Re: Bug Reports Link to this post

    Hi!

    I think the encoding of the german language file for the uploadify module should be UTF-8

    https://gist.github.com/gists/757396/download

    Cheers, Fabian

  • s!m
    Avatar
    Community Member
    9 Posts

    Re: Bug Reports Link to this post

    I've updated the german language files for DOM, ImageGallery and Uploadify as those were not available by the time I needed those...
    As I see, the now active german language files all include characters like "ä,ü,ß", etc while those should possibly be "&auml;, &uuml, etc..". So I rewrote those files and translated all items with "&auml;, etc." so that the problems with the encoding of the files are gone...

    I also found one untranslatable string in DataObjectManager_holder.ss:
    line 3, it says:

    <p>You may add $PluralTitle once you have saved for the first time.</p>


    where it should be something like this:

    <p><% sprintf(_t('ADDAFTERSAVE','You may add %s once you have saved for the first time.'),$PluralTitle) %></p>


    To translate this line I added the following to my "de_DE.php"-language file:

    $lang['de_DE']['DataObjectManager_holder.ss']['ADDAFTERSAVE'] = 'Sie k&ouml;nnen %s hinzuf&uuml;gen, sobald Sie das erste Mal gespeichert haben.';

    If anyone's interested, here are the links for those three language files, maybe they are useful to someone...
    DOM: http://pastebin.com/iCbN1M2Q
    ImageGallery: http://pastebin.com/SQuEhNv0
    Uploadify: http://pastebin.com/ZfB7sjhM

    Best regards,
    s!m

    47616 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
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.