cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Custom Action in Share Using Predefined Evaluators

vamirr
Champ on-the-rise
Champ on-the-rise
I'm adding a custom action in share based on its mimetype.    Can I use the IsMimetype evaluator directly or do I have to make a child of that declared in another bean?

I'd like this action to only show on zip files.   In my Share config, I'm trying to use IsMimetype directly by feeding it a mimetypes list.   I can't get this working and I'm not sure if it's my configuration that's wrong or if you can't use IsMimetype directly within the Share config as I am trying to do.


 <action id="aeroCOMPASS.doclib.action.ZipImport"
                        label="message.ZipImport.label"
                        type="javascript"       >

                        <param name="function">onActionZipImport</param>
                        <param name="successMessage">message.ZipImport.success</param>
                        <param name="failureMessage">message.ZipImport.failure</param>
                        <evaluator id="evaluator.doclib.action.isMimetype">
                                <property name="mimetypes">
                                        <list>
                                                <value>ZIP</value>
                                        </list>
                                </property>
                        </evaluator>
                </action>
3 REPLIES 3

mikeh
Star Contributor
Star Contributor
One obvious problem is that the mimetype for zip files is actually application/zip, not ZIP.

Thanks,
Mike

wabson
Star Contributor
Star Contributor
'ZIP' is not a valid MIME type, as Mike says. See http://en.wikipedia.org/wiki/Internet_media_type for background reading.

But to answer your main question, you do need to declare your Spring bean (for the evaluator) in a separate file to your action declaration, since the latter is Alfresco-specific rather than Spring config.

You don't mention which file you have placed the config above in, but the simplest approach is normally to place custom Alfresco config in share-config-custom.xml and custom Spring config in a *-context.xml file, both under tomcat/shared/alfresco/web-extension.

Cheers,
Will

vamirr
Champ on-the-rise
Champ on-the-rise
Got it.  Thanks guys.