Task edit document preview component Alfresco - alfresco

First question:
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?
Second question:
In the preview of the Aikau page I get: Warning: unimplemented annotation type: Widget signature in the console of the firebug of the Mozilla Firefox and the document is displayed without the digital signatures... But, for example, if I upload a document with a digital signature, I can see the document with the signature in the page of document-details of the document. The preview of this page is different? How can I implement this preview?

The main problem you have here is that the you don't have any nodeRef request parameter when viewing a workflow task (this is mapped to the {nodeRef} token that is assigned to the <nodeRef> element in the web-preview component. As a result the web-preview WebScript will not have a node to render.
You are either going to need to make a customization such that the nodeRef of the attached file is included as a request parameter when viewing the workflow task or use your own WebScript (other than the web-preview WebScript) in order to access the nodeRef of the document to preview.
A couple of other things to consider here, is that it is entirely possible to have more than one document assigned to a workflow, so you'd need to handle that scenario (i.e. which document is previewed, or how to preview all documents).
I don't think that this is going to be a simple customization though.

It can be easier to just use the javascript previewer that is integrated in share (pdf.js). If you use directly the javascript library, it shouldn't be difficult to open a preview.
There are examples in the official site of the project: pdf.js
you can use the share webscript to initialise the javascript with the list of urls of the documents attached to the workflow. If the document attached is not a pdf, you will need to use its pdf rendition.

For future references. You can do it as follows (example):
Create Share extension and add the following container to the /src/main/amp/config/alfresco/templates/org/alfresco/workflow-details.ftl:
<div class="yui-gc">
<div class="yui-u first">
<#if (config.scoped['DocumentDetails']['document-details'].getChildValue('display-web-preview') == "true")>
<#region id="web-preview" scope="template"/>
</#if>
</div>
</div>
Also add the same #templateHeader as in the document-details.ftl. Your workflow-details.ftl will look like this:
<#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"/>
<#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" />
<#region id="data-form" scope="page" />
<div class="yui-gc">
<div class="yui-u first">
<#if (config.scoped['DocumentDetails']['document-details'].getChildValue('display-web-preview') == "true")>
<#region id="web-preview" scope="template"/>
</#if>
</div>
</div>
<#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>
</#>
</#>
Add the WebPreview component to the \src\main\amp\config\alfresco\site-data\template-instances\workflow-details.xml:
<!-- WebPreview -->
<component>
<region-id>web-preview</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="config.component.evaluator">
<params>
<element>DocumentDetails/document-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>document-details</dependencyGroup>
</properties>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
Your workflow-details.xml will look like this:
<?xml version='1.0' encoding='UTF-8'?>
<template-instance>
<template-type>org/alfresco/workflow-details</template-type>
<properties>
<pageFamily>documentlibrary</pageFamily>
</properties>
<components>
<!-- Site Navigation -->
<component>
<region-id>navigation</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<!-- if referred from my tasks page: Task toolbar -->
<evaluation id="tasks">
<evaluators>
<evaluator type="equals.component.evaluator">
<params>
<referrer>{referrer}</referrer>
<tasks>tasks</tasks>
</params>
</evaluator>
</evaluators>
<url>/components/workflow/task-toolbar</url>
</evaluation>
<!-- if referred from my workflows page: Workflows toolbar -->
<evaluation id="workflows">
<evaluators>
<evaluator type="equals.component.evaluator">
<params>
<referrer>{referrer}</referrer>
<workflows>workflows</workflows>
</params>
</evaluator>
</evaluators>
<url>/components/workflow/workflow-toolbar</url>
</evaluation>
<!-- if in site: Site navigation -->
<evaluation id="site">
<evaluators>
<evaluator type="site.component.evaluator"/>
</evaluators>
<url>/components/navigation/collaboration-navigation</url>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<!-- WebPreview -->
<component>
<region-id>web-preview</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="config.component.evaluator">
<params>
<element>DocumentDetails/document-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>document-details</dependencyGroup>
</properties>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<!-- Path -->
<component>
<region-id>path</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<!-- if in site: Site title -->
<evaluation id="site">
<evaluators>
<evaluator type="site.component.evaluator"/>
</evaluators>
<url>/components/document-details/path</url>
</evaluation>
<!-- otherwise: Repository title -->
<evaluation id="repo">
<url>/components/document-details/repo/path</url>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
</components>
</template-instance>
If you want to place the component in an arbitrary region, you may need to use JavaScript, for example:
...
var container = YAHOO.util.Dom.get('user-list');
var web_preview = YAHOO.util.Dom.get('template_x002e_web-preview_x002e_workflow-details_x0023_default');
YAHOO.util.Dom.insertAfter(web_preview, container);
...
The container with ID==user-list I placed in the userdetails.ftl which added to the share-config-custom.xml as follows:
...
<field id="mswf:userDetails" set="userDetails" label="...">
<control template="/org/alfresco/components/form/controls/workflow/userdetails.ftl" />
</field>
...
The result may look as shown below.

