cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Share 4.0 - making changes to out of the box files

bengrah
Champ on-the-rise
Champ on-the-rise
Hi all.

I'm just playing about with some of the out of the box files for document actions. I've made a copy of actions.js, made some changes, minified it using the YUI Compressor and copied it back into the /webapps/share/components/documentlibrary directory and overwritten the original file. But I can't get any of these changes to appear via the Share website.

Even if I remove the actions-min.js entirely from the directory and refresh the page / restart the application, actions still work in Share. Is there anything I can do here? Is it a caching thing with my browser (I have tried to purging temp files, history, cookies etc. and still no joy)?

Any help would be much appreciated.

Cheers,
Ben.
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
Sounds like you are just playing around, but I feel duty-bound to tell you anyway: You probably shouldn't change the client-side JavaScript files. You should be able to extend those JavaScript components to add your own functionality. And when you do that, it is a really good idea to use your own namespace. If you need an example of how to do that, check out rule-config-action-custom.js script in the custom actions tutorial.

Still, what you are doing should be possible.

Make sure you have a non-minified version of the script called actions.js and a minified version of the script called actions-min.js. Share determines which one to use based on the client-debug flag in share-config-custom.xml:
    <config replace="true">
        <flags>
            <client-debug>false</client-debug>
            <client-debug-autologging>false</client-debug-autologging>
        </flags>
    </config>
If you have that flag set to false, it uses the minified version and if it is set to true it uses the non-minified version.

Maybe you didn't replace both the minified and the non-minified versions of the file and Share is using the one you didn't expect?

If that's not it and you are sure you've cleared your cache, you can always use Firebug or the equivalent JavaScript console in your browser to set some breakpoints and figure out what's going on.

Jeff

bengrah
Champ on-the-rise
Champ on-the-rise
Sounds like you are just playing around, but I feel duty-bound to tell you anyway: You probably shouldn't change the client-side JavaScript files. You should be able to extend those JavaScript components to add your own functionality. And when you do that, it is a really good idea to use your own namespace. If you need an example of how to do that, check out rule-config-action-custom.js script in the custom actions tutorial.

Still, what you are doing should be possible.

Make sure you have a non-minified version of the script called actions.js and a minified version of the script called actions-min.js. Share determines which one to use based on the client-debug flag in share-config-custom.xml:
    <config replace="true">
        <flags>
            <client-debug>false</client-debug>
            <client-debug-autologging>false</client-debug-autologging>
        </flags>
    </config>
If you have that flag set to false, it uses the minified version and if it is set to true it uses the non-minified version.

Maybe you didn't replace both the minified and the non-minified versions of the file and Share is using the one you didn't expect?

If that's not it and you are sure you've cleared your cache, you can always use Firebug or the equivalent JavaScript console in your browser to set some breakpoints and figure out what's going on.

Jeff

Hi Jeff, thanks for the update. It turns out I was looking at the wrong actions javascript file. I should've been looking at documentlibrary-actions.js instead.

Are you able to overwrite the out of the box JS using a JAR file with the same path? I will also check out your example, especially relating to the Custom Action, it's something I'd like to look into regarding notifications.