Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Feature Requests

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
Go to End
Author Topic: 12620 Views
  • UncleCheese
    Avatar
    4085 Posts

    Feature Requests Link to this post

    Please post any feature requests for here. My hope is to use the RSS feed of this thread as a punchlist when I have time to put into developing new features for DataObjectManager or ImageGallery.

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Feature Requests Link to this post

    It would be absolutely lovely if the DatePickerField could be used in the regular CMS as well, not just the popup window. I tried using it instead of the regular calendar field but the calendar didn't show up when I clicked in the field. It worked when I used it in a popup when I tried out your Testimonial examples.

    Kindly, Marcus

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Feature Requests Link to this post

    Ok I have fixed it (kind of). There seems to be two issues, the first one is a CSS issue. Simply add in #ui-datepicker-div { z-index: 999;} to make sure that the datepicker lands itself on top of everything else.

    The second issue seems alot weirder. If I navigate from one page type in the CMS that doesn't have the datepicker field to a page that does then the datepicker won't function. However if I reload the page while on the page with the datepicker field then the datepicker will work the way it should.

    I have no idea why this is. I modified the datepicker code to

    '(function($) {
       $(function(){
          $("#'.$id.'").datepicker({dateFormat : "'.self::$dateFormat.'"
          , buttonImage : "/sapphire/images/calendar-icon.gif"
          , buttonImageOnly : true
       });
    });            
    })(jQuery);'

    It seems to need document ready when used as a regular field in the CMS, I tried running it with your old code and got an error on the field being null.

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Feature Requests Link to this post

    Ok I wasn't thinking big enough on my event delegation. If you run the rather silly
             '(function($) {
                $(function(){
                   $("body").mouseover(function(event) {
                      var target = event.target;
                      if (target.id == "'.$id.'") {
                         $(target).datepicker({dateFormat : "'.self::$dateFormat.'"
                            , buttonImage : "/sapphire/images/calendar-icon.gif"
                            , buttonImageOnly : true
                         });
                      }   
                   });
                });            
             })(jQuery);'
    it works.

    Now if you'll excuse me I'll have go and pretend I never wrote that.

    Oh and if you go from a Testimonial page to the regular cms page with the datepicker on, the styles don't work. I think the issue is related to the fact that we get two datepicker divs with the same id on the page and jQuery gets confused.

    Ok I fixed that by switching DataObjectManager to jquery ui 1.6 instead of 1.5.3. After putting both the field and the DataObjectManager on the same version of jQuery ui they play nice.

    There is one last issue which seems to be related to the fact that as far as I can tell, the javascript for the DatePickerField is not loaded properly unless I do a reload on a page which has the datepickerfield on it. It works for the popup but we need to find a way to register the scripts even though the field isn't actually on the first page we visit in the CMS.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Feature Requests Link to this post

    Oh, I see. Right, so we'll have to apply the event using the Behaviour class. That sounds easy enough. I'll give it a try.

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Feature Requests Link to this post

    Ok so I managed to get scripts registered globally through Object::extend() by looking at how you did it in verticaltabs.

    So I wrote something like this
    <?php
    class DatePickerFieldScriptInit extends Extension {
       public function augmentInit() {
          Requirements::javascript("jsparty/jquery/jquery.js");

          Requirements::javascript("dataobject_manager/javascript/jquery-ui.1.6.js");
          Requirements::javascript("dataobject_manager/code/date_picker_field/datepicker.js");

          Requirements::css("dataobject_manager/css/ui/ui.core.css");
          Requirements::css("dataobject_manager/css/ui/ui.datepicker.css");
          Requirements::css("dataobject_manager/css/ui/ui.theme.css");
          
       }
    }
    ?>

    And this gets the scripts registered on all pages. However what do we do about the custom script that references internal properties of the DatePickerField? Is there some other way of getting scripts on the global queue?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Feature Requests Link to this post

    You can now set a default value to your filter using the optional fourth argument of the setFilter() function

    $manager->setFilter(
    'MyField',
    'MyLabel',
    array('Value1' => 'Label1', 'Value2' => 'Label2'),
    'Value2'
    )';

    Sets a default filter of "Value2"

  • UncleCheese
    Avatar
    4085 Posts

    Re: Feature Requests Link to this post

    You can have more control over your thumbnails by toggling the "square thumbnails" boolean.

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