Inserted regular expression to validate new folder names

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@85201 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-11-07 17:27:56 +00:00
parent ba93191e95
commit 5c37e2b25e
4 changed files with 10 additions and 5 deletions

View File

@ -73,7 +73,7 @@ public class ConstantsExplorer {
public static final String NUMREQUESTS = "numrequests";
public static final String MESSAGE_WEBDAV_URL = "View Url WebDAV ";
public static final String URL_WEBDAV = "WebDAV URL";
public static final String MESSAGE_NAME_FORCE_APHANUMERIC = "Field name must be alphanumeric and not contain special chars!";
public static final String REGEX_FOLDER_NAME = "Field name must not begin with one of the following characters";
public static final String MESSAGE_SEARCH_FORCE_APHANUMERIC = "Field search must be alphanumeric and not contain special chars!";
public static final String MESSAGE_CREATE_NEW_MESSAGE = "Create New Message";
public static final String FORWARDTO = "Forward to";

View File

@ -218,6 +218,8 @@ public class DialogShareFolder extends Dialog {
txtName.setAllowBlank(false);
txtName.setAutoValidate(true);
txtName.setFieldLabel("Folder Name");
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$");
txtName.setRegex("^[^.<>\\|?/*%$]*$");
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea);

View File

@ -59,10 +59,12 @@ public class DialogAddFolderAndSmart extends Dialog {
txtName.setAllowBlank(false);
// txtName.setRegex("^[a-zA-Z0-9]+[ ]*[a-zA-Z0-9_-]+$");
// txtName.setRegex("^[a-zA-Z0-9_]+[-]*[a-zA-Z0-9_\\s]*$");
// txtName.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
txtName.setAutoValidate(true);
txtName.getMessages().setRegexText(ConstantsExplorer.MESSAGE_NAME_FORCE_APHANUMERIC);
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$");
txtName.setRegex("^[^.<>\\|?/*%$]*$");
// txt.setMinLength(2);
txtName.setFieldLabel(ConstantsExplorer.DIALOG_NAME);

View File

@ -42,8 +42,9 @@ public class DialogText extends Dialog {
txt.setFieldLabel(msgTitle);
txt.setValue(msgTxt);
// txt.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_()-]*");
txt.setRegex("^[a-zA-Z0-9]+[^<>\\|?/*%$]*$");
txt.getMessages().setRegexText(ConstantsExplorer.MESSAGE_NAME_FORCE_APHANUMERIC);
// txt.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
txt.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$");
txt.setRegex("^[^.<>\\|?/*%$]*$");
txt.setAutoValidate(true);
txt.setAllowBlank(false);