[Bedework-commit] webapps r374 - in trunk: webclient/war/WEB-INF webclient/war/docs webcommon/src/org/bedework/webcommon webcommon/src/org/bedework/webcommon/misc webcommon/src/org/bedework/webcommon/taglib/portlet

svnadmin at bedework.org svnadmin at bedework.org
Tue May 29 09:52:52 EDT 2007


Author: douglm
Date: 2007-05-29 09:52:50 -0400 (Tue, 29 May 2007)
New Revision: 374

Removed:
   trunk/webclient/war/docs/exportData.jsp
Modified:
   trunk/webclient/war/WEB-INF/struts-config.xml
   trunk/webclient/war/docs/header.jsp
   trunk/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
   trunk/webcommon/src/org/bedework/webcommon/ForwardDefs.java
   trunk/webcommon/src/org/bedework/webcommon/misc/ExportAction.java
   trunk/webcommon/src/org/bedework/webcommon/misc/FreeBusyAction.java
   trunk/webcommon/src/org/bedework/webcommon/taglib/portlet/CalRewriteTag.java
Log:
Export changes

To try to get this working in a portal switched to writing directly to output stream. Requires 
 1. a code change to !UtilAbstractAction - not handling null action
 2. Change !ExportAction
 3. Change style sheet so we don't set contentType and skinName (number of these in webuser, 2 in maincampus, 2 in soe)
 4. Remove ical.xsl from each app
 5. Remove export code from FreeBusyAction (FreeBusyPublish does it)
 6. Remove vcal property from form
 7. Remove showExportData action from struts-config
 8. Ensure other data export actions don't forward 


Modified: trunk/webclient/war/WEB-INF/struts-config.xml
===================================================================
--- trunk/webclient/war/WEB-INF/struts-config.xml	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webclient/war/WEB-INF/struts-config.xml	2007-05-29 13:52:50 UTC (rev 374)
@@ -466,21 +466,11 @@
 
     <!-- ........... PUBLIC and PERSONAL clients ...... -->
 
-    <!-- renderUrl -->
-    <action    path="/misc/showExportData"
-               type="org.bedework.webcommon.RenderAction"
-               name="calForm"
-               scope="session"
-               validate="false">
-      <forward name="success" path="/docs/exportData.jsp" />
-    </action>
-
     <action    path="/misc/export"
                type="org.bedework.webcommon.misc.ExportAction"
                name="calForm"
                scope="session"
                validate="false">
-      <forward name="success" path="/misc/showExportData.rdo" redirect="true" />
     </action>
 
     <!-- ........... PERSONAL client only ...... -->
@@ -690,9 +680,6 @@
                name="calForm"
                scope="session"
                validate="false">
-      <forward name="success" path="/misc/showExportData.rdo" redirect="true" />
-      <forward name="noAccess" path="/freeBusy/showFreeBusy.rdo" redirect="true" />
-      <forward name="notFound" path="/freeBusy/showFreeBusy.rdo" redirect="true" />
     </action>
 
     <action    path="/freeBusy/getFreeBusy"
@@ -700,7 +687,6 @@
                name="calForm"
                scope="session"
                validate="false">
-      <forward name="export" path="/misc/showExportData.rdo" redirect="true" />
       <forward name="success" path="/freeBusy/showFreeBusy.rdo" redirect="true" />
       <forward name="noAccess" path="/freeBusy/showFreeBusy.rdo" redirect="true" />
       <forward name="notFound" path="/freeBusy/showFreeBusy.rdo" redirect="true" />

Deleted: trunk/webclient/war/docs/exportData.jsp
===================================================================
--- trunk/webclient/war/docs/exportData.jsp	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webclient/war/docs/exportData.jsp	2007-05-29 13:52:50 UTC (rev 374)
@@ -1,27 +0,0 @@
-<%@ taglib uri='struts-bean' prefix='bean' %>
-<%@ taglib uri='struts-logic' prefix='logic' %>
-<%@ taglib uri='struts-html' prefix='html' %>
-<%@ taglib uri='struts-genurl' prefix='genurl' %>
-
-<%@ include file="/docs/header.jsp" %>
-
-<%
-try {
-%>
-
-<page>exportData</page>
-
-<logic:present name="calForm" property="vcal" >
-<vcalendar><![CDATA[<bean:write filter="no" name="calForm" property="vcal" />
-]]>
-</vcalendar>
-</logic:present>
-
-<%
-} catch (Throwable t) {
-  t.printStackTrace();
-}
-%>
-
-<%@ include file="/docs/footer.jsp" %>
-