Here is an easier solution that handles multiple documents and uses web-preview component:
In your share-config-custom.xml override packageItems field:
<field id="packageItems" set="items">
<control template="/com/yourdomain/components/form/controls/workflow/packageitems.ftl" />
</field>
Control template (/com/yourdomain/components/form/controls/workflow/packageitems.ftl):
<#include "/org/alfresco/components/form/controls/workflow/packageitems.ftl" />
<#assign el>${controlId}-wp</#assign>
<#assign dependencyGroup="web-preview">
<#include "/org/alfresco/components/preview/include/web-preview-css-dependencies.lib.ftl" />
<#include "/org/alfresco/components/preview/include/web-preview-js-dependencies.lib.ftl" />
<div class="yui-g" id="${el}"></div>
<script type="text/javascript">//<![CDATA[
(function(){
var nodeRefs = ("${field.value?html}" || "").split(',');
for (var ni = 0; ni < nodeRefs.length; ni++) {
Alfresco.util.loadWebscript({
url: Alfresco.constants.URL_SERVICECONTEXT + "components/preview/web-preview",
properties: { nodeRef: nodeRefs[ni], htmlid: "${el}-preview-" + ni},
target: "${el}"
});
}
})();
//]]></script>

Related

How to edit template-instance of start workflow page in Alfresco Share?

I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>

to hide custom workflow from another site alfresco share

I need to hide custom workflow list for folders/documents present in " MyFiles " and other sites areas.Doing that from "show-site-workflow-modules.xml " with this configuration(code below), hides workflows from "workflows that I have started" also,which is terribly wrong.
<module>
<id>General_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>.*</sites>
<sitePresets>.*</sitePresets>
<applyForNonSites>true</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all Custom workflows -->
<workflow name="customactiviti$xxxx" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<task type="customwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>
<module>
<id>xxx_Conditional_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>xxx-xxx-xxx</sites>
<applyForNonSites>false</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all WCM related workflows -->
<workflow name="activiti$activitiAdhoc" />
<workflow name="activiti$activitiInvitationModerated" />
<workflow name="activiti$activitiInvitationNominated" />
<workflow name="activiti$activitiInvitationNominatedAddDirect" />
<workflow name="activiti$activitiParallelGroupReview" />
<workflow name="activiti$activitiParallelReview" />
<workflow name="activiti$activitiReview" />
<workflow name="activiti$activitiReviewPooled" />
<workflow name="activiti$publishWebContent" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<!-- Hide all WCM related tasks -->
<task type="wcmwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>

FluidTYPO3 duplicated Content Modules with Flux Grid at TYPO3 Backend

