Managing embargo_date and access_conditions
This commit is contained in:
parent
8e66e540e3
commit
5e61b54214
|
@ -23,7 +23,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
|||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
/**
|
||||
* The Class CkanToZendoPublisherWidget.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors.CreatorsFormView;
|
||||
|
@ -18,18 +18,20 @@ 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.Controls;
|
||||
import com.github.gwtbootstrap.client.ui.Fieldset;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
import com.github.gwtbootstrap.datepicker.client.Datepicker;
|
||||
import com.github.gwtbootstrap.datepicker.client.ui.DateBox;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
@ -78,11 +80,20 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
@UiField
|
||||
ListBox field_image_type;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_access_condition;
|
||||
|
||||
@UiField
|
||||
TextArea field_access_condition;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_publication_type;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_image_type;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_embargo_date;
|
||||
|
||||
@UiField
|
||||
ControlLabel cl_upload_type;
|
||||
|
@ -116,6 +127,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
|
||||
@UiField
|
||||
TagsPanel the_tags_panel;
|
||||
|
||||
@UiField
|
||||
DateBox embargoDate;
|
||||
|
||||
// @UiField
|
||||
// Pager pager;
|
||||
|
@ -169,28 +183,47 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
}
|
||||
}
|
||||
});
|
||||
//
|
||||
// pager.getRight().addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
//
|
||||
// Ckan2ZenodoViewManager.eventBus.fireEvent(new TabPagerClickedEvent(TabPagerClickedEvent.PAGER.NEXT));
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// if(conf!=null)
|
||||
// this.isEditConfiguration = true;
|
||||
// this.editConfiguration = conf;
|
||||
|
||||
// bindEvents();
|
||||
|
||||
// if (isEditConfiguration) {
|
||||
// pager.getRight().setText("Update Configuration");
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
|
||||
field_access_right.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
cg_embargo_date.setVisible(false);
|
||||
cg_access_condition.setVisible(false);
|
||||
|
||||
if(zenodoItem.getMetadata().getEmbargo_date()!=null) {
|
||||
Date embDate = zenodoItem.getMetadata().getEmbargo_date();
|
||||
boolean insertedFromModel = embDate!=null;
|
||||
cg_embargo_date.setVisible(insertedFromModel);
|
||||
}
|
||||
|
||||
if(zenodoItem.getMetadata().getAccess_conditions()!=null) {
|
||||
cg_access_condition.setVisible(true);
|
||||
}
|
||||
|
||||
String selectedLower = field_access_right.getSelectedValue().toLowerCase();
|
||||
if(selectedLower.compareTo("open")==0 || selectedLower.compareTo("embargoed")==0) {
|
||||
cg_embargo_date.setVisible(true);
|
||||
}else if(selectedLower.compareTo("restricted")==0) {
|
||||
cg_access_condition.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
embargoDate.setPlaceholder("Insert Embargo Date");
|
||||
embargoDate.setValue(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the embargo date.
|
||||
*
|
||||
* @return the embargo date
|
||||
*/
|
||||
public Date getEmbargoDate(){
|
||||
return embargoDate.getValue();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,6 +302,17 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
field_access_right.setEnabled(false);
|
||||
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("access_right", cl_access_right);
|
||||
|
||||
if(zMeta.getEmbargo_date()!=null) {
|
||||
embargoDate.setValue(zMeta.getEmbargo_date());
|
||||
cg_embargo_date.setVisible(true);
|
||||
}else
|
||||
cg_embargo_date.setVisible(false);
|
||||
|
||||
if(zMeta.getAccess_conditions()!=null) {
|
||||
field_access_condition.setValue(zMeta.getAccess_conditions());
|
||||
}else
|
||||
cg_access_condition.setVisible(false);
|
||||
|
||||
// License
|
||||
if (zMeta.getLicenses() != null) {
|
||||
|
@ -277,14 +321,16 @@ public class BasicInformationView extends Composite implements FormValidator {
|
|||
if(zMeta.getLicenses().getSelectableValues()!=null) {
|
||||
listLicensesIds = FieldUtil.toZenodoIds(zMeta.getLicenses().getSelectableValues());
|
||||
FieldUtil.addValuesToListBox(field_license, listLicensesIds);
|
||||
field_license.setEnabled(true);
|
||||
}else {
|
||||
//Exception case on missing list of selectable license ids
|
||||
FieldUtil.addValuesToListBox(field_access_right, selectedLicensesId);
|
||||
FieldUtil.addValuesToListBox(field_license, selectedLicensesId);
|
||||
field_license.setEnabled(false); //only one license id is available
|
||||
|
||||
}
|
||||
FieldUtil.selectValueToListBox(field_license, selectedLicensesId);
|
||||
}
|
||||
field_license.setEnabled(false); // because is not changeable
|
||||
}else
|
||||
field_license.setEnabled(false);
|
||||
|
||||
InfoTextAndLabels.addFieldDescriptionInfo("license", cl_license);
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
.margin-left-100 {
|
||||
margin-left: 80px;
|
||||
}
|
||||
|
||||
.flow-panel-style {
|
||||
display: inline-block;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="html_panel_field">
|
||||
|
@ -135,6 +139,33 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_embargo_date">
|
||||
<b:ControlLabel for="cl_embargo_date"
|
||||
ui:field="cl_embargo_date">
|
||||
<font color="red">*</font>
|
||||
Embargo Date
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<g:FlowPanel width="100%" ui:field="singleDate"
|
||||
styleName="{style.flow-panel-style}" visible="true">
|
||||
<b2:DateBox format="yyyy-mm-dd" autoClose="true"
|
||||
language="en" ui:field="embargoDate" width="70%" />
|
||||
</g:FlowPanel>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_access_condition">
|
||||
<b:ControlLabel for="cl_access_condition"
|
||||
ui:field="cl_access_condition">
|
||||
<font color="red">*</font>
|
||||
Access Condition
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea name="Access Condition"
|
||||
ui:field="field_access_condition"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_publication_date">
|
||||
<b:ControlLabel for="cl_publication_date"
|
||||
ui:field="cl_publication_date">
|
||||
|
|
|
@ -240,6 +240,10 @@ public class ItemToZenodoConverter {
|
|||
}
|
||||
zm.setLicenses(CkanToZenodoUtil.toSerializableEnum(selectedLicenses, null)); //NEED TO ADD ALL LICENSES
|
||||
|
||||
if(depositionMetadata.getEmbargo_date()!=null) {
|
||||
|
||||
}
|
||||
|
||||
zm.setKeywords(depositionMetadata.getKeywords());
|
||||
zm.setCommunities(toZenodoCommunities(depositionMetadata.getCommunities()));
|
||||
zm.setConference_acronym(depositionMetadata.getConference_acronym());
|
||||
|
@ -252,6 +256,7 @@ public class ItemToZenodoConverter {
|
|||
zm.setContributors(toZenodoContributors(depositionMetadata.getContributors()));
|
||||
zm.setCreators(toZenodoCreators(depositionMetadata.getCreators()));
|
||||
zm.setDates(toZenodoDateIntervals(depositionMetadata.getDates()));
|
||||
zm.setEmbargo_date(depositionMetadata.getEmbargo_date());
|
||||
zm.setRelated_identifiers(toRelatedIdentifiers(depositionMetadata.getRelated_identifiers()));
|
||||
zm.setSubjects(toZenodoSubjects(depositionMetadata.getSubjects()));
|
||||
zm.setThesis_supervisors(toZenodoCreators(depositionMetadata.getThesis_supervisors()));
|
||||
|
|
|
@ -1,9 +1,34 @@
|
|||
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface ZenodoLicense.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jan 21, 2020
|
||||
*/
|
||||
public interface ZenodoLicense {
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
String getTitle();
|
||||
|
||||
/**
|
||||
* Gets the url.
|
||||
*
|
||||
* @return the url
|
||||
*/
|
||||
String getUrl();
|
||||
|
||||
}
|
||||
|
|
|
@ -75,9 +75,6 @@ public class ZenodoMetadata implements Serializable{
|
|||
private List<ZenodoDateInterval> dates;
|
||||
private String method; //TODO html
|
||||
|
||||
|
||||
private LicenseBean license; //TODO html
|
||||
|
||||
private SerializableEnum<LicenseBean> licenses;
|
||||
|
||||
|
||||
|
@ -945,24 +942,6 @@ public class ZenodoMetadata implements Serializable{
|
|||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Gets the license.
|
||||
// *
|
||||
// * @return the license
|
||||
// */
|
||||
// public LicenseBean getLicense() {
|
||||
// return license;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the license.
|
||||
// *
|
||||
// * @param license the new license
|
||||
// */
|
||||
// public void setLicense(LicenseBean license) {
|
||||
// this.license = license;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Sets the licenses.
|
||||
|
@ -983,9 +962,6 @@ public class ZenodoMetadata implements Serializable{
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -1001,6 +977,10 @@ public class ZenodoMetadata implements Serializable{
|
|||
builder.append(title);
|
||||
builder.append(", creators=");
|
||||
builder.append(creators);
|
||||
builder.append(", contributors=");
|
||||
builder.append(contributors);
|
||||
builder.append(", thesis_supervisors=");
|
||||
builder.append(thesis_supervisors);
|
||||
builder.append(", description=");
|
||||
builder.append(description);
|
||||
builder.append(", access_right=");
|
||||
|
@ -1019,8 +999,6 @@ public class ZenodoMetadata implements Serializable{
|
|||
builder.append(notes);
|
||||
builder.append(", related_identifiers=");
|
||||
builder.append(related_identifiers);
|
||||
builder.append(", contributors=");
|
||||
builder.append(contributors);
|
||||
builder.append(", references=");
|
||||
builder.append(references);
|
||||
builder.append(", communities=");
|
||||
|
@ -1059,8 +1037,6 @@ public class ZenodoMetadata implements Serializable{
|
|||
builder.append(partof_title);
|
||||
builder.append(", partof_pages=");
|
||||
builder.append(partof_pages);
|
||||
builder.append(", thesis_supervisors=");
|
||||
builder.append(thesis_supervisors);
|
||||
builder.append(", thesis_university=");
|
||||
builder.append(thesis_university);
|
||||
builder.append(", subjects=");
|
||||
|
@ -1075,8 +1051,8 @@ public class ZenodoMetadata implements Serializable{
|
|||
builder.append(dates);
|
||||
builder.append(", method=");
|
||||
builder.append(method);
|
||||
builder.append(", license=");
|
||||
builder.append(license);
|
||||
builder.append(", licenses=");
|
||||
builder.append(licenses);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue