Re: svn commit: r701257 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java webtools/webapp/webtools/tempexpr/tempExprMacros.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r701257 - in /ofbiz/trunk/framework: service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java webtools/webapp/webtools/tempexpr/tempExprMacros.ftl

Jacques Le Roux
Administrator
Thanks Adrian :o)

Thanks for all you work on this time stuff BTW !

Jacques

From: <[hidden email]>

> Author: adrianc
> Date: Thu Oct  2 15:00:11 2008
> New Revision: 701257
>
> URL: http://svn.apache.org/viewvc?rev=701257&view=rev
> Log:
> Made the Temporal Expressions UI more France friendly.
>
> Modified:
>    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java
>    ofbiz/trunk/framework/webtools/webapp/webtools/tempexpr/tempExprMacros.ftl
>
> Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java?rev=701257&r1=701256&r2=701257&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java (original)
> +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java Thu Oct  2 15:00:11 2008
> @@ -58,13 +58,33 @@
>         tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
>         SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale);
>         List<Map> result = new ArrayList<Map>(7);
> -        for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {
> -            result.add(UtilMisc.toMap("description", dateFormat.format(tempCal.getTime()), "value", new Integer(i)));
> +        for (int i = 0; i < 7; i++) {
> +            result.add(UtilMisc.toMap("description", dateFormat.format(tempCal.getTime()), "value", new
> Integer(tempCal.get(Calendar.DAY_OF_WEEK))));
>             tempCal.roll(Calendar.DAY_OF_WEEK, 1);
>         }
>         return result;
>     }
>
> +    /** Returns the first day of the week for the specified locale.
> +     * @param locale
> +     * @return The first day of the week for the specified locale
> +     */
> +    public static int getFirstDayOfWeek(Locale locale) {
> +        Calendar tempCal = Calendar.getInstance(locale);
> +        return tempCal.getFirstDayOfWeek();
> +    }
> +
> +    /** Returns the last day of the week for the specified locale.
> +     * @param locale
> +     * @return The last day of the week for the specified locale
> +     */
> +    public static int getLastDayOfWeek(Locale locale) {
> +        Calendar tempCal = Calendar.getInstance(locale);
> +        tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
> +        tempCal.roll(Calendar.DAY_OF_WEEK, -1);
> +        return tempCal.get(Calendar.DAY_OF_WEEK);
> +    }
> +
>     /** Returns a List of Maps containing month values.
>      * @param locale
>      * @return List of Maps. Each Map has a
>
> Modified: ofbiz/trunk/framework/webtools/webapp/webtools/tempexpr/tempExprMacros.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/tempexpr/tempExprMacros.ftl?rev=701257&r1=701256&r2=701257&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/webapp/webtools/tempexpr/tempExprMacros.ftl (original)
> +++ ofbiz/trunk/framework/webtools/webapp/webtools/tempexpr/tempExprMacros.ftl Thu Oct  2 15:00:11 2008
> @@ -28,6 +28,8 @@
> <#assign
>   occurrenceList = Static["org.ofbiz.service.calendar.ExpressionUiHelper"].getOccurrenceList()
>   frequencyTypeList = Static["org.ofbiz.service.calendar.ExpressionUiHelper"].getFrequencyValueList(uiLabelMap)
> +  firstDayOfWeek = Static["org.ofbiz.service.calendar.ExpressionUiHelper"].getFirstDayOfWeek(locale)
> +  lastDayOfWeek = Static["org.ofbiz.service.calendar.ExpressionUiHelper"].getLastDayOfWeek(locale)
> />
>
> <#macro DateRange formName="" fromDate="" toDate="">
> @@ -45,7 +47,7 @@
>   </tr>
> </#macro>
>
> -<#macro DayInMonth occurrence=0 day=1>
> +<#macro DayInMonth occurrence=0 day=firstDayOfWeek>
>   <tr>
>     <td class="label">${uiLabelMap.TemporalExpressionOccurrence}</td>
>     <td>
> @@ -76,7 +78,7 @@
>   </tr>
> </#macro>
>
> -<#macro DayOfWeekRange fromDay=1 toDay=7>
> +<#macro DayOfWeekRange fromDay=firstDayOfWeek toDay=lastDayOfWeek>
>   <tr>
>     <td class="label">${uiLabelMap.CommonFrom}</td>
>     <td><@DayOfWeekField fieldName="integer1" fieldValue=fromDay/></td>
>
>