Photo Metadata Editor Widget

The Photo Metadata Editor Widget allows users to change metadata in photos. This widget is based on the Prototype Javascript library.

Features

  • Allows users to modify photo metadata

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%>/photoMetadataEditor/photoMetadataEditor.js">     </script>
<script type="text/JavaScript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","dialog","dialog.js")%>">
</script>

HTML code

Include the following code where you want to invoke the Collection Manager in page:

<div  onclick=" openMetaDataEditor ('PHOTO_DIO_ID', 'FILE_LOCATION_ON_DESKTOP');"> Change the photo metadata </div>

JavaScript code

The basic syntax to initialize the Dialog widget is

<script type="text/javascript">
 /<![CDATA[
  function openMetaDataEditor(photoId, fileLocation){new PhotoMetadataEditor('metadatatray', photoId, fileLocation);}
  //]]>
</script>

Parameters for initializing the widget

Required parameters

OptionsSinceDescriptionDefault
IdV1.0Photo metadata editor id
dioIdV1.0The photo Digital Object Id
sourcePathV1.0The path of photo on the desktop

Optional parameters

OptionsSinceDescriptionDefault
classNameV1.0The style classDekoh
titleV1.0Set the title here‘Photo Information’
trayTopMessageV1.0The top message on the dialogEdit photo information
resizableV1.0Allow the dialog to resize value is set to true or falsefalse
widthV1.0Width of the dialog640
heightV1.0Height of the dialog480
xPosV1.0Specify the x position of the dialog in the document 0
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 minimized False
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
initMetadatadioId-
addCountrycountryPair-
setSpecialDataTypesdata-
populateCountries--
toggleviewview-
save--
cancel--
addMetadataPropid, name, description, metadataType, isEditable, fullOrSummary-

DWR Implementation

Reference in web.xml
The DWR method mapping XML is given in web.xml
<init-param>
            <param-name>config-photoMetadataEditor</param-name>        <param-value>widgets/photoMetadataEditor/dwr-photometadataeditor.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="photoMetadataEditor">
            <param name="class" value="dekoh.photo.widget.photometadataeditor.PhotoMetaDataEditor" />
            <include method="save"/>
            <include method="getAllMetaData"/>
            <include method="getSummaryMetaData"/>
            <include method="getCountries"/>
            <include method="getSpecialFields"/>
        </create>
        <convert converter="bean" match="dekoh.photo.widget.photometadataeditor.MetaDataTagInfo"/>
        <convert converter="bean" match="dekoh.photo.Country"/>
  </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.
  • Convert-class: dekoh.photo.widget.photometadataeditor.MetaDataTagInfo
  • Description: DWR transfer object holding the selected photo metadata.
  • Convert-class: dekoh.photo.Country
  • Description : DWR transfer object holding general list of coutries.

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.photometadataeditor.PhotoMetaDataEditor
  • Description: Class will provide the functionality to display and edit the selected photo metadata.

Methods-functionality

Method NameFunctionality
getAllMetaDataGets all EXIF and IPTC available metadata for the given digitalObject (photo)
saveSaves the edited Exif and Iptc metadata to the photo
getSummaryMetaDataGet EXIF and IPTC summary metadata
getCountriesGet the list of general available countries
getSpecialFieldsField values for iptc TAG_DATE_CREATED and TAG_COUNTRY_OR_PRIMARY_LOCATION

Availability

Dekoh Portal Ver 0.4.2 or later.

Attachments