Modified: trunk/webclient/war/docs/header.jsp
===================================================================
--- trunk/webclient/war/docs/header.jsp	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webclient/war/docs/header.jsp	2007-05-29 13:52:50 UTC (rev 374)
@@ -146,7 +146,7 @@
     </search>
 
     <misc>
-      <export><genurl:link page="/misc/export.gdo?b=de"/></export>
+      <export><genurl:rewrite action="/misc/export.gdo?b=de"/></export>
     </misc>
 
     <mail>

Modified: trunk/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/BwActionFormBase.java	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webcommon/src/org/bedework/webcommon/BwActionFormBase.java	2007-05-29 13:52:50 UTC (rev 374)
@@ -316,8 +316,6 @@
 
   private FormFile uploadFile;
 
-  private String vcal;
-
   /* ....................................................................
    *                       Selection type and selection
    * .................................................................... */
@@ -1728,20 +1726,6 @@
     return uploadFile;
   }
 
-  /**
-   * @param val
-   */
-  public void setVcal(String val) {
-    vcal = val;
-  }
-
-  /**
-   * @return Calendar
-   */
-  public String getVcal() {
-    return vcal;
-  }
-
   /* ====================================================================
    *                   View Period methods
    * ==================================================================== */

Modified: trunk/webcommon/src/org/bedework/webcommon/ForwardDefs.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/ForwardDefs.java	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webcommon/src/org/bedework/webcommon/ForwardDefs.java	2007-05-29 13:52:50 UTC (rev 374)
@@ -179,7 +179,7 @@
     "cancelled",
     "badRequest",
     "nochange",
-    "done",
+    "done",       //35
     "export",
     "FORWARD-NULL",
   };

Modified: trunk/webcommon/src/org/bedework/webcommon/misc/ExportAction.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/misc/ExportAction.java	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webcommon/src/org/bedework/webcommon/misc/ExportAction.java	2007-05-29 13:52:50 UTC (rev 374)
@@ -157,8 +157,18 @@
 
     Calendar ical = trans.toIcal(evs, method);
 
-    form.setVcal(IcalTranslator.toIcalString(ical));
+    //form.setVcal(IcalTranslator.toIcalString(ical));
 
-    return forwardSuccess;
+    //return forwardSuccess;
+    request.getResponse().setHeader("Content-Disposition",
+                                    "Attachment; Filename=\"" +
+                                    form.getContentName() + "\"");
+    request.getResponse().setContentType("text/calendar");
+    //form.getPresentationState().setNoXSLT(true);
+
+    IcalTranslator.writeCalendar(ical, request.getResponse().getWriter());
+    request.getResponse().getWriter().close();
+
+    return forwardNull;
   }
 }

Modified: trunk/webcommon/src/org/bedework/webcommon/misc/FreeBusyAction.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/misc/FreeBusyAction.java	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webcommon/src/org/bedework/webcommon/misc/FreeBusyAction.java	2007-05-29 13:52:50 UTC (rev 374)
@@ -37,15 +37,10 @@
 import org.bedework.calfacade.timezones.CalTimezones;
 import org.bedework.calfacade.util.CalFacadeUtil;
 import org.bedework.calsvci.CalSvcI;
-import org.bedework.icalendar.IcalTranslator;
-import org.bedework.icalendar.Icalendar;
-import org.bedework.icalendar.VFreeUtil;
 import org.bedework.webcommon.BwAbstractAction;
 import org.bedework.webcommon.BwActionFormBase;
 import org.bedework.webcommon.BwRequest;
 
