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.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
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.
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
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.
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.
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.
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?
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"
You can have more control over your thumbnails by toggling the "square thumbnails" boolean.