Collection Manager Widget

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.

Features

  • Add, copy, move and remove specific photos from a collection.

How to use

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>

HTML code

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>

Parameters for initializing the manageCollection class in the widget

Functions

FunctionParametersDescription
addPhotosToCollectiondioIdAdd the photos to a collection
importCreateCollectiondioIdImport photos and create new collection
createRootCollectionrootPageUrlCreate a root collection
removeSinglePhotodioId, currentPathRemove a single photo
removePhotosdioIdRemove multiple photos
copyPhotosdioIdCopy photo from different collection to the current collection
movePhotosToCollectiondioIdMove the photo from a different collection to current collection

DWR Implementation

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>

DWR XML

<!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>

Converters

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.

Creators

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.

Methods-functionality

Method NameFunctionality
removeCollectionRemoves the given collection.
removeSelectionRemoves the photos in the selection tray.
copyDigitalObjectsToCollectionCopies the digitalObjects(photos) to the current accessing collection.
moveDigitalObjectToCollectionCopies the digitalObjects(photos) to the current accessing collection and removes from the collections selected from.
AddPhotosToExistingCollectionAdds the given photo path to the current accessing collection.
CreateRootCollectionCreates a root collection with the given photo paths.
CreateRootCollectionWithDiosCreates a root collection with the selected digital objects.
ImportCreateCollectionImports the given collection path to current accessing collection.
rotatePhotoRotates the photo clockwise or anti clockwise and will not change the original image

Availability

Dekoh Portal Ver 0.4.2 or later.