[Bedework-commit] r481 - in trunk/calendar3: deployment/webuser/webapp/resources/demoskins/default/default deployment/webuser/webapp/resources/demoskins/resources webclient/war/WEB-INF webclient/war/docs

svnadmin at bedework.org svnadmin at bedework.org
Mon May 15 16:47:01 EDT 2006


Author: johnsa
Date: 2006-05-15 16:46:57 -0400 (Mon, 15 May 2006)
New Revision: 481

Modified:
   trunk/calendar3/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl
   trunk/calendar3/deployment/webuser/webapp/resources/demoskins/resources/includes.js
   trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
   trunk/calendar3/webclient/war/docs/header.jsp
Log:
personal client: add subscription to user calendar form added (currently buggy)

Modified: trunk/calendar3/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl
===================================================================
--- trunk/calendar3/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl	2006-05-15 19:43:33 UTC (rev 480)
+++ trunk/calendar3/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl	2006-05-15 20:46:57 UTC (rev 481)
@@ -75,6 +75,8 @@
   <!-- subscriptions -->
   <xsl:variable name="subscriptions-fetch" select="/bedework/urlPrefixes/subscriptions/fetch/a/@href"/>
   <xsl:variable name="subscriptions-fetchForUpdate" select="/bedework/urlPrefixes/subscriptions/fetchForUpdate/a/@href"/>
+  <xsl:variable name="subscriptions-addSubByUri" select="/bedework/urlPrefixes/subscriptions/addSubByUri/a/@href"/>
+  <xsl:variable name="subscriptions-subscribeByUri" select="/bedework/urlPrefixes/subscriptions/subscribeByUri/a/@href"/>
   <xsl:variable name="subscriptions-initAdd" select="/bedework/urlPrefixes/subscriptions/initAdd/a/@href"/>
   <xsl:variable name="subscriptions-subscribe" select="/bedework/urlPrefixes/subscriptions/subscribe/a/@href"/>
   <!-- preferences -->
@@ -159,7 +161,9 @@
                     <xsl:when test="/bedework/page='editLocation'">
                       <xsl:apply-templates select="/bedework/formElements" mode="editLocation"/>
                     </xsl:when>
-                    <xsl:when test="/bedework/page='subscriptions' or /bedework/page='modSubscription'">
+                    <xsl:when test="/bedework/page='subscriptions' or
+                                    /bedework/page='modSubscription' or
+                                    /bedework/page='addSubByUri'">
                       <xsl:apply-templates select="/bedework/subscriptions"/>
                     </xsl:when>
                     <xsl:when test="/bedework/page='calendarList' or
@@ -240,6 +244,7 @@
                   /bedework/page='editEvent' or
                   /bedework/page='selectCalForEvent' or
                   /bedework/page='upload' or
+                  /bedework/page='addSubByUri' or
                   /bedework/page='modPrefs'">
       <script type="text/javascript" src="{$resourcesRoot}/resources/includes.js"></script>
     </xsl:if>
@@ -722,11 +727,11 @@
                       all day
                     </td>
                   </xsl:when>
-                  <xsl:when test="start/shortdate = end/shortdate and 
+                  <xsl:when test="start/shortdate = end/shortdate and
                                   start/time = end/time">
                     <td class="{$dateRangeStyle} center" colspan="3">
                       <a href="{$eventView}?subid={$subscriptionId}&amp;calPath={$calPath}&amp;guid={$guid}&amp;recurrenceId={$recurrenceId}">
-                        <xsl:value-of select="start/time"/>                      
+                        <xsl:value-of select="start/time"/>
                       </a>
                     </td>
                   </xsl:when>
@@ -2877,8 +2882,11 @@
             <xsl:when test="/bedework/page='subscriptions'">
               <xsl:call-template name="subscriptionList"/>
             </xsl:when>
+            <xsl:when test="/bedework/page='addSubByUri'">
+              <xsl:call-template name="addSubByUri"/>
+            </xsl:when>
             <xsl:when test="/bedework/creating='true'">
-              <xsl:apply-templates select="subscription" mode="addSubscription"/>
+              <xsl:apply-templates select="subscription" mode="addSystemSubscription"/>
             </xsl:when>
             <xsl:otherwise>
               <xsl:apply-templates select="subscription" mode="modSubscription"/>
