Re: Overriding stylesheet and images used by AjaxDatePicker
Re: Overriding stylesheet and images used by AjaxDatePicker
- Subject: Re: Overriding stylesheet and images used by AjaxDatePicker
- From: Chuck Hill <email@hidden>
- Date: Tue, 9 Nov 2010 10:52:20 -0800
On Nov 9, 2010, at 10:35 AM, Ricardo J. Parada wrote:
> Hi,
>
> I thought I knew the answer to this one but maybe not quite. I'm using an AjaxDatePicker and I managed to override its stylesheet by defining this property in my MPVWebComponents framework:
>
> er.extensions.ERXResponseRewriter.resource.Ajax.calendar.css=MPVWebComponents.css/calendar.css
Bindings?
* @binding calendarCSS name of CSS resource with classed for calendar, defaults to "calendar.css"
* @binding calendarCSSFramework name of framework (null for application) containing calendarCSS resource, defaults to "Ajax"
> Then I tried these to override the prev/next icons used by the date picker:
>
> er.extensions.ERXResponseRewriter.resource.Ajax.calendar_next.png=MPVWebComponents.images/calendar_next.gif
> er.extensions.ERXResponseRewriter.resource.Ajax.calendar_prev.png=MPVWebComponents.images/calendar_prev.gif
>
> The first one seems to work fine because it's using the our calendar.css. However, the icons for next/prev month/year are still using the ones from the Ajax framework. Can they be overriden?
>
> Is this the correct way to do this?
public AjaxDatePicker(WOContext context) {
super(context);
// I am not expecting the images to get localized, so this can be set once
// This is hacky, but I wanted to avoid changing the JS to take the path for each image in options
// and WO does not expose this path any other way. Still half thinking I should have changed the JS...
if (defaultImagesDir == null) {
defaultImagesDir = application().resourceManager().urlForResourceNamed("calendar_prev.png", "Ajax", null, context().request()).toString();
int lastSeperator = defaultImagesDir.lastIndexOf("/");
if (lastSeperator == -1) {
lastSeperator = defaultImagesDir.lastIndexOf('/');
}
defaultImagesDir = defaultImagesDir.substring(0, lastSeperator);
// Need to pre-populate the cache for WOResourceManager
application().resourceManager().urlForResourceNamed("calendar_next.png", "Ajax", null, context().request()).toString();
}
}
Have fun!
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden