aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-07-04 16:09:36 +0200
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-07-04 16:09:36 +0200
commitb2c1ca665aaaa3246671ef2ec933e29b8ff87b25 (patch)
tree5e91b6fbaa3378514acf2b9ff4686103993bdf62
parent27c5460e2138fbb7de64214a7538b98effb5a7a6 (diff)
downloadmoa-id-spss-b2c1ca665aaaa3246671ef2ec933e29b8ff87b25.tar.gz
moa-id-spss-b2c1ca665aaaa3246671ef2ec933e29b8ff87b25.tar.bz2
moa-id-spss-b2c1ca665aaaa3246671ef2ec933e29b8ff87b25.zip
made country code readonly
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java15
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java34
-rw-r--r--id/ConfigWebTool/src/main/webapp/js/common.js4
-rw-r--r--id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp2
4 files changed, 35 insertions, 20 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
index ec261335d..ef0672e99 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
@@ -512,9 +512,20 @@ public class EditGeneralConfigAction extends BasicAction {
else
stork.setAttributes((List<StorkAttribute>) (new ArrayList<StorkAttribute>()));
- if (storkconfig.getCpepslist() != null)
+ if (storkconfig.getCpepslist() != null) {
+
+ // make CountryCode "readonly"
+ for(CPEPS newone : storkconfig.getCpepslist()) {
+ for(CPEPS current : stork.getCPEPS()) {
+ if(current.getHjid().equals(newone.getHjid())) {
+ newone.setCountryCode(current.getCountryCode());
+ break;
+ }
+ }
+ }
+
stork.setCPEPS(storkconfig.getCpepslist());
-
+ }
else
stork.setCPEPS((List<CPEPS>) (new ArrayList<CPEPS>()));
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
index 4a5676fd6..5ec3af519 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
@@ -32,27 +32,29 @@ public class StorkConfigValidator {
if(null == current)
continue;
- // check country code
- String check = current.getCountryCode();
- if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsPotentialCSSCharacter(check, false)) {
- log.warn("CPEPS config countrycode contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc",
- new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request ));
- }
- if(!check.toLowerCase().matches("^[a-z][a-z]$")) {
- log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check);
+ if(null == current.getHjid()) {
+ // check country code
+ String check = current.getCountryCode();
+ if (MiscUtil.isNotEmpty(check)) {
+ if (ValidationHelper.containsPotentialCSSCharacter(check, false)) {
+ log.warn("CPEPS config countrycode contains potentail XSS characters: " + check);
errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc",
- new Object[] {check}, request ));
+ new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request ));
+ }
+ if(!check.toLowerCase().matches("^[a-z][a-z]$")) {
+ log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check);
+ errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc",
+ new Object[] {check}, request ));
+ }
+ } else {
+ log.warn("CPEPS config countrycode is empty : " + check);
+ errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty",
+ new Object[] {check}, request ));
}
- } else {
- log.warn("CPEPS config countrycode is empty : " + check);
- errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty",
- new Object[] {check}, request ));
}
// check url
- check = current.getURL();
+ String check = current.getURL();
if (MiscUtil.isNotEmpty(check)) {
if (!ValidationHelper.validateURL(check)) {
log.info("CPEPS config URL is invalid : " + check);
diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js
index a86b9fede..f7ef2c415 100644
--- a/id/ConfigWebTool/src/main/webapp/js/common.js
+++ b/id/ConfigWebTool/src/main/webapp/js/common.js
@@ -230,7 +230,9 @@ function newPeps() {
var lastindex = 1;
}
var nextindex = lastindex + 1;
- clone.innerHTML = clone.innerHTML.replace(/<input.*type="hidden".*>/, '');
+
+ clone.innerHTML = clone.innerHTML.replace(/[A-Z]{2}</, '<');
+ clone.innerHTML = clone.innerHTML.replace(/<input.*type="hidden".*>/, '<div id="wwgrp_loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="wwgrp"> <div id="wwctrl_loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="wwctrl"> <input id="loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="textfield_short" type="text" value="IT" name="storkconfig.cpepslist[0].countryCode"> </div> </div>');
clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex);
clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2');
target.parentNode.appendChild(clone);
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
index 9b94bcef5..21ba246c1 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
@@ -252,7 +252,7 @@
<tr><th>Country Shortcode</th><th>PEPS URL</th>
<s:iterator value="storkconfig.cpepslist" status="stat">
<tr><td><s:hidden name="storkconfig.cpepslist[%{#stat.index}].hjid" property="%{hjid}"/>
- <s:textfield name="storkconfig.cpepslist[%{#stat.index}].countryCode" value="%{countryCode}" cssClass="textfield_short"/></td>
+ <s:property value="%{countryCode}" /></td>
<td><s:textfield name="storkconfig.cpepslist[%{#stat.index}].URL" value="%{URL}" cssClass="textfield_long"/></td>
<td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
</s:iterator>