Daniel,
I'm not against using dojo. I like the idea of using Java's Calendar class because that makes the
localization details Sun's problem, not ours or dojo's. Sun has a good handle on
internationalization, so using the Java classes for calendars almost guarantees that they will work
nearly anywhere in the world.
The HTML version should be fairly quick, since no data is being retrieved or anything. The HTML
calendar implementation will be trivial - just use the user's locale and time zone to construct a
Calendar object, and then pass that object to a Freemarker template that uses it to iterate through
the dates.
I will be available to help work on it this weekend. I can't imagine it taking
more than a day.
-Adrian
Daniel Martínez wrote:
Adrian,
ofbiz dojo is outdated (and AFAIK not used at all...) I have been
testing with the beta version of the new 0.9 dojo release (I just did
not like 0.4 version). Calendar in dojo 0.9 is fully localized based on
data from the CLDR and is also stylable through css. Anyway, being a
beta and the differences in locales between dojo and ofbiz I think your
solution is the best way to go right now. This solution will not be
faster as Jacques wanted, though ...
I will post when I create the issue.
Thanks,
--
Daniel
Adrian Crum escribió:
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