[gatein-commits] gatein SVN: r6899 - in epp/portal/branches/EPP_5_1_Branch: web/eXoResources/src/main/webapp/javascript/eXo/webui and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 20 08:28:21 EDT 2011


Author: theute
Date: 2011-07-20 08:28:21 -0400 (Wed, 20 Jul 2011)
New Revision: 6899

Modified:
   epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_en.js
   epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_fr.js
   epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_vi.js
   epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js
   epp/portal/branches/EPP_5_1_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java
Log:
JBEPP-1019
The day of the month in the calendar pop-up is not translated to French

Modified: epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_en.js
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_en.js	2011-07-20 12:02:16 UTC (rev 6898)
+++ epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_en.js	2011-07-20 12:28:21 UTC (rev 6899)
@@ -20,4 +20,9 @@
 eXo.i18n.I18NMessage.SessionTimeout = "Session timeout ! Refresh your browser.";
 eXo.i18n.I18NMessage.TargetBlockNotFound = "The target blockId to update is not found : {0}";
 eXo.i18n.I18NMessage.BlockUpdateNotFound = "The blockId to update is not found : {0}";
-eXo.i18n.I18NMessage.DefaultTheme = "Default Theme";
\ No newline at end of file
+eXo.i18n.I18NMessage.DefaultTheme = "Default Theme";
+eXo.i18n.I18NMessage.PreviousMonth="Previous Month";
+eXo.i18n.I18NMessage.NextMonth="Next Month";
+eXo.i18n.I18NMessage.PreviousYear="Previous Year";
+eXo.i18n.I18NMessage.NextYear="Next Year";
+eXo.i18n.I18NMessage.weekdays=["S", "M", "T", "W", "T", "F", "S"];

Modified: epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_fr.js
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_fr.js	2011-07-20 12:02:16 UTC (rev 6898)
+++ epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_fr.js	2011-07-20 12:28:21 UTC (rev 6899)
@@ -20,4 +20,9 @@
 eXo.i18n.I18NMessage.SessionTimeout = "La session a expir\u00e9 ! Veuillez recharger la page.";
 eXo.i18n.I18NMessage.TargetBlockNotFound = "The target blockId to update is not found : {0}";
 eXo.i18n.I18NMessage.BlockUpdateNotFound = "The blockId to update is not found : {0}";
-eXo.i18n.I18NMessage.DefaultTheme = "Style par Défaut";
\ No newline at end of file
+eXo.i18n.I18NMessage.DefaultTheme = "Style par Défaut";
+eXo.i18n.I18NMessage.PreviousMonth="Mois précédent";
+eXo.i18n.I18NMessage.NextMonth="Mois prochain";
+eXo.i18n.I18NMessage.PreviousYear="Année précédente";
+eXo.i18n.I18NMessage.NextYear="Année suivante";
+eXo.i18n.I18NMessage.weekdays=["D", "L", "M", "M", "J", "V", "S"];

Modified: epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_vi.js
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_vi.js	2011-07-20 12:02:16 UTC (rev 6898)
+++ epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/i18n/MessageResource_vi.js	2011-07-20 12:28:21 UTC (rev 6899)
@@ -20,4 +20,9 @@
 eXo.i18n.I18NMessage.SessionTimeout = "Phiên làm việc hết hạn! Tải lại trang này.";
 eXo.i18n.I18NMessage.TargetBlockNotFound = "Không tìm thấy vùng đích với ID là : {0}";
 eXo.i18n.I18NMessage.BlockUpdateNotFound = "Không tìm thấy vùng cần cập nhật : {0}";
-eXo.i18n.I18NMessage.DefaultTheme = "Mặc định";
\ No newline at end of file
+eXo.i18n.I18NMessage.DefaultTheme = "Mặc định";
+eXo.i18n.I18NMessage.PreviousMonth="Tháng trước";
+eXo.i18n.I18NMessage.NextMonth="Tháng sau";
+eXo.i18n.I18NMessage.PreviousYear="Năm trước";
+eXo.i18n.I18NMessage.NextYear="Năm sau";
+eXo.i18n.I18NMessage.weekdays=["CN", "T2", "T3", "T4", "T5", "T6", "T7"];
\ No newline at end of file

Modified: epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js	2011-07-20 12:02:16 UTC (rev 6898)
+++ epp/portal/branches/EPP_5_1_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js	2011-07-20 12:28:21 UTC (rev 6899)
@@ -26,6 +26,9 @@
   														// if selectedDate is invalid, currentDate deals with system time;
   this.selectedDate = null ; //Datetime value of input date&time field
   this.months ;
