<?xml version="1.0" encoding="UTF-8"?>
<meta id="meta.user" label="CONF_MESSAGE[Text Metadata]" description="CONF_MESSAGE[Simple metadata implementation stored in a hidden file.]"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
	<class_definition filename="plugins/meta.user/class.UserMetaManager.php" classname="UserMetaManager"/>
	<client_settings icon="plugins/access.mysql/resources/images/mysql_icon.png">
		<resources>
			<i18n namespace="meta.user" path="plugins/meta.user/i18n" />
			<js file="plugins/meta.user/class.MetaCellRenderer.js" className="MetaCellRenderer"/>
            <img_library alias="meta_user" path="plugins/meta.user/img"/>
		</resources>
	</client_settings>
	<server_settings>
		<!--<param name="meta_file_name" type="string" label="CONF_MESSAGE[Meta File]" description="CONF_MESSAGE[Hidden file used inside folders to save meta data]" mandatory="true" default=".ajxp_meta"/>-->
		<param name="meta_fields" type="string" replicationGroup="group1" label="CONF_MESSAGE[Field ID]" description="CONF_MESSAGE[Id of fiels, use standard characters here.]" mandatory="true" default="comment_field"/>
		<param name="meta_labels" type="string" replicationGroup="group1" label="CONF_MESSAGE[Label]" description="CONF_MESSAGE[Label of the field, human friendly]" mandatory="true" default="My Comments"/>
		<param name="meta_types" type="select" choices="string|CONF_MESSAGE[Short text],textarea|CONF_MESSAGE[Long text],creator|CONF_MESSAGE[Created by...],updater|CONF_MESSAGE[Last updated by...],stars_rate|CONF_MESSAGE[Stars Rating],css_label|CONF_MESSAGE[Color labels],choice|CONF_MESSAGE[Selection (set choices in Additional Info)],tags|CONF_MESSAGE[Tags (extensible sets of values)]" replicationGroup="group1" label="CONF_MESSAGE[Field Type]" description="CONF_MESSAGE[Type of field]" mandatory="true" default="string"/>
		<param name="meta_visibility" type="select" replicationGroup="group1" label="CONF_MESSAGE[Column visibility]" description="CONF_MESSAGE[Set default visibility.]" mandatory="true" default="visible" choices="visible|CONF_MESSAGE[Visible],hidden|CONF_MESSAGE[Hidden]"/>
		<param name="meta_additional" type="string" replicationGroup="group1" label="CONF_MESSAGE[Additional info]" description="CONF_MESSAGE[Depending on the field type. Currently used for selection only]" mandatory="false"/>
	</server_settings>
	<registry_contributions>
		<hooks>
			<serverCallback hookName="node.info" methodName="extractMeta" applyCondition="$apply=($args[2]!='minimal');"/>
			<serverCallback hookName="node.change" methodName="updateMetaLocation" defer="true"/>
		</hooks>
		<client_configs>
			<template_part ajxpId="search_container" ajxpClass="SearchEngine" ajxpOptions="{}"/>
			<template_part ajxpId="search_container" ajxpClass="SearchEngine" ajxpOptions='{"toggleResultsVisibility":"search_results_cont", "fitMarginBottom":20}' theme="vision"/>
			<template_part ajxpId="search_container" ajxpClass="SearchEngine" ajxpOptions='{"toggleResultsVisibility":"search_results_cont", "searchChooserAsResultsHeader":true, "openSearchInput":"true", "openSearchStickLeftTo":"topPane", "toggleResultsFitTo":"cpane_tabs", "fitMarginBottom":0, "toggleResultsOffsetRight":0, "toggleResultsOffsetTop":0, "detailThumbSize":24}' theme="orbit"/>
			<component_config className="FilesList">
				<columns><!-- Dynamically generated by the plugin  --></columns>
			</component_config>
			<component_config className="InfoPanel">
				<infoPanelExtension mime="generic_file,generic_dir" attributes="">
					<html></html>
				</infoPanelExtension>
			</component_config>
		</client_configs>
		<actions>
            <action name="meta_user_list_tags">
                <processing>
                    <serverCallback methodName="listTags"/>
                </processing>
            </action>
            <action name="edit_user_meta_mass">
                <gui text="meta.user.1" title="meta.user.1" src="meta_user/ICON_SIZE/tag.png" iconClass="icon-tags" hasAccessKey="false">
                    <context selection="true" dir="" recycle="hidden"
                             actionBar="true" contextMenu="true" infoPanel="false"
                             actionBarGroup="info_panel" inZip="false">
                    </context>
                    <selectionContext dir="true" file="file" recycle="false" unique="false" multipleOnly="true"/>
                </gui>
                <rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
                <processing>
                    <clientCallback prepareModal="true"><![CDATA[
                        pydio.getController().fireAction("edit_user_meta");
                    ]]></clientCallback>
                </processing>
            </action>
			<action name="edit_user_meta">
				<gui text="meta.user.1" title="meta.user.1" src="meta_user/ICON_SIZE/tag.png" iconClass="icon-tags" hasAccessKey="false">
					<context selection="true" dir="" recycle="hidden"
						actionBar="true" contextMenu="true" infoPanel="false"
						actionBarGroup="more" inZip="false">
					</context>
					<selectionContext dir="true" file="file" recycle="false" unique="false"/>
					</gui>
				<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
				<processing>
					<clientCallback prepareModal="true"><![CDATA[
                        ResourcesManager.detectModuleToLoadAndApply('MetaCellRenderer', function(){
                            var userSelection = ajaxplorer.getUserSelection();
                            var loadFunc = function(oForm){
                                var form = $(oForm).select('div[id="user_meta_form"]')[0];
                                var nodeMeta = $H();
                                var firstNodeMeta = userSelection.getUniqueNode().getMetadata();
                                var metaConfigs = MetaCellRenderer.prototype.staticGetMetaConfigs();
                                if(userSelection.isUnique()){
                                    nodeMeta = firstNodeMeta;
                                }
                                metaConfigs.each(function(pair){
                                    var value = nodeMeta.get(pair.key) || '';
                                    form.insert('<div class="SF_element"><div class="SF_label">'+pair.value.label+' : </div><input class="SF_input" name="'+pair.key+'" value="'+value.replace(/"/g, '&quot;')+'"/></div>');
                                    var element = form.down('input[name="'+pair.key+'"]');
                                    var fieldType = pair.value.type;
                                    if(fieldType == 'stars_rate'){
                                        MetaCellRenderer.prototype.formPanelStars(element, form);
                                    }else if(fieldType == 'css_label'){
                                        MetaCellRenderer.prototype.formPanelCssLabels(element, form);
                                    }else if(fieldType == 'textarea'){
                                        MetaCellRenderer.prototype.formTextarea(element, form);
                                    }else if(fieldType == 'choice'){
                                        MetaCellRenderer.prototype.formPanelSelectorFilter(element, form);
                                    }else if(fieldType == 'tags'){
                                        MetaCellRenderer.prototype.formPanelTags(element, form);
                                    }else if(fieldType == 'updater' || fieldType == 'creator'){
                                        element.disabled = true;
                                    }
                                });
                            }
                            var closeFunc = function(){
                                var oForm = $(modal.getForm());
                                userSelection.updateFormOrUrl(modal.getForm());
                                PydioApi.getClient().submitForm(oForm, true);
                                hideLightBox(true);
                                return false;
                            };
                            modal.showDialogForm('Meta Edit', 'user_meta_form', loadFunc, closeFunc);
						});
                    ]]></clientCallback>
					<clientForm id="user_meta_form"><![CDATA[
					<div id="user_meta_form" action="edit_user_meta" box_width="320"></div>
					]]></clientForm>
					<serverCallback methodName="editMeta" restParams="/file+" developerComment="Edit user-defined metadata on a node">
                        <input_param name="file" type="path" description="Path to the node to edit"/>
                        <input_param name="ANY" type="ANY"
                                     description="User-defined metadata key(s) and their corresponding values"/>
					</serverCallback>
					</processing>
			</action>
		</actions>
	</registry_contributions>
	<dependencies>
		<!-- Wrapper type plugins only -->
		<pluginClass pluginName="access.fs|access.ftp|access.demo|access.remote_fs"/>
	</dependencies>
</meta>
