The Collection Manager Widget can be used to create a new collection and help in copying, moving, removing and adding specific photos from a collection. The widget is based on the Prototype JavaScript library.
- Add, copy, move and remove specific photos from a collection.
Add this code to the head section of the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<style type="text/css" title="currentStyle" media="screen">
@import '<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "theme","app","css.jsp?externalApp=true")%>';
</style>
<script src='/dekohportal/dwr/engine.js'></script>
<script src='/dekohportal/dwr/util.js'></script>
<script type="text/javascript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "common",null,"JSlibrary.jsp")%>">
</script>
<script type='text/javascript' src='/photos/widgets/<%=dekoh.photo.URLGenerator.staticContentVersion%>/collectionManager/collectionManager.js'>
</script>
Include the following code where you want to invoke the Collection Manager in page:
// Import photos and cerate collection out of it
<h1>Import photos and cerate collection out of it</h1>
<input type='text' id='sa_FileChooserReturnBox' value='add photos separated by'/>
<div onclick="javascript:manageCollection.prototype.importCreateCollection('/COLLECTION_ID/');">Import photos and Create Collection</div>
<br/>
<h1>For the utility like add,remove,copy,move photos to collection</h1> <input type='text' id='ma_PhotoChooserReturnBox' value=' add photos separated by ,'/>
// Import the photos in the collection
<div onclick="javascript:manageCollection.prototype.addPhotosToCollection('/COLLECTION_ID/');">Add photos to Collection</div>
<div onclick="javascript:manageCollection.prototype.removePhotos ('/COLLECTION_ID/');">Remove Photos from Collection</div>
<div onclick="javascript:manageCollection.prototype.copyPhotos ('/COLLECTION_ID/');">Copy Photos from Collection</div>
<div onclick="javascript:manageCollection.prototype.movePhotosToCollection ('/COLLECTION_ID/');">Move Photos from Collection</div>
| Function | Parameters | Description |
| addPhotosToCollection | dioId | Add the photos to a collection |
| importCreateCollection | dioId | Import photos and create new collection |
| createRootCollection | rootPageUrl | Create a root collection |
| removeSinglePhoto | dioId, currentPath | Remove a single photo |
| removePhotos | dioId | Remove multiple photos |
| copyPhotos | dioId | Copy photo from different collection to the current collection |
| movePhotosToCollection | dioId | Move the photo from a different collection to current collection | |
Reference in web.xml
The DWR method mapping XML is given in the web.xml file.
<init-param>
<param-name>config-manageCollections</param-name>
<param-value>widgets/collectionManager/dwr-collectionmanager.xml</param-
value>
</init-param>
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
<allow>
<create creator="new" javascript="manageCollections">
<param name="class" value="dekoh.photo.widget.editor.ManageCollections"/>
<include method="removeCollection"/>
<include method="removeSelection"/>
<include method="copyDigitalObjectsToCollection"/>
<include method="moveDigitalObjectToCollection"/>
<include method="addPhotosToExistingCollection"/>
<include method="createRootCollection"/>
<include method="createRootCollectionWithDios"/>
<include method="importCreateCollection"/>
<include method="rotatePhoto"/>
</create>
</allow>
</dwr>
We need to ensure that all the parameters can be converted. Many of the types provided by the JDK are enabled for you, but you need to give DWR permission to convert your own bean. Generally this means that JavaBean parameters will need a <convert ...> entry.
Each class on which we execute methods, needs a <create ...> entry. There are several types of creator. The most common ones use either the 'new' keyword or the Spring framework. For more information, see the Creator documentation.
- ClassName: dekoh.photo.widget.editor.ManageCollections
- Description: Class will provide the CURD functionality on the selected collection.
| Method Name | Functionality |
| removeCollection | Removes the given collection. |
| removeSelection | Removes the photos in the selection tray. |
| copyDigitalObjectsToCollection | Copies the digitalObjects(photos) to the current accessing collection. |
| moveDigitalObjectToCollection | Copies the digitalObjects(photos) to the current accessing collection and removes from the collections selected from. |
| AddPhotosToExistingCollection | Adds the given photo path to the current accessing collection. |
| CreateRootCollection | Creates a root collection with the given photo paths. |
| CreateRootCollectionWithDios | Creates a root collection with the selected digital objects. |
| ImportCreateCollection | Imports the given collection path to current accessing collection. |
| rotatePhoto | Rotates the photo clockwise or anti clockwise and will not change the original image | |
Dekoh Portal Ver 0.4.2 or later.