[Bedework-commit] webapps r510 - in trunk: webclient/war/docs/event webcommon/src/org/bedework/webcommon/taglib

svnadmin at bedework.org svnadmin at bedework.org
Fri Sep 7 10:25:42 EDT 2007


Author: douglm
Date: 2007-09-07 10:25:41 -0400 (Fri, 07 Sep 2007)
New Revision: 510

Added:
   trunk/webcommon/src/org/bedework/webcommon/taglib/EmitRExDatesTag.java
Modified:
   trunk/webclient/war/docs/event/emitRecur.jsp
   trunk/webclient/war/docs/event/eventForm.jsp
Log:
Emit rdates and exdates in eventform

Modified: trunk/webclient/war/docs/event/emitRecur.jsp
===================================================================
--- trunk/webclient/war/docs/event/emitRecur.jsp	2007-09-07 05:16:36 UTC (rev 509)
+++ trunk/webclient/war/docs/event/emitRecur.jsp	2007-09-07 14:25:41 UTC (rev 510)
@@ -74,5 +74,13 @@
       </logic:present>
     </recurrence>
   </logic:iterate>
+
+  <logic:present name="event" property="rdates">
+    <bw:emitRexdates name="event" property="rdates" indent="    " />
+  </logic:present>
+
+  <logic:present name="event" property="exdates">
+    <bw:emitRexdates name="event" property="exdates" indent="    " />
+  </logic:present>
 </logic:present>
 

Modified: trunk/webclient/war/docs/event/eventForm.jsp
===================================================================
--- trunk/webclient/war/docs/event/eventForm.jsp	2007-09-07 05:16:36 UTC (rev 509)
+++ trunk/webclient/war/docs/event/eventForm.jsp	2007-09-07 14:25:41 UTC (rev 510)
@@ -179,7 +179,7 @@
 
     <bw:emitText name="event" property="trashable"/>
     <bw:emitText name="event" property="recurringEntity"/>
-    <jsp:include page="/docs/event/emitRecur.jsp"/>
+    <%@ include file="/docs/event/emitRecur.jsp" %>
 
     <%@ include file="/docs/schedule/emitEventProperties.jsp" %>
 

Added: trunk/webcommon/src/org/bedework/webcommon/taglib/EmitRExDatesTag.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/taglib/EmitRExDatesTag.java	                        (rev 0)
+++ trunk/webcommon/src/org/bedework/webcommon/taglib/EmitRExDatesTag.java	2007-09-07 14:25:41 UTC (rev 510)
@@ -0,0 +1,179 @@
+/*
+ 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.webcommon.taglib;
+
+import org.bedework.calfacade.BwDateTime;
+
+import java.util.Collection;
+
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.JspTagException;
+
+/** A simple Tag to emit rdates or exdates. This tag has the attributes, <ul>
+ * <li><b>name<b> (Required) defines the name of object embedded somewhere
+ *               in the page context containing the path object.</li>
+ * <li><b>property<b> Object property containing rdates </li>
+ * </ul>
+ *
+ * We retrieve the value and emit xml.
+ *
+ * @author Mike Douglass
+ */
+public class EmitRExDatesTag extends EmitTextTag {
+  private boolean exdates;
+
+  /**
+   * Constructor
+   */
+  public EmitRExDatesTag() {
+  }
+
+  /** Called at end of Tag
+   *
+   * @return int      either EVAL_PAGE or SKIP_PAGE
+   */
+  public int doEndTag() throws JspTagException {
+    try {
+      /* Try to retrieve the value */
+      Collection<BwDateTime> dates = (Collection<BwDateTime>)getObject(false);
+      if (dates == null) {
+        return EVAL_PAGE;
+      }
+
+      String outerTag = getTagName();
+      if (outerTag == null) {
+        outerTag = property;
+      }
+
+      if (outerTag == null) {
+        outerTag = "name";
+      }
+
+      String innerTag;
+
+      if (exdates) {
+        innerTag = "exdate";
+      } else {
+        innerTag = "rdate";
+      }
+
+      JspWriter out = pageContext.getOut();
+
+      String indent = getIndent();
+      if (indent == null) {
+        indent = "";
+      }
+
+      out.print('<');
+      out.print(outerTag);
+      out.println('>');
+
+      for (BwDateTime dt: dates) {
+        out.print(indent);
+        out.print("  ");
+        out.print('<');
+        out.print(innerTag);
+        out.print('>');
+
+        String dtval = dt.getDtval();
+
+        out.print("<date>");
+        out.print(dtval.substring(0, 8));
+        out.print("</date>");
+
+        out.print("<time>");
+        if (dtval.length() > 8) {
+          out.print(dtval.substring(9, 13));
+        }
+        out.print("</time>");
+
+        out.print("<tzid>");
+        if (dt.getTzid() != null) {
+          out.print(dt.getTzid());
+        }
+        out.print("</tzid>");
+
+        out.print("</");
+        out.print(innerTag);
+        out.println('>');
+      }
+
+      out.print(indent);
+      out.print("</");
+      out.print(outerTag);
+      out.println('>');
+    } catch(Throwable t) {
+      throw new JspTagException("Error: " + t.getMessage());
+    } finally {
+    }
+
+    return EVAL_PAGE;
+  }
+
+  /** Sets the exdates value.
+   *
+   * @param val
+   */
+  public void setExdates(boolean val) {
+    exdates = val;
+  }
+
+  /** Returns the exdates value.
+   *
+   * @return boolean
+   */
+  public boolean getExdates() {
+      return exdates;
+  }
+}


Property changes on: trunk/webcommon/src/org/bedework/webcommon/taglib/EmitRExDatesTag.java
___________________________________________________________________
Name: svn:eol-style
   + LF



More information about the Bedework-commit mailing list