The Collection Importer Widget is used in the Photos application to import photos from directories on the desktop. This widget based on the Prototype javascript library.
- Import photos using this widget
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="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","locationChooser","locationchooser.js")%>">
</script>
<script type='text/javascript' src='/photos/widgets/<%=dekoh.photo.URLGenerator.staticContentVersion%>/collectionImporter/collectionImporter.js'>
</script>
<script type="text/JavaScript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","dialog","dialog.js")%>">
</script>
Include the code where you want to invoke the Collection Importer in page:
<div onclick="new CollectionImporter('<url:command name=executeimport/>',{fileSeparator:'//'});">Open Collection Importer</div>
| Options | Since | Description | Default |
| servletUrl | V1.0 | The URL of Servlet executing the import process | - |
| Options | Since | Description | Default |
| className | V1.0 | The style class | Dekoh |
| title | V1.0 | Set the title here | 'Template Chooser' |
| trayTopMessage | V1.0 | The top message on the dialog | 'Pick a template that suits your collection' |
| width | V1.0 | Width of the dialog | 640 |
| height | V1.0 | Height of the dialog | 480 |
| fileSeperator | V1.0 | fileSeperator is the operating system dependent | ' ' |
| xPos | V1.0 | Specify the x position of the dialog in the document | 0 |
| yPos | V1.0 | Specify the y position of the dialog in the document | 0 |
| minimizable | V1.0 | Works with resizable value set to 'true'. The value defined for this is 'true' or 'false' depends on whether you want to make dialog minimized | False |
| maximizable | V1.0 | Works with resizable value set to 'true'. The value defined for this is 'true' or 'false' depends on whether you want to make dialog maximized | False |
| isModal | V1.0 | Specify whether the dialog is modal or not | true |
| Function | Parameters | Description |
| stopImporting | - | Stop Importing the photos |
| addLocation | - | Add location to import |
| removeLocation | - | Remove location from import from the Import location |
List array
| removeLocationItem | member | Remove a location |
| emptyImportCollection | - | removes all the import photo locations |
| handleStopClick | - | Handle the stop button click |
| handleSaveClick | runInBackground | Handle the start button click |
| getProgress | - | Get the progress of the import process |
| successImportAction | - | After the success of import, it sets the action |
on the dialog
| Options | Since | Description | Default |
| sTargetId | V1.0 | Target html element id on the page | - |
| sId | V1.0 | Id of the element | - |
| sLabel | V1.0 | File name | - |
Reference in web.xml
The DWR method mapping XML is given in photos web.xml as
<init-param>
<param-name>config-collectionimporter</param-name>
<param-value>widgets/collectionImporter/dwr-collectionImporter.xml</para
m-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="collectionimporter">
<param name="class" value="dekoh.photo.widget.collectionimporter.CollectionImporterUtil"/>
<include method="getProgress"/>
<include method="getImporter"/>
<include method="stopImporting"/>
<include method="getImportedCollectionList"/>
<include method="getLatestFileList"/>
<include method="isProcessRunning"/>
</create>
</allow>
</dwr>
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.collectionimporter.CollectionImporterUtil
- Description: Class will provide the collection/photos import functionality.
Once the import process is initialized we not initialize another process until the running process is completed.
| Method Name | Functionality |
| getImporter | Will take the location or folder path to import and start import processes. |
| getProgress | Gets the current import progress Object. |
| stopImporting | Will stop importing if any import process is running. |
| getImportedCollectionList | Get the list of imported collections in the current import process. |
| getLatestFileList | Get the list files imported in the current running import process. |
| isProcessRunning | Tells is any import process is running. | |
Dekoh Portal Ver 0.4.2 or later.