<?xml version="1.0" encoding="UTF-8"?>
<registry_contributions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
	<actions>
        <action name="get_xml_registry">
            <processing>
                <serverCallback methodName="switchAction"/>
            </processing>
        </action>
        <action name="state">
            <processing>
                <serverCallback methodName="switchAction" restParams="/xPath+" sdkMethodName="getAccountData" developerComment="REST equivalent of the get_xml_registry query, to load some non-workspace-specific data based on a registry xPath. Output format can be sent back in JSON (XML by default).">
                    <input_param name="xPath" type="string" description="Optional xPath to search in registry"/>
                    <input_param name="format" type="string" description="Optional format parameter, xml by default, can be forced to json"/>
                    <output type="JSON|XML" description="Return XML or JSON depending on the format parameter."/>
                </serverCallback>
            </processing>
        </action>
		<action name="switch_repository">
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="load_repository_info">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
			<processing>
				<serverCallback methodName="switchAction" restParams="/" developerComment="Retrieve some plugins-contributed info about the workspace (e.g. Quota, Sharing status, etc).">
                    <output type="JSON" description="Array of plugins informations"/>
				</serverCallback>
			</processing>
		</action>
        <action name="user_create_repository">
            <gui text="417" title="418" src="user-create-repository.png" accessKey="" hasAccessKey="false" iconClass="icon-plus-sign">
                <context selection="false" dir="" recycle="true" ajxpWidgets="RepositorySelect"/>
            </gui>
            <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
            <processing>
				<clientCallback prepareModal="true" dialogOpenForm="user_create_repository_form" dialogOkButtonOnly="false" dialogSkipButtons="false">
					<dialogOnOpen><![CDATA[
                       var conn = new Connexion();
                       var okButton = oForm.down('.dialogButtons input');
                       var backButton = new Element('img', {
                            src:ajxpResourcesFolder+'/images/actions/22/back_22.png',
                            style:'float: left;margin-top: 7px;margin-left: 4px;cursor: pointer;',
                            title:'Back'
                       }).observe('click', function(e){
                            Event.stop(e);
                            new Effect.Parallel([
                                new Effect.Morph('user_templates_selector', {style:'left:0px;'}),
                                new Effect.Morph('user_template_parameters', {style:'left:420px;'}),
                                new Effect.Morph('user_tpl_container', {style:'height:'+conn.ORIGINAL_HEIGHT+'px;'}),
                                new Effect.Opacity(okButton, {sync:true,from:1.0,to:0}),
                                new Effect.Opacity(backButton, {sync:true,from:1.0,to:0})
                            ], {
                                afterFinish:function(){
                                    $('user_templates_selector').select('div').invoke('removeClassName', 'selected-focus');
                                    modal.refreshDialogPosition();
                                }
                            });
                       }).setStyle({opacity:0});
                       okButton.setStyle({opacity:0});
                       okButton.insert({before:backButton});
                       conn.addParameter("get_action", "get_user_templates_definition");
                       conn.parseTplParameters = function(tplDiv){
                            if(!conn.TPL_XML) return;
                            if(!conn.FORM_MANAGER) conn.FORM_MANAGER = new FormManager();
                            var tplId = tplDiv.getAttribute('data-templateId');
                            var tplLabel = tplDiv.getAttribute('data-templateLabel');
                            tplDiv.addClassName('selected-focus');
                            $('user_tpl_params_title').update('<img style="top:3px;left:4px;" src="'+conn._baseUrl+'&get_action=get_user_template_logo&template_id='+tplId+'&icon_format=small'+'" class="panelHeaderIcon"> '+MessageHash[421].replace('%s',tplLabel));
                            $('user_template_parameters').select('div.SF_element').invoke('remove');
                            $('user_tpl_params_parameters').update('');
                            var params = conn.FORM_MANAGER.parseParameters(conn.TPL_XML, '//template[@repository_id="'+tplId+'"]/param');
                            //params.push(new Hash({name:"DISPLAY", type:"string", label:"Label", mandatory:"true", description:"Label of your repository"}));
                            conn.FORM_MANAGER.createParametersInputs($('user_tpl_params_parameters'), params, true, null, false, true, false);
                            $('user_tpl_params_parameters').insert(new Element('input', {type:'hidden',name:'template_id',value:tplId}));
                            var elements = $('user_tpl_params_parameters').select("div.SF_element");
                            $('user_template_parameters').down('div.dialogLegend').insert({before:elements[elements.length-1]});
                            var targetHeight = parseInt($('user_template_parameters').getHeight());
                             if(!targetHeight) targetHeight = params.length * 44 + 80;
                            new Effect.Parallel([
                                new Effect.Morph('user_templates_selector', {style:'left:-420px;'}),
                                new Effect.Morph('user_template_parameters', {style:'left:0px;'}),
                                new Effect.Morph('user_tpl_container', {style:'height:'+targetHeight+'px;'}),
                                new Effect.Opacity(okButton, {sync:true,from:0,to:1.0}),
                                new Effect.Opacity(backButton, {sync:true,from:0,to:1.0})
                            ], {afterFinish : function(){modal.refreshDialogPosition();}});
                       }
                       conn.onComplete = function(transport){
                            conn.TPL_XML = transport.responseXML;
                            var templates = XPathSelectNodes(conn.TPL_XML, "//template");
                            conn.ORIGINAL_HEIGHT = (templates.length*39+25);
                            $('user_tpl_container').setStyle({height:conn.ORIGINAL_HEIGHT+'px'});
                            $('user_templates_selector').update('<div class="panelHeader">'+MessageHash[420]+'</div>');
                            for(var i=0;i<templates.length;i++){
                                var label = templates[i].getAttribute('repository_label');
                                var tplId = templates[i].getAttribute('repository_id');
                                var labelDiv = new Element('div').update(label);
                                labelDiv.setStyle({
                                    padding:'12px 6px 12px 35px',
                                    fontSize:'1.3em',
                                    cursor:'pointer',
                                    borderBottom:'1px solid #EEE',
                                    backgroundRepeat: 'no-repeat',
                                    backgroundPosition: '5px 10px',
                                    backgroundImage:'url('+conn._baseUrl+'&get_action=get_user_template_logo&template_id='+tplId+'&icon_format=big)'
                                });
                                var tplDiv = new Element('div', {"data-templateId":tplId,"data-templateLabel":label}).update(labelDiv);
                                tplDiv.observe('click', function(e){
                                    conn.parseTplParameters(( e.target.getAttribute("data-templateId")?e.target:e.target.up('div') ));
                                });
                                labelDiv.observe('mouseover', function(e){e.target.up('div').addClassName('selected');}).observe('mouseout', function(e){e.target.up('div').removeClassName('selected');});
                                $('user_templates_selector').insert(tplDiv);
                            }
                       };
                       conn.sendAsync();
					]]></dialogOnOpen>
					<dialogOnComplete hideDialog="true"><![CDATA[
                            var formManager = new FormManager();
                            var params = $H({get_action:'user_create_repository'});
                            formManager.serializeParametersInputs($('user_template_parameters'), params, "DRIVER_OPTION_");
                            $('user_tpl_params_parameters').select('input[type="hidden"]').each(function(el){
                                params.set(el.name,el.value);
                            });
                            params.set("DISPLAY", params.get("DRIVER_OPTION_DISPLAY"));
                            params.unset("DRIVER_OPTION_DISPLAY");
                            params.unset("DRIVER_OPTION_DISPLAY_ajxptype");
                            var conn = new Connexion();
                            conn.setParameters(params);
                            conn.onComplete = function(transport){
                                PydioApi.getClient().parseXmlMessage(transport.responseXML);
                            }
                            conn.sendAsync();
					]]></dialogOnComplete>
				</clientCallback>
				<clientForm id="user_create_repository_form"><![CDATA[
					<div id="user_create_repository_form" action="user_create_repository" box_width="420" box_padding="0">
					    <div id="user_tpl_container" style="position:relative;width:418px;overflow:hidden;height:130px;border:1px solid #ddd; background-color: #f4f4f4;">
						<div id="user_templates_selector" style="position:absolute;width:420px;"><div class="panelHeader">AJXP_MESSAGE[419]</div></div>
						<div id="user_template_parameters" style="position:absolute;left:420px;width:420px;">
						    <div id="user_tpl_params_title" class="panelHeader panelHeaderWithIcon"></div>
						    <div style="padding:5px;">
						        <div class="dialogLegend" style="clear:left;">AJXP_MESSAGE[422]</div>
						        <div id="user_tpl_params_parameters"></div>
						    </div>
						</div>
						</div>
					</div>
				]]></clientForm>
                <serverCallback methodName="switchAction"/>
            </processing>
        </action>
		<action name="get_user_templates_definition">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="get_user_template_logo">
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="user_delete_repository">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="user_delete_user">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="get_bookmarks">
            <gui text="145" title="145" src="edit_user.png" iconClass="icon-bookmark" accessKey="" hasAccessKey="false">
                <context selection="false" dir="" recycle="true" actionBar="false" actionBarGroup="filter" contextMenu="false" infoPanel="false"/>
            </gui>
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback><![CDATA[

                ]]></clientCallback>
                <clientListener name="init"><![CDATA[
                window.setTimeout(function(){
                    if(!$('get_bookmarks_button')) {
                        if(!ajaxplorer.bookmarkBar) ajaxplorer.bookmarkBar = new BookmarksBar(null, {});
                        return;
                    }
                    if(!window.BookmarksBar) return;
                    var bmBar = new BookmarksBar($('get_bookmarks_button'), {bookmarksMenuOptions:{
                        className: 'menu desktop toolbarmenu panelHeaderMenu bmbarMenu',
                        mouseClick:'over',
                        topOffset:2,
                        leftOffset:0,
                        position:'bottom right'
                    }});
                    var bmAction = pydio.getController().actions.get('bookmark');
                    bmBar.addBookmarkObject = {
                        name:bmAction.getKeyedText(),
                        alt:bmAction.options.title,
                        image:ajxpResourcesFolder+'/images/actions/16/bookmark_add.png',
                        icon_class:'icon-plus-sign',
                        callback:function(e){
                            var node = ajaxplorer.getContextNode();
                            node.getMetadata().set('ajxp_bookmarked', 'true');
                            node.getMetadata().set('overlay_icon', 'bookmark.png');
                            node.getMetadata().set('overlay_class', 'icon-bookmark');
                            bmBar.addBookmark(node.getPath(), node.getLabel());
                        }.bind(this)
                    };
                    bmBar.load($H(), true);
                }, 500);
                ]]></clientListener>
                <serverCallback methodName="switchAction"/>
			</processing>
		</action>
        <action name="get_permissions_mask">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
            <processing>
                <serverCallback methodName="publishPermissionsMask" restParams="/" developerComment="Send the permissions mask for the current workspace, if defined."/>
            </processing>
        </action>
		<action name="save_user_pref">
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="get_binary_param" skipSecureToken="true">
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="get_global_binary_param" skipSecureToken="true">
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="store_binary_temp">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
			<processing>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
        <action name="user_list_authorized_users">
            <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
            <processing>
                <serverCallback methodName="switchAction" restParams="/value" developerComment="List users that are visible to the currently logged users">
                    <input_param name="value" type="string" description="Search string: users will be searched starting with this value. Can be empty."/>
                    <input_param name="users_only" type="boolean" description="Whether to return users only or users, groups and roles"/>
                    <input_param name="existing_only" type="boolean" description="If false and value is a non-existing user, will return a Create User ... entry in the list"/>
                    <output type="HTML" description="an UL/LI HTML list of users, groups, roles"/>
                </serverCallback>
            </processing>
        </action>
        <action name="custom_data_edit">
            <gui text="442" title="443" src="edit_user.png" iconClass="icon-reorder" accessKey="" hasAccessKey="false">
                <context selection="false" dir="" recycle="true" actionBar="false" actionBarGroup="utils" contextMenu="false" infoPanel="false"/>
            </gui>
            <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback prepareModal="true" dialogOpenForm="custom_data_edit" dialogOkButtonOnly="false" dialogSkipButtons="false">
                    <dialogOnOpen><![CDATA[
                        var f = new FormManager();
                          var definitions = f.parseParameters(ajaxplorer.getXmlRegistry(), "user/preferences/pref[@exposed]|//param[contains(@scope,'user')]");
                          f.createParametersInputs(oForm.down('#custom_data_edit'), definitions, true, ajaxplorer.user.preferences, false, true);
                          modal.refreshDialogPosition();
                    ]]></dialogOnOpen>
                    <dialogOnComplete hideDialog="true"><![CDATA[
                        var params = $H();
                        var f = new FormManager();
                          f.serializeParametersInputs(oForm.down('#custom_data_edit'), params, 'PREFERENCES_');
                          var conn = new Connexion();
                          params.set("get_action", "custom_data_edit");
                          conn.setParameters(params);
                          conn.setMethod("POST");
                          conn.onComplete = function(transport){
                              PydioApi.getClient().parseXmlMessage(transport.responseXML);
                              document.observeOnce("ajaxplorer:registry_part_loaded", function(event){
                                  if(event.memo != "user/preferences") return;
                                  pydio.Registry.logXmlUser();
                              });
                              ajaxplorer.loadXmlRegistry(false, "user/preferences");
                          };
                          conn.sendAsync();
                    ]]></dialogOnComplete>
                    <dialogOnCancel><![CDATA[]]></dialogOnCancel>
                </clientCallback>
                <clientForm id="custom_data_edit"><![CDATA[
                    <div id="custom_data_edit" action="custom_data_edit" box_width="320">
                    </div>
                ]]></clientForm>
                <serverCallback methodName="switchAction"/>
            </processing>
        </action>
        <action name="user_update_user">
            <gui text="519" title="520" src="edit_user.png" iconClass="icon-user" accessKey="" hasAccessKey="false">
                <context selection="true" dir="" recycle="true" actionBar="true" actionBarGroup="address_book" contextMenu="false" infoPanel="false"/>
                <selectionContext dir="false" file="true" recycle="false" unique="true" allowedMimes="shared_user"/>
            </gui>
            <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback prepareModal="true" dialogOpenForm="user_create_user" dialogOkButtonOnly="false" dialogSkipButtons="false">
                    <dialogOnOpen><![CDATA[

                        var user = window.actionManager.getDataModel().getUniqueNode();
                        if(user && user.getAjxpMime() == "shared_user"){
                            var user_id = getBaseName(user.getPath());
                            var conn = new Connexion();
                            conn.setParameters({
                                get_action:'user_update_user',
                                user_id:user_id
                            });
                            conn.onComplete = function(transport){
                                var values = $H(transport.responseJSON);
                                values.set("existing_user_id", user_id);

                                var params = $A(ajaxplorer.getPluginConfigs('conf').get('NEWUSERS_EDIT_PARAMETERS').split(','));
                                for(var i=0;i<params.length;i++){
                                    params[i] = "user/preferences/pref[@exposed]|//param[@name='"+params[i]+"']";
                                }
                                var f = new FormManager();
                                var def1 = $A();
                                def1.push($H({
                                    description: MessageHash[522],
                                    editable: "true",
                                    expose: "true",
                                    label: MessageHash[522],
                                    name: "existing_user_id",
                                    scope: "user",
                                    type: "hidden"
                                }),$H({
                                    description: MessageHash[524],
                                    editable: "true",
                                    expose: "true",
                                    label: MessageHash[524],
                                    name: "new_password",
                                    scope: "user",
                                    type: "password-create"
                                }));
                                var definitions = f.parseParameters(ajaxplorer.getXmlRegistry(), params.join('|'));
                                definitions.each(function(el){ def1.push(el); });
                                f.createParametersInputs(oForm.down('#user_create_user'), def1, true, values, false, true);
                                modal.refreshDialogPosition();

                            };
                            conn.sendAsync();
                        }
                    ]]></dialogOnOpen>
                    <dialogOnComplete hideDialog="true"><![CDATA[
                        var params = $H();
                        var f = new FormManager();
                          f.serializeParametersInputs(oForm.down('#user_create_user'), params, 'NEW_');
                          var conn = new Connexion();
                          params.set("get_action", "user_create_user");
                          conn.setParameters(params);
                          conn.setMethod("POST");
                          conn.onComplete = function(transport){
                                if(transport.responseText == "SUCCESS"){
                                   if($("address_book")){
                                        $("address_book").ajxpPaneObject.reloadDataModel();
                                  }
                                  ajaxplorer.displayMessage("SUCCESS", MessageHash[521]);
                                }
                          };
                          conn.sendAsync();
                    ]]></dialogOnComplete>
                    <dialogOnCancel><![CDATA[]]></dialogOnCancel>
                </clientCallback>
                <serverCallback methodName="switchAction"/>
            </processing>
        </action>
        <action name="user_create_user">
      			<gui text="484" title="485" src="edit_user.png" iconClass="icon-user" accessKey="" hasAccessKey="false">
      				<context selection="false" dir="" recycle="true" actionBar="true" actionBarGroup="address_book" contextMenu="false" infoPanel="false"/>
      			</gui>
                <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback prepareModal="true" dialogOpenForm="user_create_user" dialogOkButtonOnly="false" dialogSkipButtons="false">
                    <dialogOnOpen><![CDATA[
                        var params = $A(ajaxplorer.getPluginConfigs('conf').get('NEWUSERS_EDIT_PARAMETERS').split(','));
                        for(var i=0;i<params.length;i++){
                            params[i] = "user/preferences/pref[@exposed]|//param[@name='"+params[i]+"']";
                        }
                        var f = new FormManager();
                        var def1 = $A();
                        def1.push($H({
                            description: MessageHash[522],
                            editable: "true",
                            expose: "true",
                            label: MessageHash[522],
                            name: "new_user_id",
                            scope: "user",
                            type: "string"
                        }),$H({
                            description: MessageHash[523],
                            editable: "true",
                            expose: "true",
                            label: MessageHash[523],
                            name: "new_password",
                            scope: "user",
                            type: "password-create"
                        }));
                        var definitions = f.parseParameters(ajaxplorer.getXmlRegistry(), params.join('|'));
                        definitions.each(function(el){ def1.push(el); });
                        f.createParametersInputs(oForm.down('#user_create_user'), def1, true, $H(), false, true);
                        modal.refreshDialogPosition();
                    ]]></dialogOnOpen>
                    <dialogOnComplete hideDialog="true"><![CDATA[
                        var params = $H();
                        var f = new FormManager();
                          f.serializeParametersInputs(oForm.down('#user_create_user'), params, 'NEW_');
                          var conn = new Connexion();
                          params.set("get_action", "user_create_user");
                          conn.setParameters(params);
                          conn.setMethod("POST");
                          conn.onComplete = function(transport){
                               if($("address_book")){
                                    $("address_book").ajxpPaneObject.reloadDataModel();
                              }
                          };
                          conn.sendAsync();
                    ]]></dialogOnComplete>
                    <dialogOnCancel><![CDATA[]]></dialogOnCancel>
                </clientCallback>
                <clientForm id="user_create_user"><![CDATA[
                    <div id="user_create_user" action="custom_data_edit" box_width="320">
                    </div>
                ]]></clientForm>
                <serverCallback methodName="switchAction"/>
            </processing>
        </action>
		<action name="switch_language">
			<gui text="190" title="190" src="flag.png" accessKey="" hasAccessKey="false" iconClass="icon-flag">
				<context selection="false" dir="" recycle="true" actionBar="false" actionBarGroup="utils" contextMenu="false" infoPanel="false"/>
			</gui>
			<processing>
				<clientCallback prepareModal="true" dialogOpenForm="switch_language_form" dialogOkButtonOnly="false" dialogSkipButtons="false">
					<dialogOnOpen><![CDATA[
					    if(ajaxplorer.user) var userLang = ajaxplorer.user.getPreference("lang");
						if(!userLang) userLang = window.ajxpBootstrap.parameters.get("currentLanguage");
						var selector = $(oForm).select('select[id="language_selector"]')[0];
						var languages = $H(window.ajxpBootstrap.parameters.get("availableLanguages"));
						languages.each(function(pair){
							var option = new Element('option', {value:pair.key,id:'lang_'+pair.key});
							option.update(pair.value);
							selector.insert(option);
						});
						selector.setValue(userLang);
						selector.observe("change", function(){
							var value = selector.getValue();
							if(ajaxplorer.user){
    							ajaxplorer.user.setPreference("lang", selector.getValue());
	    						ajaxplorer.user.savePreference("lang");
	    					}
						});
						$(oForm).up('.dialogContent').previous('.dialogTitle').select('span').invoke('remove');
					]]></dialogOnOpen>
					<dialogOnComplete hideDialog="true"><![CDATA[
                        if(ajaxplorer.user){
                            var oUser = ajaxplorer.user;
                            if(oUser.getPreference('lang') != null
                                && oUser.getPreference('lang') != ""
                                && oUser.getPreference('lang') != ajaxplorer.currentLanguage)
                            {
                                ajaxplorer.loadI18NMessages(oUser.getPreference('lang'));
                                ajaxplorer.displayMessage('SUCCESS', MessageHash[241]);
                            }
                        }else{
                            var selector = $(oForm).select('select[id="language_selector"]')[0];
                            var value = selector.getValue();
                            ajaxplorer.loadI18NMessages(value);
                            window.ajxpBootstrap.parameters.set("currentLanguage", value);
                        }
					]]></dialogOnComplete>
                    <dialogOnCancel><![CDATA[
                        pydio.Controller.fireAction("login");
                    ]]></dialogOnCancel>
					<dialogOnCancel><![CDATA[]]></dialogOnCancel>
				</clientCallback>
				<clientForm id="switch_language_form"><![CDATA[
					<div id="switch_language_form" action="switch_language_form" box_width="320">
					    <div class="dialogLegend"  style="margin-left:50px; font-size: 15px;">AJXP_MESSAGE[190]</div>
						<select id="language_selector" style="margin-left:50px; margin-bottom: 20px;"></select>
					</div>
				]]></clientForm>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
		<action name="webdav_preferences">
			<gui text="403" title="403" src="drive_remote.png" iconClass="icon-cog" accessKey="" hasAccessKey="false">
				<context selection="false" dir="" recycle="true" actionBar="false" actionBarGroup="utils" contextMenu="false" infoPanel="false"/>
			</gui>
            <rightsContext noUser="false" userLogged="only" read="true" write="false" adminOnly=""/>
			<processing>
				<clientCallback prepareModal="true" dialogOpenForm="webdav_pref_form" dialogOkButtonOnly="true" dialogSkipButtons="false">
					<dialogOnOpen><![CDATA[
					if(!ajaxplorer.user) return;
					var cont = $('webdav_repo_list');
					cont.update('');
					var even = false;
					var conn = new Connexion();
					conn.setParameters(new Hash({get_action:'webdav_preferences'}));
					conn.onComplete = function(transport){
						ajaxplorer.webdavCurrentPreferences = transport.responseJSON;
						$('webdav_activator').checked = ajaxplorer.webdavCurrentPreferences.webdav_active;
						if($('webdav_activator').checked && !ajaxplorer.webdavCurrentPreferences.digest_set
						    && !ajaxplorer.webdavCurrentPreferences.webdav_force_basic) {
						    $('webdav_password_form').show();
						}
                        ProtoCompat.map2hash(ajaxplorer.user.getRepositoriesList()).each(function(pair){
                            if(ajaxplorer.webdavCurrentPreferences.webdav_repositories[pair.key]){
                                var div = new Element('div', {className:(even?'even':'')});
                                div.update('<span>'+pair.value.label+'</span><input readonly type="text" value="'+ ajaxplorer.webdavCurrentPreferences.webdav_repositories[pair.key] +'">' );
                                cont.insert(div);
                                even = !even;
                            }
                        });
                        modal.getForm().down('#webdav_main_access').setValue(ajaxplorer.webdavCurrentPreferences.webdav_base_url);
                        modal.getForm().down('#webdav_main_access').observe("click", function(){
                            modal.getForm().down('#webdav_main_access').select();
                        });
                        modal.getForm().down('#perworkspace-urls-toggle').observe("click", function(event){
                            modal.getForm().down('#webdav_repo_list').toggle();
                            var span = modal.getForm().down('#perworkspace-urls-toggle').down("span");
                            var open = span.hasClassName("icon-caret-right");
                            span.removeClassName(open ? "icon-caret-right" : "icon-caret-down");
                            span.addClassName(!open ? "icon-caret-right" : "icon-caret-down");
                            modal.refreshDialogPosition();
                        });

                        modal.getForm().down('input[name="ok"]').observe("click", hideLightBox);
                        if(!$('webdav_activator').hasObserver){
                            $('webdav_activator').observe("change", function(e){
                                var checked = $('webdav_activator').checked;
                                var conn = new Connexion();
                                conn.setParameters(new Hash({
                                    get_action:'webdav_preferences',
                                    activate:(checked?'true':'false')
                                }));
                                conn.onComplete = function(transport){
                                    ajaxplorer.webdavCurrentPreferences = transport.responseJSON;
                                    if(ajaxplorer.webdavCurrentPreferences.webdav_active){
                                        if(!ajaxplorer.webdavCurrentPreferences.digest_set
                                        || ajaxplorer.webdavCurrentPreferences.webdav_force_basic) {
                                            $('webdav_password_form').show();
                                        }
                                        ajaxplorer.displayMessage("SUCCESS", MessageHash[408]);
                                    }else {
                                        $('webdav_password_form').hide();
                                        ajaxplorer.displayMessage("SUCCESS", MessageHash[409]);
                                    }
                                };
                                conn.sendAsync();
                            });
                            if(!ajaxplorer.webdavCurrentPreferences.digest_set){
                                $('webdav_pass_saver').observe("click", function(){
                                    var conn = new Connexion();
                                    conn.setMethod('POST');
                                    conn.setParameters(new Hash({
                                        get_action:'webdav_preferences',
                                        webdav_pass: $('webdav_password').value
                                    }));
                                    conn.onComplete = function(transport){
                                        ajaxplorer.displayMessage("SUCCESS", MessageHash[410]);
                                    };
                                    conn.sendAsync();
                                });
                            }
                            $('webdav_activator').hasObserver = true;
                        }
					};
					conn.sendAsync();

					]]></dialogOnOpen>
					<dialogOnComplete hideDialog="false"><![CDATA[
					]]></dialogOnComplete>
					<dialogOnCancel><![CDATA[]]></dialogOnCancel>
				</clientCallback>
				<clientForm id="webdav_pref_form"><![CDATA[
					<div id="webdav_pref_form" action="webdav_pref_form" box_width="450">
					    <div class="dialogContentMainTitle">WebDAV Access</div>
						<div class="dialogLegend" style="margin-bottom: 2px;padding: 0 5px;" ajxp_message_id="404">AJXP_MESSAGE[404]</div>
						<div style="padding:10px;"><input type="checkbox" id="webdav_activator" style="width:16px;" name="webdav_activator"> <label for="webdav_activator">AJXP_MESSAGE[406]</label></div>
						<div id="webdav_password_form" style="display:none;text-align: left;padding-left: 15px;height: 42px;font-size: 0.9em;padding-top: 5px;">
							<div style="width: 70%; float: left; padding-right: 5px; text-align: right;">AJXP_MESSAGE[407]</div><input type="password" id="webdav_password" style="float:left;height: 24px;width: 80px;"> <input type="image" src="AJXP_THEME_FOLDER/images/actions/22/dialog_ok_apply.png" height="22" width="22" title="OK" id="webdav_pass_saver">
						</div>
						<div class="dialogLegend" style="margin: 5px;" ajxp_message_id="405">AJXP_MESSAGE[405]</div>
						<input type="text" id="webdav_main_access" value="AJXP_MESSAGE[466]" readonly/>
						<div class="dialogLegend" id="perworkspace-urls-toggle" style="margin-bottom: 2px; padding:5px;" ajxp_message_id="405">
						<span class="icon-caret-right"></span>AJXP_MESSAGE[465]</div>
						<div id="webdav_repo_list" style="display:none; height: 200px; overflow:auto;"></div>
						<input type="hidden" name="get_action" value="webdav_preferences">
					</div>
				]]></clientForm>
				<serverCallback methodName="switchAction"/>
			</processing>
		</action>
        <action name="switch_to_user_dashboard">
            <gui src="drive_remote.png" text="user_dash.title" title="user_dash.desc" hasAccessKey="false" iconClass="icon-dashboard" >
                <context dir="false" recycle="true" selection="false" actionBar="false" actionBarGroup="utils" ajxpWidgets="UserWidget::logging_string"/>
            </gui>
            <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback><![CDATA[
                    if(!ajaxplorer.repositoryId || ajaxplorer.repositoryId != "ajxp_user"){
                        ajaxplorer.triggerRepositoryChange('ajxp_user');
                    }
                ]]></clientCallback>
            </processing>
        </action>
        <action name="switch_to_settings">
            <gui src="drive_remote.png" text="165" title="506" accessKey="settings_access_key" hasAccessKey="true" iconClass="icon-cogs" >
                <context dir="false" recycle="true" selection="false" actionBar="true" actionBarGroup="utils" ajxpWidgets="UserWidget::logging_string"/>
            </gui>
            <rightsContext adminOnly="true" noUser="true" read="false" userLogged="only" write="false"/>
            <processing>
                <clientCallback><![CDATA[
                    if(!ajaxplorer.repositoryId || ajaxplorer.repositoryId != "ajxp_conf"){
                        ajaxplorer.triggerRepositoryChange('ajxp_conf');
                    }
                ]]></clientCallback>
            </processing>
        </action>
	</actions>
    <client_configs>
        <component_config className="AjxpTabulator::userdashboard_main_tab">
            <additional_tab id="webdav_pane"
                            tabInfo='{"id":"my-webdav-data","iconClass":"icon-cog","element":"webdav_pane","closeable":false,"label":"403","title":"403","dontFocus":true,"position":3}'
                            paneInfo='{"type":"widget"}'><![CDATA[
                <div id="webdav_pane" ajxpClass="WebDAVprefsEditor" class="tabbed_editor">
                    <div class="action_bar" style="height: 33px;">&nbsp;</div>
                    <h3 class="dashboard_panel_title">AJXP_MESSAGE[403]</h3>
                    <div style="padding:10px;overflow: auto;" class="fit_me_to_bottom">
                        <div style="padding:10px;"><input type="checkbox" id="webdav_activator" style="width:16px;" name="webdav_activator"> <label for="webdav_activator">AJXP_MESSAGE[406]</label></div>
                        <div class="dialogLegend" style="margin-bottom: 2px;padding: 10px;" ajxp_message_id="404">AJXP_MESSAGE[404]</div>
                        <div id="webdav_password_form" style="display:none;text-align: left;padding-left: 15px;height: 42px;font-size: 0.9em;padding-top: 5px;">
                            <div style="width: 70%; float: left; padding-right: 5px; text-align: right;">AJXP_MESSAGE[407]</div><input type="password" id="webdav_password" style="float:left;height: 24px;width: 80px !important;"> <input type="image" src="AJXP_THEME_FOLDER/images/actions/22/dialog_ok_apply.png" height="22" width="22" title="OK" id="webdav_pass_saver">
                        </div>
                        <div class="dialogLegend" style="margin: 10px;" ajxp_message_id="405">AJXP_MESSAGE[405]</div>
                        <input type="text" style="width: 95% !important;" id="webdav_main_access" value="AJXP_MESSAGE[466]" readonly/>
                        <div class="dialogLegend" id="perworkspace-urls-toggle" style="margin-bottom: 2px; padding:5px;" ajxp_message_id="405">
                        <span class="icon-caret-right"></span>AJXP_MESSAGE[465]</div>
                        <div id="webdav_repo_list" style="display:none; height: 200px; overflow:auto; margin: 10px;"></div>
                        <input type="hidden" name="get_action" value="webdav_preferences">
                    </div>
                </div>
                ]]></additional_tab>
        </component_config>
        <component_config className="InfoPanel">
            <infoPanelExtension mime="ajxp_root_node" attributes="">
                <messages>
                    <message key="shared_string" id="527"/>
                    <message key="internal_string" id="531"/>
                    <message key="external_string" id="532"/>
                </messages>
                <html><![CDATA[
                    <div id="ajxp_workspace_info_panel" data-infoPanelPosition="top" style="margin:6px 20px;">
                        <div class="panelHeader">#{shared_string}</div>
                        <div id="ajxp_workspace_info_panel_content"></div>
                        <script>
                            if(pydio.user) {
                                var cacheService = MetaCacheService.getInstance();
                                cacheService.registerMetaStream('workspace.info', 'MANUAL_TRIGGER');
                                var render = function(data){
                                    $('ajxp_workspace_info_panel_content').update('#{internal_string}: ' + data['core.users']['users'] + ' <br/> #{external_string}: ' + data['core.users']['groups']);
                                };
                                var repoKey = pydio.user.getActiveRepository();
                                if(cacheService.hasKey('workspace.info', repoKey)){
                                    render(cacheService.getByKey('workspace.info', repoKey));
                                }else{
                                    bufferCallback("ajxp_load_repo_info_timer", 300,function(){
                                        if(!$('ajxp_workspace_info_panel_content') || !$('ajxp_workspace_info_panel_content').visible()){
                                            return;
                                        }
                                        $("ajxp_workspace_info_panel").addClassName("infopanel_loading");
                                        PydioApi.getClient().request({get_action:'load_repository_info'}, function(transport){
                                            $("ajxp_workspace_info_panel").addClassName("infopanel_loading_finished");
                                            if(transport.responseJSON && $('ajxp_workspace_info_panel_content')){
                                                var data = transport.responseJSON;
                                                if(!data['core.users']['groups']){
                                                    data['core.users']['groups'] = 0;
                                                }
                                            }
                                            cacheService.setKey('workspace.info', repoKey, data);
                                            render(data);
                                        }, null, {discrete:true});
                                    });
                                }
                            }

                        </script>
                    </div>
                ]]></html>
            </infoPanelExtension>
        </component_config>
    </client_configs>
</registry_contributions>
