Tags fixed
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@130346 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
08a2d1b8cd
commit
43a50b1492
|
@ -72,7 +72,7 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class CreateDatasetForm extends Composite{
|
||||
|
||||
|
||||
/**
|
||||
* Create a remote service proxy to talk to the server-side ckan service.
|
||||
*/
|
||||
|
@ -152,7 +152,7 @@ public class CreateDatasetForm extends Composite{
|
|||
@UiField Icon infoIconResources;
|
||||
@UiField FocusPanel focusPanelResources;
|
||||
@UiField Popover popoverResources;
|
||||
|
||||
|
||||
protected static final String ERROR_PRODUCT_CREATION = "There was an error while trying to publish your product, sorry.. Retry later";
|
||||
|
||||
// tab panel
|
||||
|
@ -1139,21 +1139,28 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
/**
|
||||
* Add the tag as an element
|
||||
* Add the tag as an element (inserted by the user)
|
||||
*/
|
||||
private void addTagElement(TextBox itemBox){
|
||||
|
||||
GWT.log("value is " + itemBox.getValue());
|
||||
|
||||
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) {
|
||||
|
||||
if(tagsList.contains(itemBox.getValue()))
|
||||
if(tagsList.contains(itemBox.getValue())){
|
||||
itemBox.setValue("");
|
||||
return;
|
||||
}
|
||||
|
||||
// ckan accepts only alphanumeric values
|
||||
if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$"))
|
||||
return;
|
||||
|
||||
if(itemBox.getValue().length() <= 1)
|
||||
return;
|
||||
String[] subTags = itemBox.getValue().split(" ");
|
||||
for (int i = 0; i < subTags.length; i++) {
|
||||
String subTag = subTags[i];
|
||||
if(!subTag.matches("^[a-zA-Z0-9]*$"))
|
||||
return;
|
||||
if(subTag.length() <= 1)
|
||||
return;
|
||||
}
|
||||
|
||||
final String value = itemBox.getValue();
|
||||
final ListItem displayItem = new ListItem();
|
||||
|
@ -1179,13 +1186,23 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
/**
|
||||
* Add the tag as an element
|
||||
* Add the tag as an element (when publishing from workspace)
|
||||
*/
|
||||
private void addTagElement(final String tag){
|
||||
|
||||
if(tagsList.contains(tag))
|
||||
return;
|
||||
|
||||
// ckan accepts only alphanumeric values
|
||||
String[] subTags = tag.split(" ");
|
||||
for (int i = 0; i < subTags.length; i++) {
|
||||
String subTag = subTags[i];
|
||||
if(!subTag.matches("^[a-zA-Z0-9]*$"))
|
||||
return;
|
||||
if(subTag.length() <= 1)
|
||||
return;
|
||||
}
|
||||
|
||||
final ListItem displayItem = new ListItem();
|
||||
displayItem.setStyleName("tag-style");
|
||||
Span p = new Span(tag);
|
||||
|
|
|
@ -9,7 +9,9 @@ public class InfoIconsLabels {
|
|||
// TAGS
|
||||
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 product and by means of them it can be retrieved. A tag cannot contain white spaces and can contain only alphanumeric characters. It must be at least of two characters.";
|
||||
public static final String TAGS_INFO_TEXT = "Tags are meaningful information that can be associated to the "
|
||||
+ "product and by means of them it can be retrieved. A tag can contain only alphanumeric characters. "
|
||||
+ "Any string of the tag must be at least of two characters. Examples of good tags: \"This is my sample tag\", \"tagY\". Examples of bad tags: \"This is a tag\", \"c\".";
|
||||
|
||||
// VISIBILITY
|
||||
public static final String VISIBILITY_INFO_ID_POPUP = "visibility-popup-panel-info";
|
||||
|
|
|
@ -560,7 +560,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
|
||||
}
|
||||
|
||||
String datasetId = utils.createCKanDataset(getUserCKanTokenFromSession(), null, title, organizationNameOrId, author,
|
||||
String datasetId = utils.createCKanDataset(getUserCKanTokenFromSession(), title, organizationNameOrId, author,
|
||||
authorMail, maintainer, maintainerMail, version, description, licenseId,
|
||||
listOfTags, customFields, resources, setPublic);
|
||||
|
||||
|
|
Loading…
Reference in New Issue