Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » HasManyFileManager: New CMS module/extension. Testers/review needed

Our old forums are still available as a read-only archive.

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

Page: 1 2 3 4 5 6 7 8
Go to End
Author Topic: 104028 Views
  • banal
    Avatar
    Community Member
    901 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    @Ingo
    That would be awesome, yes.
    Somehow i didn't get e-mail notification on this thread any more. The last notification i received was for the post by Hamish.. odd. Or i just didn't log in to the forums for a while

    Anyway: yeah! I'd love to put the module on your SVN. I'm quite busy at the moment but hopefully i'll find some time to enhance the module or write a proper documentation.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts
  • banal
    Avatar
    Community Member
    901 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    Hello all.
    The documentation for the HasManyFileManager is now online. Please let me know if i forgot something important.
    http://doc.silverstripe.com/doku.php?id=modules:hasmanyfilemanager

    Sources have been updated as well. I added a bit of documentation in the code and fixed some bugs. A thanks goes to BO_Einzeller who already fixed several Bugs in the old version. Get the current sources here: http://bummzack.ch/hasmanyfilemanager/ or checkout the SVN trunk:

    I'll build a release version soon, hopefully it will make it to the modules page
    Have fun!

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    aaawesome, thanks for putting this much effort into good documentation, its an important part

  • erwanpia
    Avatar
    Community Member
    63 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    Hi, well done for this extension, I am currently testing the 0.3 and adde the following modification

    instead of extenting SiteTree and ContentController I extend Page and Page_Controller

    that allows me to use my main site template. Seems to work fine on FilePage for the moment

    E.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    @erwanpia
    Ah. Yes, sure! The FilePage is only meant as an example. You can use the HasManyFileManager Field/Control in any of your own pages... maybe i should clarify that in the documentation.
    The FilePage.php is actually at the wrong place. It isn't a required component of the Module and therefore shouldn't be in the filemanager/code folder really. Maybe i'll remove the file from the module sources and just put the code into the documentation as a explanation.

  • erwanpia
    Avatar
    Community Member
    63 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    Thks for the answer. I find it nice to get the FilePage as a sample of what can be done.

    I'm now trying to extend the image decorator but can't get the Sitetree drop down to work. I got inspiration form the redirector Page type but without success yet.

    class AttachedFile extends DataObjectDecorator
    {
       // get the additional DB Fields
       public function extraDBFields() {
          return array(
             'db' => array(
                'Grouping' => 'Varchar(255)',
                'DestLink'=> 'Varchar(255)'
             ),
             'has_one' => array(
                'SiteTree' => 'SiteTree',
                "LinkTo" => "SiteTree"
             ),
             
          );
       }

    ...

       public function getMyCMSFields(){
          /**
           * FIXED: Value is only shown if theres an existing entry.
           * Otherwise we get some crappy stuff in the Title
           */
          $fields = new FieldSet(
             new TextField('Title', _t('AttachedFile_Uploader.TITLE', 'Title'),($this->owner->ID) ? $this->owner->Title : ""),
             new TextField('DestLink', _t('DestLink', 'DestLink'),($this->owner->ID) ? $this->owner->DestLink : ""),
             new TreeDropdownField(   
                      "LinkToID",
                      _t('RedirectorPage.YOURPAGE', "Page"),
                      "SiteTree"
                   )
          );
          return $fields;
       }

  • banal
    Avatar
    Community Member
    901 Posts

    Re: HasManyFileManager: New CMS module/extension. Testers/review needed Link to this post

    Hi erwanpia

    If i were you, i wouldn't modify the AttachedFile directly. You'll have a hard time updating to another version of the HasManyFileManager if you mix in your own code. I recommend that you implement your own Decorator as described in the documentation (see the MyFile Source-code example). You can then put that code into your mysite/code directory, this way you have all your code nicely bundled in one directory.

    Concerning your problem: That's most likely because there aren't all required JavaScript Libraries loaded inside the iframe. I'm afraid some of the form fields won't work inside the iframe due to JavaScript Libs that are missing. You could add them to the AttachedFile_Uploader::iframe method, but that would be a hack once again

    If you don't have too many pages, you can solve it with a regular dropdown. like this:

    public function getMyCMSFields(){
    $items = DataObject::get('SiteTree');
    $values = array();
    foreach($items as $item){
    $values[$item->ID] = $item->Title;
    }

    $fields = new FieldSet(
    new TextField('Title', _t('AttachedFile_Uploader.TITLE', 'Title'),($this->owner->ID) ? $this->owner->Title : ""),
    new TextField('DestLink', _t('DestLink', 'DestLink'),($this->owner->ID) ? $this->owner->DestLink : ""),
    new DropdownField('LinkToID', _t('RedirectorPage.YOURPAGE', "Page"), $values, $this->owner->LinkToID)
    );
    return $fields;
    }

    104028 Views
Page: 1 2 3 4 5 6 7 8
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.