You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/02/15 13:03:39 UTC

svn commit: r507908 - in /lenya/trunk/src/modules-core/usecase: templates/error.jx usecases.js

Author: andreas
Date: Thu Feb 15 04:03:38 2007
New Revision: 507908

URL: http://svn.apache.org/viewvc?view=rev&rev=507908
Log:
Fix usecase handling in usecase.js when no view is used

Added:
    lenya/trunk/src/modules-core/usecase/templates/error.jx
Modified:
    lenya/trunk/src/modules-core/usecase/usecases.js

Added: lenya/trunk/src/modules-core/usecase/templates/error.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/templates/error.jx?view=auto&rev=507908
==============================================================================
--- lenya/trunk/src/modules-core/usecase/templates/error.jx (added)
+++ lenya/trunk/src/modules-core/usecase/templates/error.jx Thu Feb 15 04:03:38 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: login.jx 496697 2007-01-16 14:12:36Z andreas $ -->
+
+<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" 
+           xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" 
+           xmlns="http://www.w3.org/1999/xhtml" 
+           xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+
+  <jx:set var="pubId" value="${usecase.getParameterAsString('publicationId')}"/>
+
+  <page:title>
+    <jx:choose>
+      <jx:when test="${usecase.getParameter('currentUser') != null}">
+        <i18n:text>Access Denied</i18n:text>
+      </jx:when>
+      <jx:otherwise>
+        <i18n:translate>
+          <i18n:text i18n:key="login-to-pub"/>
+          <i18n:param><jx:out value="${pubId.toUpperCase()}"/></i18n:param>
+        </i18n:translate>
+      </jx:otherwise>
+    </jx:choose>
+  </page:title>
+  <page:body>
+    
+    <div class="lenya-box">
+      <div class="lenya-box-title">
+        <i18n:text>Error</i18n:text>
+      </div>
+      
+      <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
+
+    </div>
+  </page:body>
+</page:page>

Modified: lenya/trunk/src/modules-core/usecase/usecases.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/usecases.js?view=diff&rev=507908&r1=507907&r2=507908
==============================================================================
--- lenya/trunk/src/modules-core/usecase/usecases.js (original)
+++ lenya/trunk/src/modules-core/usecase/usecases.js Thu Feb 15 04:03:38 2007
@@ -1,4 +1,4 @@
-3/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  *  contributor license agreements.  See the NOTICE file distributed with
  *  this work for additional information regarding copyright ownership.
@@ -360,8 +360,17 @@
         usecase = getUsecase(usecaseName);
         proxy.setup(usecase);
         passRequestParameters(usecase);
-        state = executeFlow(usecase);
+        usecase.checkExecutionConditions();
+        var hasErrors = usecase.hasErrors()
+        if (!hasErrors) {
+            state = executeFlow(usecase);
+            hasErrors = usecase.hasErrors();
+        }
         releaseUsecase(usecase);
+        if (hasErrors) {
+            proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
+            cocoon.sendPage("usecases-view/nomenu/modules/usecase/templates/error.jx", { "usecase" : proxy});
+        }
     }
     //getTargetURL takes a boolean that is true on success:
     targetUrl = usecase.getTargetURL(state == "success");



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