Fehler #2400 FormprocessException, modul ccm-core/../web
git-svn-id: https://svn.libreccm.org/ccm/trunk@3220 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e19bf2b8eb
commit
0f1b1cb8b7
|
|
@ -0,0 +1,2 @@
|
|||
web.ui.url_cannot_contain_/=The url cannot contain '/'
|
||||
web.ui.app_already_exists=An application already exists with that name
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
web.ui.url_cannot_contain_/=Die URL darf kein "/" enthalten
|
||||
web.ui.app_already_exists=Es besteht bereits eine Anwendung mit diesem Namen.
|
||||
|
|
@ -43,13 +43,12 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.util.WebGlobalizationUtil;
|
||||
|
||||
/**
|
||||
* An implementation of ResourceConfigFormSection to be
|
||||
* used for creating / editing Application instances.
|
||||
* For simple apps, can be used as is. If an app has any
|
||||
* custom properties, this can be subclassed to add
|
||||
* futher form fields.
|
||||
* An implementation of ResourceConfigFormSection to be used for creating /
|
||||
* editing Application instances. For simple apps, can be used as is. If an app
|
||||
* has any custom properties, this can be subclassed to add futher form fields.
|
||||
*/
|
||||
public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
||||
|
||||
|
|
@ -90,8 +89,8 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
PageState state = e.getPageState();
|
||||
|
||||
if (m_currentResource != null) {
|
||||
Application application =
|
||||
(Application) m_currentResource.get(state);
|
||||
Application application
|
||||
= (Application) m_currentResource.get(state);
|
||||
initWidgets(state, application);
|
||||
} else {
|
||||
initWidgets(state, null);
|
||||
|
|
@ -106,8 +105,8 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
PageState state = e.getPageState();
|
||||
|
||||
if (m_currentResource != null) {
|
||||
Application application =
|
||||
(Application) m_currentResource.get(state);
|
||||
Application application
|
||||
= (Application) m_currentResource.get(state);
|
||||
validateWidgets(state, application);
|
||||
} else {
|
||||
validateWidgets(state, null);
|
||||
|
|
@ -120,9 +119,8 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds basic form widgets for URL, title
|
||||
* and description properties. Override this
|
||||
* method to add further widget.
|
||||
* Adds basic form widgets for URL, title and description properties.
|
||||
* Override this method to add further widget.
|
||||
*/
|
||||
protected void addWidgets() {
|
||||
m_url = new TextField(new StringParameter("url"));
|
||||
|
|
@ -150,6 +148,7 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
|
||||
/**
|
||||
* Initialize the form fields
|
||||
*
|
||||
* @param state
|
||||
* @param application the application being edited, if any
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
|
|
@ -174,6 +173,7 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
|
||||
/**
|
||||
* Validates the form fields
|
||||
*
|
||||
* @param application the application being edited
|
||||
*/
|
||||
protected void validateWidgets(PageState state,
|
||||
|
|
@ -184,7 +184,8 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
|
||||
// Change this part
|
||||
if (url.indexOf("/") != -1) {
|
||||
throw new FormProcessException("The url cannot contain '/'");
|
||||
throw new FormProcessException(WebGlobalizationUtil.globalize(
|
||||
"web.ui.url_cannot_contain_/"));
|
||||
}
|
||||
// amended cg - prevent null pointer exception when
|
||||
// saving edit of child application
|
||||
|
|
@ -204,8 +205,8 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
}
|
||||
if (Application.isInstalled(Application.BASE_DATA_OBJECT_TYPE,
|
||||
url)) {
|
||||
throw new FormProcessException(
|
||||
"An application already exists with that name");
|
||||
throw new FormProcessException(WebGlobalizationUtil.globalize(
|
||||
"web.ui.app_already_exists"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -240,6 +241,7 @@ public class ApplicationConfigFormSection extends ResourceConfigFormSection {
|
|||
|
||||
/**
|
||||
* Processes the form submission
|
||||
*
|
||||
* @param application the application being edited, or newly created
|
||||
*/
|
||||
protected void processWidgets(PageState state,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.web.util;
|
||||
|
||||
import com.arsdigita.globalization.Globalized;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* .
|
||||
* Contains methods to simplify globalizing keys
|
||||
* </p>
|
||||
*
|
||||
* @author Konermann
|
||||
*/
|
||||
public class WebGlobalizationUtil implements Globalized {
|
||||
|
||||
private static final String BUNDLE_NAME = "com.arsdigita.web.WebResources";
|
||||
|
||||
public static GlobalizedMessage globalize(final String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
public static GlobalizedMessage globalize(final String key, final Object[] args) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue