Saturday, November 30, 2013

Disable Download Action in offline editing



      How to disable Download Action in Document Library when a document is locked for offline editing?

Using Evaluator: evaluator.doclib.action.isWorkingCopy (An OOTB evaluator which checks whether a node is a working copy or not), we can configure Download Action to be visible or not in the UI.

Add the following entry in Alfresco_Home/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file.

< !-- Document Library Actions config section -- >
< config evaluator="string-compare" condition="DocLibActions" >

    < !--
       Action definitions
    -- >
    < actions >
       
       < !-- Download document -- >
       < action id="document-download" type="link" label="actions.document.download" >
         
         < param name="href" >{downloadUrl}</ param >

       < !--
       Evaluator to Disable Download action when document is locked by a user
       -- >
          < evaluator negate="true" >evaluator.doclib.action.isWorkingCopy</ evaluator >
       </ action >


    </ actions >
</ config >

     For more info, refer following link: 

Disable Publish Action in Share Document Library


      How to disable Publish Action in Document Library for all the users?

Using Evaluator, we can configure Document Actions to be visible or not in the UI.

Add the following entry in Alfresco_Home/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file.


< !-- Document Library Actions config section -- >
<config evaluator="string-compare" condition="DocLibActions">

    < !--
       Action definitions
    -- >
    < actions>

        < !-- Publish document -- >
         < action id="document-publish" type="javascript" label="actions.document.publish" >

            <param name="function">onActionPublish</param>

            < !--
             Evaluator to disable Pulish Document Action for all users.
            -- >
            < evaluator>evaluator.doclib.action.disableAction</ evaluator>

            < evaluator negate="true"> evaluator.doclib.action.isLocked</ evaluator>
         </ action>

    </ actions>
</ config>

evaluator.doclib.action.disableAction :  This is an OOTB evaluator which always return false.

For more info, refer following link:
OOTB evaluators: http://wiki.alfresco.com/wiki/Document_Library_Predefined_Evaluators