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

Feature Requests


Go to End
Reply


75 Posts   14041 Views

Avatar
UncleCheese

Forum Moderator, 4093 Posts

21 May 2009 at 2:56am

Edited: 21/05/2009 2:56am

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.

Avatar
MarcusDalgren

Community Member, 288 Posts

27 June 2009 at 1:56am

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

Avatar
MarcusDalgren

Community Member, 288 Posts

28 June 2009 at 1:01am

Edited: 28/06/2009 1:02am

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.

Avatar
MarcusDalgren

Community Member, 288 Posts

28 June 2009 at 1:37am

Edited: 28/06/2009 2:59am

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.

Avatar
UncleCheese

Forum Moderator, 4093 Posts

28 June 2009 at 4:10am

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.

Avatar
MarcusDalgren

Community Member, 288 Posts

28 June 2009 at 5:01am

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?

Avatar
UncleCheese

Forum Moderator, 4093 Posts

8 July 2009 at 8:49am

Edited: 08/07/2009 8:50am

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"

Avatar
UncleCheese

Forum Moderator, 4093 Posts

14 July 2009 at 4:20am

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

Go to Top