[dev] Calendar Issue

Jan Schneider jan at horde.org
Tue Jan 22 13:49:28 UTC 2013


Zitat von Roman Geber <geber at b1-systems.de>:

> Hi :)
>
> I'd like to resolve the JavaScript Problem within Horde date picker.  
> I've already proposed a fix (see GIthub Pull Request 23). Jan wasn't  
> satisfied with the way this was done and responded with a, for me,  
> slightly cryptic message.
>
> Before I get any deeper into that, this is the original problem:
>
> Whenever a date/time field (or any other field attached to a date  
> picker) is augmented with an onchange statement, that onchange is  
> code is not executed if the date_picker changes the value of that  
> field. The simple solution would be to trigger the change event  
> manually. Thats what my patch does.
>
> Example:
>
> $myDateTime = $this->addVariable("label", "html_field_id",  
> "datetime", true, false, null);
> $myDateTime->setAction(Horde_Form_Action::factory('reload'));
>
> Ralf Lang and I discussed a strategy and would like to have your opinion on
>
> The proposed patch involves nothing but the calendar.js file. The  
> way I read Jan's reply he'd rather have that additional code located  
> somewhere else. Our current idea would be to create a new JavaScript  
> file within '''$HORDE_GIT/framework/Form/js/ ''' listening on the  
> date picker, running the patch code whenever required.

This is the correct place in the long run, but Horde_Form is still a  
mess, so the event listener should probably go to  
framework/Core/js/form_helpers.js instead.

> While I'd include that JS file whenever a date picker is loaded  
> through Horde_Form to avoid this problem from happening ever again,  
> Ralf seems concerned that this would compromise the libraries  
> standalone capabilities. I wonder, is there a safe way to find out  
> if Horde_Form is used standalone or within a Horde Instance?

I don't understand the concerns, especially if you originally planned  
to add the JS file to Horde_Form. But anyway, Horde_Form is not really  
a stand-alone working library.

> Are we on the right track here or does anyone have a better idea?
>
> On top, I'd like to ask you how I'd listen on the date picker from  
> an external script. Jan meant something about  
> "Horde_Calendar:select". Since I'm no longer that well versed in  
> Prototype these days and just starting out on Horde I need a bit of  
> help there.

Grep for Horde_Calendar:select in the git source you will fine a few  
use cases that you can use as examples.
-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the dev mailing list