@@ -2913,7 +2921,83 @@
     </xsl:if>
   </xsl:template>
 
-  <xsl:template match="subscription" mode="addSubscription">
+  <!-- add a subscription to a user calendar by user and path; this is actually
+       a subscription to an arbitrary URI (which we can expose later) -->
+  <xsl:template name="addSubByUri">
+    <h3>Add Subscription to User Calendar</h3>
+    <p class="note">*the subsciption name must be unique</p>
+    <form name="subscribeForm" action="{$subscriptions-subscribe}" onsubmit="return setSubscriptionUri(this)" method="post">
+      <table class="common" cellspacing="0">
+        <tr>
+          <td class="fieldname">Name:</td>
+          <td>
+            <input type="text" value="" name="subscription.name" size="60"/>
+          </td>
+        </tr>
+        <!-- the following would be for an arbitrary URI.  We'll add this later.
+        <tr>
+          <td class="fieldname">Uri:</td>
+          <td>
+            <input type="text" value="" name="subscription.uri" size="60"/>
+          </td>
+        </tr>-->
+        <tr>
+          <td class="fieldname">User ID:</td>
+          <td>
+            <input type="hidden" value="" name="subscription.uri"/>
+            <input type="text" value="" name="userId" size="20"/>
+            <span class="note">ex: douglm</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="fieldname">User path:</td>
+          <td>
+            <input type="text" value="" name="userPath" size="20"/>
+            <span class="note">(optional) ex: someDept/meetings</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="fieldname">Display:</td>
+          <td>
+            <input type="radio" value="true" name="subscription.display" checked="checked"/> yes
+            <input type="radio" value="false" name="subscription.display"/> no
+          </td>
+        </tr>
+        <tr>
+          <td class="fieldname">Affects Free/Busy:</td>
+          <td>
+            <input type="radio" value="true" name="subscription.affectsFreeBusy"/> yes
+            <input type="radio" value="false" name="subscription.affectsFreeBusy" checked="checked"/> no
+          </td>
+        </tr>
+        <tr>
+          <td class="fieldname">Style:</td>
+          <td>
+            <input type="text" value="" name="subscription.style" size="60"/>
+          </td>
+        </tr>
+        <!--<tr>
+          <td class="fieldname">Unremovable:</td>
+          <td>
+            <input type="radio" value="true" name="unremoveable" size="60"/> true
+            <input type="radio" value="false" name="unremoveable" size="60" checked="checked"/> false
+          </td>
+        </tr>-->
+      </table>
+      <table border="0" id="submitTable">
+        <tr>
+          <td>
+            <input type="submit" name="addSubscription" value="Add Subscription"/>
+            <input type="submit" name="cancelled" value="Cancel"/>
+            <input type="reset" value="Clear"/>
+          </td>
+        </tr>
+      </table>
+    </form>
+  </xsl:template>
+
+  <!-- add a subscription to a public calendar within the system -->
+  <xsl:template match="subscription" mode="addSystemSubscription">
     <h3>Add New Subscription</h3>
     <p class="note">*the subsciption name must be unique</p>
     <form name="subscribeForm" action="{$subscriptions-subscribe}" method="post">
@@ -3130,7 +3214,7 @@
         </tr>
       </xsl:for-each>
     </table>
-    <h4><a href="{$subscriptions-initAdd}">Subscribe to a calendar</a> (by URI)</h4>
+    <h4><a href="{$subscriptions-addSubByUri}">Subscribe to another user's calendar</a></h4>
   </xsl:template>
 
   <xsl:template match="subscription" mode="mySubscriptions">
@@ -3413,7 +3497,7 @@
     <div style="margin-bottom: 1em;">&#160;</div>
     <xsl:call-template name="editLocationList"/>
   </xsl:template>
-  
+
   <xsl:template name="editLocationList">
     <table class="common" cellspacing="0">
       <tr>

Modified: trunk/calendar3/deployment/webuser/webapp/resources/demoskins/resources/includes.js
===================================================================
--- trunk/calendar3/deployment/webuser/webapp/resources/demoskins/resources/includes.js	2006-05-15 19:43:33 UTC (rev 480)
+++ trunk/calendar3/deployment/webuser/webapp/resources/demoskins/resources/includes.js	2006-05-15 20:46:57 UTC (rev 481)
@@ -99,6 +99,7 @@
   window.close();
 }
 
