<?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" autoload="true"/>
            <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[Meta Fields]" description="CONF_MESSAGE[Comma separated list of fields, use standard characters here.]" mandatory="true" default="comment_field"/>
		<param name="meta_labels" type="string" replicationGroup="group1" label="CONF_MESSAGE[Meta Labels]" description="CONF_MESSAGE[Comma separated list of labels, be sure to define as many as fields!]" mandatory="true" default="My Comments"/>
		<param name="meta_visibility" type="string" replicationGroup="group1" label="CONF_MESSAGE[Columns visibility]" description="CONF_MESSAGE[Set default visibility for each columns. Either by columns, using commas, or one value that will be applied to all columns. Value can be 'visible' or 'hidden'.]" mandatory="false" default="visible"/>
	</server_settings>
	<registry_contributions>
		<hooks>
			<serverCallback hookName="node.info" methodName="extractMeta" applyCondition="$apply=($args[2]!='minimal');"></serverCallback>
			<serverCallback hookName="node.change" methodName="updateMetaLocation" defer="true"></serverCallback>
		</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"/>
			<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="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="true"></selectionContext>
					</gui>
				<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""></rightsContext>
				<processing>
					<clientCallback prepareModal="true"><![CDATA[
						var userSelection = ajaxplorer.getUserSelection();
						var loadFunc = function(oForm){
							var form = $(oForm).select('div[id="user_meta_form"]')[0];
							var nodeMeta = userSelection.getUniqueNode().getMetadata();
							var metaFields = nodeMeta.get('meta_fields').split(',');
							var metaLabels = nodeMeta.get('meta_labels').split(',');
							for(var i=0;i<metaFields.length;i++){
								var value = nodeMeta.get(metaFields[i]) || '';
								form.insert('<div class="SF_element"><div class="SF_label">'+metaLabels[i]+' : </div><input class="SF_input" name="'+metaFields[i]+'" value="'+value+'"/></div>');
								if(metaFields[i] == 'stars_rate'){
									var element = form.down('input[name="stars_rate"]');
									MetaCellRenderer.prototype.formPanelStars(element, form);
								}else if(metaFields[i] == 'css_label'){
									var element = form.down('input[name="css_label"]');
									MetaCellRenderer.prototype.formPanelCssLabels(element, form);
								}
								// mod for textarea
								else if(metaFields[i].substr(0,5) == 'area_'){
									var element = form.down('input[name="'+metaFields[i]+'"]');
									MetaCellRenderer.prototype.formTextarea(element, form);
								}
							}
						}
						var closeFunc = function(){
							var oForm = $(modal.getForm());
							userSelection.updateFormOrUrl(modal.getForm());	
							ajaxplorer.actionBar.submitForm(oForm);				
							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="250"></div>
					]]></clientForm>
					<serverCallback methodName="editMeta"></serverCallback>
					</processing>
			</action>			
		</actions>
	</registry_contributions>
	<dependencies>
		<!-- Wrapper type plugins only -->
		<pluginClass pluginName="access.fs|access.ftp|access.demo|access.remote_fs"/>
	</dependencies>				
</meta>