Extension Point | Modifying Out-of-the-box Surf Web Scripts |
---|---|
Support Status | Full Support |
Architecture Information | Share Architecture. |
Description |
Out-of-the-box Surf Web Scripts can be overridden by putting the modified files under SkyVault/web-extension/site-webscripts/org/alfresco/... directory. Let's say you wanted to add code to display some custom types in the Upload Dialog. So an end user could select type for the file that he or she is uploading. We got the following type that we want to be available: <type name="mc:itDocument"> <title>My Company IT Document</title> <parent>cm:content</parent> </type> This can be done by overriding an OOTB Web Script called Flash Upload that is contained in the flash-upload.get.* files. These files are located in the tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/upload/ directory. We need to override the controller file (flash-upload.get.js) to do what we want. Update the controller to look like this: /** * Custom content types */ function getContentTypes() { // TODO: Data webscript call to return list of available types var contentTypes = [ { id: "cm:content", value: "cm_content" }, { id: "mc:itDocument", value: "type.mc_itDocument" } ]; return contentTypes; } model.contentTypes = getContentTypes(); function main() { // Widget instantiation metadata... var flashUpload = { id : "FlashUpload", name : "Alfresco.FlashUpload" }; model.widgets = [flashUpload]; } Now we just need to put this new controller file here: SkyVault/web-extension/site-webscripts/org/alfresco/components/upload/flash-upload.get.js for it to override the original one. To try out this example you will need to first enable Flash Upload, in tomcat/conf/context.xml update to: <Context useHttpOnly="false"> |
Deployment - App Server |
|
Deployment - SDK Project |
|
More Information | |
Tutorials | |
SkyVault Developer Blogs |
You are here
Modifying Out-of-the-box Surf Web Scripts
Most of the Share UI functionality can be traced back to a Web Script in one place or
another. Sometimes it is useful to be able to override the controller or template of one of
these Out-of-the-box (OOTB) Web Scripts.
© 2017 TBS-LLC. All Rights Reserved. Follow @twitter