<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
		<meta name="generator" content="Adobe GoLive 6"/>
		<title>XMP Extension</title>
	</head>

	<body>
		<hr/>
		<p>ADOBE SYSTEMS INCORPORATED</p>
		<p>Copyright 2004 Adobe Systems Incorporated</p>
		<p>All Rights Reserved</p>
		<p>NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it. If you have received this file from a source other than Adobe, then your use, modification, or distribution of it requires the prior written permission of Adobe.</p>
		<hr/>
		<p><b>Extension Name:</b> XMP</p>
		<p><b>Folder name: </b>XMP</p>
		<hr/>
		<p><b>Description:</b></p>
		<p>This sample extension creates a palette to display/modify a file's XMP information using the XMP object. The user can perform operations like get/set/delete the properties in a XMP NameSpace.</p>
		<hr/>
		<p><b>Module Definition:</b></p>
		<jsxmodule debug="debug" info="$$$/GoLiveExtension/XMP/info=This sample extension creates a palette to display/modify a file's XMP information using the XMP object." name="XMP" version="1.0"/> 
		<p><b>Scripts:</b></p>
		<script><![CDATA[
//--------------------------------------------------------------------
// GLOBAL VARIABLES
//--------------------------------------------------------------------


// global variables
var theFile, xmpOfFile, previewDlg;
var NSList = new Array( 
'http://purl.org/dc/elements/1.1/', 'dc:contributor,dc:coverage,dc:creator,dc:date,dc:description,dc:format,dc:identifier,dc:language,dc:publisher,dc:relation,dc:rights,dc:source,dc:subject,dc:title,dc:type',
'http://ns.adobe.com/xap/1.0/', 'xmp:Advisory,xmp:BaseURL,xmp:CreateDate,xmp:CreatorTool,xmp:Identifier,xmp:MetadataDate,xmp:ModifyDate,xmp:Nickname,xmp:Thumbnails',
'http://ns.adobe.com/xmp/Identifier/qual/1.0/', 'xmpidq:Scheme',
'http://ns.adobe.com/xap/1.0/rights/', 'xmpRights:Certificate,xmpRights:Marked,xmpRights:Owner,xmpRights:UsageTerms,xmpRights:WebStatement',
'http://ns.adobe.com/xap/1.0/mm/', 'xmpMM:DerivedFrom,xmpMM:DocumentID,xmpMM:Histor,xmpMM:ManagedFrom,xmpMM:Manager,xmpMM:ManageTo,xmpMM:ManageUI,xmpMM:ManagerVariant,xmpMM:RenditionClass,xmpMM:RenditionParams,xmpMM:VersionID,xmpMM:Versions',
'http://ns.adobe.com/xap/1.0/bj/', 'xmpBJ:JobRef', 
'http://ns.adobe.com/xap/1.0/t/pg/', 'xmpTPg:MaxPageSize,xmpTPg:NPages',
'http://ns.adobe.com/pdf/1.3/', 'pdf:Keywords,pdf:PDFVersion,pdf:Producer',
'http://ns.adobe.com/photoshop/1.0/','photoshop:AuthorsPosition,photoshop:CaptionWriter,photoshop:Category,photoshop:City,photoshop:Country,photoshop:Credit,photoshop:DateCreated,photoshop:Headline,photoshop:Instructions,photoshop:Source,photoshop:State,photoshop:SupplementalCategories,photoshop:TransmissionReference,photoshop:Urgency',
'http://ns.adobe.com/tiff/1.0/', 'tiff:ImageWidth,tiff:ImageLength,tiff:BitsPerSample,tiff:Compression,tiff:PhotometricInterpretation,tiff:Orientation,tiff:SamplesPerPixel,tiff:PlanarConfiguration,tiff:YCbCrSubSampling,tiff:YCbCrPositioning,tiff:XResolution,tiff:YResolution,tiff:ResolutionUnit,tiff:TransferFunction,tiff:WhitePoint,tiff:PrimaryChromaticities,tiff:YCbCrCoefficients,tiff:ReferenceBlackWhite,tiff:DateTime,tiff:ImageDescription,tiff:Make,tiff:Model,tiff:Software,tiff:Artist,tiff:Copyright',
'http://ns.adobe.com/exif/1.0/', 'exif:ExifVersion,exif:FlashpixVersion,exif:ColorSpace,exif:ComponentsConfiguration,exif:CompressedBitsPerPixel,exif:PixelXDimension,exif:PixelYDimension,exif:MakerNote,exif:UserComment,exif:RelatedSoundFile,exif:DateTimeOriginal,exif:DateTimeDigitized,exif:ExposureTime,exif:FNumber,exif:ExposureProgram,exif:SpectralSensitivity,exif:ISOSpeedRatings,exif:OECF,exif:ShutterSpeedValue,exif:ApertureValue,exif:BrightnessValue,exif:ExposureBiasValue,exif:MaxApertureValue,exif:SubjectDistance,exif:MeteringMode,exif:LightSource,exif:Flash,exif:FocalLength,exif:SubjectArea,exif:FlashEnergy,exif:SpatialFrequencyResponse,exif:FocalPlaneXResolution,exif:FocalPlaneYResolution,exif:FocalPlaneResolutionUnit,exif:SubjectLocation,exif:ExposureIndex,exif:SensingMethod,exif:FileSource,exif:SceneType,exif:CFAPattern,exif:CustomRendered,exif:ExposureMode,exif:WhiteBalance,exif:DigitalZoomRatio,exif:FocalLengthIn35mmFilm,exif:SceneCaptureType,exif:GainControl,exif:Contrast,exif:Saturation,exif:Sharpness,exif:DeviceSettingDescription,exif:SubjectDistanceRange,exif:ImageUniqueID,exif:GPSVersionID,exif:GPSLatitude,exif:GPSLongitude,exif:GPSAltitudeRef,exif:GPSAltitude,exif:GPSTimeStamp,exif:GPSSatellites,exif:GPSStatus,exif:GPSMeasureMode,exif:GPSDOP,exif:GPSSpeedRef,exif:GPSSpeed,exif:GPSTrackRef,exif:GPSTrack,exif:GPSImgDirectionRef,exif:GPSImgDirection,exif:GPSMapDatum,exif:GPSDestLatitude,exif:GPSDestLongitude,exif:GPSDestBearingRef,exif:GPSDestBearing,exif:GPSDestDistanceRef,exif:GPSDestDistance,exif:GPSProcessingMethod,exif:GPSAreaInformation,exif:GPSDifferential'
)


//--------------------------------------------------------------------
// CALLBACK FUNCTIONS
//--------------------------------------------------------------------


//---------------------------------------------------------------
// MODULE CALLBACKS


//---------------------------------------------------------
// initializeModule - called after the module has been loaded
//
// Description
//   Use to initialize global variables and data structures, and
//   create Picture objects using createPicture.

function initializeModule() 
{
	dialogs['xmp'].addEventListener( 'onClick', onClickHandler );
	disableAll();
}




//--------------------------------------------------------------------
// CUSTOM EXTENSION FUNCTIONS
//--------------------------------------------------------------------

//---------------------------------------------------------
// clearAll - Called to clear all controls in the 
// dialog.

function clearAll()
{
	dialogs['xmp'].children['nsPopup'].removeAll();
	dialogs['xmp'].children['propNamePopup'].removeAll();
	dialogs['xmp'].children['propValEdit'].value = "Property Value here" ;
	dialogs['xmp'].children['nsPropEdit'].value = "Properties in a Namespace" ;
}

//---------------------------------------------------------
// disableAll - Called to disable all controls in the 
// dialog until a valid file is selected.

function disableAll()
{
	dialogs['xmp'].children['nsPopup'].enabled = false ;
	dialogs['xmp'].children['dispBtn'].enabled = false ;
	dialogs['xmp'].children['modifyPropPopup'].enabled = false ;
	dialogs['xmp'].children['propNamePopup'].enabled = false ;
	dialogs['xmp'].children['propValEdit'].enabled = false ;
}


//---------------------------------------------------------
// enableAll - Called to enable all controls in the 
// dialog when a valid file is selected.

function enableAll()
{
	dialogs['xmp'].children['nsPopup'].enabled = true;
	dialogs['xmp'].children['dispBtn'].enabled = true ;
	dialogs['xmp'].children['modifyPropPopup'].enabled = true ;
	dialogs['xmp'].children['propNamePopup'].enabled = true ;
}


//---------------------------------------------------------
// getFile - called when the control to get a xmp file is 
// clicked.

function getFile()
{
	theFile = fileGetDialog("Please select a file");
	if ( theFile )
	{
		xmpOfFile = theFile.xmp;
		
		if( xmpOfFile != null )
		{
			xmpNSArray = xmpOfFile.existingNameSpaces;
			xmpNSpopup = xmpNSArray.join(',');
			dialogs['xmp'].children['nsPopup'].values = xmpNSpopup;
			enableAll();
		}
	}
}


//---------------------------------------------------------
// onClickHandler - called when a control is clicked in the 
// xmp palette.

function onClickHandler( UIEventObj )
{
	switch( UIEventObj.target.name )
	{
		case 'clearBtn':
			clearAll();
			break;
		
		case 'dispBtn':
			if( xmpOfFile != null )
			{
				xmpContent = xmpOfFile.dump();
				dialogs['xmp'].children['nsPropEdit'].value = xmpContent;
			}
			break;
		
		case 'fileBtn':
			getFile();
			populateNS();
			break;
		
		case 'goBtn':
			modifyProps( UIEventObj );
			break;
		
		case 'modifyPropPopup':
			if ( UIEventObj.target.value == 'SET' )
			{
				dialogs['xmp'].children['propValEdit'].enabled = true ;
			}
			else
			{
				dialogs['xmp'].children['propValEdit'].enabled = false ;
			}
			break;
		
		case 'nsPopup': 
			populateNS();
			break;
	}
}

//---------------------------------------------------------
// modifyProps - called when user choses to modify a file's
// property.

function modifyProps( eventObj )
{
	var propValue;
	switch( dialogs['xmp'].children['modifyPropPopup'].value )
	{
		case 'DELETE':
			if( xmpOfFile != null )
				xmpOfFile.deleteProperty( dialogs['xmp'].children['propNamePopup'].value );
			break;
		case 'GET':
			if( xmpOfFile != null )
			{
				propValue = xmpOfFile.getPropertyValue( dialogs['xmp'].children['propNamePopup'].value );
				dialogs['xmp'].children['propValEdit'].value = propValue;
			}
			break;
		case 'SET':	
			if( xmpOfFile != null )
				xmpOfFile.setPropertyValue( dialogs['xmp'].children['propNamePopup'].value,  dialogs['xmp'].children['propValEdit'].value );
			break;
	}
}

//---------------------------------------------------------
// populateNS - called when a namespace is selected to update 
// the property popup to display the list of properties 
// available to that namespace

function populateNS()
{
	if( xmpOfFile != null )
	{
		xmpOfFile.nameSpace = dialogs['xmp'].children['nsPopup'].value;
		for ( i=0 ; i < NSList.length; i++ )
		{
			// Find the current namespace in the NSList
			if ( NSList[i] == xmpOfFile.nameSpace )
			{
				// display the Namespace's property list in the Property popup
				dialogs['xmp'].children['propNamePopup'].removeAll();	
				dialogs['xmp'].children['propNamePopup'].values = NSList[i+1];	
			}
		}
	}
}
//]]>
</script>
		<hr/>
		<p><b>User Interface Tags:</b></p>
		<p><b>Palettes</b> Palette Window Definitions - Listed in Windows Menu by Default</p>
		<jsxpalette height="250" name="xmp" title="XMP Palette" menu="" width="550" minwidth="540" minheight="185">
			<jsxcontrol halign="" height="" name="" group="" posx="" posy="" type="" valign="" value="" width=""></jsxcontrol>
			<table width="722" border="0" cellspacing="0" cellpadding="0" cool="cool" gridx="5" gridy="5" height="276" showgridx="showgridx" showgridy="showgridy" usegridx="usegridx" usegridy="usegridy">
				<tr height="10">
					<td rowspan="9" width="10" height="275"></td>
					<td rowspan="2" colspan="4" width="265" height="20"></td>
					<td width="446" height="10"></td>
					<td width="1" height="10"><spacer height="10" type="block" width="1"/></td>
				</tr>
				<tr height="10">
					<td rowspan="8" align="left" valign="top" width="446" height="265" xpos="275">
						<jsxcontrol height="255" name="nsPropEdit" posx="275" posy="10" type="editarea" value="Properties in a NameSpace" width="435"></jsxcontrol>
					</td>
					<td width="1" height="10"><spacer height="10" type="block" width="1"/></td>
				</tr>
				<tr height="35">
					<td colspan="2" align="left" valign="top" width="100" height="35" xpos="10">
						<jsxcontrol height="19" name="static" posx="10" posy="20" type="static" value="Choose File" width="80"></jsxcontrol>
					</td>
					<td colspan="2" align="left" valign="top" width="165" height="35" xpos="110">
						<jsxcontrol height="19" name="fileBtn" posx="110" posy="20" type="button" value="..." width="40"></jsxcontrol>
					</td>
					<td width="1" height="35"><spacer height="35" type="block" width="1"/></td>
				</tr>
				<tr height="30">
					<td colspan="4" align="left" valign="top" width="265" height="30" xpos="10">
						<jsxcontrol height="19" name="nsPopup" posx="10" posy="55" type="popup" value="NameSpaces" width="250"></jsxcontrol>
					</td>
					<td width="1" height="30"><spacer height="30" type="block" width="1"/></td>
				</tr>
				<tr height="35">
					<td width="40" height="35"></td>
					<td colspan="3" align="left" valign="top" width="225" height="35" xpos="50">
						<jsxcontrol height="19" name="dispBtn" posx="50" posy="85" type="button" value="Display/Refresh Properties" width="165"></jsxcontrol>
					</td>
					<td width="1" height="35"><spacer height="35" type="block" width="1"/></td>
				</tr>
				<tr height="35">
					<td colspan="2" align="left" valign="top" width="100" height="35" xpos="10">
						<jsxcontrol height="19" name="modifyPropPopup" posx="10" posy="120" type="popup" value="DELETE,GET,SET" width="100"></jsxcontrol>
					</td>
					<td colspan="2" width="165" height="35"></td>
					<td width="1" height="35"><spacer height="35" type="block" width="1"/></td>
				</tr>
				<tr height="35">
					<td colspan="4" align="left" valign="top" width="265" height="35" xpos="10">
						<jsxcontrol height="19" name="propNamePopup" posx="10" posy="155" type="popup" value="None" width="190"></jsxcontrol>
					</td>
					<td width="1" height="35"><spacer height="35" type="block" width="1"/></td>
				</tr>
				<tr height="40">
					<td colspan="4" align="left" valign="top" width="265" height="40" xpos="10">
						<jsxcontrol height="19" name="propValEdit" posx="10" posy="190" type="edit" value="Property Value here" width="190"></jsxcontrol>
					</td>
					<td width="1" height="40"><spacer height="40" type="block" width="1"/></td>
				</tr>
				<tr height="45">
					<td colspan="2" align="left" valign="top" width="100" height="45" xpos="10">
						<jsxcontrol height="19" name="goBtn" posx="10" posy="230" type="button" value="GO" width="90"></jsxcontrol>
					</td>
					<td width="20" height="45"></td>
					<td align="left" valign="top" width="145" height="45" xpos="130">
						<jsxcontrol height="19" name="clearBtn" posx="130" posy="230" type="button" value="Clear" width="90"></jsxcontrol>
					</td>
					<td width="1" height="45"><spacer height="45" type="block" width="1"/></td>
				</tr>
				<tr cntrlrow="cntrlrow" height="1">
					<td width="10" height="1"><spacer height="1" type="block" width="10"/></td>
					<td width="40" height="1"><spacer height="1" type="block" width="40"/></td>
					<td width="60" height="1"><spacer height="1" type="block" width="60"/></td>
					<td width="20" height="1"><spacer height="1" type="block" width="20"/></td>
					<td width="145" height="1"><spacer height="1" type="block" width="145"/></td>
					<td width="446" height="1"><spacer height="1" type="block" width="446"/></td>
					<td width="1" height="1"></td>
				</tr>
			</table>
		</jsxpalette>
		<p></p>
	</body>

</html>