From 8fd559b730968748117642c1a8993a0e70bd6758 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 25 Feb 2021 16:57:34 +0100 Subject: [PATCH] #19568 Unify and extend the tags allowed values #20828 Revisited title size and format --- CHANGELOG.md | 2 ++ .../client/ui/form/CreateDatasetForm.java | 12 +++++++++--- .../client/ui/tags/TagsPanel.java | 2 +- .../client/ui/utils/InfoIconsLabels.java | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faf9dbc..de2e2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm [#19764] Porting ckan-metadata-publisher-widget to catalogue-util-library [#20680] Ported to SHUB +[#19568] Unify and extend the tags allowed values +[#20828] Revisited title size and format ## [v1.6.2] - 2021-02-08 diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java index f0b625a..0112ebf 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java @@ -167,7 +167,7 @@ public class CreateDatasetForm extends Composite{ // Create a remote service proxy to talk to the server-side ckan service. private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class); - private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]"; + //private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]"; private static final String REGEX_MAIL = "\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b"; private static final String NONE_PROFILE = "none"; @@ -1381,17 +1381,23 @@ public class CreateDatasetForm extends Composite{ productTitleGroup.setType(ControlGroupType.ERROR); return "Missing title"; } + + if(title.length()<2) { + productTitleGroup.setType(ControlGroupType.ERROR); + return "The field title is too short"; + } // better check for the title - String[] splittedTitle = title.split(" "); + //String[] splittedTitle = title.split(" "); + /* No check, see #20828 for (String word : splittedTitle) { String replaced = word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, ""); if(!replaced.equals(word)){ productTitleGroup.setType(ControlGroupType.ERROR); return "Please note not all characters are allowed for the title"; } - } + }*/ // email reg expression String maintainerMail = maintainerEmailTextbox.getText(); diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/tags/TagsPanel.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/tags/TagsPanel.java index 2473a5f..8fcc5ec 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/tags/TagsPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/tags/TagsPanel.java @@ -48,7 +48,7 @@ public class TagsPanel extends Composite{ @UiField ListBox tagsEnterListBox; // regular expression for tags - private static final String REGEX_TAG = "^[a-zA-Z0-9]*$"; + private static final String REGEX_TAG = "^[a-zA-Z0-9._-]*$"; // tags list private List tagsList = new ArrayList(); diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/InfoIconsLabels.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/InfoIconsLabels.java index b26c2a4..09e3787 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/InfoIconsLabels.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/InfoIconsLabels.java @@ -26,7 +26,7 @@ public class InfoIconsLabels { public static final String TAGS_INFO_ID_POPUP = "tags-popup-panel-info"; public static final String TAGS_INFO_CAPTION = "Tags"; public static final String TAGS_INFO_TEXT = "Tags are meaningful information that can be associated to the " - + "item and by means of them it can be retrieved. A tag can contain only alphanumeric characters. " + + "item and by means of them it can be retrieved. A tag can contain only alphanumeric characters or symbols . (dot) - (hyphen minus) _ (underscore)." + "If the tag is composed by a single word it must have a size of at least two characters." + "Examples of good tags: \"This is a sample tag\", \"tagY\". Example of bad tag: \"c\"." + " You must push ENTER for attaching a tag, or use the provided list of predefined tags. In the latter case" @@ -80,7 +80,7 @@ public class InfoIconsLabels { // TITLE public static final String TITLE_INFO_ID_POPUP = "title-popup-panel-info"; - public static final String TITLE_INFO_TEXT = "Item Title must contain only alphanumer characters, dots, underscore or hyphen minus. No others symbols are allowed. Please note that this field will be always visible, despite the item's visibility."; + public static final String TITLE_INFO_TEXT = "The title of the item. Please note that this field will be always visible, despite the item's visibility."; public static final String TITLE_INFO_CAPTION = "Item Title"; // DESCRIPTION