AnsweredAssumed Answered

How to call existing Alfresco.doclib.Actions from custom doc action?

Question asked by why-pengo on Oct 17, 2013
Latest reply on Oct 21, 2013 by why-pengo
Hi,

I've created a custom document action to wrap the onActionCancelEditing
document action with a warning message, like this:


YAHOO.Bubbling.fire("registerAction", {
    actionName: "sgiOnActionCancelEditing",
    fn: function sgi_onActionCancelEditing(record)
    {
        var displayName = record.displayName;

        var rv = confirm("WARNING! You are about to delete this working copy and any edits you may have made!");
        if (rv === true) {
            Alfresco.doclib.Actions.prototype.onActionCancelEditing(record);
        }
    }
});


Also did the share-config-custom.xml change:


            <!– Cancel editing (cancel checkout) –>
            <action id="document-cancel-editing"
                    type="javascript"
                    label="actions.document.cancel-editing">
                <param name="function">sgiOnActionCancelEditing</param>
                <permissions>
                   <permission allow="true">CancelCheckOut</permission>
                </permissions>
                <evaluator>evaluator.doclib.action.isWorkingCopy</evaluator>
                <evaluator>evaluator.doclib.action.editableByCurrentUser</evaluator>
            </action>

and:

    <config evaluator="string-compare" condition="DocLibCustom" replace="true">
        <dependencies>
            <!– js src="components/sgi-object-finder/sgi-cancelEdit-min.js" / –>
            <js src="components/sgi-object-finder/sgi-cancelEdit.js" />
        </dependencies>
    </config>

I now have the popup warning and can step through the javascript in Firebug, but
my call to Alfresco.doclib.Actions.prototype.onActionCancelEditing(); does not cancel
the edit. How do I call this method?

Thanks for any help,

-jon

Outcomes