Navigation Menu

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

Commit

Permalink
Fix #1319, enable Copy action on readonly files.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jan 18, 2017
1 parent 120aaf9 commit bf5d9a9
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions core/src/plugins/access.fs/fsActions.xml
Expand Up @@ -20,13 +20,13 @@
path = window.actionArguments[0];
if(Object.isString(path)){path = new AjxpNode(path,false,getBaseName(path));}
}else{
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
if(userSelection && userSelection.isUnique() && (userSelection.hasDir() || userSelection.hasMime("AJXP_MIMES_ZIP".split(",")))){
path = userSelection.getUniqueNode();
}
}
if(path){
ajaxplorer.updateContextData(path);
pydio.updateContextData(path);
}
]]></clientCallback>
<serverCallback methodName="switchAction" restParams="/dir+" preferredHttp="GET" sdkMethodName="listNodes" checkParams="true" developerComment="Standard listing action
Expand Down Expand Up @@ -69,7 +69,7 @@
}, function(){
var oForm = $(modal.getForm());
var elementToCheck=(oForm['dirname']);
if(ajaxplorer.getContextHolder().fileNameExists($(elementToCheck).getValue()))
if(pydio.getContextHolder().fileNameExists($(elementToCheck).getValue()))
{
alert(MessageHash[125]);
return false;
Expand Down Expand Up @@ -103,7 +103,7 @@
modal.showDialogForm('Create', 'mkfile_form', null, function(){
var oForm = $(modal.getForm());
var elementToCheck=(oForm['filename']);
if(ajaxplorer.getContextHolder().fileNameExists($(elementToCheck).getValue()))
if(pydio.getContextHolder().fileNameExists($(elementToCheck).getValue()))
{
alert(MessageHash[125]);
return false;
Expand Down Expand Up @@ -227,7 +227,7 @@
<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
if(( userSelection.isUnique() && !userSelection.hasDir() ) || pydio.Parameters.get('multipleFilesDownloadEnabled'))
{
if(window.gaTrackEvent){
Expand Down Expand Up @@ -269,8 +269,8 @@
</div>]]>
</clientForm>
<clientListener name="selectionChange"><![CDATA[
if(ajaxplorer){
var userSelection = ajaxplorer.getUserSelection();
if(pydio){
var userSelection = pydio.getUserSelection();
var action = pydio.getController().getActionByName("download");
if(window.zipEnabled && window.multipleFilesDownloadEnabled){
if(action){
Expand Down Expand Up @@ -337,7 +337,7 @@
<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
if((multipleFilesDownloadEnabled))
{
var loadFunc = function(oForm){
Expand Down Expand Up @@ -371,8 +371,8 @@
</div>
]]></clientForm>
<clientListener name="selectionChange"><![CDATA[
if(ajaxplorer){
var userSelection = ajaxplorer.getUserSelection();
if(pydio){
var userSelection = pydio.getUserSelection();
var action = pydio.getController().getActionByName("compress_ui");
if(!window.zipEnabled || !window.multipleFilesDownloadEnabled){
if(action){
Expand Down Expand Up @@ -474,12 +474,12 @@
if(url.indexOf('?') > 0){
url = url.substring(0, url.indexOf('?'));
}
var repoId = ajaxplorer.repositoryId || (ajaxplorer.user ? ajaxplorer.user.activeRepository : null);
if(ajaxplorer.user){
var slug = ajaxplorer.user.repositories.get(repoId).getSlug();
var repoId = pydio.repositoryId || (pydio.user ? pydio.user.activeRepository : null);
if(pydio.user){
var slug = pydio.user.repositories.get(repoId).getSlug();
if(slug) repoId = slug;
}
link = url + '?goto=' + repoId + encodeURIComponent(ajaxplorer.getUserSelection().getUniqueNode().getPath());
link = url + '?goto=' + repoId + encodeURIComponent(pydio.getUserSelection().getUniqueNode().getPath());
input.value = link;
var email = oForm.down('a[id="email"]');
if (email){
Expand Down Expand Up @@ -560,7 +560,7 @@
<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
var fileNames = $A(userSelection.getFileNames());
var connexion = new Connexion();
connexion.addParameter('get_action', 'restore');
Expand Down Expand Up @@ -637,8 +637,8 @@
<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(ajaxplorer.user){
var user = ajaxplorer.user;
if(pydio.user){
var user = pydio.user;
var activeRepository = user.getActiveRepository();
}
var context = pydio.getController();
Expand Down Expand Up @@ -692,7 +692,7 @@
if(activeRepository && this.treeSelector.getFilterActive(activeRepository)){
getAction.value = "cross_copy" ;
}
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
pydio.getUserSelection().updateFormOrUrl(oForm);
this.submitForm(oForm);
this.treeSelector.unload();
hideLightBox();
Expand All @@ -712,20 +712,22 @@
</div>
]]></clientForm>
<clientListener name="contextChange"><![CDATA[
if(ajaxplorer){
if(pydio){
var action = pydio.getController().getActionByName("copy");
if(action){
action.rightsContext.write = true;
var ajxpUser = ajaxplorer.user;
if(ajxpUser && !ajxpUser.canWrite() && ajxpUser.canCrossRepositoryCopy() && ajxpUser.hasCrossRepositories()){
var ajxpUser = pydio.user;
if(ajxpUser && ajxpUser.canRead() && ajxpUser.canCrossRepositoryCopy() && ajxpUser.hasCrossRepositories()){
action.rightsContext.write = false;
pydio.getController().defaultActions['delete']('ctrldragndrop');
pydio.getController().defaultActions['delete']('dragndrop');
if(!ajxpUser.canWrite()){
pydio.getController().defaultActions['delete']('ctrldragndrop');
pydio.getController().defaultActions['delete']('dragndrop');
}
}
if(ajxpUser && ajxpUser.canWrite() && ajaxplorer.getContextNode().hasAjxpMimeInBranch("ajxp_browsable_archive")){
if(ajxpUser && ajxpUser.canWrite() && pydio.getContextNode().hasAjxpMimeInBranch("ajxp_browsable_archive")){
action.rightsContext.write = false;
}
if(ajaxplorer.getContextNode().hasAjxpMimeInBranch("ajxp_browsable_archive")){
if(pydio.getContextNode().hasAjxpMimeInBranch("ajxp_browsable_archive")){
action.setLabel(247, 248);
action.setIconSrc('ark_extract.png');
}else{
Expand All @@ -752,8 +754,8 @@
<processing>
<clientCallback prepareModal="true"><![CDATA[
var context = pydio.getController();
if(ajaxplorer.user){
var user = ajaxplorer.user;
if(pydio.user){
var user = pydio.user;
var activeRepository = user.getActiveRepository();
}
var context = pydio.getController();
Expand All @@ -766,7 +768,7 @@
}
});
this.treeSelector.load();
if(!ajaxplorer.getUserSelection().hasDir() && user && user.canCrossRepositoryCopy() && user.hasCrossRepositories()){
if(!pydio.getUserSelection().hasDir() && user && user.canCrossRepositoryCopy() && user.hasCrossRepositories()){
this.treeSelector.setFilterShow(true);
ProtoCompat.map2hash(user.getCrossRepositories()).each(function(pair){
this.treeSelector.appendFilterValue(pair.key, pair.value.getLabel());
Expand All @@ -789,11 +791,11 @@
var oForm = modal.getForm();
var getAction = oForm.down('input[name="get_action"]');
var selectedNode = this.treeSelector.getSelectedNode();
if(!this.treeSelector.getFilterActive(activeRepository) && selectedNode == ajaxplorer.getContextNode().getPath()){
if(!this.treeSelector.getFilterActive(activeRepository) && selectedNode == pydio.getContextNode().getPath()){
alert(MessageHash[183]);
return false;
}
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
pydio.getUserSelection().updateFormOrUrl(oForm);
if(activeRepository && this.treeSelector.getFilterActive(activeRepository)){
getAction.value = "cross_copy" ;
var subAction = new Element('input', {type:'hidden',name:'moving_files',value:'true'});
Expand Down Expand Up @@ -840,7 +842,7 @@
};
modal.showDialogForm('Delete', 'delete_form', onLoad, function(){
var oForm = modal.getForm();
ajaxplorer.getUserSelection().updateFormOrUrl(oForm);
pydio.getUserSelection().updateFormOrUrl(oForm);
PydioApi.getClient().submitForm(oForm, true, function(transport){
var result = PydioApi.getClient().parseXmlMessage(transport.responseXML);
}.bind(pydio.getController()));
Expand Down Expand Up @@ -868,7 +870,7 @@
<rightsContext noUser="true" userLogged="only" read="true" write="true" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
var loadFunc = function(oForm){
pydio.getController().propertyPane = new PropertyPanel(userSelection, oForm);
};
Expand Down Expand Up @@ -915,7 +917,7 @@
<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
var userSelection = pydio.getUserSelection();
var loadFunc = function(oForm){
var dObject = oForm.down('div[id="multiple_download_container"]');
Expand Down

0 comments on commit bf5d9a9

Please sign in to comment.