Added fields description as tooltip
This commit is contained in:
parent
6d5de0712a
commit
95ea2396e9
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.Ckan2ZenodoViewManager;
|
||||
|
@ -35,6 +37,7 @@ public class CkanToZendoPublisherWidget {
|
|||
private Ckan2ZenodoViewManager manager = null;
|
||||
private BasicTabPanel basicTabPanel;
|
||||
private ModalFooter modalFooter;
|
||||
public static Map<String, String> mapOfFieldsDescriptions = new HashMap<String, String>();
|
||||
|
||||
|
||||
public CkanToZendoPublisherWidget() {
|
||||
|
@ -85,6 +88,20 @@ public class CkanToZendoPublisherWidget {
|
|||
}
|
||||
});
|
||||
|
||||
ckanToZenodoService.readFieldsDescriptions(new AsyncCallback<Map<String,String>>() {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, String> result) {
|
||||
mapOfFieldsDescriptions = result;
|
||||
}
|
||||
});
|
||||
|
||||
buttonPublish.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||
|
||||
|
@ -16,4 +18,6 @@ public interface CkanToZenodoPublisherService extends RemoteService {
|
|||
|
||||
String publishOnZenodo(ZenodoItem zenodoItem) throws Exception;
|
||||
|
||||
Map<String, String> readFieldsDescriptions() throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||
|
||||
|
@ -33,5 +35,7 @@ public interface CkanToZenodoPublisherServiceAsync {
|
|||
|
||||
void publishOnZenodo(ZenodoItem zenodoItem, AsyncCallback<String> callback);
|
||||
|
||||
void readFieldsDescriptions(AsyncCallback<Map<String, String>> callback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuth
|
|||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||
import com.github.gwtbootstrap.client.ui.Controls;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -22,7 +21,6 @@ import com.google.gwt.uibinder.client.UiField;
|
|||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
@ -109,6 +107,14 @@ public class CreatorView extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
if(userRole.toLowerCase().startsWith("creator")) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("creators", field_cl_author);
|
||||
}else if(userRole.toLowerCase().startsWith("contributor")) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("contributors", field_cl_author);
|
||||
}else {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("authors", field_cl_author);
|
||||
}
|
||||
|
||||
GWT.log("Created creator view with author: "+this.author);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,11 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformati
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors.CreatorsFormView;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.tags.TagsPanel;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils.FieldDescription;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils.InfoTextAndLabels;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
||||
|
@ -18,6 +17,7 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMeta
|
|||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||
import com.github.gwtbootstrap.client.ui.Fieldset;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
|
@ -54,6 +54,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
@UiField
|
||||
TextBox field_title;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_title;
|
||||
|
||||
@UiField
|
||||
TextBox field_doi;
|
||||
|
||||
|
@ -63,21 +66,39 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
@UiField
|
||||
TextArea field_description;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_description;
|
||||
|
||||
@UiField
|
||||
ListBox field_upload_type;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_upload_type;
|
||||
|
||||
@UiField
|
||||
ListBox field_access_right;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_access_right;
|
||||
|
||||
@UiField
|
||||
ListBox field_license;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_license;
|
||||
|
||||
@UiField
|
||||
ListBox field_publication_type;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_publication_type;
|
||||
|
||||
@UiField
|
||||
DateBox field_publication_date;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_publication_date;
|
||||
|
||||
@UiField
|
||||
Alert error_alert;
|
||||
|
||||
|
@ -93,8 +114,6 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
|
||||
private ZenodoItem zenodoItem;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can be used as a binder
|
||||
* template. In other words, it can be used in other *.ui.xml files as follows:
|
||||
|
@ -156,74 +175,74 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fill parameters to operator.
|
||||
*/
|
||||
private void fillForm() {
|
||||
|
||||
field_title.setValue(zenodoItem.getTitle());
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("title", cl_title);
|
||||
field_description.setValue(zenodoItem.getMetadata().getDescription());
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("description", cl_description);
|
||||
field_doi.setValue(zenodoItem.getDoi().toString());
|
||||
|
||||
ZenodoMetadata zMeta = zenodoItem.getMetadata();
|
||||
if (zMeta != null) {
|
||||
String title = zenodoItem.getTitle()!=null?zenodoItem.getTitle():zMeta.getTitle();
|
||||
String title = zenodoItem.getTitle() != null ? zenodoItem.getTitle() : zMeta.getTitle();
|
||||
field_title.setValue(title); // Re.fill title to be sure
|
||||
|
||||
String value = zenodoItem.getFieldsDescriptions().get("title");
|
||||
if(value!=null) {
|
||||
Widget parent = field_title.getParent();
|
||||
FieldDescription fd = new FieldDescription(null, value);
|
||||
parent.getElement().appendChild(fd.getElement());
|
||||
}
|
||||
|
||||
field_title.setValue(title); //Re.fill title to be sure
|
||||
|
||||
//Upload type
|
||||
if(zMeta.getUpload_type()!=null) {
|
||||
// Upload type
|
||||
if (zMeta.getUpload_type() != null) {
|
||||
FieldUtil.addValuesToListBox(field_upload_type, zMeta.getUpload_type().getSelectableValues());
|
||||
FieldUtil.selectValueToListBox(field_upload_type, zMeta.getUpload_type().getSelectedValues());
|
||||
}else
|
||||
} else
|
||||
field_upload_type.setEnabled(false);
|
||||
|
||||
//Publication Type
|
||||
if(zMeta.getPublication_type()!=null) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("upload_type", cl_upload_type);
|
||||
|
||||
// Publication Type
|
||||
if (zMeta.getPublication_type() != null) {
|
||||
FieldUtil.addValuesToListBox(field_publication_type, zMeta.getPublication_type().getSelectableValues());
|
||||
FieldUtil.selectValueToListBox(field_publication_type, zMeta.getPublication_type().getSelectedValues());
|
||||
}else
|
||||
} else
|
||||
field_publication_type.setEnabled(false);
|
||||
|
||||
if(zMeta.getAccess_right()!=null) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("publication_type", cl_publication_type);
|
||||
|
||||
if (zMeta.getAccess_right() != null) {
|
||||
FieldUtil.addValuesToListBox(field_access_right, zMeta.getAccess_right().getSelectableValues());
|
||||
FieldUtil.selectValueToListBox(field_access_right, zMeta.getAccess_right().getSelectedValues());
|
||||
}else
|
||||
} else
|
||||
field_access_right.setEnabled(false);
|
||||
|
||||
if(zMeta.getLicense()!=null) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("access_right", cl_access_right);
|
||||
|
||||
if (zMeta.getLicense() != null) {
|
||||
FieldUtil.addValuesToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
|
||||
FieldUtil.selectValueToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
|
||||
}
|
||||
field_license.setEnabled(false); //because is not changeable
|
||||
field_license.setEnabled(false); // because is not changeable
|
||||
|
||||
if(zMeta.getKeywords()!=null && zMeta.getKeywords().size()>0) {
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("license", cl_license);
|
||||
|
||||
if (zMeta.getKeywords() != null && zMeta.getKeywords().size() > 0) {
|
||||
for (String keyword : zMeta.getKeywords()) {
|
||||
the_tags_panel.addTagElement(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
if(listOfCreatorsView==null)
|
||||
if (listOfCreatorsView == null)
|
||||
listOfCreatorsView = new ArrayList<CreatorsFormView>();
|
||||
|
||||
if(listOfContributorsView==null)
|
||||
if (listOfContributorsView == null)
|
||||
listOfContributorsView = new ArrayList<CreatorsFormView>();
|
||||
|
||||
// ADDING AUTHORS
|
||||
GWT.log("Adding creators: "+zenodoItem.getMetadata().getCreators());
|
||||
GWT.log("Adding creators: " + zenodoItem.getMetadata().getCreators());
|
||||
CreatorsFormView authorView = new CreatorsFormView(zenodoItem.getMetadata().getCreators());
|
||||
listOfCreatorsView.add(authorView);
|
||||
|
||||
GWT.log("Adding contributors: "+zenodoItem.getMetadata().getContributors());
|
||||
GWT.log("Adding contributors: " + zenodoItem.getMetadata().getContributors());
|
||||
CreatorsFormView contributorView = new CreatorsFormView(zenodoItem.getMetadata().getContributors());
|
||||
listOfContributorsView.add(contributorView);
|
||||
|
||||
|
@ -236,116 +255,6 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// if(zenodoItem.getFiles()!=null) {
|
||||
// label_files.setVisible(true);
|
||||
// for (ZenodoFile file : zenodoItem.getFiles()) {
|
||||
// addFileForPublishing(file);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Adds the values to list box.
|
||||
// *
|
||||
// * @param list the list
|
||||
// * @param listValues the list values
|
||||
// */
|
||||
// private void addValuesToListBox(ListBox list, List<String> listValues) {
|
||||
// if (listValues == null)
|
||||
// return;
|
||||
//
|
||||
// for (int i = 0; i < listValues.size(); i++) {
|
||||
// list.addItem(listValues.get(i), listValues.get(i));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Select value to list box.
|
||||
// *
|
||||
// * @param list the list
|
||||
// * @param values the values
|
||||
// */
|
||||
// private void selectValueToListBox(ListBox list, List<String> values) {
|
||||
// GWT.log("Selecting value: "+values);
|
||||
// String selectValue = null;
|
||||
// if (values == null || values.isEmpty()) {
|
||||
// selectValue = null;
|
||||
// } else {
|
||||
// selectValue = values.get(0);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// if (list.getItemCount() > 0)
|
||||
// list.setSelectedValue(selectValue);
|
||||
// } catch (Exception e) {
|
||||
// GWT.log("error: " + e);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void addFileForPublishing(ZenodoFile file) {
|
||||
// PublishFileView pv = new PublishFileView();
|
||||
// pv.getField_file_name().setValue(file.getFilename());
|
||||
// pv.getSwitchButton().setValue(true);
|
||||
// to_zenodo_form_unit_fields.add(pv);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Bind events.
|
||||
// */
|
||||
// private void bindEvents() {
|
||||
//
|
||||
// pager.getLeft().addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// pager.getRight().addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// setError(false, "");
|
||||
// boolean isValid = validateSubmit();
|
||||
// if (isValid)
|
||||
// submitHandler();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
|
||||
/*
|
||||
* cg_select_task_id.setType(ControlGroupType.NONE);
|
||||
* //cg_parameters_control.setType(ControlGroupType.NONE);
|
||||
* //cg_remote_path.setType(ControlGroupType.NONE);
|
||||
*
|
||||
* if(field_select_scope.getSelectedItemText()==null){
|
||||
* cg_select_vre.setType(ControlGroupType.ERROR); setError(true,
|
||||
* "You must select a Scope!"); return false; }
|
||||
*
|
||||
* if(field_select_scope.getSelectedItemText() == null ||
|
||||
* field_select_scope.getSelectedItemText().isEmpty()){
|
||||
* cg_select_task_id.setType(ControlGroupType.ERROR); setError(true,
|
||||
* "You must select an Algorithm!"); return false; }
|
||||
*
|
||||
* for (CustomFieldEntry cFE : customFieldEntriesList) {
|
||||
* cFE.getControlGroup().setType(ControlGroupType.NONE); if(cFE.getKey()==null
|
||||
* || cFE.getKey().isEmpty()){
|
||||
* cFE.getControlGroup().setType(ControlGroupType.ERROR);
|
||||
* //cg_parameters_control.setType(ControlGroupType.ERROR); setError(true,
|
||||
* "You must type a valid key parameter!"); return false; } }
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -375,12 +284,12 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
FieldUtil.setControlGroup(cgDOI, ControlGroupType.NONE);
|
||||
FieldUtil.setControlGroup(cgTitle, ControlGroupType.NONE);
|
||||
|
||||
//Validating DOI
|
||||
// Validating DOI
|
||||
if (cgDOI.isVisible()) {
|
||||
GWT.log("Checking doi---");
|
||||
String value = getTextValue(field_doi);
|
||||
boolean isValid = FieldUtil.isValidValue(value);
|
||||
if(!isValid) {
|
||||
if (!isValid) {
|
||||
FieldUtil.setControlGroup(cgDOI, ControlGroupType.ERROR);
|
||||
error_alert.setVisible(true);
|
||||
error_alert.setText("This field DOI is required");
|
||||
|
@ -388,13 +297,13 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
}
|
||||
}
|
||||
|
||||
//Validating Title
|
||||
// Validating Title
|
||||
if (cgTitle.isVisible()) {
|
||||
GWT.log("Checking title---");
|
||||
String value = getTextValue(field_title);
|
||||
boolean isValid = FieldUtil.isValidValue(value);
|
||||
GWT.log("isValid: "+isValid);
|
||||
if(!isValid) {
|
||||
GWT.log("isValid: " + isValid);
|
||||
if (!isValid) {
|
||||
FieldUtil.setControlGroup(cgTitle, ControlGroupType.ERROR);
|
||||
error_alert.setVisible(true);
|
||||
error_alert.setText("The field Title is required");
|
||||
|
@ -402,20 +311,20 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
}
|
||||
}
|
||||
|
||||
//Validating Creators
|
||||
// Validating Creators
|
||||
for (CreatorsFormView cfv : listOfCreatorsView) {
|
||||
String error = cfv.validateFormFields();
|
||||
if(error!=null) {
|
||||
if (error != null) {
|
||||
error_alert.setVisible(true);
|
||||
error_alert.setText(error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
//Validating Contributors
|
||||
// Validating Contributors
|
||||
for (CreatorsFormView cfv : listOfContributorsView) {
|
||||
String error = cfv.validateFormFields();
|
||||
if(error!=null) {
|
||||
if (error != null) {
|
||||
error_alert.setVisible(true);
|
||||
error_alert.setText(error);
|
||||
return error;
|
||||
|
@ -425,16 +334,18 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator#isValidForm()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator#
|
||||
* isValidForm()
|
||||
*/
|
||||
@Override
|
||||
public boolean isValidForm() {
|
||||
return validateFormFields()==null;
|
||||
return validateFormFields() == null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the text value.
|
||||
*
|
||||
|
@ -480,7 +391,6 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
return listOfCreators;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of contributors.
|
||||
*
|
||||
|
@ -596,16 +506,13 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
return the_tags_panel.getTags();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of keywords.
|
||||
*
|
||||
* @return the list of keywords
|
||||
*/
|
||||
public List<String> getListOfKeywords(){
|
||||
public List<String> getListOfKeywords() {
|
||||
return the_tags_panel.getTags();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_title">
|
||||
<b:ControlLabel for="cl_title">
|
||||
<b:ControlLabel for="cl_title" ui:field="cl_title">
|
||||
<font color="red">*</font>
|
||||
Title
|
||||
</b:ControlLabel>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_description">
|
||||
<b:ControlLabel for="cl_description">
|
||||
<b:ControlLabel for="cl_description" ui:field="cl_description">
|
||||
<font color="red">*</font>
|
||||
Description
|
||||
</b:ControlLabel>
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
|
||||
<b:ControlGroup ui:field="cg_upload_type">
|
||||
<b:ControlLabel for="cg_upload_type">
|
||||
<b:ControlLabel for="cg_upload_type" ui:field="cl_upload_type">
|
||||
Upload type
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
@ -79,7 +79,7 @@
|
|||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_publication_type">
|
||||
<b:ControlLabel for="cl_publication_type">
|
||||
<b:ControlLabel for="cl_publication_type" ui:field="cl_publication_type">
|
||||
Publication type
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_access_right">
|
||||
<b:ControlLabel for="cl_access_right">
|
||||
<b:ControlLabel for="cl_access_right" ui:field="cl_access_right">
|
||||
Access right
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
@ -105,7 +105,7 @@
|
|||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_license">
|
||||
<b:ControlLabel for="cl_license">
|
||||
<b:ControlLabel for="cl_license" ui:field="cl_license">
|
||||
License
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
@ -117,7 +117,7 @@
|
|||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_publication_date">
|
||||
<b:ControlLabel for="cl_publication_date">
|
||||
<b:ControlLabel for="cl_publication_date" ui:field="cl_publication_date">
|
||||
Publication date
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
|
|
@ -5,8 +5,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils.InfoTextAndLabels;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.base.ListItem;
|
||||
|
@ -37,11 +39,9 @@ public class TagsPanel extends Composite{
|
|||
|
||||
@UiField TextBox tagsEnterTextBox;
|
||||
@UiField FlowPanel tagsPanel;
|
||||
// @UiField Icon infoIconTags;
|
||||
// @UiField FocusPanel focusPanelTags;
|
||||
// @UiField Popover popoverTags;
|
||||
@UiField ControlGroup tagsInsertGroup;
|
||||
@UiField ListBox tagsEnterListBox;
|
||||
@UiField ControlLabel cl_keywords;
|
||||
|
||||
// regular expression for tags
|
||||
private static final String REGEX_TAG = "^[a-zA-Z0-9]*$";
|
||||
|
@ -57,6 +57,8 @@ public class TagsPanel extends Composite{
|
|||
tagsEnterListBox.setVisible(false);
|
||||
tagsList.clear();
|
||||
tagsPanel.clear();
|
||||
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("keywords", cl_keywords);
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,22 +89,6 @@ public class TagsPanel extends Composite{
|
|||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Prepare icons
|
||||
// * @param popupOpenedIds
|
||||
// */
|
||||
// public void prepareIcon(List<String> popupOpenedIds) {
|
||||
// InfoTextAndLabels.preparePopupPanelAndPopover(
|
||||
// InfoTextAndLabels.TAGS_INFO_ID_POPUP,
|
||||
// InfoTextAndLabels.TAGS_INFO_TEXT,
|
||||
// InfoTextAndLabels.TAGS_INFO_CAPTION,
|
||||
// infoIconTags,
|
||||
// popoverTags,
|
||||
// focusPanelTags,
|
||||
// popupOpenedIds
|
||||
// );
|
||||
// }
|
||||
|
||||
@UiHandler("tagsEnterTextBox")
|
||||
void onAddTag(KeyDownEvent event){
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:ControlGroup ui:field="tagsInsertGroup">
|
||||
<b:ControlLabel for="tags" title="Item tag">
|
||||
<b:ControlLabel for="tags" title="Item tag" ui:field="cl_keywords">
|
||||
<!-- <font color="red">*</font> -->
|
||||
Keywords
|
||||
</b:ControlLabel>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Cursor;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class FieldDescription extends Composite {
|
||||
|
||||
private static FieldDescriptionUiBinder uiBinder = GWT.create(FieldDescriptionUiBinder.class);
|
||||
|
||||
interface FieldDescriptionUiBinder extends UiBinder<Widget, FieldDescription> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
Popover popoverDescription;
|
||||
|
||||
@UiField
|
||||
Icon infoIconDescription;
|
||||
|
||||
public FieldDescription(String captionText, String text) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// prepare the popover
|
||||
if(captionText!=null)
|
||||
popoverDescription.setHeading(new HTML("<b>" + captionText + "</b>").getHTML());
|
||||
|
||||
popoverDescription.setText(new HTML("<p style='color:initial'>" + text + "</p>").getHTML());
|
||||
|
||||
// set icon cursor
|
||||
infoIconDescription.getElement().getStyle().setCursor(Cursor.HELP);
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.Icon;
|
||||
//import com.github.gwtbootstrap.client.ui.Popover;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.dom.client.Style.Cursor;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.HTML;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
//public class FieldDescription extends Composite {
|
||||
//
|
||||
// private static FieldDescriptionUiBinder uiBinder = GWT.create(FieldDescriptionUiBinder.class);
|
||||
//
|
||||
// interface FieldDescriptionUiBinder extends UiBinder<Widget, FieldDescription> {
|
||||
// }
|
||||
//
|
||||
// @UiField
|
||||
// Popover popoverDescription;
|
||||
//
|
||||
// @UiField
|
||||
// Icon infoIconDescription;
|
||||
//
|
||||
// public FieldDescription(String captionText, String text) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
//
|
||||
// // prepare the popover
|
||||
// if(captionText!=null)
|
||||
// popoverDescription.setHeading(new HTML("<b>" + captionText + "</b>").getHTML());
|
||||
//
|
||||
// popoverDescription.setText(new HTML("<p style='color:initial'>" + text + "</p>").getHTML());
|
||||
//
|
||||
// // set icon cursor
|
||||
// infoIconDescription.getElement().getStyle().setCursor(Cursor.HELP);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
@ -6,19 +6,24 @@
|
|||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
.div-inline{
|
||||
display: inline;
|
||||
|
||||
.div-inline {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.the-font-size {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="{style.div-inline}">
|
||||
<span style="float:right; width:5%; color: #aaaaaa;">
|
||||
<div style="width:5%; color: #aaaaaa;">
|
||||
<b:Popover ui:field="popoverDescription" html="true"
|
||||
animation="true" placement="LEFT">
|
||||
animation="true" placement="RIGHT">
|
||||
<g:FocusPanel ui:field="focusPanelDescription">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES"
|
||||
ui:field="infoIconDescription" />
|
||||
<b:Icon type="INFO_SIGN" ui:field="infoIconDescription"
|
||||
addStyleNames="{style.the-font-size}" />
|
||||
</g:FocusPanel>
|
||||
</b:Popover>
|
||||
</span>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -2,8 +2,11 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublisherWidget;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.Cursor;
|
||||
|
@ -152,4 +155,24 @@ public class InfoTextAndLabels {
|
|||
return value;
|
||||
}
|
||||
|
||||
public static void addFieldDescriptionInfo(String theFieldKey, Widget widget) {
|
||||
String value = CkanToZendoPublisherWidget.mapOfFieldsDescriptions.get(theFieldKey);
|
||||
if(value!=null) {
|
||||
String caption = theFieldKey.substring(0,1).toUpperCase()+theFieldKey.substring(1,theFieldKey.length());
|
||||
setupPopover(widget, value, caption);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupPopover(Widget w, String message, String heading) {
|
||||
Popover popover = new Popover();
|
||||
popover.setWidget(w);
|
||||
popover.setHtml(true);
|
||||
popover.setText(message);
|
||||
popover.setHeading(heading);
|
||||
popover.setPlacement(Placement.RIGHT);
|
||||
popover.reconfigure();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation.BasicInformationView;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
||||
|
|
|
@ -115,5 +115,4 @@ public class FieldUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.data.publishing.ckan2zenodo.Ckan2Zenodo;
|
||||
import org.gcube.data.publishing.ckan2zenodo.Ckan2ZenodoImpl;
|
||||
|
@ -150,7 +148,6 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
|
||||
zenodoItem.setName(item.getItemName());
|
||||
|
||||
zenodoItem.setFieldsDescriptions(ZenodoFieldsDescriptionsReader.readProperties());
|
||||
LOG.debug("Returning item: "+zenodoItem);
|
||||
return zenodoItem;
|
||||
|
||||
|
@ -182,6 +179,30 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> readFieldsDescriptions() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
if(isOutFromPortal()) {
|
||||
PortalUtils.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||
}
|
||||
|
||||
return ZenodoFieldsDescriptionsReader.readProperties();
|
||||
|
||||
} catch (Exception e) {
|
||||
String error = "Unable to read the file of properties with the fields desciptions";
|
||||
LOG.error(error, e);
|
||||
String clientError = String.format("%s. %s", error, e.getMessage());
|
||||
throw new Exception(clientError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load item preview from service.
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#Property file to read the fields descriptions to show on GUI side
|
||||
title = Title of deposition.
|
||||
description = Abstract or description for deposition.
|
||||
creators = The creators/authors of the deposition. Name of creator (is required) in the format Family name, Given names
|
||||
access_right = open: Open Access, embargoed: Embargoed Access, restricted: Restricted Access, closed: Closed Access Defaults to open.
|
||||
license = The selected license applies to all files in this deposition, but not to the metadata which is licensed under Creative Commons Zero. Further information about licenses is available at Open Definition Licenses Service. Defaults to cc-by for non-datasets and cc-zero for datasets.
|
||||
contributors = The contributors of the deposition (e.g. editors, data curators, etc.). Name of creator (is required) in the format Family name, Given names
|
||||
title=Title of deposition.
|
||||
description=Abstract or description for deposition.
|
||||
creators= he creators/authors of the deposition. Name of creator (is required) in the format Family name, Given names
|
||||
access_right=Controlled vocabulary: <br>* open: Open Access<br>* embargoed: Embargoed Access<br>* restricted: Restricted Access<br>* closed: Closed Access Defaults to open.
|
||||
license=The selected license applies to all files in this deposition, but not to the metadata which is licensed under Creative Commons Zero. Further information about licenses is available at Open Definition Licenses Service. Defaults to cc-by for non-datasets and cc-zero for datasets.
|
||||
contributors=The contributors of the deposition (e.g. editors, data curators, etc.). Name of creator (is required) in the format Family name, Given names
|
||||
upload_type=Controlled vocabulary: <br>* publication: Publication<br>* poster: Poster<br>* presentation: Presentation<br>* dataset: Dataset, etc.
|
||||
publication_type=Controlled vocabulary: <br>* annotationcollection: Annotation collection<br>* book: Book<br>* section: Book section<br>* conferencepaper: Conference paper<br>* datamanagementplan: Data management plan<br>* article: Journal article, etc.
|
||||
publication_date=Date of publication in ISO8601 format (YYYY-MM-DD). Defaults to current date.
|
||||
keywords=Free form keywords for this deposition.
|
|
@ -2,9 +2,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The Class ZenodoItem.
|
||||
|
@ -34,8 +32,6 @@ public class ZenodoItem implements Serializable {
|
|||
private String title;
|
||||
private String name; //this is the dataset name
|
||||
|
||||
private Map<String, String> fieldsDescriptions;
|
||||
|
||||
/**
|
||||
* Instantiates a new zenodo item.
|
||||
*/
|
||||
|
@ -282,29 +278,6 @@ public class ZenodoItem implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the fields descriptions.
|
||||
*
|
||||
* @param mapOfFieldsDescriptions the map of fields descriptions
|
||||
*/
|
||||
public void setFieldsDescriptions(Map<String, String> mapOfFieldsDescriptions) {
|
||||
this.fieldsDescriptions = mapOfFieldsDescriptions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the fields descriptions.
|
||||
*
|
||||
* @return the fields descriptions
|
||||
*/
|
||||
public Map<String, String> getFieldsDescriptions() {
|
||||
if(fieldsDescriptions == null)
|
||||
return new HashMap<String, String>();
|
||||
|
||||
return fieldsDescriptions;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue