<?xml version="1.0" encoding="UTF-8"?>
<meta id="meta.comments" label="CONF_MESSAGE[Comments Feed]" description="CONF_MESSAGE[Display a chat-like feed on all nodes]"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
	<class_definition filename="plugins/meta.comments/CommentsMetaManager.php" classname="Pydio\Access\Meta\UserGenerated\CommentsMetaManager"/>
	<client_settings>
		<resources>
			<i18n namespace="meta.comments" path="plugins/meta.comments/res/i18n" />
            <css file="plugins/meta.comments/res/comments_feed.css" autoload="true"/>
			<js file="plugins/meta.comments/res/build/MetaComments.js" className="MetaComments"/>
		</resources>
	</client_settings>
    <server_settings>
        <param name="COMMENT_SIZE_LIMIT" type="integer" label="CONF_MESSAGE[Comment limit]"
                      description="CONF_MESSAGE[Maximum number of characters for each comment]" default="1000" />
    </server_settings>
	<registry_contributions>
		<hooks>
			<serverCallback hookName="node.info" methodName="mergeMeta" applyCondition="$apply=($args[2]!='minimal');"/>
            <serverCallback hookName="node.change" methodName="moveMeta" defer="true"/>
		</hooks>
		<client_configs>
			<component_config component="InfoPanel">
                <infoPanel mime="meta:ajxp_has_comments_feed,ajxp_root_node" reactComponent="MetaComments.Panel" weight="10"/>
			</component_config>
		</client_configs>
		<actions>
			<action name="load_comments_feed">
				<processing>
					<serverCallback methodName="switchActions" restParams="/file+" developerComment="Load the comments on this file or below">
                        <input_param name="file" type="path" description="Path to file or folder"/>
                        <input_param name="sort_by" type="string" description="Sort field" default="date"/>
                        <input_param name="sort_dir" type="string" description="Sort direction" default="asc"/>
                        <input_param name="offset" type="integer" description="Start at given index" default="0"/>
                        <input_param name="limit" type="integer" description="Limit result to a number of results"/>
                        <output type="json" description="Return comments as a JSON array"/>
					</serverCallback>
				</processing>
			</action>
			<action name="post_comment">
				<processing>
					<serverCallback methodName="switchActions" restParams="/file+" developerComment="Post a comment linked to a given file">
                        <input_param name="file" type="path" description="Path to file or folder"/>
                        <input_param name="content" type="string" description="Content of the comment"/>
					</serverCallback>
				</processing>
			</action>
			<action name="delete_comment">
				<processing>
					<serverCallback methodName="switchActions" restParams="/" developerComment="Delete a comment by reposting its json representation">
                        <input_param name="comment_data" type="JSON"
                                     description="An array containing date, author and content, as returned by load_comments_feed"/>
					</serverCallback>
				</processing>
			</action>
		</actions>
	</registry_contributions>
	<dependencies>
		<!-- Wrapper type plugins only -->
		<pluginClass pluginName="access.fs|access.ftp|access.demo"/>
	</dependencies>
</meta>