+// build the workdays parameter as a string when submitting user preferences form
 function setWorkDays(formObj) {
   if (formObj) {
     var workDays = "";
@@ -114,3 +115,24 @@
     alert("The preferences form is not available.");
   }
 }
+
+// build a uri based on user and path in the subscription form
+function setSubscriptionUri(formObj) {
+  if (formObj) {
+    var fullUri = "bwcal:///user/";
+    fullUri += formObj.userId.value;
+    if (formObj.userPath.value != "") {
+      if (formObj.userPath.value.substring(0,1) == "/") {
+        fullUri += formObj.userPath.value;
+      } else {
+        fullUri += "/" + formObj.userPath.value;
+      }
+    }
+    formObj["subscription.uri"].value = fullUri;
+    alert(formObj["subscription.uri"].value);
+    return true;
+  } else {
+    alert("The subscription form is not available.");
+    return false;
+  }
+}

Modified: trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
===================================================================
--- trunk/calendar3/webclient/war/WEB-INF/struts-config.xml	2006-05-15 19:43:33 UTC (rev 480)
+++ trunk/calendar3/webclient/war/WEB-INF/struts-config.xml	2006-05-15 20:46:57 UTC (rev 481)
@@ -612,6 +612,15 @@
       <forward name="success" path="/docs/subs/modSubscription.jsp"/>
     </action>
 
+    <!-- renderUrl -->
+    <action    path="/subs/showAddByUriForm"
+               type="org.bedework.webclient.BwRenderAction"
+               name="calForm"
+               scope="session"
+               validate="false">
+      <forward name="success" path="/docs/subs/addSubByUri.jsp"/>
+    </action>
+
     <action    path="/subs/initAdd"
                type="org.bedework.webcommon.subs.InitSubscribeAction"
                name="calForm"
@@ -639,9 +648,22 @@
       <forward name="cancelled" path="/subs/showSubs.rdo" redirect="true"/>
       <forward name="retry" path="/subs/showModForm.rdo" redirect="true"/>
       <forward name="reffed" path="/subs/showSubs.rdo" redirect="true"/>
+      <forward name="noAccess" path="/subs/showSubs.rdo" redirect="true"/>
       <forward name="success" path="/subs/showSubs.rdo" redirect="true" />
     </action>
 
+    <action    path="/subs/subscribeByUri"
+               type="org.bedework.webcommon.subs.SubscribeAction"
+               name="calForm"
+               scope="session"
+               validate="false">
+      <forward name="cancelled" path="/subs/showSubs.rdo" redirect="true"/>
+      <forward name="retry" path="/subs/showAddByUriForm.rdo" redirect="true"/>
+      <forward name="reffed" path="/subs/showSubs.rdo" redirect="true"/>
+      <forward name="noAccess" path="/subs/showSubs.rdo" redirect="true"/>
+      <forward name="success" path="/subs/showSubs.rdo" redirect="true" />
+    </action>
+
     <action    path="/subs/unsubscribe"
                type="org.bedework.webcommon.subs.UnsubscribeAction"
                name="calForm"

Modified: trunk/calendar3/webclient/war/docs/header.jsp
===================================================================
--- trunk/calendar3/webclient/war/docs/header.jsp	2006-05-15 19:43:33 UTC (rev 480)
+++ trunk/calendar3/webclient/war/docs/header.jsp	2006-05-15 20:46:57 UTC (rev 481)
@@ -162,6 +162,8 @@
       <subscriptions> <!-- only those listed are used here (no need to clean up) -->
         <fetch><genurl:link page="/subs/fetch.do?b=de"/></fetch>
         <fetchForUpdate><genurl:link page="/subs/fetchForUpdate.do?b=de"/></fetchForUpdate>
+        <addSubByUri><genurl:link page="/subs/showAddByUriForm.rdo?b=de"/></addSubByUri>
+        <subscribeByUri><genurl:link page="/subs/subscribeByUri.do?b=de"/></subscribeByUri>
         <initAdd><genurl:link page="/subs/initAdd.do?b=de"/></initAdd>
         <subscribe><genurl:link page="/subs/subscribe.do?b=de"/></subscribe>
       </subscriptions>



More information about the Bedework-commit mailing list