Collection Importer Widget

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.

Features

  • Import photos using this widget

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="<%=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>

HTML code

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>

Parameters for initializing the Collection Importer class

Required parameters

OptionsSinceDescriptionDefault
servletUrlV1.0The URL of Servlet executing the import process-

Optional parameters

OptionsSinceDescriptionDefault
classNameV1.0The style classDekoh
titleV1.0Set the title here'Template Chooser'
trayTopMessageV1.0The top message on the dialog'Pick a template that suits your collection'
widthV1.0Width of the dialog640
heightV1.0Height of the dialog480
fileSeperatorV1.0fileSeperator is the operating system dependent'
'
xPosV1.0Specify the x position of the dialog in the document0
yPosV1.0Specify the y position of the dialog in the document0
minimizableV1.0Works with resizable value set to 'true'. The value defined for this is 'true' or 'false' depends on whether you want to make dialog minimizedFalse
maximizableV1.0Works with resizable value set to 'true'. The value defined for this is 'true' or 'false' depends on whether you want to make dialog maximizedFalse
isModalV1.0Specify whether the dialog is modal or nottrue

Functions

FunctionParametersDescription
stopImporting-Stop Importing the photos
addLocation-Add location to import
removeLocation-Remove location from import from the Import location
List array
removeLocationItemmemberRemove a location
emptyImportCollection-removes all the import photo locations
handleStopClick-Handle the stop button click
handleSaveClickrunInBackgroundHandle 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

Parameters for initializing the LC_oLocItem class

Required Parameters

OptionsSinceDescriptionDefault
sTargetIdV1.0Target html element id on the page-
sIdV1.0Id of the element-
sLabelV1.0File name-

DWR Implementation

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>

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="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>

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

Methods-functionality

Method NameFunctionality
getImporterWill take the location or folder path to import and start import processes.
getProgressGets the current import progress Object.
stopImportingWill stop importing if any import process is running.
getImportedCollectionListGet the list of imported collections in the current import process.
getLatestFileListGet the list files imported in the current running import process.
isProcessRunningTells is any import process is running.

Availability

Dekoh Portal Ver 0.4.2 or later.

Attachments