[
https://issues.apache.org/jira/browse/OFBIZ-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669415#action_12669415
]
Todor Spasov commented on OFBIZ-1825:
-------------------------------------
Hello Marco & everyone,
Regarding the localized calendar all date-time fields rendered by form-widget
work just fine but there is one major problem regarding freemarker files. The
current way it is made suggests that *every* call to javascript:call_cal() in
all ftl files must be changed to include the new surrounding <div date_panel>
tag and also hidden parameters for all info like locale etc. Here is the
problematic code in form-widget date-time render function which does not have
an equivalent in ftl.
{code:title=HtmlFormRenderer.java|borderStyle=solid}
// this is part of renderDateTimeField function
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"paramName\"
value=\""+("time-dropdown".equals(dateTimeField.getInputMethod()) ?
UtilHttp.makeCompositeParam(paramName, "date") : paramName)+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"time\" value=\""+"time".equals(dateTimeField.getType())+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"shortDateInput\" value=\""+shortDateInput+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"dateTimeValue\" value=\""+UtilHttp.encodeBlanks(dateTimeValue)+"\"/>");
if (dateTimeField.getShowFormat() && UtilValidate.isEmpty(value))
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"localizedDefaultFormatToShow\"
value=\""+localizedDefaultFormatToShow+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"localizedInputTitle\" value=\""+localizedInputTitle+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"localizedIconTitle\" value=\""+localizedIconTitle+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"yearRange\" value=\""+dateTimeField.getYearRange()+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"localizedValue\" value=\""+ value +"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"size\" value=\""+size+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"maxlength\" value=\""+maxlength+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"locale\" value=\""+UtilHttp.getLocale(request).getLanguage()+"\"/>");
writer.append("<input type=\"hidden\" class=\"dateParams\"
name=\"imagesrc\" value=\"");
{code}
It would lead to a lot of superfluous code for every call to the javascript
calendar. One alternative though is to include a freemarker macro for the
calendar which will receive all needed parameters. This means that, again, all
ftl files must be changed to include the new macro & additional calculation of
the desired parameters must be made for every field. Please suggest a solution.
Todor
> Colors and localisation for the calendar
> ----------------------------------------
>
> Key: OFBIZ-1825
> URL: https://issues.apache.org/jira/browse/OFBIZ-1825
> Project: OFBiz
> Issue Type: Improvement
> Components: ALL COMPONENTS
> Affects Versions: SVN trunk
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Minor
> Fix For: Release Branch 9.3
>
> Attachments: calendar.patch, calendar_sequence.patch,
> calendarDateSelectColor.patch, calendarDateSelectColor.patch,
> calendarModified.patch, CommonScreens.patch, Existing.jpg,
> LocalizedDate_it.patch, Proposition.jpg, WE_CAL.gif
>
>
> I tried to change the calendar colors, to be more "in the OFBiz way". Please
> let me you know what you think.
> I also changed some colors to respect our CSS best practices (no color names).
> Here are some remarks :
> Colors
> * I kept the 3 chars scheme when it's was obvious. For instance we don't
> need to set #000000 or #ffffff when actually #000 or #fff is sufficient.
> * I used Wikipedia as reference http://en.wikipedia.org/wiki/Web_colors for
> choising colors. While doing this change I wondered if we could not authorise
> and even recommend to use sandard names for colors as shown in Wikipedia
> page. I found it easier to recall a color by its names than by an hexa
> number...! As long as we would use this Wikipedia reference I think it could
> be possible to use names instead of hexa, WDYT ?
> * The days initials are not centered but at left (It's late and I did not
> found the reason)
> We need to provide a localisation mean. From
> http://electronicholas.com/calendar?style=default&format=natural it should
> not be too hard. I propose a simple way, maybe we can do better
> * More calendar formats in a calendar.properties file (like the euro or
> american ones)
> * For the moment I think all string are harcoded in calendar_date_select.js
> Date.weekdays = $w("S M T W T F S");
> Date.first_day_of_week = 0;
> Date.months = $w("January February March April May June July August
> September October November December" );
> _translations = {
> "OK": "OK",
> "Now": "Now",
> "Today": "Today"
> }
> A very simple way (but not very clever I must admit) could be to set a
> property for the language to use in calendar.properties file and use it in a
> switch statement with "hardcoded" strings in calendar_date_select.js. Is
> anybody aware of better ways to do that in Javascript or Prototype ?
> BTW I think we should delete calendarstyles.css and calendarTable.css. If
> it's ok, I will do it when I will upate the attached patch later.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.