The Photo Metadata Editor Widget allows users to change metadata in photos. This widget is based on the Prototype Javascript library.
- Allows users to modify photo metadata
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>
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>
The basic syntax to initialize the Dialog widget is
<script type="text/javascript">
/<![CDATA[
function openMetaDataEditor(photoId, fileLocation){new PhotoMetadataEditor('metadatatray', photoId, fileLocation);}
//]]>
</script>
| Options | Since | Description | Default |
| Id | V1.0 | Photo metadata editor id | |
| dioId | V1.0 | The photo Digital Object Id | |
| sourcePath | V1.0 | The path of photo on the desktop |
| Options | Since | Description | Default |
| className | V1.0 | The style class | Dekoh |
| title | V1.0 | Set the title here | ‘Photo Information’ |
| trayTopMessage | V1.0 | The top message on the dialog | Edit photo information |
| resizable | V1.0 | Allow the dialog to resize value is set to true or false | false |
| width | V1.0 | Width of the dialog | 640 |
| height | V1.0 | Height of the dialog | 480 |
| 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 |
| initMetadata | dioId | - |
| addCountry | countryPair | - |
| setSpecialDataTypes | data | - |
| populateCountries | - | - |
| toggleview | view | - |
| save | - | - |
| cancel | - | - |
| addMetadataProp | id, name, description, metadataType, isEditable, fullOrSummary | - |
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>
<!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>
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.
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.
| Method Name | Functionality |
| getAllMetaData | Gets all EXIF and IPTC available metadata for the given digitalObject (photo) |
| save | Saves the edited Exif and Iptc metadata to the photo |
| getSummaryMetaData | Get EXIF and IPTC summary metadata |
| getCountries | Get the list of general available countries |
| getSpecialFields | Field values for iptc TAG_DATE_CREATED and TAG_COUNTRY_OR_PRIMARY_LOCATION |
Dekoh Portal Ver 0.4.2 or later.