<?xml version="1.0" encoding="UTF-8"?>
<editor id="editor.diaporama" order="-1" openable="true" iconClass="icon-picture" previewProvider="true" text="186" title="136" icon="frame_image.png" className="Diaporama" mimes="png,jpg,jpeg,gif" formId="diaporama_box" label="CONF_MESSAGE[Image viewer]" description="CONF_MESSAGE[Image viewer, used for previewing images and browsing them in a diaporam. Generates a thumbnail version of the images.]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
	<server_settings>
		<global_param name="META_EXTRACTION_REMOTEWRAPPERS" type="array" label="CONF_MESSAGE[Remote Wrappers]" description="CONF_MESSAGE[When connected to a remote server, metadata extraction can make the listing action very long, as it must first copy each file locally. For plugins using the defined wrappers and files whose size is greater than this threshold, the image type and dimension will be skipped.]" default="ftpAccessWrapper"/>
		<global_param name="META_EXTRACTION_THRESHOLD" type="string" label="CONF_MESSAGE[Size Threshold]" description="CONF_MESSAGE[Threshold]" default="50000"/>
		<global_param name="GENERATE_THUMBNAIL" type="boolean" label="CONF_MESSAGE[Thumbnails]" description="CONF_MESSAGE[Generate thumbnails or not]" default="true"/>
		<global_param name="PREVIEWER_LOWRES_SIZES" type="string" label="CONF_MESSAGE[Low-res Sizes]" description="CONF_MESSAGE[Threshold for low-res versions of images]" default="300,700,1000,1300" expose="true"/>
		<global_param name="THUMBNAIL_QUALITY" type="integer" label="CONF_MESSAGE[Quality]" description="CONF_MESSAGE[Thumbs quality]" default="2"/>
    <global_param name="EXIF_ROTATION" type="boolean" label="CONF_MESSAGE[Exif Rotation]" description="CONF_MESSAGE[Rotate image using exif rotation]" default="true"/>
	</server_settings>
	<class_definition filename="plugins/editor.diaporama/class.ImagePreviewer.php" classname="ImagePreviewer"/>
    <client_settings>
        <resources>
            <js file="plugins/editor.diaporama/class.Diaporama.js" className="Diaporama"/>
            <i18n namespace="diaporama" path="plugins/editor.diaporama/i18n"/>
            <css file="plugins/editor.diaporama/rotator.css"/>
        </resources>
    </client_settings>
	<clientForm id="diaporama_box"><![CDATA[
		<div id="diaporama_box" action="view_diapo" box_width="90%" box_height="90%" box_resize="true" box_padding="0">
			<div class="action_bar full_width_action_bar" style="width: 100%;" title="AJXP_MESSAGE[414]">
				<div align="right" id="diaporama_input_boxes" style="float:right; padding-top: 1px; padding-right: 5px; height: 21px;margin-top:28px;margin-left:30px;">
				    <a href="#" id="showLowResButton" class="icon-picture" style="float: none; display:none;padding: 0 !important;margin-top: 0;font-size: 10px;"><span message_id="526">AJXP_MESSAGE[526]</span></a>
				    <a href="#" id="showOriginalButton" class="icon-picture" style="float: none; display:none;padding: 0 !important;margin-top: 0;font-size: 14px;"><span message_id="525">AJXP_MESSAGE[525]</span></a>
					<input id="zoomValue" type="text" style="text-align: center;width: 40px;height: 16px;padding: 2px;border: 1px solid #222;padding-right: 1px;background-color: #666;color: #fff;margin-top: -2px;"/>
					<a href="#" class="icon-screenshot" id="actualSizeButton" style="float: none;padding: 0 !important;margin-top: 0;font-size: 14px;" onclick="return false;"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/zoom-original.png" alt="" border="0"><br><span message_id="327">AJXP_MESSAGE[327]</span></a>
				</div>
				<a href="#" class="icon-arrow-left" id="prevButton" onclick="return false;"><img  width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/back_22.png" alt="" border="0"><br><span message_id="178">AJXP_MESSAGE[178]</span></a>
				<a href="#" class="icon-stop" access_key="s" id="stopButton" onclick="return false;"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/player_stop.png" alt="AJXP_MESSAGE[233]" border="0"><br><span message_id="232">AJXP_MESSAGE[232]</span></a>
                <input id="time" type="text" value="3 s" style="text-align: center;width: 26px;height: 17px;padding: 0px 2px 2px 2px;background-color: #666;color: #fff;margin: 6px 1px;float: left;border: 1px solid #222;border-radius: 2px;"/>
				<a href="#" class="icon-play" access_key="p" id="playButton" onclick="return false;"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/player_play.png" alt="AJXP_MESSAGE[231]" border="0"><br><span message_id="230">AJXP_MESSAGE[230]</span></a>
				<a href="#" class="icon-arrow-right" id="nextButton" onclick="return false;"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/forward_22.png" alt="" border="0"><br><span message_id="179">AJXP_MESSAGE[179]</span></a>
			</div>
            <div style="text-align:center; vertical-align:center;overflow:auto; background-color:rgb(85,85,85);" id="imageContainer">
                <div id="imageBorder" style="background-color:transparent;-webkit-box-shadow:rgb(51, 51, 51) 2px 2px 6px;-moz-box-shadow:rgb(51, 51, 51) 2px 2px 6px;box-shadow:rgb(51, 51, 51) 2px 2px 6px;"><img id="mainImage" src=""></div>
            </div>
		</div>
	]]></clientForm>
	<clientForm id="diaporama_box" theme="orbit"><![CDATA[
		<div id="diaporama_box" action="view_diapo" box_width="90%" box_height="90%" box_resize="true" box_padding="0">
			<div class="action_bar full_width_action_bar" style="width: 100%;" title="AJXP_MESSAGE[414]">
				<div align="right" id="diaporama_input_boxes" style="float:right; padding-top: 1px; padding-right: 5px; height: 21px;margin-top:28px;margin-left:30px;">
				    <a href="#" id="showLowResButton" class="icon-picture" style="float: none; display:none;padding: 0 !important;margin-top: 0;font-size: 10px;"><span message_id="526">AJXP_MESSAGE[526]</span></a>
				    <a href="#" id="showOriginalButton" class="icon-picture" style="float: none; display:none;padding: 0 !important;margin-top: 0;font-size: 14px;"><span message_id="525">AJXP_MESSAGE[525]</span></a>
					<input id="zoomValue" type="text" style="text-align: center;width: 40px;height: 16px;padding: 2px;border: 1px solid #222;padding-right: 1px;background-color: #666;color: #fff;margin-top: -2px;"/>
					<a href="#" class="icon-screenshot" id="actualSizeButton" style="float: none;padding: 0 !important;margin-top: 0;font-size: 14px;" onclick="return false;"><span message_id="327">AJXP_MESSAGE[327]</span></a>
				</div>
				<a href="#" class="icon-arrow-left" id="prevButton" onclick="return false;"><span message_id="178">AJXP_MESSAGE[178]</span></a>
				<a href="#" class="icon-stop" access_key="s" id="stopButton" onclick="return false;"><span message_id="232">AJXP_MESSAGE[232]</span></a>
                <input id="time" type="text" value="3 s" style="text-align: center;width: 26px;height: 17px;padding: 0px 2px 2px 2px;background-color: #666;color: #fff;margin: 6px 1px;float: left;border: 1px solid #222;border-radius: 2px;"/>
				<a href="#" class="icon-play" access_key="p" id="playButton" onclick="return false;"><span message_id="230">AJXP_MESSAGE[230]</span></a>
				<a href="#" class="icon-arrow-right" id="nextButton" onclick="return false;"><span message_id="179">AJXP_MESSAGE[179]</span></a>
			</div>
            <div style="text-align:center; vertical-align:center;overflow:auto; background-color:rgb(85,85,85);" id="imageContainer">
                <div id="imageBorder" style="background-color:transparent;-webkit-box-shadow:rgb(51, 51, 51) 2px 2px 6px;-moz-box-shadow:rgb(51, 51, 51) 2px 2px 6px;box-shadow:rgb(51, 51, 51) 2px 2px 6px;"><img id="mainImage" src=""></div>
            </div>
		</div>
	]]></clientForm>
    <dependencies>
        <!-- Image proxy must be implemented -->
        <activePlugin pluginName="access.AJXP_STREAM_PROVIDER"/>
        <activePlugin pluginName="access.ajxp_user"/>
    </dependencies>
	<registry_contributions>
		<hooks>
			<serverCallback hookName="node.change" methodName="removeThumbnail" defer="true"/>
		</hooks>
		<actions>
			<action name="slideshow_sel">
				<gui text="234" title="234" src="frame_image.png" accessKey="" hasAccessKey="false">
					<context selection="true" dir="" recycle="hidden"
						actionBar="false" contextMenu="false" infoPanel="true"
						actionBarGroup="get">
					</context>
					<selectionContext dir="true" file="true" recycle="true" unique="false" multipleOnly="true" allowedMimes="AJXP_MIMES_IMAGE" behaviour="hidden"/>
                </gui>
				<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
				<processing>
					<clientCallback prepareModal="true"><![CDATA[
						var selectedMime = getAjxpMimeType(ajaxplorer.getUserSelection().getUniqueNode());
						var editors = pydio.Registry.findEditorsForMime(selectedMime);
						var editorData;
						if(editors.length){
							editorData = editors[0];
						}
						if(editorData){
							pydio.Registry.loadEditorResources(editorData.resourcesManager);
							modal.openEditorDialog(editorData);
						}else{
							alert('no data found!');
						}
						]]></clientCallback>
					</processing>
			</action>
			<action name="preview_data_proxy" skipSecureToken="true" contentTypedProvider="true">
				<processing>
					<serverCallback methodName="switchAction" restParams="/file+" sdkMethodName="imagePreview" developerComment="Server an image with correct mimetype, eventually rendered as thumb.">
                        <input_param name="file" type="AJXP_NODE" description="Path to the node" mandatory="true"/>
                        <input_param name="get_thumb" type="boolean" description="Whether to get a thumb version of the image" mandatory="true"/>
                        <input_param name="dimension" type="integer" description="If get_thumb is true, max dimension of the thumb" default="200" mandatory="false" />
					</serverCallback>
				</processing>
			</action>
		</actions>
		<hooks>
			<serverCallback hookName="node.info" methodName="extractImageMetaData" applyCondition="$apply=($args[2]!='minimal');"/>
		</hooks>
		<client_configs>
			<component_config className="FilesList">
				<columns>
					<additional_column messageId="135" attributeName="readable_dimension" sortType="String" defaultVisibilty="hidden"/>
				</columns>
			</component_config>
			<component_config className="InfoPanel">
				<infoPanelExtension mime="AJXP_MIMES_IMAGE" attributes="image_width,image_height,image_type" theme="oxygen,umbra,vision">
					<messages>
						<message key="type_string" id="134"/>
						<message key="dim_string" id="135"/>
						<message key="header_string" id="343"/>
					</messages>
					<html><![CDATA[
						<div style="">
							<div class="panelHeader infoPanelGroup" colspan="2"><span class="icon-picture" data-ajxpAction="no-action"></span> #{header_string}</div>
							<table class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">
								<tr>
									<td class="infoPanelLabel">#{dim_string}</td>
									<td class="infoPanelValue">#{image_width}px X #{image_height}px</td>
								</tr>
								<tr class="even">
									<td class="infoPanelLabel">#{type_string}</td>
									<td class="infoPanelValue">#{image_type}</td>
								</tr>
							</table>
						</div>
					]]></html>
				</infoPanelExtension>
				<infoPanelExtension mime="AJXP_MIMES_IMAGE" attributes="basename,preview_rich,filesize,mimestring,formated_date,ajxp_description,image_width,image_height,image_type" theme="orbit" primary="true">
                    <messages>
                        <message key="name_string" id="133"/>
                        <message key="size_string" id="127"/>
                        <message key="type_string" id="134"/>
                        <message key="modif_string" id="138"/>
                        <message key="dim_string" id="135"/>
                    </messages>
                    <html><![CDATA[
                        <div class="infoPanelImagePreview">
                            <div class="infoPanelBasenameTitle">#{basename}</div>
                            #{preview_rich}
                            <div>
                                <div class="toolbar_placeholder" data-toolbarId="info_panel" style="margin-top: 15px;"></div>
                                <div class="toolbar_placeholder" data-toolbarId="info_panel_share"></div>
                            </div>
                        </div>
                        <div class="infoPanelAllMetadata">
                            <div id="info_panel_primary">
                                <table class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">
                                    <tr class="even">
                                        <td class="infoPanelLabel">#{size_string}</td>
                                        <td class="infoPanelLabel">#{dim_string}</td>
                                    </tr>
                                    <tr>
                                        <td class="infoPanelValue">#{filesize}</td>
                                        <td class="infoPanelValue">W #{image_width} px <br> H  #{image_height} px</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="infoPanelLabel">#{modif_string}</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="infoPanelValue">#{ajxp_description}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    ]]></html>
				</infoPanelExtension>
			</component_config>
		</client_configs>
	</registry_contributions>
</editor>
