<?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/class.CommentsMetaManager.php" classname="CommentsMetaManager"/>
	<client_settings>
		<resources>
			<i18n namespace="meta.comments" path="plugins/meta.comments/i18n" />
            <css file="plugins/meta.comments/comments_feed.css" autoload="true"/>
			<js file="plugins/meta.comments/class.CommentsPanel.js" className="CommentsPanel"/>
		</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 className="InfoPanel">
				<infoPanelExtension mime="meta:ajxp_has_comments_feed,ajxp_root_node" attributes="" modifier="CommentsPanel.prototype.loadInfoPanel">
					<html><![CDATA[
                        <div id="ajxp_comments_info_panel">
                            <div class="panelHeader infoPanelGroup" colspan="2"><span class="icon-comments-alt" data-ajxpAction="comments" title="AJXP_MESSAGE[meta.comments.1]"></span>AJXP_MESSAGE[meta.comments.1]</div>
                            <div id="comments_container"></div>
                            <div id="comments_form">
                                <textarea class="comments_textarea" placeholder="AJXP_MESSAGE[meta.comments.2]"></textarea>
                                <div><input type="button" value="AJXP_MESSAGE[meta.comments.3]" id="comments_submit"></div>
                            </div>
                        </div>
                    ]]></html>
				</infoPanelExtension>
			</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|access.remote_fs"/>
	</dependencies>
</meta>
