Book Image

Learning Alfresco Web Scripts

By : Ramesh Chauhan
Book Image

Learning Alfresco Web Scripts

By: Ramesh Chauhan

Overview of this book

Table of Contents (18 chapters)
Learning Alfresco Web Scripts
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Code examples


Now that you have information on the different root objects you can use in the JavaScript controller, let's take a look at some code examples to get a better understanding of how you can put the root objects in action to achieve the required functionality. We will go through some code examples for some of the generic functionalities that every developer will use at some point in time. We will use some of the root objects we have gone through previously.

Creating a folder

Consider a scenario where you have a custom frontend application and Alfresco as the backend repository. Now, you want to have the functionality for the users to create a folder in Alfresco under the company home from the custom frontend. Once the folder is created, you might also want to create some content inside the folder or run some action on the folder. First, our goal is to create a folder under the company home.

To address this, we will create a new web script foldercreation, which will accept the argument...