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
|
@ -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){
|
private void addTagElement(TextBox itemBox){
|
||||||
|
|
||||||
|
GWT.log("value is " + itemBox.getValue());
|
||||||
|
|
||||||
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) {
|
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) {
|
||||||
|
|
||||||
if(tagsList.contains(itemBox.getValue()))
|
if(tagsList.contains(itemBox.getValue())){
|
||||||
|
itemBox.setValue("");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// ckan accepts only alphanumeric values
|
// ckan accepts only alphanumeric values
|
||||||
if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$"))
|
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;
|
return;
|
||||||
|
if(subTag.length() <= 1)
|
||||||
if(itemBox.getValue().length() <= 1)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final String value = itemBox.getValue();
|
final String value = itemBox.getValue();
|
||||||
final ListItem displayItem = new ListItem();
|
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){
|
private void addTagElement(final String tag){
|
||||||
|
|
||||||
if(tagsList.contains(tag))
|
if(tagsList.contains(tag))
|
||||||
return;
|
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();
|
final ListItem displayItem = new ListItem();
|
||||||
displayItem.setStyleName("tag-style");
|
displayItem.setStyleName("tag-style");
|
||||||
Span p = new Span(tag);
|
Span p = new Span(tag);
|
||||||
|
|
|
@ -9,7 +9,9 @@ public class InfoIconsLabels {
|
||||||
// TAGS
|
// TAGS
|
||||||
public static final String TAGS_INFO_ID_POPUP = "tags-popup-panel-info";
|
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_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
|
// VISIBILITY
|
||||||
public static final String VISIBILITY_INFO_ID_POPUP = "visibility-popup-panel-info";
|
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,
|
authorMail, maintainer, maintainerMail, version, description, licenseId,
|
||||||
listOfTags, customFields, resources, setPublic);
|
listOfTags, customFields, resources, setPublic);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue