[Bedework-commit] r324 - in trunk/calendar3:
webclient/src/org/bedework/webclient webclient/war/WEB-INF
webcommon/src/org/bedework/webcommon
svnadmin at bedework.org
svnadmin at bedework.org
Mon Apr 3 16:03:12 EDT 2006
Author: douglm
Date: 2006-04-03 16:03:12 -0400 (Mon, 03 Apr 2006)
New Revision: 324
Added:
trunk/calendar3/webclient/src/org/bedework/webclient/BwInitEventAction.java
Modified:
trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java
Log:
Action to initialise create of an event for a given day
Added: trunk/calendar3/webclient/src/org/bedework/webclient/BwInitEventAction.java
===================================================================
--- trunk/calendar3/webclient/src/org/bedework/webclient/BwInitEventAction.java (rev 0)
+++ trunk/calendar3/webclient/src/org/bedework/webclient/BwInitEventAction.java 2006-04-03 20:03:12 UTC (rev 324)
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.webclient;
+
+import org.bedework.calfacade.CalFacadeUtil;
+
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+
+/** Set up for addition of new event.
+ *
+ * <p>Parameters are:<ul>
+ * <li>"date" Optional date for the event</li>
+ * </ul>
+ *
+ */
+public class BwInitEventAction extends BwCalAbstractAction {
+ /* (non-Javadoc)
+ * @see org.bedework.webclient.BwCalAbstractAction#doAction(javax.servlet.http.HttpServletRequest, org.bedework.webclient.BwActionForm)
+ */
+ public String doAction(HttpServletRequest request,
+ BwActionForm form) throws Throwable {
+ form.refreshIsNeeded();
+
+ String date = getReqPar(request, "date");
+
+ if (date != null) {
+ Date jdt = CalFacadeUtil.fromISODate(date);
+
+ form.assignEventDates(jdt);
+ }
+
+ return "success";
+ }
+}
+
Modified: trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
===================================================================
--- trunk/calendar3/webclient/war/WEB-INF/struts-config.xml 2006-04-03 19:28:34 UTC (rev 323)
+++ trunk/calendar3/webclient/war/WEB-INF/struts-config.xml 2006-04-03 20:03:12 UTC (rev 324)
@@ -241,7 +241,7 @@
(a la Demo, Rensselaer); on error, we return to the
addEvent.jsp page. -->
<action path="/initEvent"
- type="org.bedework.webclient.BwAction"
+ type="org.bedework.webclient.BwInitEventAction"
name="calForm"
scope="session"
validate="false">
Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java 2006-04-03 19:28:34 UTC (rev 323)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java 2006-04-03 20:03:12 UTC (rev 324)
@@ -1926,6 +1926,14 @@
* They will be distinguished by the action called.
* ==================================================================== */
+ /** Assign event dates based on parameter
+ *
+ * @param dt Date object representing date
+ */
+ public void assignEventDates(Date dt) {
+ getEventDates().setFromDate(dt);
+ }
+
/** Return an object containing the dates.
*
* @return EventDates object representing date/times and duration
Modified: trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java
===================================================================
--- trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java 2006-04-03 19:28:34 UTC (rev 323)
+++ trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java 2006-04-03 20:03:12 UTC (rev 324)
@@ -62,6 +62,8 @@
import edu.rpi.sss.util.log.MessageEmit;
+import java.util.Date;
+
/** The dates (and/or duration which define when an event happens. These are
* stored in objects which allow manipulation of indiviual date and time
* components.
@@ -125,6 +127,18 @@
}
}
+ /** We set the time date components from the date.
+ *
+ * <p>If the end date is a date only value it is adjusted backwards by one
+ * day to take account of accepted practice.
+ *
+ * @param val
+ */
+ public void setFromDate(Date val) {
+ getStartDate().setDateTime(val);
+ getEndDate().setDateTime(val);
+ }
+
/** We set the time date components to be today. The end date is
* set to the current date + 1 hour.
*
More information about the Bedework-commit
mailing list