05-07-2012 12:56 PM
<action id="ext.plugin.doclib.action.version-difference" type="javascript" label="action.label.version-diff"
icon="../../../components/documentlibrary/actions/version-diff-icon">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">version-difference</param>
<param name="mode">create</param>
<param name="destination">{node.nodeRef}</param>
<param name="failureMessage">message.version-diff.failure</param>
<evaluator>evaluator.doclib.action.versionDiffMimetype</evaluator>
</action>
/*
* Form parameters:
*/
public static final String PARAM_VDIFF_MAJOR_VERS = "major-vers-number";
public static final String PARAM_VDIFF_MINOR_VERS = "minor-vers-number";
…
…
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
paramList.add(new ParameterDefinitionImpl(
PARAM_VDIFF_MAJOR_VERS,
DataTypeDefinition.TEXT,
true,
getParamDisplayLabel(PARAM_VDIFF_MAJOR_VERS)));
…
…
05-08-2012 08:15 AM
/** Standard action result parameter name */
public static String PARAM_RESULT = "result";
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) {
if (this.nodeService.exists(actionedUponNodeRef))
{
// Get the parent node
int count = this.nodeService.getChildAssocs(actionedUponNodeRef).size();
ruleAction.setParameterValue(PARAM_RESULT, Integer.valueOf(count));
}
}
05-08-2012 08:41 AM
05-08-2012 09:10 AM
You can't.ok so how can I run the action asynchronously?
If you are running your action synchronously then you get the result and continue with the next page in the dialog.
05-09-2012 04:28 AM
[size=150]Simple Dialogs[/size]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
To launch any dialog an action is prefixed with dialog:. Whenever the Alfresco navigation handler see a dialog prefix on an action the current page is added to a stack so it knows where to come back to when the dialog is closed.
05-10-2012 03:29 AM
<action id="ext.plugin.doclib.action.declarative" type="pagelink" label="Declarative"
icon="../../../components/documentlibrary/actions/version-diff-icon">
<param name="page">version-difference?nodeRef={node.nodeRef}</param>
<evaluator>evaluator.doclib.action.versionDiffMimetype</evaluator>
</action>
diffhook.get.jsvar connector = remote.connect("alfresco");
var data = connector.get("/docdiff/declarative.json");
// create json object from data
var result = eval('(' + data + ')');
model.diffhooked = result;
template-instances/page_template.xml
….
<!– Custom Component –>
<component>
<region-id>doclib-custom</region-id>
<url>/components/diffhook</url> <!– call to the diffhook.get.js webscript –>
</component>
</components>
</template-instance>
all this code works fine, well I thought that I can try to implement a dialog with the YUI library directly for the diffhook.get.js (with a diffhook.get.html.ftl file) and handle the parameter passage through the Javascript code and build the URL with the parameters I've to pass to the repository webscript like that:…some code to catch the passed parameters…sorry for the bad pseudocode but I have not managed to look the part on JavaScript, which I'm learning the basics at this time.. but the behind concept is this..
var connector = remote.connect("alfresco");
var data = connector.get("/docdiff/declarative.json?args=argument");
// create json object from data
var result = eval('(' + data + ')');
model.diffhooked = result;
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.