Author: ndkhoiits
Date: 2010-04-01 05:30:08 -0400 (Thu, 01 Apr 2010)
New Revision: 2440
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PasswordStringLengthValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java
Log:
GTNPORTAL-173 Change to get resource bundle in template file instead of hardcoding in java
code
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl 2010-04-01
09:30:08 UTC (rev 2440)
@@ -60,7 +60,7 @@
Object[] msgArguments = mess.getMessageAruments();
if(msgArguments != null && msgArguments.length > 0) {
for(i in 0..msgArguments.length-1){
- msgValue = msgValue.replaceAll("\\{" + i + "\\}", msgArguments
[i]);
+ msgValue = msgValue.replaceAll("\\{" + i + "\\}",
_ctx.appRes(msgArguments [i]));
}
}
println msgValue;
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -61,7 +61,7 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -48,15 +48,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
if (uiInput.getValue() == null || ((String)uiInput.getValue()).trim().length() ==
0)
return;
String s = (String)uiInput.getValue();
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -79,17 +79,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- {
- label = label.substring(0, label.length() - 1);
- }
Object[] args = {label,};
throw new MessageException(new ApplicationMessage(key_, args,
ApplicationMessage.WARNING));
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -48,15 +48,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
if (Character.isDigit(s.charAt(0)) || s.charAt(0) == '-')
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -54,15 +54,13 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
Object[] args = {label, uiInput.getBindingField()};
throw new MessageException(new
ApplicationMessage("EmptyFieldValidator.msg.empty-input", args,
ApplicationMessage.WARNING));
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -48,15 +48,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
for (int i = 0; i < s.length(); i++)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -46,15 +46,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
Object[] args = {label, uiInput.getBindingField()};
throw new MessageException(new
ApplicationMessage("EmptyFieldValidator.msg.empty-input", args));
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -46,15 +46,13 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
for (int i = 0; i < s.length(); i++)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PasswordStringLengthValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PasswordStringLengthValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PasswordStringLengthValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -80,15 +80,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label;
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
Object[] args = {label, min_.toString(), max_.toString()};
throw new MessageException(new
ApplicationMessage("StringLengthValidator.msg.length-invalid", args,
ApplicationMessage.WARNING));
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -47,15 +47,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
boolean error = false;
for (int i = 0; i < s.length(); i++)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -48,15 +48,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
if (Character.isDigit(s.charAt(0)) || s.charAt(0) == '-' || s.charAt(0) ==
'.' || s.charAt(0) == '_')
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -46,15 +46,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
String s = (String)uiInput.getValue();
for (int i = 0; i < s.length(); i++)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -75,15 +75,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- label = label.trim();
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
Object[] args = {label, min_.toString(), max_.toString()};
throw new MessageException(new
ApplicationMessage("StringLengthValidator.msg.length-invalid", args,
ApplicationMessage.WARNING));
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java 2010-04-01
09:16:42 UTC (rev 2439)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java 2010-04-01
09:30:08 UTC (rev 2440)
@@ -75,14 +75,12 @@
String label;
try
{
- label = uiForm.getLabel(uiInput.getName());
+ label = uiForm.getId() + ".label." + uiInput.getName();
}
catch (Exception e)
{
label = uiInput.getName();
}
- if (label.charAt(label.length() - 1) == ':')
- label = label.substring(0, label.length() - 1);
Object[] args = {label};
throw new MessageException(new ApplicationMessage(key_, args,
ApplicationMessage.WARNING));
}