You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/04/29 14:20:24 UTC
svn commit: r165299 - in /lenya/trunk/src:
java/org/apache/lenya/cms/ac/usecases/
java/org/apache/lenya/cms/cocoon/transformation/
java/org/apache/lenya/cms/site/usecases/ java/org/apache/lenya/cms/usecase/
java/org/apache/lenya/cms/workflow/usecases/
webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/
webapp/lenya/resources/i18n/ webapp/lenya/usecases/
webapp/lenya/usecases/edit/forms/ webapp/lenya/usecases/site/
webapp/lenya/usecases/tab/ webapp/lenya/usecases/templates/
Author: jwkaltz
Date: Fri Apr 29 05:20:23 2005
New Revision: 165299
URL: http://svn.apache.org/viewcvs?rev=165299&view=rev
Log:
added possibility for parameters in usecase messages, to be used in i18n
Added:
lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseMessage.java
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AddUser.java
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java (contents, props changed)
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java (contents, props changed)
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/DeleteLanguage.java
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java (contents, props changed)
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java (contents, props changed)
lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
lenya/trunk/src/java/org/apache/lenya/cms/usecase/Usecase.java
lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseProxy.java
lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java (contents, props changed)
lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java (contents, props changed)
lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java
lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml
lenya/trunk/src/webapp/lenya/usecases/edit-document.js
lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx (contents, props changed)
lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx (contents, props changed)
lenya/trunk/src/webapp/lenya/usecases/site/restore.jx
lenya/trunk/src/webapp/lenya/usecases/tab/meta.jx
lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx (contents, props changed)
lenya/trunk/src/webapp/lenya/usecases/usecases.js
Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AddUser.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AddUser.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AddUser.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AddUser.java Fri Apr 29 05:20:23 2005
@@ -76,7 +76,7 @@
try {
if (!ldapUser.existsUser(ldapId)) {
- addErrorMessage("This LDAP user ID does not exist.");
+ addErrorMessage("ldap_no_such_user", new String[]{ldapId});
}
} catch (AccessControlException e) {
throw new UsecaseException(e);
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -119,7 +119,7 @@
passRequestParameters(usecase, attr.getValue(HREF_ATTRIBUTE));
}
usecase.checkPreconditions();
- if (!usecase.getErrorMessages().isEmpty()) {
+ if (usecase.hasErrors()) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Usecase preconditions not complied");
}
@@ -256,4 +256,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeLabel.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -40,7 +40,7 @@
*/
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -135,4 +135,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -39,7 +39,7 @@
/**
* Change the node ID of a document.
*
- * @version $Id: ChangeLabel.java 152682 2005-02-08 18:13:39Z gregor $
+ * @version $Id$
*/
public class ChangeNodeID extends DocumentUsecase {
@@ -103,7 +103,7 @@
*/
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -232,4 +232,4 @@
return newDocumentId;
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -43,7 +43,7 @@
*/
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -131,4 +131,4 @@
setTargetDocument(target);
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Delete.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/DeleteLanguage.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/DeleteLanguage.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/DeleteLanguage.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/DeleteLanguage.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -34,7 +34,7 @@
*/
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -65,4 +65,4 @@
setTargetDocument(DocumentHelper.getExistingLanguageVersion(document));
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -41,7 +41,7 @@
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -127,4 +127,4 @@
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Nudge.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -38,7 +38,7 @@
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -101,4 +101,4 @@
}
}
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Paste.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -78,6 +78,34 @@
}
/**
+ * Determine if the usecase has error messages.
+ * Provides a way of checking for errors without actually retrieving them.
+ * @return true if the usecase resulted in error messages.
+ */
+ public boolean hasErrors() {
+ boolean ret = false;
+ if (this.errorMessages != null)
+ ret = ! this.errorMessages.isEmpty();
+
+ if (getLogger().isDebugEnabled())
+ getLogger().debug("AbstractUsecase::hasErrors() called, returning " + ret);
+
+ return ret;
+ }
+
+ /**
+ * Determine if the usecase has info messages.
+ * Provides a way of checking for info messages without actually retrieving them.
+ * @return true if the usecase resulted in info messages being generated.
+ */
+ public boolean hasInfoMessages() {
+ boolean ret = false;
+ if (this.infoMessages != null)
+ ret = ! this.infoMessages.isEmpty();
+ return ret;
+ }
+
+ /**
* Checks if the operation can be executed and returns the error messages. Error messages
* prevent the operation from being executed.
* @return A boolean value.
@@ -102,7 +130,16 @@
* @param message The message.
*/
public void addErrorMessage(String message) {
- this.errorMessages.add(message);
+ addErrorMessage(message, null);
+ }
+
+ /**
+ * Adds an error message.
+ * @param message The message.
+ * @param _params parameters
+ */
+ public void addErrorMessage(String message, String[] _params) {
+ this.errorMessages.add(new UsecaseMessage(message, _params));
}
/**
@@ -118,9 +155,18 @@
/**
* Adds an info message.
* @param message The message.
+ * @param _params parameters
+ */
+ public void addInfoMessage(String message, String[] _params) {
+ this.infoMessages.add(new UsecaseMessage(message, _params));
+ }
+
+ /**
+ * Adds an info message.
+ * @param message The message.
*/
public void addInfoMessage(String message) {
- this.infoMessages.add(message);
+ addInfoMessage(message, null);
}
/**
@@ -160,7 +206,7 @@
List _errorMessages = getErrorMessages();
for (int i = 0; i < _errorMessages.size(); i++) {
- getLogger().info((String) _errorMessages.get(i));
+ getLogger().info(_errorMessages.get(i).toString());
}
} catch (Exception e) {
getLogger().error(e.getMessage(), e);
@@ -236,7 +282,7 @@
protected void dumpErrorMessages() {
List _errorMessages = getErrorMessages();
for (int i = 0; i < _errorMessages.size(); i++) {
- getLogger().error((String) _errorMessages.get(i));
+ getLogger().error(_errorMessages.get(i).toString());
}
}
@@ -596,4 +642,4 @@
throw new UsecaseException(e);
}
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/Usecase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/Usecase.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/Usecase.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/Usecase.java Fri Apr 29 05:20:23 2005
@@ -128,6 +128,20 @@
List getInfoMessages();
/**
+ * Determine if the usecase has error messages.
+ * Provides a way of checking for errors without actually retrieving them.
+ * @return true if the usecase resulted in error messages.
+ */
+ public boolean hasErrors();
+
+ /**
+ * Determine if the usecase has info messages.
+ * Provides a way of checking for info messages without actually retrieving them.
+ * @return true if the usecase resulted in info messages being generated.
+ */
+ public boolean hasInfoMessages();
+
+ /**
* Executes the usecase. During this method error and info messages are
* filled in. If getErrorMessages() returns an empty array, the operation
* succeeded. Otherwise, the operation failed.
@@ -175,4 +189,4 @@
*/
void setView(UsecaseView view);
-}
\ No newline at end of file
+}
Added: lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseMessage.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseMessage.java?rev=165299&view=auto
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseMessage.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseMessage.java Fri Apr 29 05:20:23 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 1999-2005 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.usecase;
+
+
+/**
+ * A message in a usecase. This an encapsulation for an internationalizable
+ * message, containing a message content and potentially some parameters.
+ * The parameters correspond to the placeholders in dictionary entries.
+ *
+ * @version $Id$
+ */
+public class UsecaseMessage {
+
+ private String message;
+ private String[] params;
+
+ /**
+ * Ctor.
+ */
+ public UsecaseMessage(String _message, String[] _params) {
+ this.message = _message;
+ this.params = _params;
+ }
+
+ /**
+ * Determine if this message has parameters
+ * @return true if the message has parameters
+ */
+ public boolean hasParameters() {
+ return params != null && params.length > 0;
+ }
+
+ /**
+ * Retrieve the message content
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Retrieve the parameters for this message
+ * @return the parameters
+ */
+ public String[] getParameters() {
+ return params;
+ }
+
+ /**
+ * Accomodates scripts which do no care about parameters
+ * @return a string representation disregarding any parameters
+ */
+ public String toString() {
+ return message;
+ }
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseProxy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseProxy.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseProxy.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseProxy.java Fri Apr 29 05:20:23 2005
@@ -130,6 +130,30 @@
}
/**
+ * Determine if the usecase has error messages.
+ * Provides a way of checking for errors without actually retrieving them.
+ * @return true if the usecase resulted in error messages.
+ */
+ public boolean hasErrors() {
+ boolean ret = false;
+ if (this.errorMessages != null)
+ ret = ! this.errorMessages.isEmpty();
+ return ret;
+ }
+
+ /**
+ * Determine if the usecase has info messages.
+ * Provides a way of checking for info messages without actually retrieving them.
+ * @return true if the usecase resulted in info messages being generated.
+ */
+ public boolean hasInfoMessages() {
+ boolean ret = false;
+ if (this.infoMessages != null)
+ ret = ! this.infoMessages.isEmpty();
+ return ret;
+ }
+
+ /**
* @return The name of this usecase.
*/
public String getName() {
@@ -143,4 +167,4 @@
return this.view;
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -57,7 +57,7 @@
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (!getErrorMessages().isEmpty()) {
+ if (hasErrors()) {
return;
}
@@ -109,4 +109,4 @@
this.event = config.getChild(ELEMENT_EVENT).getAttribute(ATTRIBUTE_ID);
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/workflow/usecases/InvokeWorkflow.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -53,7 +53,7 @@
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (getErrorMessages().isEmpty()) {
+ if (! hasErrors()) {
if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
addErrorMessage("This usecase can only be invoked from the authoring area.");
@@ -275,4 +275,4 @@
}
-}
\ No newline at end of file
+}
Propchange: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Deactivate.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -100,7 +100,7 @@
*/
protected void doCheckPreconditions() throws Exception {
super.doCheckPreconditions();
- if (getErrorMessages().isEmpty()) {
+ if (! hasErrors()) {
String event = getEvent();
Document document = getSourceDocument();
@@ -355,4 +355,4 @@
}
-}
\ No newline at end of file
+}
Modified: lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml (original)
+++ lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml Fri Apr 29 05:20:23 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 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.
@@ -188,6 +188,8 @@
<message key="Group Affiliation">Group Affiliation</message>
<message key="Change Password">Change Password</message>
<message key="Edit Group Affiliation">Edit Group Affiliation</message>
+ <!-- Errors in user administration -->
+ <message key="ldap_no_such_user">The user {0} does not exist in the LDAP directory.</message>
<!-- User Types -->
<message key="LDAP User">LDAP User</message>
@@ -326,4 +328,5 @@
<message key="lenya.rc.nocheckin">Resource could not be checked in</message>
<message key="Generic Exception">Generic Exception</message>
<message key="Check the log files.">Check the log files.</message>
+
</catalogue>
Modified: lenya/trunk/src/webapp/lenya/usecases/edit-document.js
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/edit-document.js?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/edit-document.js (original)
+++ lenya/trunk/src/webapp/lenya/usecases/edit-document.js Fri Apr 29 05:20:23 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Copyright 1999-2005 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.
@@ -56,9 +56,10 @@
usecase.lockInvolvedObjects();
usecase.execute();
- if (usecase.getErrorMessages().isEmpty()) {
- // TODO: handle error messages
- }
+
+ // FIXME: handle error messages
+ //if (usecase.hasErrors()) {
+ //}
if(_getParameter("noStatus", "false") == "false")
cocoon.sendStatus(_getParameter("status", 204));
Modified: lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx Fri Apr 29 05:20:23 2005
@@ -1,3 +1,20 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2005 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.
+-->
+<!-- $Id$ -->
<page:page
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
@@ -15,7 +32,7 @@
<input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
<input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
<jx:choose>
- <jx:when test="${usecase.getErrorMessages().isEmpty()}">
+ <jx:when test="${! usecase.hasErrors()}">
<div class="lenya-box">
<div class="lenya-box-title">Information</div>
Propchange: lenya/trunk/src/webapp/lenya/usecases/edit/forms/forms.jx
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx Fri Apr 29 05:20:23 2005
@@ -1,3 +1,20 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2005 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.
+-->
+<!-- $Id$ -->
<page:page
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
@@ -15,7 +32,7 @@
<input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
<input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
<jx:choose>
- <jx:when test="${usecase.getErrorMessages().isEmpty()}">
+ <jx:when test="${! usecase.hasErrors()}">
<div class="lenya-box">
<div class="lenya-box-title">Information</div>
Propchange: lenya/trunk/src/webapp/lenya/usecases/edit/forms/oneform.jx
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/webapp/lenya/usecases/site/restore.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/site/restore.jx?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/site/restore.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/site/restore.jx Fri Apr 29 05:20:23 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 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.
@@ -37,7 +37,7 @@
</div>
<div class="lenya-box-body">
<jx:choose>
- <jx:when test="${not(empty(usecase.getErrorMessages()))}">
+ <jx:when test="${usecase.hasErrors()}">
<jx:import uri="templates/messages.jx"/>
<input type="button" class="lenya-form-element" onClick="location.href='${requesturi}';" value="Back"/>
</jx:when>
Modified: lenya/trunk/src/webapp/lenya/usecases/tab/meta.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/tab/meta.jx?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/tab/meta.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/tab/meta.jx Fri Apr 29 05:20:23 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 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.
@@ -83,7 +83,7 @@
<td>
<br/>
<jx:choose>
- <jx:when test="${usecase.getParameter('document').getArea().equals('authoring') && usecase.getErrorMessages().isEmpty()}">
+ <jx:when test="${usecase.getParameter('document').getArea().equals('authoring') && ! usecase.hasErrors()}">
<input i18n:attr="value" name="submit" type="submit" value="Save"/>
</jx:when>
<jx:otherwise>
Modified: lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx Fri Apr 29 05:20:23 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 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.
@@ -15,30 +15,44 @@
limitations under the License.
-->
-<!-- $Id: archive.jx 123421 2004-12-27 16:02:27Z gregor $ -->
+<!-- $Id$ -->
<jx:template name="messages"
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
- <jx:if test="${!usecase.getErrorMessages().isEmpty() || !usecase.getInfoMessages().isEmpty()}">
+ <!--
+ Note: in current implementation, ${usecase} refers to an
+ instance of UsecaseProxy, not of Usecase !
+ -->
+ <jx:if test="${usecase.hasErrors() || usecase.hasInfoMessages()}">
<div class="lenya-error">
<ul>
<jx:forEach var="message" items="${usecase.getErrorMessages()}">
<li>
- <i18n:text>
- <jx:out value="${message}"/>
- </i18n:text>
+ <i18n:translate>
+ <i18n:text><jx:out value="${message.getMessage()}"/></i18n:text>
+ <jx:if test="${message.hasParameters()}">
+ <jx:forEach var="param" items="${message.getParameters()}">
+ <i18n:param><jx:out value="${param}"/></i18n:param>
+ </jx:forEach>
+ </jx:if>
+ </i18n:translate>
</li>
</jx:forEach>
<jx:forEach var="message" items="${usecase.getInfoMessages()}">
<li>
- <i18n:text>
- <jx:out value="${message}"/>
- </i18n:text>
+ <i18n:translate>
+ <i18n:text><jx:out value="${message.getMessage()}"/></i18n:text>
+ <jx:if test="${message.hasParameters()}">
+ <jx:forEach var="param" items="${message.getParameters()}">
+ <i18n:param><jx:out value="${param}"/></i18n:param>
+ </jx:forEach>
+ </jx:if>
+ </i18n:translate>
</li>
</jx:forEach>
Propchange: lenya/trunk/src/webapp/lenya/usecases/templates/messages.jx
------------------------------------------------------------------------------
svn:keywords = Id
Modified: lenya/trunk/src/webapp/lenya/usecases/usecases.js
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/usecases.js?rev=165299&r1=165298&r2=165299&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/usecases.js (original)
+++ lenya/trunk/src/webapp/lenya/usecases/usecases.js Fri Apr 29 05:20:23 2005
@@ -155,11 +155,11 @@
if (cocoon.request.getParameter("submit")) {
usecase.checkExecutionConditions();
- if (usecase.getErrorMessages().isEmpty()) {
+ if (! usecase.hasErrors()) {
usecase.execute();
- if (usecase.getErrorMessages().isEmpty()) {
+ if (! usecase.hasErrors()) {
usecase.checkPostconditions();
- if (usecase.getErrorMessages().isEmpty()) {
+ if (! usecase.hasErrors()) {
ready = true;
success = true;
}
@@ -192,9 +192,9 @@
proxy.setup(usecase);
usecase.execute();
- if (usecase.getErrorMessages().isEmpty()) {
+ if (! usecase.hasErrors()) {
usecase.checkPostconditions();
- if (usecase.getErrorMessages().isEmpty()) {
+ if (! usecase.hasErrors()) {
success = true;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org