You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/02/27 02:15:45 UTC

svn commit: r155605 - in lenya/trunk/src: java/org/apache/lenya/cms/workflow/usecases/History.java webapp/WEB-INF/cocoon-xconf.xsl webapp/lenya/usecases/tab/workflow.jx

Author: gregor
Date: Sat Feb 26 17:15:44 2005
New Revision: 155605

URL: http://svn.apache.org/viewcvs?view=rev&rev=155605
Log:
Added stub usecase for workflow history tab.

Added:
    lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java   (with props)
Modified:
    lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl
    lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx

Added: lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java?view=auto&rev=155605
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java Sat Feb 26 17:15:44 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.workflow.usecases;
+
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.lenya.workflow.WorkflowInstance;
+
+/**
+ * Invoke a workflow event on the current document. The event is obtained from
+ * the <code>lenya.event</code> request parameter.
+ * 
+ * @version $Id:$
+ */
+public class History extends DocumentUsecase {
+
+    /**
+     * The name of the event request parameter.
+     */
+    public static final String EVENT = "lenya.event";
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
+     */
+    protected void doCheckPreconditions() throws Exception {
+        super.doCheckPreconditions();
+        
+        if (!getErrorMessages().isEmpty()) {
+            return;
+        }
+        
+        String eventName = getParameterAsString(EVENT);
+        WorkflowInstance instance = getWorkflowInstance(getSourceDocument());
+        if (!instance.canInvoke(getSituation(), eventName)) {
+            addErrorMessage("The event [" + eventName + "] is not executable on document ["
+                    + getSourceDocument() + "].");
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+     */
+    protected void doExecute() throws Exception {
+        super.doExecute();
+
+    }
+}
\ No newline at end of file

Propchange: lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/History.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl?view=diff&r1=155604&r2=155605
==============================================================================
--- lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl Sat Feb 26 17:15:44 2005
@@ -273,6 +273,7 @@
     <component-instance name="tab.assets" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Assets"/>
     <component-instance name="tab.meta" logger="lenya.site" class="org.apache.lenya.cms.metadata.usecases.Metadata"/>
     <component-instance name="tab.overview" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Overview"/>
+    <component-instance name="tab.workflow" logger="lenya.site" class="org.apache.lenya.cms.workflow.usecases.History"/>
   </usecases>
 
   </xsl:copy>

Modified: lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx?view=diff&r1=155604&r2=155605
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx Sat Feb 26 17:15:44 2005
@@ -29,7 +29,6 @@
             <i18n:text>Overview</i18n:text>
           </a>
         </td>
-        <jx:if test="${usecase.getParameter('languageexists').equals('true')}">
           <jx:if test="${not(usecase.getParameter('documentid').equals('/'))}">
             <td>
               <a href="?lenya.usecase=tab.meta" class="lenya-tablink">
@@ -85,11 +84,52 @@
               <i18n:text>Scheduler</i18n:text>
             </a>
           </td>
-        </jx:if>
       </tr>
     </table>
     <div id="contentblock1" class="lenya-tab">
-      <!-- TODO xinclude the generated workflow history here -->
+      <h2><i18n:text>Variables</i18n:text></h2>
+      <table class="lenya-table">
+        <tr><th><i18n:text>Name</i18n:text></th><th><i18n:text>Value</i18n:text></th></tr>
+        <jx:forEach var="item" items="${usecase.getParameter('variables')}">
+          <!--wf:variable -->
+          <tr>
+            <td>
+              <jx:out value="${item.name}"/>
+            </td>
+            <td>
+              <jx:out value="${item.value}"/>
+            </td>
+          </tr>
+        </jx:forEach>
+      </table>
+      <h2><i18n:text>History</i18n:text></h2>
+      <table class="lenya-table">
+      <tr>
+          <th><i18n:text>Date</i18n:text></th>
+          <th><i18n:text>Event</i18n:text></th>
+          <th><i18n:text>State</i18n:text></th>
+          <th><i18n:text>User</i18n:text></th>
+          <th><i18n:text>IP Address</i18n:text></th>
+        </tr>
+        <jx:forEach var="item" items="${usecase.getParameter('versions')}">
+          <tr>
+            <td><jx:out value="${item.date}"/></td>
+            <td><i18n:text><jx:out value="${item.event}"/></i18n:text></td>
+            <td><i18n:text><jx:out value="${item.state}"/></i18n:text></td>
+            <td>
+              <span style="white-space: nobreak">
+              <jx:out value="${item.userid}"/>
+              <jx:if test="${item.username} != ''">
+                (<jx:out value="${item.username}"/>)
+              </jx:if>
+              </span>
+            </td>
+            <td>
+              <jx:out value="${item.ip-address}"/>
+            </td>
+          </tr>
+        </jx:forEach>
+      </table>
     </div>
   </div>
 </page:page>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org