We'll need to get OFBIZ-1170 (https://issues.apache.org/jira/browse/OFBIZ-1170) committed prior to
introducing an HTML popup calendar. I'm not trying to pressure anyone, I'm just letting everyone
know in advance that it will be a blocker.
-Adrian
David E Jones wrote:
I think that's totally reasonable and with a server round trip it makes
things much more flexible, like for example being able to (in special
circumstances like on group calendar screens) have something that shows
available or unavailable dates for something.
Anyway, right now it's in a popup window so a plan http request for that
is fine, and we would just have minimal javascript to close the window
and populate the field that it came from. We already have stuff in the
form widget and other places for this sort of popup/lookup window.
If it wasn't in a popup window, ie someone wanted a different design,
the same request could be used (or a slight variation on it) in an
AJAX'ed page. Getting HTML from the server in the background is a
totally valid way to use AJAX.
-David
Adrian Crum wrote:
I've been thinking about this some more...
Maybe JavaScript isn't the way to go. JavaScript doesn't have a
Calendar class, so creating a calendar in JS is a nightmare.
I looked through the dojo source that is included with OFBiz and there
is a lot of data to maintain. Even in the dozens of dojo calendar/date
related files there are problems - just look at all of the FIXME
comments.
I considered passing localized data to JS functions, but that has
problems too. For example, what do you do if there are quote
characters in translated text? Those could be escaped I guess, but
then the code starts becoming complicated.
Maybe it would be better to have a regular HTML Calendar that pops up
in its own window. That would require server requests, but the upside
is we can use bsh, ftl, java.util.Calendar, and our own style sheet to
style it. The name of the HTML element that receives the date could be
passed as a parameter so that the selected date could be fed back to
the parent window via the JS window.opener property.
What do you think?
-Adrian
Adrian Crum wrote:
On second thought, since this is running in JavaScript, we can assume
the browser will default to the user's locale. The trick will be to
figure out how to render the calendar correctly in the user's locale.
Some locales have their week start on Monday, some locales have 13
months in a year, etc.
Adrian Crum wrote:
There are more locale issues than just the date format string.
Different locales use different calendars. It would be best to find
a way to pass a properly constructed Calendar object.
-Adrian
Daniel Martínez wrote:
Hi,
As a pre for correct implementation of locale date formats I am
looking
forward to make a new javascript calendar. I have been testing dojo
0.9
and it has a nice widget (DateTextbox) for selecting dates, It is nice
and fast ;) and it supports different locale formats. It should be
extended however to:
- Accept time input.
- "Forget" about dojo locales (based upon CLDR, which I like but
that's
another story) and allow a date format string as parameter.
These requirement should not be very difficult (I believe as I am a
newbie to dojo and javascript in general). However, being the calendar
one of the most visual parts of ofbiz I would like to see comments
about
this approach.
Thanks,
--
Daniel Martínez
http://www.paradisosistemas.es