|
|
@ -658,11 +658,12 @@ define([
|
|
|
|
if (!isOwnDrive()) {
|
|
|
|
if (!isOwnDrive()) {
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-own'));
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-own'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($element.is('.cp-app-drive-element-owned')) {
|
|
|
|
if (!$element.is('.cp-app-drive-element-owned')) {
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-delete'));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-deleteowned'));
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-deleteowned'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($element.is('.cp-app-drive-element-notrash')) {
|
|
|
|
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-delete'));
|
|
|
|
|
|
|
|
}
|
|
|
|
if ($element.is('.cp-app-drive-element-file')) {
|
|
|
|
if ($element.is('.cp-app-drive-element-file')) {
|
|
|
|
// No folder in files
|
|
|
|
// No folder in files
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-newfolder'));
|
|
|
|
hide.push($menu.find('a.cp-app-drive-context-newfolder'));
|
|
|
@ -1183,6 +1184,7 @@ define([
|
|
|
|
if (data.owners && data.owners.indexOf(edPublic) !== -1) {
|
|
|
|
if (data.owners && data.owners.indexOf(edPublic) !== -1) {
|
|
|
|
var $owned = $ownedIcon.clone().appendTo($state);
|
|
|
|
var $owned = $ownedIcon.clone().appendTo($state);
|
|
|
|
$owned.attr('title', Messages.fm_padIsOwned);
|
|
|
|
$owned.attr('title', Messages.fm_padIsOwned);
|
|
|
|
|
|
|
|
$span.addClass('cp-app-drive-element-owned');
|
|
|
|
} else if (data.owners && data.owners.length) {
|
|
|
|
} else if (data.owners && data.owners.length) {
|
|
|
|
var $owner = $ownerIcon.clone().appendTo($state);
|
|
|
|
var $owner = $ownerIcon.clone().appendTo($state);
|
|
|
|
$owner.attr('title', Messages.fm_padIsOwnedOther);
|
|
|
|
$owner.attr('title', Messages.fm_padIsOwnedOther);
|
|
|
@ -2065,7 +2067,7 @@ define([
|
|
|
|
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
|
|
|
|
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
|
|
|
|
ro ? ' cp-app-drive-element-readonly' : '';
|
|
|
|
ro ? ' cp-app-drive-element-readonly' : '';
|
|
|
|
var $element = $('<li>', {
|
|
|
|
var $element = $('<li>', {
|
|
|
|
'class': 'cp-app-drive-element cp-app-drive-element-file cp-app-drive-element-row' + roClass,
|
|
|
|
'class': 'cp-app-drive-element cp-app-drive-element-notrash cp-app-drive-element-file cp-app-drive-element-row' + roClass,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$element.prepend($icon).dblclick(function () {
|
|
|
|
$element.prepend($icon).dblclick(function () {
|
|
|
|
openFile(id);
|
|
|
|
openFile(id);
|
|
|
@ -2103,7 +2105,8 @@ define([
|
|
|
|
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
|
|
|
|
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
|
|
|
|
ro ? ' cp-app-drive-element-readonly' : '';
|
|
|
|
ro ? ' cp-app-drive-element-readonly' : '';
|
|
|
|
var $element = $('<li>', {
|
|
|
|
var $element = $('<li>', {
|
|
|
|
'class': 'cp-app-drive-element cp-app-drive-element-owned cp-app-drive-element-file cp-app-drive-element-row' + roClass
|
|
|
|
'class': 'cp-app-drive-element cp-app-drive-element-notrash ' +
|
|
|
|
|
|
|
|
'cp-app-drive-element-file cp-app-drive-element-row' + roClass
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$element.prepend($icon).dblclick(function () {
|
|
|
|
$element.prepend($icon).dblclick(function () {
|
|
|
|
openFile(id);
|
|
|
|
openFile(id);
|
|
|
@ -2600,6 +2603,30 @@ define([
|
|
|
|
paths.forEach(function (p) { pathsList.push(p.path); });
|
|
|
|
paths.forEach(function (p) { pathsList.push(p.path); });
|
|
|
|
moveElements(pathsList, [TRASH], false, refresh);
|
|
|
|
moveElements(pathsList, [TRASH], false, refresh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-deleteowned')) {
|
|
|
|
|
|
|
|
var pathsListD = [];
|
|
|
|
|
|
|
|
var msgD = Messages.fm_deleteOwnedPads;
|
|
|
|
|
|
|
|
UI.confirm(msgD, function(res) {
|
|
|
|
|
|
|
|
$(window).focus();
|
|
|
|
|
|
|
|
if (!res) { return; }
|
|
|
|
|
|
|
|
// Try to delete each selected pad from server, and delete from drive if no error
|
|
|
|
|
|
|
|
var n = nThen(function () {});
|
|
|
|
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
|
|
|
|
var el = filesOp.find(p.path);
|
|
|
|
|
|
|
|
var data = filesOp.getFileData(el);
|
|
|
|
|
|
|
|
var parsed = Hash.parsePadUrl(data.href);
|
|
|
|
|
|
|
|
var channel = Util.base64ToHex(parsed.hashData.channel);
|
|
|
|
|
|
|
|
n = n.nThen(function (waitFor) {
|
|
|
|
|
|
|
|
sframeChan.query('Q_CONTACTS_CLEAR_OWNED_CHANNEL', channel,
|
|
|
|
|
|
|
|
waitFor(function (e) {
|
|
|
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
|
|
|
filesOp.delete([p.path], refresh);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-open')) {
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-open')) {
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
var $element = p.element;
|
|
|
|
var $element = p.element;
|
|
|
@ -2689,17 +2716,26 @@ define([
|
|
|
|
moveElements(pathsList, [TRASH], false, refresh);
|
|
|
|
moveElements(pathsList, [TRASH], false, refresh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-deleteowned')) {
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-deleteowned')) {
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
// Remove owned pad from drive and remove from server
|
|
|
|
|
|
|
|
var pathsListD = [];
|
|
|
|
var pathsListD = [];
|
|
|
|
paths.forEach(function (p) { pathsListD.push(p.path); });
|
|
|
|
|
|
|
|
var msgD = Messages.fm_deleteOwnedPads;
|
|
|
|
var msgD = Messages.fm_deleteOwnedPads;
|
|
|
|
UI.confirm(msgD, function(res) {
|
|
|
|
UI.confirm(msgD, function(res) {
|
|
|
|
$(window).focus();
|
|
|
|
$(window).focus();
|
|
|
|
if (!res) { return; }
|
|
|
|
if (!res) { return; }
|
|
|
|
filesOp.delete(pathsListD, refresh);
|
|
|
|
// Try to delete each selected pad from server, and delete from drive if no error
|
|
|
|
// TODO XXX HERE
|
|
|
|
var n = nThen(function () {});
|
|
|
|
// RPC to delete from server
|
|
|
|
paths.forEach(function (p) {
|
|
|
|
|
|
|
|
var el = filesOp.find(p.path);
|
|
|
|
|
|
|
|
var data = filesOp.getFileData(el);
|
|
|
|
|
|
|
|
var parsed = Hash.parsePadUrl(data.href);
|
|
|
|
|
|
|
|
var channel = Util.base64ToHex(parsed.hashData.channel);
|
|
|
|
|
|
|
|
n = n.nThen(function (waitFor) {
|
|
|
|
|
|
|
|
sframeChan.query('Q_CONTACTS_CLEAR_OWNED_CHANNEL', channel,
|
|
|
|
|
|
|
|
waitFor(function (e) {
|
|
|
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
|
|
|
filesOp.delete([p.path], refresh);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|