You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2012/04/15 14:28:07 UTC

svn commit: r1326317 - in /incubator/openmeetings/trunk/singlewebapp: WebContent/src/modules/lzcalendar/compontents/ src/org/openmeetings/app/data/calendar/management/ src/org/openmeetings/test/calendar/ src/org/openmeetings/utils/math/

Author: sebawagner
Date: Sun Apr 15 12:28:07 2012
New Revision: 1326317

URL: http://svn.apache.org/viewvc?rev=1326317&view=rev
Log:
OPENMEETINGS-166 Meeting is created with incorrect start time in the calendar.

Removed:
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/calendar/TestSaveAppointment.java
Modified:
    incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/math/TimezoneUtil.java

Modified: incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx?rev=1326317&r1=1326316&r2=1326317&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx (original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/lzcalendar/compontents/lzEditCalendarEvent.lzx Sun Apr 15 12:28:07 2012
@@ -140,6 +140,9 @@
                 updateObj.password = this._password.getText();
                 
                 if ($debug) Debug.write("appointmentId: ",updateObj.appointmentId);
+                
+                if ($debug) Debug.write("appointmentstart: ",updateObj.appointmentstart);
+                if ($debug) Debug.write("appointmentstart: ",updateObj.appointmentend);
                                
 				if (updateObj.appointmentId > 0) {
 					this.updateAppointment.doCall();

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/calendar/management/AppointmentLogic.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/calendar/management/AppointmentLogic.java?rev=1326317&r1=1326316&r2=1326317&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/calendar/management/AppointmentLogic.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/calendar/management/AppointmentLogic.java Sun Apr 15 12:28:07 2012
@@ -139,7 +139,7 @@ public class AppointmentLogic {
 
 	public Long saveAppointment(String appointmentName, Long userId,
 			String appointmentLocation, String appointmentDescription,
-			Date appointmentstartLocal, Date appointmentendLocal,
+			Date appointmentstart, Date appointmentend,
 			Boolean isDaily, Boolean isWeekly, Boolean isMonthly,
 			Boolean isYearly, Long categoryId, Long remind,
 			@SuppressWarnings("rawtypes") List mmClient, Long roomType,
@@ -192,15 +192,11 @@ public class AppointmentLogic {
 
 			// Adding Invitor as Meetingmember
 			Users user = userManagement.getUserById(userId);
-
+			
 			// Refactor the given time ignoring the Date is always UTC!
 			TimeZone timezone = timezoneUtil.getTimezoneByUser(user);
-			Date appointmentstart = TimezoneUtil
-					.reCalcDateToTimezonCalendarObj(appointmentstartLocal,
-							timezone).getTime();
-			Date appointmentend = TimezoneUtil.reCalcDateToTimezonCalendarObj(
-					appointmentendLocal, timezone).getTime();
-
+			log.debug("timezone "+timezone);
+			
 			Long appointmentId = appointmentDao.addAppointment(appointmentName,
 					userId, appointmentLocation, appointmentDescription,
 					appointmentstart, appointmentend, isDaily, isWeekly,

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/math/TimezoneUtil.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/math/TimezoneUtil.java?rev=1326317&r1=1326316&r2=1326317&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/math/TimezoneUtil.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/math/TimezoneUtil.java Sun Apr 15 12:28:07 2012
@@ -19,7 +19,6 @@
 package org.openmeetings.utils.math;
 
 import java.util.Calendar;
-import java.util.Date;
 import java.util.TimeZone;
 
 import org.openmeetings.app.OpenmeetingsVariables;
@@ -37,24 +36,6 @@ public class TimezoneUtil {
 	private static final Logger log = Red5LoggerFactory.getLogger(
 			TimezoneUtil.class, OpenmeetingsVariables.webAppRootKey);
 
-	public static void main(String... args) {
-
-		TimeZone testZoneT = TimeZone.getTimeZone("Etc/GMT+4");
-
-		System.out.println("testZoneT OFFSET "
-				+ testZoneT.getOffset(new Date().getTime()));
-
-		TimeZone testZone = TimeZone.getTimeZone("America/New_York");
-
-		System.out.println("testZoneT OFFSE2T "
-				+ testZone.getOffset(new Date().getTime()));
-
-		Calendar cal = reCalcDateToTimezonCalendarObj(new Date(), testZone);
-
-		System.out.println(cal.getTime());
-
-	}
-
 	@Autowired
 	private Configurationmanagement cfgManagement;
 	@Autowired
@@ -186,40 +167,7 @@ public class TimezoneUtil {
 		log.error("There is no correct time zone set in the configuration of OpenMeetings for the key default.timezone or key is missing in table, using default locale!");
 		return TimeZone.getDefault();
 	}
-
-	/**
-	 * We ignore the fact that a Date Object is always in UTC internally and
-	 * treat it as if it contains only dd.mm.yyyy HH:mm:ss. We need to do this
-	 * cause we cannot trust the Date Object send from the client. We have the
-	 * timeZone information additional to the Date, so we need to transform it
-	 * now to a Calendar Object.
-	 * 
-	 * The client for example send 01.01.2011 12:30:00 but he has the timezone
-	 * PDT while the server stands in CET. The result is the the server will
-	 * receive the time 01.01.2011 12:30:00 and adds CET to it, so we need to
-	 * manipulate this time back to its original time.
-	 * 
-	 * @param dateTime
-	 * @param timezone
-	 * @return
-	 */
-	public static Calendar reCalcDateToTimezonCalendarObj(Date dateTime,
-			TimeZone timezone) {
-
-		Calendar calOrig = Calendar.getInstance();
-		calOrig.setTime(dateTime);
-
-		Calendar cal = Calendar.getInstance(timezone);
-		cal.set(Calendar.YEAR, calOrig.get(Calendar.YEAR));
-		cal.set(Calendar.MONTH, calOrig.get(Calendar.MONTH));
-		cal.set(Calendar.DATE, calOrig.get(Calendar.DATE));
-		cal.set(Calendar.HOUR_OF_DAY, calOrig.get(Calendar.HOUR_OF_DAY));
-		cal.set(Calendar.MINUTE, calOrig.get(Calendar.MINUTE));
-		cal.set(Calendar.SECOND, calOrig.get(Calendar.SECOND));
-
-		return cal;
-	}
-
+	
 	public static long _getOffset(TimeZone timezone) {
 		Calendar cal = Calendar.getInstance();
 		cal.setTimeZone(timezone);