Author: solomax
Date: Thu Sep 20 10:46:10 2012
New Revision: 1387958
URL: http://svn.apache.org/viewvc?rev=1387958&view=rev
Log:
Wicket: build modified to set DEPLOYMENT mode by default;
Calendar updated to display actual events based on the dates selected
with user timezone in effect;
Calendar is switched to readonly mode
Modified:
incubator/openmeetings/trunk/singlewebapp/build.properties
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
Modified: incubator/openmeetings/trunk/singlewebapp/build.properties
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/build.properties?rev=1387958&r1=1387957&r2=1387958&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/build.properties (original)
+++ incubator/openmeetings/trunk/singlewebapp/build.properties Thu Sep 20
10:46:10 2012
@@ -4,5 +4,5 @@ ivy.install.version=2.3.0-rc1
red5.server.revision=4414
red5.client.revision=4414
laszlo.proxied=solo
-wicket.mode=DEVELOPMENT
+wicket.mode=DEPLOYMENT
db=derby
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java?rev=1387958&r1=1387957&r2=1387958&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/app/WebSession.java
Thu Sep 20 10:46:10 2012
@@ -18,6 +18,11 @@
*/
package org.apache.openmeetings.web.app;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
+
import org.apache.openmeetings.data.basic.AuthLevelmanagement;
import org.apache.openmeetings.data.basic.Configurationmanagement;
import org.apache.openmeetings.data.basic.Fieldmanagment;
@@ -36,6 +41,8 @@ public class WebSession extends Abstract
private long userLevel = -1;
private String SID = null;
private String area = null;
+ private TimeZone tz;
+ private SimpleDateFormat ISO8601FORMAT = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
public WebSession(Request request) {
super(request);
@@ -78,7 +85,10 @@ public class WebSession extends Abstract
null, false);
if (u instanceof Users) {
- userId = ((Users)u).getUser_id();
+ Users user = (Users)u;
+ userId = user.getUser_id();
+ tz =
TimeZone.getTimeZone(user.getOmTimeZone().getIcal());
+ ISO8601FORMAT.setTimeZone(tz);
if (null == getId()) {
bind();
}
@@ -114,6 +124,14 @@ public class WebSession extends Abstract
return get().userId;
}
+ public static Calendar getCalendar() {
+ return Calendar.getInstance(get().tz);
+ }
+
+ public static DateFormat getDateFormat() {
+ return get().ISO8601FORMAT;
+ }
+
public static long getUserLevel() {
return get().userLevel;
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html?rev=1387958&r1=1387957&r2=1387958&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.html
Thu Sep 20 10:46:10 2012
@@ -39,7 +39,11 @@
center: 'title',
right:
'month,agendaWeek,agendaDay'
}
- , editable: true
+ //, editable: true
+ , timeFormat: {
+ agenda: 'H:mm{ - H:mm}'
+ , '': 'H(:mm)'
+ }
, height: getCalendarHeight()
});
$(window).resize(function() {
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java?rev=1387958&r1=1387957&r2=1387958&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/calendar/CalendarPanel.java
Thu Sep 20 10:46:10 2012
@@ -19,9 +19,8 @@
package org.apache.openmeetings.web.components.user.calendar;
import static org.apache.wicket.ajax.attributes.CallbackParameter.context;
-import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
+import static org.apache.wicket.ajax.attributes.CallbackParameter.resolved;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.apache.openmeetings.data.calendar.daos.AppointmentDaoImpl;
@@ -34,7 +33,9 @@ import org.apache.wicket.ajax.AbstractDe
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.attributes.AjaxCallListener;
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.ajax.json.JSONArray;
+import org.apache.wicket.ajax.json.JSONException;
+import org.apache.wicket.ajax.json.JSONObject;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -42,7 +43,6 @@ import org.apache.wicket.request.handler
public class CalendarPanel extends UserPanel {
private static final long serialVersionUID = -6536379497642291437L;
- public static SimpleDateFormat ISO8601FORMAT = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
public CalendarPanel(String id) {
super(id);
@@ -59,13 +59,7 @@ public class CalendarPanel extends UserP
super.updateAjaxAttributes(attributes);
attributes.setDataType("json");
attributes.setWicketAjaxResponse(false);
- attributes.getAjaxCallListeners().add(new
AjaxCallListener() {
- private static final long
serialVersionUID = -2316088040375497938L;
-
- public CharSequence
getSuccessHandler(Component component) {
- return "callback(data);";
- }
- });
+ attributes.getAjaxCallListeners().add(new
AjaxCallListener().onSuccess("callback(data);"));
}
@Override
@@ -75,7 +69,7 @@ public class CalendarPanel extends UserP
"function setEventSource(){\n"
+ "
$('#calendar').fullCalendar('addEventSource', \n"
+ " {\n"
- + " events: " +
this.getCallbackFunction(explicit("start"), explicit("end"),
context("callback")) + "\n"
+ + " events: " +
this.getCallbackFunction(context("start"), context("end"), context("callback"),
resolved("_start", "start.getTime()"), resolved("_end", "end.getTime()")) + "\n"
//+ " , color:
'#4793E6'\n"
//+ " , textColor:
'black'\n"
+ "});\n"
@@ -85,26 +79,26 @@ public class CalendarPanel extends UserP
@Override
protected void respond(AjaxRequestTarget target) {
- StringBuilder sb = new StringBuilder("[");
- Calendar start = Calendar.getInstance();
- start.set(2012, 8, 1);
- Calendar end = Calendar.getInstance();
- end.set(2012, 8, 30);
- String delim = "";
+ Calendar start = WebSession.getCalendar();
+
start.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_start").toLong());
+ Calendar end = WebSession.getCalendar();
+
end.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_end").toLong());
+ JSONArray events = new JSONArray();
for (Appointment a :
Application.getBean(AppointmentDaoImpl.class).getAppointmentsByRange(WebSession.getUserId(),
start.getTime(),
end.getTime())) {
- sb.append(delim).append("{\n")
- .append("\"id\":
").append(a.getAppointmentId()).append("\n")
- .append(", \"title\":
\"").append(JavaScriptUtils.escapeQuotes(a.getAppointmentName())).append("\"\n")
- .append(", \"start\":
\"").append(ISO8601FORMAT.format(a.getAppointmentStarttime())).append("\"\n")
- .append(", \"end\":
\"").append(ISO8601FORMAT.format(a.getAppointmentEndtime())).append("\"\n")
- .append(", \"allDay\": false\n")
- .append("}\n");
- delim = ", ";
+ try {
+ events.put(new JSONObject()
+ .put("id",
a.getAppointmentId())
+ .put("title",
a.getAppointmentName())
+ .put("start",
WebSession.getDateFormat().format(a.getAppointmentStarttime()))
+ .put("end",
WebSession.getDateFormat().format(a.getAppointmentEndtime()))
+ .put("allDay", false));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
}
- sb.append("]");
getRequestCycle().scheduleRequestHandlerAfterCurrent(
- new TextRequestHandler("application/json", "UTF-8",
sb.toString()));
+ new TextRequestHandler("application/json", "UTF-8",
events.toString()));
}
});
}