Added code to reload the same page after dataset creation
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129097 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d043c06a72
commit
90e9c33dd3
|
@ -0,0 +1,14 @@
|
||||||
|
package org.gcube.portlets.widgets.ckandatapublisherwidget.client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* simply encode base64 strings
|
||||||
|
*/
|
||||||
|
public class Encoder {
|
||||||
|
public static native String encode(String toEncode) /*-{
|
||||||
|
return btoa(toEncode);
|
||||||
|
}-*/;
|
||||||
|
|
||||||
|
public static native String decode(String toDecode) /*-{
|
||||||
|
return atob(toDecode);
|
||||||
|
}-*/;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
||||||
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.Encoder;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceBean;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceBean;
|
||||||
|
|
||||||
|
@ -71,7 +72,14 @@ public class AddResourceToDataset extends Composite{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
Window.Location.assign(datasetUrl);
|
String currentPath = Window.Location.getHref();
|
||||||
|
int datasetIndex = datasetUrl.indexOf("/dataset");
|
||||||
|
if(datasetIndex == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String finalPart = datasetUrl.substring(datasetIndex);
|
||||||
|
String finalPath = currentPath + "?" + Encoder.encode("q") + "=" + Encoder.encode(finalPart);
|
||||||
|
Window.Location.assign(finalPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Map.Entry;
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
||||||
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.Encoder;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetMetadataBean;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetMetadataBean;
|
||||||
|
@ -554,7 +555,14 @@ public class CreateDatasetForm extends Composite{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
Window.Location.assign(datasetUrl);
|
String currentPath = Window.Location.getHref();
|
||||||
|
int datasetIndex = datasetUrl.indexOf("/dataset");
|
||||||
|
if(datasetIndex == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String finalPart = datasetUrl.substring(datasetIndex);
|
||||||
|
String finalPath = currentPath + "?" + Encoder.encode("q") + "=" + Encoder.encode(finalPart);
|
||||||
|
Window.Location.assign(finalPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue