Author: cvrabie
Date: 2008-01-16 21:25:32 +0100 (Wed, 16 Jan 2008)
New Revision: 6872

Modified:
   
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
Log:
CURRIKI 1193 - Changed the title length limit, added check for special chars in 
title

Modified: 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
===================================================================
--- 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
       2008-01-16 20:21:38 UTC (rev 6871)
+++ 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
       2008-01-16 20:25:32 UTC (rev 6872)
@@ -25,6 +25,7 @@
     
     public static final String VALIDATION_TITLE_SHORT = "title-short";
     public static final String VALIDATION_TITLE_LONG = "title-long";
+    public static final String VALIDATION_TITLE_INVALID = "title-invalid";
     public static final String VALIDATION_DESC_SHORT = "desc-short";
     public static final String VALIDATION_DESC_LONG = "desc-long";
     public static final String VALIDATION_SPACE_EXISTS = "space-exists";
@@ -66,9 +67,16 @@
             String title = this.getDisplayTitle();
             if(title.length() < 1)     
                errors.put( this.VALIDATION_TITLE_SHORT, "1" );
-            if(title.length() > 32)
-               errors.put( this.VALIDATION_TITLE_LONG, "1" );
-            
+           
+            if(title.length() > 64)
+               errors.put( this.VALIDATION_TITLE_LONG, "1" );
+                               
+                       //valid characters in title
+            Pattern pt = Pattern.compile("([ a-zA-Z0-9\\-\\_\\+\\,[EMAIL 
PROTECTED]&\\*\\(\\)]*)");
+                       Matcher mt = pt.matcher(title);
+            if( !mt.matches() )
+               errors.put( this.VALIDATION_TITLE_INVALID, "1" );
+
             //existance of a group with this name
             // this won't work because we manage space name uniqueness
             // if(!this.isNew())

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to