cancel
Showing results for 
Search instead for 
Did you mean: 

4.0c removing UI actions works on windows but not in linux

ggates1
Champ in-the-making
Champ in-the-making
Hi,

I am customizing UI Actions Menus to reduce the actions that a user can take when dealing with a document.  One of the UI Actions I want to remove is  Publish which on windows does not show within either the document browse action menu or the document details action menu after editing the share-documentlibrary-config.xml.  However, I deployed the share-documentlibrary-config.xml file from the windows instance to the linux instance location /opt/alfresco-4.0.c/tomcat/webapps/share/WEB-INF/classes/alfresco. When I restarted the linux server I see the Publish UI action in both UI Actions Menus.

Any clues would be of great help as I am new to alfresco.

Thanks
George

Here is how i am disabling the Publish UI action

<!– Publish document… set to negate="false" by ggates 2/22/2012–>
         <action id="document-publish" type="javascript" label="actions.document.publish">
               <param name="function">onActionPublish</param>
               <evaluator negate="false">evaluator.doclib.action.isLocked</evaluator>
         </action>
13 REPLIES 13

jpotts
World-Class Innovator
World-Class Innovator
Hi George,

It is not a good idea to change any of the files distributed with Alfresco unless there is no other way to do what you are trying to do. Instead, you should use the "extension" mechanism. Also, in Alfresco 4 it is really easy to turn off an action. Check it out:

1. Create a directory called web-extension under $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco
2. Create a file called share-config-custom.xml with the following content:
<alfresco-config><config evaluator="string-compare" condition="DocLibActions">    <actions>         <!– Publish document –>         <action id="document-publish" type="javascript" label="actions.document.publish">            <param name="function">onActionPublish</param>            <evaluator>evaluator.doclib.action.disableAction</evaluator>         </action>    </actions></config></alfresco-config>‍‍‍‍‍‍‍‍‍‍‍
3. Save the file.
4. Restart Tomcat
5. The action will not appear.

All I'm doing here is overriding the definition of the "document-publish" action, and I'm giving it a new evaluator that disables the action.

Jeff

ggates1
Champ in-the-making
Champ in-the-making
Ah yes I see you wrapped the action tag and changed the property of the evaluator to disable.  This is slick…thanks i will give it a try.  I assume I can do these with all the ui action I want to disable. Will this also work for View in Google maps  ui action?


Thanks for the quick response

George

jpotts
World-Class Innovator
World-Class Innovator
George,

It should work for all actions.

Jeff

ggates1
Champ in-the-making
Champ in-the-making
Jeff,

It there a way to remove UI Actions by user?  As the extension takes is out for all.

Thanks
George

jpotts
World-Class Innovator
World-Class Innovator
You can look through the out-of-the-box evaluators in the Share web app to see what is available. If you grep for "<bean id=\"evaluator.doclib" you'll see they all live in slingshot-documentlibrary-context.xml. I do not see one that is based on username or group. The closest is "EditableByCurrentUser".

It is possible to write your own evaluator. It's just a Java class. So you could have an evaluator that would match on username or group name and then configure the specific user or group name in Spring, then point to the evaluator in your form config.

Jeff

nua76
Champ on-the-rise
Champ on-the-rise
Hello  jpotts

Thanks works fine on " publish"  any chance to get the portion of code to hide workflows

thanks  Smiley Happy

jpotts
World-Class Innovator
World-Class Innovator
Sorry, NUA76, I don't know what you are asking for.

Jeff

nua76
Champ on-the-rise
Champ on-the-rise
George ask you how to hide "publish" action  on the document list action ,

i have followed your exemple and it works perfectly  on my side  "publish " action is hide

this is the portion of code to do it
<alfresco-config>
<config evaluator="string-compare" condition="DocLibActions">
    <actions>
         <!– Publish document –>
         <action id="document-publish" type="javascript" label="actions.document.publish">
            <param name="function">onActionPublish</param>
            <evaluator>evaluator.doclib.action.disableAction</evaluator>
         </action>
    </actions>
</config>
</alfresco-config>

you wrapped the action tag and changed the property of the evaluator to disable

my new query was , i want to do exactly the same with the  "start worlflow action"  ( hide the start workflow action )
my question was,   can you write the code exemple to apply  hiden action  "start workflow "

Smiley Surprisedops:

jpotts
World-Class Innovator
World-Class Innovator
NUA76,

I see, thanks for clarifying. To hide the "Start Workflow" action you'd follow the exact same procedure. In that case, the action is called "document-assign-workflow", so to hide it, you'd do this:
         <!– Assign workflow –>         <action id="document-assign-workflow" type="javascript" label="actions.document.assign-workflow">            <param name="function">onActionAssignWorkflow</param>            <evaluator>evaluator.doclib.action.disableAction</evaluator>         </action>‍‍‍‍‍

If you are also hiding "document-publish" or some other action, add this immediately following the other action's "</action>" tag and before the "</actions>" tag.

Jeff
Welcome to the new Hyland Connect. Get started or submit feedback.