Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Massive refactoring of AjaXplorer class into various subclasses (Regi…
Browse files Browse the repository at this point in the history
…stry & PydioUI).
  • Loading branch information
cdujeu committed Apr 21, 2015
1 parent 14e3e96 commit 31cd0b1
Show file tree
Hide file tree
Showing 117 changed files with 1,419 additions and 1,339 deletions.
50 changes: 25 additions & 25 deletions core/src/plugins/access.ajxp_conf/ajxp_confActions.xml
Expand Up @@ -111,20 +111,20 @@
<clientCallback prepareModal="true"><![CDATA[
var completeFunc = function(){
var oForm = modal.getForm();
if(!ajaxplorer.actionBar.configEditor){
ajaxplorer.actionBar.configEditor = new ConfigEditor(oForm);
if(!pydio.getController().configEditor){
pydio.getController().configEditor = new ConfigEditor(oForm);
}
ajaxplorer.actionBar.configEditor.setForm(oForm);
result = ajaxplorer.actionBar.configEditor.submitCreateUser();
pydio.getController().configEditor.setForm(oForm);
result = pydio.getController().configEditor.submitCreateUser();
if(result) hideLightBox();
return false;
};
var loadFunc = function(oForm){
if(!ajaxplorer.actionBar.configEditor){
ajaxplorer.actionBar.configEditor = new ConfigEditor(oForm);
if(!pydio.getController().configEditor){
pydio.getController().configEditor = new ConfigEditor(oForm);
}
ajaxplorer.actionBar.configEditor.setForm(oForm);
ajaxplorer.actionBar.configEditor.loadCreateUserForm();
pydio.getController().configEditor.setForm(oForm);
pydio.getController().configEditor.loadCreateUserForm();
new Protopass(oForm.down('input[name="new_user_pwd"]'), {
barContainer:$('pwd_strength_container'),
Expand Down Expand Up @@ -239,11 +239,11 @@
<clientCallback prepareModal="true"><![CDATA[
var loadFunc = function(oForm){
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
if(!ajaxplorer.actionBar.configEditor){
ajaxplorer.actionBar.configEditor = new ConfigEditor(oForm);
if(!pydio.getController().configEditor){
pydio.getController().configEditor = new ConfigEditor(oForm);
}
ajaxplorer.actionBar.configEditor.setForm(oForm);
ajaxplorer.actionBar.configEditor.initCreateRepoWizard('repository');
pydio.getController().configEditor.setForm(oForm);
pydio.getController().configEditor.initCreateRepoWizard('repository');
};
modal.showDialogForm('Create Repository', 'create_repository_box', loadFunc, null, null, false, true);
]]></clientCallback>
Expand Down Expand Up @@ -287,11 +287,11 @@
<clientCallback prepareModal="true"><![CDATA[
var loadFunc = function(oForm){
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
if(!ajaxplorer.actionBar.configEditor){
ajaxplorer.actionBar.configEditor = new ConfigEditor(oForm);
if(!pydio.getController().configEditor){
pydio.getController().configEditor = new ConfigEditor(oForm);
}
ajaxplorer.actionBar.configEditor.setForm(oForm);
ajaxplorer.actionBar.configEditor.initCreateRepoWizard('template');
pydio.getController().configEditor.setForm(oForm);
pydio.getController().configEditor.initCreateRepoWizard('template');
};
modal.showDialogForm('Create Repository', 'create_repository_box', loadFunc, null, null, false, true);
]]></clientCallback>
Expand All @@ -310,11 +310,11 @@
var userSelection = ajaxplorer.getUserSelection();
var loadFunc = function(oForm){
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
if(!ajaxplorer.actionBar.configEditor){
ajaxplorer.actionBar.configEditor = new ConfigEditor(oForm);
if(!pydio.getController().configEditor){
pydio.getController().configEditor = new ConfigEditor(oForm);
}
ajaxplorer.actionBar.configEditor.setForm(oForm);
ajaxplorer.actionBar.configEditor.loadUsers(userSelection);
pydio.getController().configEditor.setForm(oForm);
pydio.getController().configEditor.loadUsers(userSelection);
};
modal.showDialogForm('Batch Edition', 'batch_roles_edit_box', loadFunc, function(){hideLightBox();}, null, true);
]]></clientCallback>
Expand All @@ -335,7 +335,7 @@
<clientListener name="selectionChange"><![CDATA[
if(ajaxplorer){
var userSelection = ajaxplorer.getUserSelection();
var action = ajaxplorer.getActionBar().getActionByName("user_update_role");
var action = pydio.getController().getActionByName("user_update_role");
if(action){
if(userSelection.isUnique()){
action.selectionContext.dir = true;
Expand Down Expand Up @@ -366,7 +366,7 @@
<processing>
<clientCallback prepareModal="false"><![CDATA[
var editorData = window.actionArguments[0];
ajaxplorer.openCurrentSelectionInEditor(editorData);
pydio.UI.openCurrentSelectionInEditor(editorData);
]]></clientCallback>
<serverCallback methodName="switchAction" restParams="/sub_action" developerComment="Shortcut for various actions, calling edit with subaction parameter."/>
</processing>
Expand All @@ -389,7 +389,7 @@
conn.addParameter('repository_id', node.getMetadata().get('repository_id'));
conn.addParameter('newLabel', newValue);
conn.onComplete = function(transport){
ajaxplorer.actionBar.parseXmlMessage(transport.responseXML);
pydio.getController().parseXmlMessage(transport.responseXML);
};
conn.sendSync();
};
Expand Down Expand Up @@ -478,7 +478,7 @@
};
modal.showDialogForm('Delete', 'delete_config_form', onLoad, function(){
var oForm = modal.getForm();
ajaxplorer.actionBar.submitForm(oForm);
pydio.getController().submitForm(oForm);
if (userSelection.isMultiple()) {
var i = 1;
var hidden = $(oForm).select('input[type="hidden"]')[0];
Expand All @@ -493,7 +493,7 @@
value = meta.get("text");
}
hidden.setAttribute("value", value);
ajaxplorer.actionBar.submitForm(oForm);
pydio.getController().submitForm(oForm);
i++;
} catch (e)
{
Expand Down
12 changes: 6 additions & 6 deletions core/src/plugins/access.ajxp_conf/class.ConfigEditor.js
Expand Up @@ -146,7 +146,7 @@ Class.create("ConfigEditor",{
connexion.onComplete = function(transport){
modal.refreshDialogPosition();
modal.refreshDialogAppearance();
ajaxplorer.blurAll();
pydio.UI.blurAll();
}.bind(this);
connexion.sendAsync();
},
Expand Down Expand Up @@ -188,10 +188,10 @@ Class.create("ConfigEditor",{
this.submitForm("create_user", 'create_user', parameters, null, function(responseXML){
// success callback
hideLightBox();
var editorData = ajaxplorer.findEditorById("editor.ajxp_role");
var editorData = pydio.Registry.findEditorById("editor.ajxp_role");
var node = new AjxpNode(currentPath + "/"+newUserName, true);
node.getMetadata().set("ajxp_mime", "user");
ajaxplorer.openCurrentSelectionInEditor(editorData, node);
pydio.UI.openCurrentSelectionInEditor(editorData, node);
}.bind(this), function(responseXML){
// error callback;
});
Expand Down Expand Up @@ -439,13 +439,13 @@ Class.create("ConfigEditor",{
var reloadNode = XPathSelectSingleNode(responseXML.documentElement, "//reload_instruction/@file");
if(reloadNode && reloadNode.nodeValue){
var newRepoId = reloadNode.nodeValue;
var editors = ajaxplorer.findEditorsForMime("repository");
var editors = pydio.Registry.findEditorsForMime("repository");
if(editors.length && editors[0].openable){
var editorData = editors[0];
var currentPath = ajaxplorer.getContextNode().getPath();
var node = new AjxpNode(currentPath+"/"+newRepoId, true);
node.getMetadata().set("text", this.newRepoLabelInput.getValue());
ajaxplorer.openCurrentSelectionInEditor(editorData, node);
pydio.UI.openCurrentSelectionInEditor(editorData, node);
hideLightBox();
}
}
Expand Down Expand Up @@ -556,7 +556,7 @@ Class.create("ConfigEditor",{
this.repositories.set(childs[i].getAttribute('index'), childs[i]);
}
}
ajaxplorer.actionBar.parseXmlMessage(xmlResponse);
pydio.getController().parseXmlMessage(xmlResponse);
if(xmlResponse.documentElement){
if(XPathSelectSingleNode(xmlResponse.documentElement, 'message[@type="ERROR"]') != null){
return false;
Expand Down
16 changes: 8 additions & 8 deletions core/src/plugins/access.ajxp_home/class.UserDashboardHome.js
Expand Up @@ -29,9 +29,9 @@ Class.create("UserDashboardHome", AjxpPane, {
$super(oFormObject, editorOptions);
this._repoInfos = $H();
this._repoInfosLoading = $H();
var dashLogo = ajaxplorer.getPluginConfigs("gui.ajax").get("CUSTOM_DASH_LOGO");
var dashLogo = pydio.Registry.getPluginConfigs("gui.ajax").get("CUSTOM_DASH_LOGO");
if(!dashLogo)
dashLogo = ajaxplorer.getDefaultImageFromParameters("gui.ajax", "CUSTOM_DASH_LOGO");
dashLogo = pydio.Registry.getDefaultImageFromParameters("gui.ajax", "CUSTOM_DASH_LOGO");
if(dashLogo){
var url;
if(dashLogo.indexOf('plugins/') === 0){
Expand Down Expand Up @@ -221,24 +221,24 @@ Class.create("UserDashboardHome", AjxpPane, {
switchToRepo(target.CURRENT_REPO_ID);
});

if(ajaxplorer.actionBar.getActionByName("logout") && ajaxplorer.user.id != "guest"){
if(pydio.getController().getActionByName("logout") && ajaxplorer.user.id != "guest"){
oFormObject.down("#welcome").insert('<small>'+MessageHash["user_home.67"].replace("%logout", "<span id='disconnect_link'></span>").replace('%s', ajaxplorer.user.getPreference("USER_DISPLAY_NAME") || ajaxplorer.user.id)+'</small>');
oFormObject.down('#disconnect_link').update("<a>"+ajaxplorer.actionBar.getActionByName("logout").options.text.toLowerCase()+"</a>");
oFormObject.down('#disconnect_link').update("<a>"+pydio.getController().getActionByName("logout").options.text.toLowerCase()+"</a>");
oFormObject.down('#disconnect_link').observe("click", function(e){
ajaxplorer.actionBar.fireAction("logout");
pydio.getController().fireAction("logout");
});
}else if(ajaxplorer.user.id == "guest" && ajaxplorer.actionBar.getActionByName("login")){
}else if(ajaxplorer.user.id == "guest" && pydio.getController().getActionByName("login")){
oFormObject.down("#welcome").insert("<small>You can <a id='disconnect_link'>login</a> if you are not guest.</small>");
oFormObject.down('#disconnect_link').observe("click", function(e){
ajaxplorer.actionBar.fireAction("login");
pydio.getController().fireAction("login");
});
}

if(ajaxplorer.getPluginConfigs('access.ajxp_home').get("ENABLE_GETTING_STARTED")){
var obj = oFormObject.down("#welcome");
if(oFormObject.down("#welcome > small")) obj = oFormObject.down("#welcome > small");
var span = new Element('span').update('<br>' + MessageHash["user_home.55"]);
span.down('a').observe('click', function(){ ajaxplorer.getActionBar().fireAction("open_tutorial_pane"); });
span.down('a').observe('click', function(){ pydio.getController().fireAction("open_tutorial_pane"); });
obj.insert(span);
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/access.ajxp_shared/manifest.xml
Expand Up @@ -104,7 +104,7 @@
var conn = new Connexion(baseUrl);
conn.addParameter("get_action", "reset_download_counter");
conn.onComplete = function(transport){
ajaxplorer.actionBar.parseXmlMessage(transport.responseXML);
pydio.getController().parseXmlMessage(transport.responseXML);
};
conn.sendAsync();
]]></clientCallback>
Expand All @@ -124,7 +124,7 @@
var conn = new Connexion();
conn.addParameter("get_action", "clear_expired");
conn.onComplete = function(transport){
ajaxplorer.actionBar.parseXmlMessage(transport.responseXML);
pydio.getController().parseXmlMessage(transport.responseXML);
};
conn.sendAsync();
]]></clientCallback>
Expand All @@ -150,7 +150,7 @@
modal.showDialogForm('Delete', 'delete_shared_form', onLoad, function(){
var oForm = modal.getForm();
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
ajaxplorer.actionBar.submitForm(oForm);
pydio.getController().submitForm(oForm);
hideLightBox(true);
return false;
});
Expand Down
10 changes: 5 additions & 5 deletions core/src/plugins/access.ajxp_user/class.UserProfileEditor.js
Expand Up @@ -28,7 +28,7 @@ Class.create("UserProfileEditor", AjxpPane, {

attachMobileScroll(oFormObject.down("#user_profile_form"), "vertical");

if(ajaxplorer.actionBar.getActionByName('custom_data_edit')){
if(pydio.getController().getActionByName('custom_data_edit')){

this._formManager = new FormManager();
var definitions = this._formManager.parseParameters(ajaxplorer.getXmlRegistry(), "user/preferences/pref[@exposed='true']|//param[contains(@scope,'user') and @expose='true']");
Expand All @@ -47,10 +47,10 @@ Class.create("UserProfileEditor", AjxpPane, {
conn.setParameters(params);
conn.setMethod("POST");
conn.onComplete = function(transport){
ajaxplorer.actionBar.parseXmlMessage(transport.responseXML);
pydio.getController().parseXmlMessage(transport.responseXML);
document.observeOnce("ajaxplorer:registry_part_loaded", function(event){
if(event.memo != "user/preferences") return;
ajaxplorer.logXmlUser(ajaxplorer.getXmlRegistry());
pydio.Registry.logXmlUser(false);
});
ajaxplorer.loadXmlRegistry(false, "user/preferences");
};
Expand All @@ -65,12 +65,12 @@ Class.create("UserProfileEditor", AjxpPane, {

}

if(ajaxplorer.actionBar.getActionByName('pass_change')){
if(pydio.getController().getActionByName('pass_change')){

var chPassButton = new Element('a', {className:''}).update('<span class="icon-key"></span> <span>'+MessageHash[194]+'</span>');
oFormObject.down('.toolbarGroup').insert(chPassButton);
chPassButton.observe("click", function(){
ajaxplorer.actionBar.getActionByName('pass_change').apply();
pydio.getController().getActionByName('pass_change').apply();
});

}
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/access.ajxp_user/class.WebDAVprefsEditor.js
Expand Up @@ -28,8 +28,8 @@ Class.create("WebDAVprefsEditor", AjxpPane, {
var cont = element.down('#webdav_repo_list');
cont.update('');
var activator = element.down("#webdav_activator");
element.down('#webdav_password').observe("focus", function(){ajaxplorer.disableAllKeyBindings()});
element.down('#webdav_password').observe("blur", function(){ajaxplorer.enableAllKeyBindings()});
element.down('#webdav_password').observe("focus", function(){pydio.UI.disableAllKeyBindings()});
element.down('#webdav_password').observe("blur", function(){pydio.UI.enableAllKeyBindings()});

var even = false;
var conn = new Connexion();
Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/access.ajxp_user/manifest.xml
Expand Up @@ -223,12 +223,12 @@
modal.showDialogForm('Delete', 'delete_shared_form', onLoad, function(){
var oForm = modal.getForm();
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
ajaxplorer.actionBar.submitForm(oForm, true, function(transport){
this.actionBar.parseXmlMessage(transport.responseXML);
pydio.getController().submitForm(oForm, true, function(transport){
this.getController().parseXmlMessage(transport.responseXML);
if(this.getContextHolder()._selectionSource && this.getContextHolder()._selectionSource.__className=='FetchedResultPane'){
this.getContextHolder()._selectionSource.reloadDataModel();
}
}.bind(ajaxplorer));
}.bind(pydio));
hideLightBox(true);
return false;
});
Expand Down

0 comments on commit 31cd0b1

Please sign in to comment.