-import net.fortuna.ical4j.model.component.VFreeBusy;
-
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
@@ -53,7 +48,7 @@
 import java.util.Locale;
 
 /**
- * Action to fetch free busy information
+ * Action to fetch free busy information for web use.
  * <p>Request parameters - all optional:<ul>
  *      <li>  userid:   whose free busy we want - default to current user</li>.
  *      <li>  subname:  name of the subscription - default to subscriptions
@@ -87,8 +82,6 @@
     BwUser user = null;
     CalSvcI svci = form.fetchSvci();
 
-    boolean export = request.hasExport();
-
     gotoDateView(form, form.getDate(), form.getViewTypeI(), debug);
 
     String userId = request.getReqPar("userid");
@@ -142,47 +135,33 @@
     BwDuration dur = null;
     BwCalendar cal = null;
 
-    if (export) {
-      /* We can specify a calendar for export
-       *
-       */
-      String calPath = request.getReqPar("calPath");
-      if (calPath != null) {
-        cal = svci.getCalendar(calPath);
-        if (cal == null) {
-          return forwardNotFound;
-        }
-      }
-    } else {
-      /* When we export as ics we don't chop it up. For display we divide
-       * into the requested intervals.
-       */
+    /* For display we divide into the requested intervals.
+     */
 
-      String intunitStr = request.getReqPar("intunit");
-      int interval = request.getIntReqPar("interval", 1);
-      if (interval <= 0) {
-        form.getErr().emit(ClientError.badInterval, interval);
-        return forwardError;
-      }
+    String intunitStr = request.getReqPar("intunit");
+    int interval = request.getIntReqPar("interval", 1);
+    if (interval <= 0) {
+      form.getErr().emit(ClientError.badInterval, interval);
+      return forwardError;
+    }
 
-      dur = new BwDuration();
+    dur = new BwDuration();
 
-      if (intunitStr != null) {
-        if ("minutes".equals(intunitStr)) {
-          dur.setMinutes(interval);
-        } else if ("hours".equals(intunitStr)) {
-          dur.setHours(interval);
-        } else if ("days".equals(intunitStr)) {
-          dur.setDays(interval);
-        } else if ("weeks".equals(intunitStr)) {
-          dur.setWeeks(interval);
-        } else {
-          form.getErr().emit(ClientError.badIntervalUnit, interval);
-          return forwardError;
-        }
-      } else {
+    if (intunitStr != null) {
+      if ("minutes".equals(intunitStr)) {
+        dur.setMinutes(interval);
+      } else if ("hours".equals(intunitStr)) {
         dur.setHours(interval);
+      } else if ("days".equals(intunitStr)) {
+        dur.setDays(interval);
+      } else if ("weeks".equals(intunitStr)) {
+        dur.setWeeks(interval);
+      } else {
+        form.getErr().emit(ClientError.badIntervalUnit, interval);
+        return forwardError;
       }
+    } else {
+      dur.setHours(interval);
     }
 
     //int maxRequests = 1000;
@@ -193,13 +172,7 @@
      */
     while (start.before(end)) {
       String sdt = CalFacadeUtil.isoDateTime(start.getTime());
-      String edt;
-      if (export) {
-        // All in one go
-        edt = CalFacadeUtil.isoDateTime(end.getTime());
-      } else {
-        edt = CalFacadeUtil.isoDateTime(endDay.getTime());
-      }
+      String edt = CalFacadeUtil.isoDateTime(endDay.getTime());
 
       if (debug) {
         debugMsg("getFreeBusy for start =  " + sdt +
@@ -222,20 +195,6 @@
                                                                    tzs),
                                          dur, true);
 
-        if (export) {
-          // One shot
-          VFreeBusy vfreeBusy = VFreeUtil.toVFreeBusy(fb);
-          net.fortuna.ical4j.model.Calendar ical = null;
-          if (vfreeBusy != null) {
-            ical = IcalTranslator.newIcal(Icalendar.methodTypeNone);
-            ical.getComponents().add(vfreeBusy);
-          }
-
-          form.setContentName("freebusy.ics");
-          //&skinName=ical&contentType=text/calendar
-          form.setVcal(IcalTranslator.toIcalString(ical));
-          return forwardExport;
-        }
         FormattedFreeBusy ffb = new FormattedFreeBusy(fb, tzs);
         freeBusy.add(ffb);
 

Modified: trunk/webcommon/src/org/bedework/webcommon/taglib/portlet/CalRewriteTag.java
===================================================================
--- trunk/webcommon/src/org/bedework/webcommon/taglib/portlet/CalRewriteTag.java	2007-05-22 19:40:45 UTC (rev 373)
+++ trunk/webcommon/src/org/bedework/webcommon/taglib/portlet/CalRewriteTag.java	2007-05-29 13:52:50 UTC (rev 374)
@@ -72,7 +72,15 @@
       urlType = TagsSupport.calculateURLType(urlStr);
 
       if (debug) {
-        trace("UrlStr = " + urlStr);
+        String type = "unknown";
+        if (urlType.equals(PortletURLTypes.URLType.ACTION)) {
+          type = "ACTION";
+        } else if (urlType.equals(PortletURLTypes.URLType.RENDER)) {
+          type = "RENDER";
+        } else if (urlType.equals(PortletURLTypes.URLType.RESOURCE)) {
+          type = "RESOURCE";
+        }
+        trace("urlType = " + type + " UrlStr = " + urlStr);
       }
 
       /* Drop the context



More information about the Bedework-commit mailing list