|
|
@ -1876,12 +1876,10 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var getProperties = function (el) {
|
|
|
|
var getProperties = function (el, cb) {
|
|
|
|
/* TODO...
|
|
|
|
if (!filesOp.isFile(el)) {
|
|
|
|
if we make this async, we can include an RPC call to the server which tells us
|
|
|
|
return void cb('NOT_FILE');
|
|
|
|
the size of the pinned file (if it is pinned) */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!filesOp.isFile(el)) { return; }
|
|
|
|
|
|
|
|
var ro = filesOp.isReadOnlyFile(el);
|
|
|
|
var ro = filesOp.isReadOnlyFile(el);
|
|
|
|
var base = window.location.origin;
|
|
|
|
var base = window.location.origin;
|
|
|
|
var $d = $('<div>');
|
|
|
|
var $d = $('<div>');
|
|
|
@ -1889,14 +1887,50 @@ the size of the pinned file (if it is pinned) */
|
|
|
|
$('<br>').appendTo($d);
|
|
|
|
$('<br>').appendTo($d);
|
|
|
|
if (!ro) {
|
|
|
|
if (!ro) {
|
|
|
|
$('<label>', {'for': 'propLink'}).text(Messages.editShare).appendTo($d);
|
|
|
|
$('<label>', {'for': 'propLink'}).text(Messages.editShare).appendTo($d);
|
|
|
|
$('<input>', {'id': 'propLink', 'readonly': 'readonly', 'value': base + el}).appendTo($d);
|
|
|
|
$('<input>', {'id': 'propLink', 'readonly': 'readonly', 'value': base + el})
|
|
|
|
|
|
|
|
.click(function () { $(this).select(); })
|
|
|
|
|
|
|
|
.appendTo($d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var roLink = ro ? base + el : getReadOnlyUrl(base + el);
|
|
|
|
var roLink = ro ? base + el : getReadOnlyUrl(base + el);
|
|
|
|
if (roLink) {
|
|
|
|
if (roLink) {
|
|
|
|
$('<label>', {'for': 'propROLink'}).text(Messages.viewShare).appendTo($d);
|
|
|
|
$('<label>', {'for': 'propROLink'}).text(Messages.viewShare).appendTo($d);
|
|
|
|
$('<input>', {'id': 'propROLink', 'readonly': 'readonly', 'value': roLink}).appendTo($d);
|
|
|
|
$('<input>', {'id': 'propROLink', 'readonly': 'readonly', 'value': roLink})
|
|
|
|
|
|
|
|
.click(function () { $(this).select(); })
|
|
|
|
|
|
|
|
.appendTo($d);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Cryptpad.isLoggedIn() && AppConfig.enablePinning) {
|
|
|
|
|
|
|
|
// check the size of this file...
|
|
|
|
|
|
|
|
Cryptpad.getFileSize(el, function (e, bytes) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
|
|
// there was a problem with the RPC
|
|
|
|
|
|
|
|
console.error(e);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// but we don't want to break the interface.
|
|
|
|
|
|
|
|
// continue as if there was no RPC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return void cb(void 0, $d);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var KB = Cryptpad.bytesToKilobytes(bytes);
|
|
|
|
|
|
|
|
$('<br>').appendTo($d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('<label>', {
|
|
|
|
|
|
|
|
'for': 'size'
|
|
|
|
|
|
|
|
}).text('Size in Kilobytes').appendTo($d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('<input>', {
|
|
|
|
|
|
|
|
id: 'size',
|
|
|
|
|
|
|
|
readonly: 'readonly',
|
|
|
|
|
|
|
|
value: KB + 'KB',
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.click(function () { $(this).select(); })
|
|
|
|
|
|
|
|
.appendTo($d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb(void 0, $d);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cb(void 0, $d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $d.html();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$contextMenu.on("click", "a", function(e) {
|
|
|
|
$contextMenu.on("click", "a", function(e) {
|
|
|
@ -1944,11 +1978,11 @@ the size of the pinned file (if it is pinned) */
|
|
|
|
else if ($(this).hasClass("properties")) {
|
|
|
|
else if ($(this).hasClass("properties")) {
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
var el = filesOp.find(paths[0].path);
|
|
|
|
var el = filesOp.find(paths[0].path);
|
|
|
|
var prop = getProperties(el);
|
|
|
|
getProperties(el, function (e, $prop) {
|
|
|
|
Cryptpad.alert('', undefined, true);
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
$('.alertify .msg').html(prop);
|
|
|
|
Cryptpad.alert('', undefined, true);
|
|
|
|
$('#propLink').click(function () { $(this).select(); });
|
|
|
|
$('.alertify .msg').html("").append($prop);
|
|
|
|
$('#propROLink').click(function () { $(this).select(); });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.hideMenu();
|
|
|
|
module.hideMenu();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1984,11 +2018,11 @@ the size of the pinned file (if it is pinned) */
|
|
|
|
else if ($(this).hasClass("properties")) {
|
|
|
|
else if ($(this).hasClass("properties")) {
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
if (paths.length !== 1) { return; }
|
|
|
|
var el = filesOp.find(paths[0].path);
|
|
|
|
var el = filesOp.find(paths[0].path);
|
|
|
|
var prop = getProperties(el);
|
|
|
|
getProperties(el, function (e, $prop) {
|
|
|
|
Cryptpad.alert('', undefined, true);
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
$('.alertify .msg').html(prop);
|
|
|
|
Cryptpad.alert('', undefined, true);
|
|
|
|
$('#propLink').click(function () { $(this).select(); });
|
|
|
|
$('.alertify .msg').html("").append($prop);
|
|
|
|
$('#propROLink').click(function () { $(this).select(); });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.hideMenu();
|
|
|
|
module.hideMenu();
|
|
|
|
});
|
|
|
|
});
|
|
|
|