<?xml version="1.0" encoding="UTF-8"?>
<editor enabled="false" id="editor.etherpad" openable="true" iconClass="icon-comments-alt" order="10"
        text="etherpad.2" title="etherpad.3" icon="edit.png" className="EtherpadLauncher" canWrite="true"
        mimes="pad" formId="ether_box" label="CONF_MESSAGE[Etherpad]" description="CONF_MESSAGE[Collaborative edition of text files]"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
	<client_settings>
        <resources>
            <js file="plugins/editor.etherpad/class.EtherpadLauncher.js" className="EtherpadLauncher"/>
            <i18n path="plugins/editor.etherpad/i18n" namespace="etherpad"/>
            <img_library alias="etherpad" path="plugins/editor.etherpad"/>
        </resources>
	</client_settings>
    <server_settings>
        <global_param name="ETHERPAD_SERVER" type="string" label="Server Host" description="Etherpad server host"/>
        <global_param name="ETHERPAD_APIKEY" type="string" label="Api Key" description="Etherpad api key"/>
    </server_settings>
	<clientForm id="ether_box"><![CDATA[
		<div id="ether_box" action="editer" box_width="80%" box_height="90%" box_padding="0"  class="editor_container">
            <style>
                #ether_box div.action_bar.editor_action_bar {margin-right: 220px;}
                #ether_box .action_bar a {
                    background: #fff;
                    background: -webkit-linear-gradient(#fff, #f0f0f0);
                    background: -moz-linear-gradient(#fff, #f0f0f0);
                    background: -o-linear-gradient(#fff, #f0f0f0);
                    background: -ms-linear-gradient(#fff, #f0f0f0);
                    background: linear-gradient(#fff, #f0f0f0);
                    border: 1px solid #ccc;
                    border-radius: 3px;
                    cursor: pointer;
                    display: inline-block;
                    min-height: 18px;
                    overflow: hidden;
                    padding: 4px 5px;
                    text-align: center;
                    text-decoration: none;
                    min-width: 18px;
                }
            </style>
			<div class="action_bar">
				<a href="#" onclick="return false;" class="icon-save" id="saveButton" onclick="saveForm();return false;"><img src="AJXP_THEME_FOLDER/images/actions/22/filesave.png" width="22" height="22" alt="AJXP_MESSAGE[53]" border="0"><br><span message_id="53">AJXP_MESSAGE[53]</span></a>
				<a href="#" onclick="return false;" class="icon-download" id="downloadFileButton"><img width="22" height="22" src="AJXP_THEME_FOLDER/images/actions/22/download_manager.png" alt="AJXP_MESSAGE[88]" border="0"><br><span message_id="88">AJXP_MESSAGE[88]</span></a>
			</div>
			<iframe id="ether_box_frame" style="width:100%;border: none;" src=""></iframe>
			<div class="ether_box_bottom" style="background-color: #F2F2F2;  height: 25px;  border-top: 1px solid #CCC;  margin-top: -3px;"></div>
		</div>
	]]></clientForm>
	<dependencies>
		<!-- Stream Wrapper Access -->
		<activePlugin pluginName="access.AJXP_STREAM_PROVIDER"/>
	</dependencies>
    <registry_contributions>
        <actions>
            <action name="etherpad_create">
                <processing>
                    <serverCallback methodName="switchAction"/>
                </processing>
            </action>
            <action name="etherpad_save">
                <processing>
                    <serverCallback methodName="switchAction"/>
                </processing>
            </action>
            <action name="etherpad_get_content">
                <processing>
                    <serverCallback methodName="switchAction"/>
                </processing>
            </action>
            <action name="etherpad_close">
                <processing>
                    <serverCallback methodName="switchAction"/>
                </processing>
            </action>
            <action name="etherpad_proxy_api">
                <processing>
                    <serverCallback methodName="switchAction"/>
                </processing>
            </action>
            <action name="mkpad">
                <gui text="etherpad.1" title="etherpad.1b" src="filenew.png" accessKey="file_access_key" iconClass="icon-file-alt" hasAccessKey="false">
                    <context selection="false" dir="true" recycle="hidden" actionBar="false"
                             contextMenu="false" infoPanel="false" actionBarGroup="create" inZip="false"/>
                </gui>
                <rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
                <processing>
                    <clientCallback prepareModal="true"><![CDATA[
                    modal.showDialogForm('Create', 'mkpad_form', null, function(){
                        var oForm = modal.getForm();
                        oForm.down("#filename").setValue(oForm.down("#filename").getValue()+ '.pad');
                        var d = new Date().getTime();
                        var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
                            var r = (d + Math.random()*16)%16 | 0;
                            d = Math.floor(d/16);
                            return (c=='x' ? r : (r&0x7|0x8)).toString(16);
                        });
                        oForm.down("#content").setValue(uuid);
                        PydioApi.getClient().submitForm(oForm);
                        hideLightBox(true);
                        return false;
                    });
                ]]></clientCallback>
                    <clientForm id="mkpad_form"><![CDATA[
                    <div id="mkpad_form" action="mkfile">
                        <div class="dialogLegend" ajxp_message_id="etherpad.8">AJXP_MESSAGE[etherpad.8]</div>
                        <input type="text" id="filename" style="width:390px;" name="filename" value="">
                        <input type="hidden" id="content" name="content" value="">
                    </div>
                ]]></clientForm>
                    <clientListener name="init"><![CDATA[
                    document.observe("ajaxplorer:afterApply-mkdir", function(){
                        if(modal.getForm().down("#alt_mkpad")) return;
                        var link = '<div class="dialogLegend" style="padding-top:20px;" id="alt_mkpad"><span class="icon-chevron-right"></span> '+MessageHash["etherpad.9"]+'</div>';
                        modal.getForm().down("div.dialogButtons").insert({before:link});
                        modal.getForm().down("#alt_mkpad").down("a").addClassName("create_file_alt_link").observe("click", function(){
                            pydio.getController().fireAction("mkpad");
                        });
                    });
                ]]></clientListener>
                </processing>
            </action>
        </actions>
        <extensions>
            <extension icon="etherpad/discussion.png" messageId="etherpad.1" font="comment-multiple-outline" mime="pad"/>
        </extensions>
        <hooks>
            <!--<serverCallback methodName="hideExtension" hookName="node.info"/>-->
            <serverCallback methodName="handleNodeChange" hookName="node.change"/>
        </hooks>
    </registry_contributions>
    <class_definition classname="EtherpadClient" filename="plugins/editor.etherpad/class.EtherpadClient.php"/>
</editor>
