diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml index f578000..f047f41 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml @@ -12,6 +12,7 @@ border: 1px groove #444 !important; box-shadow: 0px 0px 0px 0px #000 !important; padding: 10px !important; + margin: 5px !important; } .legend-style { @@ -46,8 +47,10 @@ font-weight: bold; } - .the-margin-left { + .the-margin-gotoitem { margin-left: 5px; + margin-top: 10px; + margin-bottom: 10px; } @@ -419,7 +422,7 @@ Go to the Item + styleName="{style.the-margin-gotoitem}"> vocabulary = field.getVocabulary(); - + GWT.log("Vocabulary: "+field.getFieldName()); for (String term : vocabulary) { + GWT.log("Adding term: "+term); tempListBox.addItem(term); } diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java index 8b161a1..9f64db7 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java @@ -7,9 +7,11 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElement import com.github.gwtbootstrap.client.ui.AlertBlock; import com.github.gwtbootstrap.client.ui.Button; +import com.github.gwtbootstrap.client.ui.ControlGroup; import com.github.gwtbootstrap.client.ui.TextArea; import com.github.gwtbootstrap.client.ui.TextBox; import com.github.gwtbootstrap.client.ui.constants.AlertType; +import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -53,6 +55,8 @@ public class AddResourceToDataset extends Composite{ @UiField Button addResourceButton; @UiField AlertBlock infoBlock; @UiField Button goToDatasetButton; + @UiField ControlGroup urlControlGroup; + @UiField ControlGroup nameControlGroup; public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetOrg, String owner, final String datasetUrl) { initWidget(uiBinder.createAndBindUi(this)); @@ -80,19 +84,31 @@ public class AddResourceToDataset extends Composite{ @UiHandler("addResourceButton") void onAddButtonClick(ClickEvent e){ - + infoBlock.setVisible(false); + urlControlGroup.setType(ControlGroupType.NONE); + nameControlGroup.setType(ControlGroupType.NONE); // validation - if(resourceUrlTextBox.getText().isEmpty() || resourceNameTextBox.getText().isEmpty()){ + if (resourceUrlTextBox.getText().isEmpty()) { - showAlert("Url and name fields cannot be empty", AlertType.ERROR); + showAlert("'URL' field cannot be empty", AlertType.ERROR); + urlControlGroup.setType(ControlGroupType.ERROR); + return; + } + + // validation + if (resourceNameTextBox.getText().isEmpty() || resourceNameTextBox.getText().isEmpty()) { + + showAlert("'Name' field cannot be empty", AlertType.ERROR); + nameControlGroup.setType(ControlGroupType.ERROR); return; } //THE URL must be HTTPS, see #21068 - if(!(resourceNameTextBox.getText().toLowerCase().startsWith("https://"))){ - showAlert("The URL must be HTTPS and starts with \"https://\" (e.g. https://your-resource.com)", AlertType.ERROR); + if(!(resourceUrlTextBox.getText().toLowerCase().startsWith("https://"))){ + showAlert("The URL must be HTTPS, so start with \"https://\" (e.g. https://your-resource.com)", AlertType.ERROR); + urlControlGroup.setType(ControlGroupType.ERROR); return; } @@ -169,6 +185,6 @@ public class AddResourceToDataset extends Composite{ } }; - t.schedule(4000); + t.schedule(8000); } } diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.ui.xml index 600bf46..419665c 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.ui.xml @@ -1,6 +1,7 @@ + xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" + xmlns:g="urn:import:com.google.gwt.user.client.ui"> .form-main-style { margin-left: 10px; @@ -56,19 +57,23 @@ is required + + Only HTTPS URLs are allowed. + If you have a desktop file upload it to Workspace and use the 'Public Link' facility to get its HTTPS URL - + * URL: - + - + * Name: @@ -80,19 +85,22 @@ - + Description: + title="Resource description" + ui:field="resourceDescriptionTextArea" /> - +