I'm using TYPO3 7.6with the latest Flux-, VHS- and FluidcontentExtensions (FluidTYPO3). I've wrote a new FLUX-Content Element, a Tab-Container from Zurb Foundation 6.
The element is working fine (frontend), but at backend I have a row with my tabs and also columns .. sth. will dublicated my tabs and the content inside?! Already cleared Cache.
Here's a screenshot. The Tab-Elements will be dublicated, I don't know why?
My FLUX FCE:
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="tabs" options="{group: 'LLL:typo3conf/ext/myelements/Resources/Private/Language/locallang.xlf:grid.elements'}">
<flux:form.sheet name="tabs">
<flux:form.section name="tabs">
<flux:form.object name="tab">
<flux:field.input name="title" />
<flux:field.input name="class" />
<flux:field.checkbox name="active" />
</flux:form.object>
</flux:form.section>
</flux:form.sheet>
<flux:grid>
<flux:grid.row>
<f:if condition="{tabs}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<flux:form.content name="content.{iteration.index}" label="Tab {iteration.cycle}" />
</f:for>
</f:if>
</flux:grid.row>
</flux:grid>
</flux:form>
</f:section>
<f:section name="Preview">
<flux:widget.grid />
</f:section>
<f:section name="Main">
<f:render section="Tabs" arguments="{_all}" />
<div class="tabs-content" data-tabs-content="tabs-{record.uid}">
<f:if condition="{tabs}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<div class="tabs-panel {f:if(condition: '{tab.tab.active} == 1', then: 'is-active')}" id="panel-{record.uid}-{iteration.index}">
<flux:content.render area="content.{iteration.index}" />
</div>
</f:for>
</f:if>
</div>
</f:section>
<f:section name="Tabs">
<f:if condition="{tabs}">
<ul class="tabs" data-tabs id="tabs-{record.uid}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<li class="tabs-title {f:if(condition: '{tab.tab.active} == 1', then: 'is-active')}">
{tab.tab.title}
</li>
</f:for>
</ul>
</f:if>
</f:section>
</div>
This is the problem:
<flux:widget.grid />
According to Release Notes of flux 7.2:
Preview Widget replaced
We have replaced the way Flux generates previews when a Grid is
involved. Before, Flux would render the Grid from the Fluid template
file which means the template had to be parsed (or loaded from
compiled cache) and then rendered, involving a significant amount of
processing. The content element container areas are now rendered by a
special View class, significantly increasing performance when working
with multiple nested elements.
The new behaviour:
Renders a Grid as content element container in the page module if your
template defines one, regardless of whether or not you have a Preview
section.
Deprecates flux:widget.grid which no longer has any function.
Removes all support for setting the Fluid template used to render the
Grid.
Basically, we sacrifice the rarely used template replacement
feature for increased performance in very frequently executed code.
So, simply remove complete Preview section from a template.
Thank you Viktor.
It's necessary to delete all flux.grid-stuff from yout template.
The whole preview section and some grid/rows at the configuration section.
That's the correct tab-template for fluxand zurb foundation:
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="Tabs" options="{group: 'LLL:typo3conf/ext/customerproject/Resources/Private/Language/locallang.xlf:grid.elements'}">
<flux:form.sheet name="tabs">
<flux:form.section name="tabs">
<flux:form.object name="tab">
<flux:field.input name="title" />
<flux:field.input name="class" />
<flux:field.checkbox name="active" />
</flux:form.object>
</flux:form.section>
</flux:form.sheet>
<f:if condition="{tabs}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<flux:form.content name="content.{iteration.index}" label="Tab {iteration.cycle}" />
</f:for>
</f:if>
</flux:form>
</f:section>
<f:section name="Main">
<div class="flux grid01Tabs">
<f:render section="Tabs" arguments="{_all}" />
<div class="tabs-content" data-tabs-content="tabs-{record.uid}">
<f:if condition="{tabs}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<div class="tabs-panel {f:if(condition: '{tab.tab.active} == 1', then: 'is-active')}" id="panel-{record.uid}-{iteration.index}">
<flux:content.render area="content.{iteration.index}" />
</div>
</f:for>
</f:if>
</div>
</div><!-- / tabWrap -->
</f:section>
<f:section name="Tabs">
<f:if condition="{tabs}">
<ul class="tabs" data-tabs id="tabs-{record.uid}">
<f:for each="{tabs}" as="tab" iteration="iteration">
<li class="tabs-title {f:if(condition: '{tab.tab.active} == 1', then: 'is-active')}">
{tab.tab.title}
</li>
</f:for>
</ul>
</f:if>
</f:section>
</div>

