Hi,I'm trying to create a custom DocLib action on Share that opens a new window with an URL that needs to be created by a webscript before (based on the node-ref).I followed this example: http://ecmstuff.blogspot.de/2012/04/adding-document-library-actions-in.htmlIt works fine so far and it seems to be exactly what I'm looking for. But the example sends only an email and return with a message. What I need is, that the webscript should return a result that includes already the full URL. And based on this URL a new window has to be opened.It fails on my missing knowledge in creating the custom javascript with the Yahoo stuff… 😞The DocLib (share-config-custom.xml) that creates the new action is defined as:
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="myCompany.doclib.action.openExternal"
icon="myCompanyIcon"
type="javascript"
label="actions.myCompany.openExternal">
<param name="function">onActionOpenExternal</param>
<param name="successMessage">message.openExternal.success</param>
<param name="failureMessage">message.openExternal.failure</param>
<evaluator>myCompany.doclib.action.openExternal</evaluator>
</action>
</actions>
<actionGroups>
<actionGroup id="document-browse">
<action index="400" id="myCompany.doclib.action.openExternal" />
</actionGroup>
<actionGroup id="document-details">
<action index="400" id="myCompany.doclib.action.openExternal" />
</actionGroup>
</actionGroups>
</config>
And this is the custom javascript that creates the current result and invokes the webscript:
(function() {
YAHOO.Bubbling.fire("registerAction",
{
actionName: "onActionopenExternal",
fn: function myCompany_onActionOpenExternalProgram(file) {
this.modules.actions.genericAction(
{
success:
{
//window.open('<URL based on the webscript response below>') ???
message: this.msg("message.openExternal.success", file.displayName, Alfresco.constants.USERNAME)
},
failure:
{
message: this.msg("message.openExternal.failure", file.displayName, Alfresco.constants.USERNAME)
},
webscript:
{
name: "myCompany/openExternal?nodeRef={nodeRef}&userName={userName}",
stem: Alfresco.constants.PROXY_URI,
method: Alfresco.util.Ajax.GET,
params:
{
nodeRef: file.nodeRef,
userName: Alfresco.constants.USERNAME
}
},
config:
{
}
});
}
});
})();
As I mentioned, it works fine. My Java backed webscript on the repository tier will be invoked and I get the "message.openExternal.success" after clicking my new action in the Share GUI.Maybe anyone of you would be so kind to give me some tips on how I can solve this issue? Is this an adequate approach at all? Or are the other / better approaches? If not, how can I get the result of the webscript section and open a new popup with the result value? Many thanks! 🙂