546: Workspace: openURL does not work in Safari nor in Chrome

Task-Url: https://support.d4science.org/issues/546

Fix to avoid blocked popup by browser

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@118963 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-09-21 11:00:26 +00:00
parent bc9867a180
commit 78f198cc2a
2 changed files with 29 additions and 15 deletions

View File

@ -133,6 +133,7 @@ import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplayMessage;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxConfirm;
import org.gcube.portlets.user.workspace.client.view.windows.NewBrowserWindow;
import org.gcube.portlets.user.workspace.client.view.windows.WindowImagePreview;
import org.gcube.portlets.user.workspace.client.view.windows.WindowOpenUrl;
import org.gcube.portlets.user.workspace.client.view.windows.accounting.WindowAccountingInfo;
@ -1768,7 +1769,9 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void doClickOpenReport(OpenReportsEvent openReportsEvent) {
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_self", "");
rpcWorkspaceService.getURLFromApplicationProfile(openReportsEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<String>() {
@Override
@ -1781,17 +1784,17 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onSuccess(String url) {
if(url==null || url.isEmpty()){
String currentUrl = portalURL();
int last = currentUrl.lastIndexOf("/");
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
new WindowOpenUrl(reportUrl, "_self", "");
// new WindowOpenUrl(reportUrl, "_self", "");
newBrowserWindow.setUrl(reportUrl);
}
else{
String reportUrl = url;
new WindowOpenUrl(reportUrl, "_self", "");
// new WindowOpenUrl(reportUrl, "_self", "");
newBrowserWindow.setUrl(reportUrl);
}
}
});
@ -1799,6 +1802,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private void doClickOpenReportTemplate(OpenReportsEvent openReportTemplateEvent) {
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_self", "");
rpcWorkspaceService.getURLFromApplicationProfile(openReportTemplateEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<String>() {
@Override
@ -1815,13 +1820,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
int last = currentUrl.lastIndexOf("/");
String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
// Log.trace("Url: "+templateUrl);
System.out.println("currentUrl " +currentUrl);
System.out.println("reportUrl " +templateUrl);
new WindowOpenUrl(templateUrl, "_self", "");
GWT.log("currentUrl " +currentUrl);
GWT.log("reportUrl " +templateUrl);
newBrowserWindow.setUrl(templateUrl);
// new WindowOpenUrl(templateUrl, "_self", "");
}else{
String templateUrl = url;
new WindowOpenUrl(templateUrl, "_self", "");
newBrowserWindow.setUrl(templateUrl);
// new WindowOpenUrl(templateUrl, "_self", "");
}
}
@ -2767,7 +2774,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(fileModel==null)
return;
GWT.log("do click url");
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", "");
rpcWorkspaceService.getUrlById(fileModel.getIdentifier(), fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT), false, new AsyncCallback<GWTWorkspaceItem>() {
@Override
@ -2783,11 +2793,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT)){
new WindowOpenUrl(((GWTUrlDocument) result).getUrl(), "_blank", "");
newBrowserWindow.setUrl(((GWTUrlDocument) result).getUrl());
// new WindowOpenUrl(((GWTUrlDocument) result).getUrl(), "_blank", "");
GWT.log("URL_DOCUMENT Open " + ((GWTUrlDocument) result).getUrl());
}
else{
new WindowOpenUrl(((GWTExternalUrl) result).getUrl(), "_blank", "");
// new WindowOpenUrl(((GWTExternalUrl) result).getUrl(), "_blank", "");
newBrowserWindow.setUrl(((GWTExternalUrl) result).getUrl());
GWT.log("ExternalUrl Open " + ((GWTExternalUrl) result).getUrl());
}

View File

@ -692,12 +692,13 @@ public class GWTWorkspaceBuilder {
case SHARED_FOLDER:
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
//TODO
/*
logger.debug("******START");
logger.debug("wsFolder.isShared(): "+shared.isShared());
logger.debug("wsFolder.getType().equals(WorkspaceItemType.SHARED_FOLDER): "+shared.getType().equals(WorkspaceItemType.SHARED_FOLDER));
logger.debug("shared.isVreFolder(): "+shared.isVreFolder());
logger.debug("*******END");
*/
String name = shared.isVreFolder()?shared.getDisplayName():item.getName();
fileModel = new FolderModel(item.getId(), name, parentFolderModel, true, true, shared.isVreFolder());
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
@ -1254,9 +1255,10 @@ public class GWTWorkspaceBuilder {
logger.debug("shared.isVreFolder(): "+shared.isVreFolder());
name = shared.isVreFolder()?shared.getDisplayName():wsFolder.getName();
/*
if(shared.isVreFolder())
logger.debug("shared.getDisplayName(): "+shared.getDisplayName());
*/
//MANAGEMENT SPECIAL FOLDER
}else if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot()){
//MANAGEMENT SPECIAL FOLDER
@ -2024,7 +2026,7 @@ public class GWTWorkspaceBuilder {
fileTrashModel.setShared(false);
logger.debug("Converting return trash item: "+fileTrashModel);
logger.debug("Converting return trash item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
return fileTrashModel;