Seam pageflow example NumberGuess Not landing on to the second page

I'm trying to run simple Seam PageFlow example NumberGuss. I have deployed it on Jboss Server. When I access the URL it lands on the first page but if I hit any of the button provided on that page it says "The page isn't redirecting properly".On server log I found
SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-16) Error Rendering View[/debug.xhtml]: org.jboss.weld.context.NonexistentConversationException: WELD-000321: No conversation found to restore for id 1.
I'm using wildfly-8.1.0 and jboss-seam-2.3.1
Attaching pageflow.jpdl.xml and numberGuess.xhtml for reference. Please help me resolve the issue I'm facing.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.org/schema/seam/taglib">
<h:head>
<title>Guess a number...</title>
<link href="niceforms.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="niceforms.js"><!-- --></script>
</h:head>
<body>
<h1>Guess a number...</h1>
<h:form id="NumberGuessMain" styleClass="niceform">
<div>
<h:messages id="messages" globalOnly="true"/>
<h:outputText id="Higher"
value="Higher!"
rendered="#{numberGuess.randomNumber gt numberGuess.currentGuess}"/>
<h:outputText id="Lower"
value="Lower!"
rendered="#{numberGuess.randomNumber lt numberGuess.currentGuess}"/>
</div>
<div>
I'm thinking of a number between <h:outputText id="Smallest" value="#{numberGuess.smallest}"/> and
<h:outputText id="Biggest" value="#{numberGuess.biggest}"/>. You have
<h:outputText id="RemainingGuesses" value="#{numberGuess.remainingGuesses}"/> guesses.
</div>
<div>
Your guess:
<h:inputText id="inputGuess" value="#{numberGuess.currentGuess}" required="true" size="3"
rendered="#{(numberGuess.biggest-numberGuess.smallest) gt 20}">
<f:validateLongRange maximum="#{numberGuess.biggest}"
minimum="#{numberGuess.smallest}"/>
</h:inputText>
<h:selectOneMenu id="selectGuessMenu" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.selectMenuRendered}">
<s:selectItems id="PossibilitiesMenuItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
</h:selectOneMenu>
<h:selectOneRadio id="selectGuessRadio" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.radioButtonRendered}">
<s:selectItems id="PossibilitiesRadioItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
</h:selectOneRadio>
<h:commandButton id="GuessButton" value="Guess" action="guess"/>
<s:button id="CheatButton" value="Cheat" action="cheat"/>
<s:button id="GiveUpButton" value="Give up" action="giveup"/>
</div>
<div>
<h:message id="message" for="inputGuess" style="color: red"/>
</div>
</h:form>
</body>
</html>
<!--
An example of pageflow in jPDL. This exemplifies the
approach where action handlers are attached transitions
and decision nodes, instead of view components.
An alternative approach would be to attach all action
handlers to view components, and let the jPDL define
only the navigation rules.
-->
<pageflow-definition
xmlns="http://jboss.org/schema/seam/pageflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.org/schema/seam/pageflow http://jboss.org/schema/seam/pageflow-2.3.xsd"
name="numberGuess">
<start-page name="displayGuess" view-id="/numberGuess.xhtml">
<redirect/>
<transition name="guess" to="evaluateGuess">
<action expression="#{numberGuess.guess}"/>
</transition>
<transition name="giveup" to="giveup"/>
<transition name="cheat" to="cheat"/>
</start-page>
<decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
<transition name="true" to="win"/>
<transition name="false" to="evaluateRemainingGuesses"/>
</decision>
<decision name="evaluateRemainingGuesses" expression="#{numberGuess.lastGuess}">
<transition name="true" to="lose"/>
<transition name="false" to="displayGuess"/>
</decision>
<page name="giveup" view-id="/giveup.xhtml">
<redirect/>
<transition name="yes" to="lose"/>
<transition name="no" to="displayGuess"/>
</page>
<process-state name="cheat">
<sub-process name="cheat"/>
<transition to="displayGuess"/>
</process-state>
<page name="win" view-id="/win.xhtml">
<redirect/>
<end-conversation/>
</page>
<page name="lose" view-id="/lose.xhtml">
<redirect/>
<end-conversation/>
</page>
</pageflow-definition>
Resolved the issue.Weld is scanning the archive, which seems to cause the problem.The Weld Docs says:
You can either set this up for your deployment only by adding the following content to the META-INF/jboss-all.xml file of your application.
jboss-all.xml file goes to your META-INF for ear archive and likely to WEB-INF for war archive
<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss>
It worked for me.

