summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-11-21 02:54:33 (EST)
committer Sven Rottstock2012-11-21 02:54:33 (EST)
commita7d695c31a5f50eeea9d849b2fc85e70ef0ab7aa (patch)
tree5cfc9c28a2290b5e7b39203868138cdff3d5890d
parenta1b3da3e6cccb01529f5cf54382b2443256aea29 (diff)
downloadorg.eclipse.stardust.ui.web-a7d695c31a5f50eeea9d849b2fc85e70ef0ab7aa.zip
org.eclipse.stardust.ui.web-a7d695c31a5f50eeea9d849b2fc85e70ef0ab7aa.tar.gz
org.eclipse.stardust.ui.web-a7d695c31a5f50eeea9d849b2fc85e70ef0ab7aa.tar.bz2
Jira-ID: CRNT-26901
Merged the changes for document autoDownload for CRNT-19409 from 7.0.1 - SP20 to 7.1 git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@60974 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--portal-common/src/main/resources/META-INF/xhtml/UiUtils.js9
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/manual/IppDocumentInputController.java7
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/docmgmt/upload/AbstractDocumentUploadHelper.java2
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/DocumentHandlerBean.java39
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/extension/toolbar/documentViewToolbar.xhtml5
-rw-r--r--views-common/src/main/resources/META-INF/xhtml/views/document/documentView.xhtml6
-rw-r--r--views-common/src/main/resources/views-common-messages_en.properties2
7 files changed, 67 insertions, 3 deletions
diff --git a/portal-common/src/main/resources/META-INF/xhtml/UiUtils.js b/portal-common/src/main/resources/META-INF/xhtml/UiUtils.js
index b122858..9c6f95b 100644
--- a/portal-common/src/main/resources/META-INF/xhtml/UiUtils.js
+++ b/portal-common/src/main/resources/META-INF/xhtml/UiUtils.js
@@ -28,3 +28,12 @@ function softClick(type,linkName)
function String_endsWith(str,subStr) {
return str.length >= subStr.length && (str.substring(str.length - subStr.length) == subStr);
}
+
+function softClickHtmlLink(id)
+{
+ var aLink = document.getElementById(id);
+ if(aLink)
+ {
+ aLink.click();
+ }
+}
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/manual/IppDocumentInputController.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/manual/IppDocumentInputController.java
index 8b043ed..35552b0 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/manual/IppDocumentInputController.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/manual/IppDocumentInputController.java
@@ -75,6 +75,7 @@ public class IppDocumentInputController extends DocumentInputController implemen
private boolean enableOpenDocument = true;
private Document documentToBeMoved;
private Document documentToBeDeleted;
+ private boolean disableAutoDownload;
/**
* @param path
@@ -136,6 +137,10 @@ public class IppDocumentInputController extends DocumentInputController implemen
params.put("processInstance", activityInstance.getProcessInstance());
params.put("dataPathId", dataMapping.getDataPath());
params.put("dataId", dataMapping.getDataId());
+ if(disableAutoDownload)
+ {
+ params.put("disableAutoDownload", disableAutoDownload);
+ }
documentView = DocumentViewUtil.openDataMappingDocument(activityInstance.getProcessInstance(),
dataMapping.getDataId(), docInfo, params);
PortalApplication.getInstance().registerViewDataEventHandler(documentView, this);
@@ -212,10 +217,12 @@ public class IppDocumentInputController extends DocumentInputController implemen
fireEvent(DocumentInputEventType.UPLOADED, null);
if (fileWrapper.isOpenDocument())
{
+ disableAutoDownload = true;
viewDocument();
}
}
refreshPortalSession();
+ disableAutoDownload = false;
}
catch (Exception e)
{
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/docmgmt/upload/AbstractDocumentUploadHelper.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/docmgmt/upload/AbstractDocumentUploadHelper.java
index 5500a35..4ecf21c 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/docmgmt/upload/AbstractDocumentUploadHelper.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/docmgmt/upload/AbstractDocumentUploadHelper.java
@@ -353,6 +353,7 @@ public abstract class AbstractDocumentUploadHelper implements Serializable
if (fileWrapper.isOpenDocument())
{
+ viewParam.put("disableAutoDownload", true);
openDocument(updatedDocument);
}
}
@@ -376,6 +377,7 @@ public abstract class AbstractDocumentUploadHelper implements Serializable
informInitiator(DocumentUploadEventType.DOCUMENT_CREATED, updatedDocument);
if (fileWrapper.isOpenDocument())
{
+ viewParam.put("disableAutoDownload", true);
openDocument(updatedDocument);
}
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/DocumentHandlerBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/DocumentHandlerBean.java
index 93d4cac..c982d51 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/DocumentHandlerBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/document/DocumentHandlerBean.java
@@ -12,6 +12,7 @@ package org.eclipse.stardust.ui.web.viewscommon.views.document;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import javax.faces.component.UIComponent;
import javax.faces.event.ActionEvent;
@@ -102,9 +103,12 @@ public class DocumentHandlerBean extends UIComponentBean implements ViewEventHan
private boolean disableSaveAction;
private boolean embededView;
private boolean loadSuccessful = false;
+ private boolean disableAutoDownload = false;
private String loadUnsuccessfulMsg;
private ConfirmationDialog confirmationDialog;
+ private String autoDownloadLinkId;
+
/**
* default constructor
*/
@@ -184,6 +188,15 @@ public class DocumentHandlerBean extends UIComponentBean implements ViewEventHan
popOutDocument();
}
+ // disableAutoDownload : true when DocumentViewer opened after FileUpload for
+ // UnsupportedFileType when OpenDocument check is true
+ if (null == contentHandler && !embededView && !disableAutoDownload)
+ {
+ autoDownloadLinkId = "autoClickToDownload" + new Random().nextInt(10000);
+ PortalApplication.getInstance().addEventScript(
+ "softClickHtmlLink('" + autoDownloadLinkId + "')");
+ }
+
loadSuccessful = true;
}
else if (ViewEventType.ACTIVATED == event.getType())
@@ -325,6 +338,20 @@ public class DocumentHandlerBean extends UIComponentBean implements ViewEventHan
disableSaveAction = Boolean.valueOf((String) disableSaveActionObj);
}
}
+
+ Object disableAutoDownloadObj = thisView.getViewParams().get("disableAutoDownload");
+
+ if (null != disableAutoDownloadObj)
+ {
+ if (disableAutoDownloadObj instanceof Boolean)
+ {
+ disableAutoDownload = (Boolean) disableAutoDownloadObj;
+ }
+ else
+ {
+ disableAutoDownload = Boolean.valueOf((String) disableAutoDownloadObj);
+ }
+ }
return true;
}
@@ -1223,4 +1250,16 @@ public class DocumentHandlerBean extends UIComponentBean implements ViewEventHan
{
this.confirmationDialog = confirmationDialog;
}
+
+ public String getAutoDownloadLinkId()
+ {
+ return autoDownloadLinkId;
+ }
+
+ public boolean isDisableAutoDownload()
+ {
+ return disableAutoDownload;
+ }
+
+
} \ No newline at end of file
diff --git a/views-common/src/main/resources/META-INF/xhtml/extension/toolbar/documentViewToolbar.xhtml b/views-common/src/main/resources/META-INF/xhtml/extension/toolbar/documentViewToolbar.xhtml
index 0a98a01..6e34a65 100644
--- a/views-common/src/main/resources/META-INF/xhtml/extension/toolbar/documentViewToolbar.xhtml
+++ b/views-common/src/main/resources/META-INF/xhtml/extension/toolbar/documentViewToolbar.xhtml
@@ -65,10 +65,11 @@
image="/plugins/views-common/images/icons/external.png"
title="#{documentHandlerBean.messages['popOut.title']}"
action="#{documentHandlerBean.popOutDocument}" immediate="true"
- styleClass="toolbar-button">
+ styleClass="toolbar-button"
+ disabled="#{documentHandlerBean.contentHandler == null}">
<pc:automationTag value="auto-COM-DocView-ToolbarPopOutDoc"
standAlone="false" />
- </ice:commandButton>
+ </ice:commandButton>
<ice:commandButton rendered="#{documentHandlerBean.poppedOut}"
image="/plugins/views-common/images/icons/external_sw.png"
diff --git a/views-common/src/main/resources/META-INF/xhtml/views/document/documentView.xhtml b/views-common/src/main/resources/META-INF/xhtml/views/document/documentView.xhtml
index 1b89fa9..f027d2d 100644
--- a/views-common/src/main/resources/META-INF/xhtml/views/document/documentView.xhtml
+++ b/views-common/src/main/resources/META-INF/xhtml/views/document/documentView.xhtml
@@ -207,6 +207,12 @@
<ice:outputText value="#{documentHandlerBean.messages['popout.message']}" />
</ice:panelGroup>
</ice:panelGroup>
+
+ <c:if test="#{not empty documentHandlerBean.autoDownloadLinkId}">
+ <a id="#{documentHandlerBean.autoDownloadLinkId}" name="#{documentHandlerBean.autoDownloadLinkId}"
+ target="_blank" style="display: none; visibility: hidden"
+ href="#{facesContext.externalContext.requestContextPath}#{documentHandlerBean.documentContentInfo.URL}">Auto Click</a>
+ </c:if>
</ice:panelGroup>
<ice:panelGroup rendered="#{not documentHandlerBean.loadSuccessful}">
diff --git a/views-common/src/main/resources/views-common-messages_en.properties b/views-common/src/main/resources/views-common-messages_en.properties
index d600a72..80cbb2e 100644
--- a/views-common/src/main/resources/views-common-messages_en.properties
+++ b/views-common/src/main/resources/views-common-messages_en.properties
@@ -875,7 +875,7 @@ views.documentView.versionToolBar.showNextVersion=Show Next Version
views.documentView.versionToolBar.revertToVersion=Revert To Version
views.documentView.versionToolBar.print=Print
-views.documentView.message.unsupportedContentMsg=Unsupported file type. Click the download icon to download the file and select a viewing application.
+views.documentView.message.unsupportedContentMsg= Download the file to view its content.
views.documentView.message.urlNotAvailablemsg = URL not available.
views.documentView.message.alreadyOpenInActivityPanel = Document is already open in Activity Panel.