cancel
Showing results for 
Search instead for 
Did you mean: 

Task-edit web preview

pat9rv3sousa
Champ on-the-rise
Champ on-the-rise
I want to implement a preview of the document in the form of the task-edit of the workflows… How can I do this? I try to adapt the document-details.xml and document-details.ftl to workflow-details.xml and workflow-details.ftl but not works. I tried to copy the components that have web-preview of the document-details files to workflow-details. Any hint to make this?

I have this in workflow-details.ftl:


<#include "include/alfresco-template.ftl" />
<@templateHeader>
   <@script type="text/javascript" src="${url.context}/res/modules/documentlibrary/doclib-actions.js" group="document-details"/>
   <@link rel="stylesheet" type="text/css" href="${url.context}/res/components/document-details/document-details-panel.css" group="document-details"/>
   <@link rel="stylesheet" type="text/css" href="${url.context}/res/components/workflow/task-edit-header.css" group="workflow-details"/>
   <@templateHtmlEditorAssets />
</@>


<@templateBody>
   <@markup id="alf-hd">
   <div id="alf-hd">
      <@region scope="global" id="share-header" chromeless="true"/>
      <@region id="title" scope="template"/>
      <#if page.url.args.nodeRef??>
         <@region id="path" scope="template"/>
      </#if>
   </div>
   </@>
   <@markup id="bd">
   <div id="bd">
      <div class="share-form">
         <@region id="data-header" scope="page" />
         <div class="yui-gc">
            <div class="yui-u first">
                 <#if (config.scoped['WorkflowDetails']['workflow-details'].getChildValue('display-web-preview') == "true")>
                    <@region id="web-preview" scope="template"/>
                 </#if>
            </div>
         </div>
         <@region id="data-form" scope="page" />
         <@region id="data-actions" scope="page" />
      </div>
   </div>
   </@>
</@>

<@templateFooter>
   <@markup id="alf-ft">
   <div id="alf-ft">
      <@region id="footer" scope="global"/>
      <@region id="data-loader" scope="page" />
   </div>
   </@>
</@>


In workflow-details.xml I add this component:


<component>
         <region-id>web-preview</region-id>
         <sub-components>
            <sub-component id="default">
               <evaluations>
                  <evaluation>
                     <evaluators>
                        <evaluator type="config.component.evaluator">
                           <params>
                              <element>WorkflowDetails/workflow-details/display-web-preview</element>
                           </params>
                        </evaluator>
                     </evaluators>
                     <url>/components/preview/web-preview</url>
                     <properties>
                        <nodeRef>{nodeRef}</nodeRef>
                        <api>api</api>
                        <proxy>alfresco</proxy>
                        <dependencyGroup>workflow-details</dependencyGroup>
                     </properties>
                  </evaluation>
               </evaluations>
            </sub-component>
         </sub-components>
      </component>


This not shows the web-preview, only creates:


<div id="template_x002e_web-preview_x002e_workflow-details">
<div id="template_x002e_web-preview_x002e_workflow-details_x0023_default"> </div>
</div>


What's my error?
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

a task / workflow is not a document and cannot be previewed just by copying over the existing web-preview component. Any one task may contain none, one or many individual documents, either directly or within its content structure / folders. The web-preview component is only capable of previewing a single document that is provided at page load time (i.e. via the nodeRef= parameter in the page URL).
In order to preview documents from the task contents, you basically need to create a new preview component / module that you can control from within the task form, i.e. when the user clicks on an action for a specific document in that task. It is not possible just by adapting / copying the existing component.

I once implemented such a feature for a customer and overall it took me (a full time professional) about a weeks worth of work. That was back in Alfresco 3.4 and I don't have access to the source anymore, so can't provide any snippets.

Regards
Axel

But in the task-edit I have nodeRef of the document attached to the workflow, and I want to make in a form, a way to preview the document. It's not possible? Like in the document-details. I have nodeRef so , I think it's possible . Or not?

afaust
Legendary Innovator
Legendary Innovator
In the task-edit you CAN have a nodeRef of the document attached, but you can also have MULTIPLE documents attached or NONE at all. The point is that there is no guaranteed / stable link and as such an external component (that is NOT part of the edit form itself) can't be used to render an attached document.
You can of course use the preview as a component WITHIN the edit form, but this is a more complex to achieve. It is definitely not simple enough to just drop some snippets/ideas here and hope you can take it from there…

And how can I achieve this ?

Suppose that workflow has 1 document only, I can't use a preview for this?

Or suppose that I want to put a preview in a page that has only a nodeRef in a link, in a simple page that I create, how can I embbed the preview (not in Aikau page… in a simple page Surf)?