Is it possible to make document picker default to document library in alfresco share?

I have a copy of association.ftl which I use for a control added to the advanced search form in share. Unfortunately when opened the default display is companyhome where as I'd rather have it default to the related site's document library.
I read this wiki and also tried the changing the parentNodeRef value in the javascript to at least add sites to the path to no success.
The share form config control:
<config evaluator="model-type" condition="cm:content">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="cm:name" force="true" />
<show id="space" force="true" />
</field-visibility>
<appearance>
<field id="cm:name" label-id="prop.search.cm_name" />
<field id="space" label-id="prop.search.cm_search_in_folder" >
<control template="/org/alfresco/components/form/controls/space.ftl">
<control-param name="startLocation">{doclib}</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
The freemarker control file :
<#include "common/picker.inc.ftl" />
<#assign controlId = fieldHtmlId + "-cntrl">
<script type="text/javascript">//<![CDATA[
(function()
{
<#renderPickerJS field "picker" />
picker.setOptions(
{
<#if field.control.params.showTargetLink??>
showLinkToTarget: ${field.control.params.showTargetLink},
<#if page?? && page.url.templateArgs.site??>
targetLinkTemplate: "${url.context}/page/site/${page.url.templateArgs.site!""}/document-details?nodeRef={nodeRef}",
<#else>
targetLinkTemplate: "${url.context}/page/document-details?nodeRef={nodeRef}",
</#if>
</#if>
<#if field.control.params.allowNavigationToContentChildren??>
allowNavigationToContentChildren: ${field.control.params.allowNavigationToContentChildren},
</#if>
itemType: "cm:folder",
multipleSelectMode: false,
parentNodeRef: "alfresco://company/home/sites", //<== Not the default path
<#if field.control.params.rootNode??>
rootNode: "${field.control.params.rootNode}",
</#if>
itemFamily: "node",
displayMode: "${field.control.params.displayMode!"items"}"
});
})();
//]]></script>
<div class="form-field">
<#if form.mode == "view">
<div id="${controlId}" class="viewmode-field">
<span class="viewmode-label">${field.label?html}:</span>
<span id="${controlId}-currentValueDisplay" class="viewmode-value current-values"></span>
</div>
<#else>
<label for="${controlId}">${field.label?html}:</label>
<div id="${controlId}" class="object-finder">
<div id="${controlId}-currentValueDisplay" class="current-values"></div>
<input type="hidden" id="${fieldHtmlId}" name="-" value="${field.value?html}" />
<input type="hidden" id="${controlId}-added" name="${field.name}_added" />
<input type="hidden" id="${controlId}-removed" name="${field.name}_removed" />
<div id="${controlId}-itemGroupActions" class="show-picker"></div>
<#renderPickerHTML controlId />
</div>
</#if>
</div>
The wiki is pretty clear on how to do this:
Supply a startLocation as parameter to the picker in the forms-config, since you want to go with the documentLibrary of the site the user searches from I would recommend you to implement a NodeLocator as described in the wiki:
https://wiki.alfresco.com/wiki/NodeLocatorService
In fact that seems to already have been implemented for you and seems to reside in the alfresco source:
http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2e/root/projects/repository/source/java/org/alfresco/repo/site/DocLibNodeLocator.java
However I cant find the bean declaration so you might have to add it to your spring-bean definitions (or copy the source to an own implementation) to be able to use it properly.

Resources