+  
+  this.firstDayOfWeek = 1;// Indecates what the first day of the week is; e.g., SUNDAY (1) in the U.S, MONDAY (2) in France, TUESDAY (3), etc
+  this.weekdays = null; 
 }
 
 UICalendar.prototype.init = function(field, isDisplayTime, datePattern, value, monthNames) {
@@ -42,6 +45,11 @@
 	this.months = monthNames.split(',');
 	this.months.pop();
 	
+	var weekdays = eXo.i18n.I18NMessage.getMessage("weekdays");
+	if(weekdays != null && typeof(weekdays) == "object") {
+		this.weekdays = weekdays; 
+	}
+	
 	if (!document.getElementById(this.calendarId)) this.create();
   this.show() ;
 
@@ -184,26 +192,36 @@
 	table += 		'<div class="UICalendar" onmousedown="event.cancelBubble = true">' ;
 	table += 		'	<table class="MonthYearBox">' ;
 	table += 		'	  <tr>' ;
-	table += 		'			<td class="MonthButton"><a class="PreviousMonth" href="javascript:eXo.webui.UICalendar.changeMonth(-1);" title="Previous Month"></a></td>' ;
-	table += 		'			<td class="YearButton"><a class="PreviousYear" href="javascript:eXo.webui.UICalendar.changeYear(-1);" title="Previous Year"></a></td>' ;
+	table += 		'			<td class="MonthButton"><a class="PreviousMonth" href="javascript:eXo.webui.UICalendar.changeMonth(-1);" title="' + eXo.i18n.I18NMessage.getMessage("PreviousMonth") + '"></a></td>' ;
+	table += 		'			<td class="YearButton"><a class="PreviousYear" href="javascript:eXo.webui.UICalendar.changeYear(-1);" title="' + eXo.i18n.I18NMessage.getMessage("PreviousYear") + '"></a></td>' ;
 	table += 		'			<td><font color="#f89302">' + this.months[this.currentDate.getMonth()] + '</font> - ' + this.currentDate.getFullYear() + '</td>' ;
-	table += 		'			<td class="YearButton"><a class="NextYear" href="javascript:eXo.webui.UICalendar.changeYear(1);" title="Next Year"></a></td>' ;
-	table += 		'			<td class="MonthButton"><a class="NextMonth" href="javascript:eXo.webui.UICalendar.changeMonth(1);" title="Next Month"></a></td>' ;
+	table += 		'			<td class="YearButton"><a class="NextYear" href="javascript:eXo.webui.UICalendar.changeYear(1);" title="' + eXo.i18n.I18NMessage.getMessage("NextYear") + '"></a></td>' ;
+	table += 		'			<td class="MonthButton"><a class="NextMonth" href="javascript:eXo.webui.UICalendar.changeMonth(1);" title="' + eXo.i18n.I18NMessage.getMessage("NextMonth") + '"></a></td>' ;
 	table += 		'		</tr>' ;
 	table += 		'	</table>' ;
 	table += 		'	<div style="margin-top: 6px;padding: 0px 5px;">' ;
 	table += 		'		<table>' ;
 	table += 		'			<tr>' ;
-	table += 		'				<td><font color="red">S</font></td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td>' ;
+	if(this.weekdays == null) {
+		this.weekdays = new Array("S", "M", "T", "W", "T", "F", "S");
+	}
+	for (var i = 0; i < 7; i++) {
+		if(i == (8-this.firstDayOfWeek)%7) {
+			table += ' <td><font color="red">' + this.weekdays[(i + this.firstDayOfWeek - 1)%7] + '</font></td>';
+		} else {
+			table += ' <td>' + this.weekdays[(i + this.firstDayOfWeek - 1)%7] + '</td>';
+		}
+	}
 	table += 		'			</tr>' ;
 	table += 		'		</table>' ;
 	table += 		'	</div>' ;
 	table += 		'	<div class="CalendarGrid">' ;
 	table += 		'	<table>' ;
+
   for (var week=0; week < 6; week++) {
     table += "<tr>";
-    for (var dayOfWeek=0; dayOfWeek < 7; dayOfWeek++) {
-      if (week == 0 && startDayOfWeek == dayOfWeek) {
+    for (var dayOfWeek=0; dayOfWeek <= 6; dayOfWeek++) {
+      if (week == 0 && dayOfWeek == (startDayOfWeek + ((8-this.firstDayOfWeek)%7))%7) {
         validDay = 1;
       } else if (validDay == 1 && dayOfMonth > daysInMonth) {
         validDay = 0;
@@ -423,4 +441,12 @@
 	return [31, ((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))? 29:28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
 }
 
+UICalendar.prototype.getFirstDayOfWeek = function() {
+	return this.firstDayOfWeek;
+}
+
+UICalendar.prototype.setFirstDayOfWeek = function(dayOfWeek) {
+	this.firstDayOfWeek = dayOfWeek;
+}
+
 eXo.webui.UICalendar = new UICalendar('UICalendarControl') ;
\ No newline at end of file

Modified: epp/portal/branches/EPP_5_1_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java	2011-07-20 12:02:16 UTC (rev 6898)
+++ epp/portal/branches/EPP_5_1_Branch/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java	2011-07-20 12:28:21 UTC (rev 6899)
@@ -19,6 +19,7 @@
 
 package org.exoplatform.webui.form;
 
+import org.exoplatform.web.application.JavascriptManager;
 import org.exoplatform.webui.application.WebuiRequestContext;
 
 import java.io.Writer;
@@ -211,7 +212,9 @@
          value_ = "";
       }
 
-      context.getJavascriptManager().importJavascript("eXo.webui.UICalendar");
+      JavascriptManager jsManager = context.getJavascriptManager();
+      jsManager.importJavascript("eXo.webui.UICalendar");
+      jsManager.addJavascript("eXo.webui.UICalendar.setFirstDayOfWeek(" + Calendar.getInstance(context.getLocale()).getFirstDayOfWeek() + ")");
       Writer w = context.getWriter();
 
       w.write("<input type='text' onfocus='eXo.webui.UICalendar.init(this,");



More information about the gatein-commits mailing list