|
|
|
@ -666,10 +666,10 @@ define([
|
|
|
|
|
var openFile = function (el, href) {
|
|
|
|
|
if (!href) {
|
|
|
|
|
var data = filesOp.getFileData(el);
|
|
|
|
|
if (!data || !data.href) {
|
|
|
|
|
if (!data || (!data.href && !data.roHref)) {
|
|
|
|
|
return void logError("Missing data for the file", el, data);
|
|
|
|
|
}
|
|
|
|
|
href = data.href;
|
|
|
|
|
href = data.href || data.roHref;
|
|
|
|
|
}
|
|
|
|
|
window.open(APP.origin + href);
|
|
|
|
|
};
|
|
|
|
@ -1271,9 +1271,10 @@ define([
|
|
|
|
|
if (!filesOp.isFile(element)) { return; }
|
|
|
|
|
|
|
|
|
|
var data = filesOp.getFileData(element);
|
|
|
|
|
var href = data.href || data.roHref;
|
|
|
|
|
if (!data) { return void logError("No data for the file", element); }
|
|
|
|
|
|
|
|
|
|
var hrefData = Hash.parsePadUrl(data.href);
|
|
|
|
|
var hrefData = Hash.parsePadUrl(href);
|
|
|
|
|
if (hrefData.type) {
|
|
|
|
|
$span.addClass('cp-border-color-'+hrefData.type);
|
|
|
|
|
}
|
|
|
|
@ -1305,7 +1306,7 @@ define([
|
|
|
|
|
$span.attr('title', name);
|
|
|
|
|
|
|
|
|
|
var type = Messages.type[hrefData.type] || hrefData.type;
|
|
|
|
|
common.displayThumbnail(data.href, data.channel, data.password, $span, function ($thumb) {
|
|
|
|
|
common.displayThumbnail(href || data.roHref, data.channel, data.password, $span, function ($thumb) {
|
|
|
|
|
// Called only if the thumbnail exists
|
|
|
|
|
// Remove the .hide() added by displayThumnail() because it hides the icon in
|
|
|
|
|
// list mode too
|
|
|
|
@ -1847,7 +1848,7 @@ define([
|
|
|
|
|
var data = filesOp.getFileData(id);
|
|
|
|
|
if (!data) { return ''; }
|
|
|
|
|
if (prop === 'type') {
|
|
|
|
|
var hrefData = Hash.parsePadUrl(data.href);
|
|
|
|
|
var hrefData = Hash.parsePadUrl(data.href || data.roHref);
|
|
|
|
|
return hrefData.type;
|
|
|
|
|
}
|
|
|
|
|
if (prop === 'atime' || prop === 'ctime') {
|
|
|
|
@ -1882,7 +1883,7 @@ define([
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if (prop === 'type') {
|
|
|
|
|
var hrefData = Hash.parsePadUrl(e.href);
|
|
|
|
|
var hrefData = Hash.parsePadUrl(e.href || e.roHref);
|
|
|
|
|
return hrefData.type;
|
|
|
|
|
}
|
|
|
|
|
if (prop === 'atime' || prop === 'ctime') {
|
|
|
|
@ -2690,10 +2691,12 @@ define([
|
|
|
|
|
return $div.html();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* XXX
|
|
|
|
|
var getReadOnlyUrl = APP.getRO = function (id) {
|
|
|
|
|
if (!filesOp.isFile(id)) { return; }
|
|
|
|
|
var data = filesOp.getFileData(id);
|
|
|
|
|
if (!data) { return; }
|
|
|
|
|
if (data.roHref) { return data.roHref; }
|
|
|
|
|
var parsed = Hash.parsePadUrl(data.href);
|
|
|
|
|
if (parsed.hashData.type !== "pad") { return; }
|
|
|
|
|
var i = data.href.indexOf('#') + 1;
|
|
|
|
@ -2702,7 +2705,7 @@ define([
|
|
|
|
|
if (!hrefsecret.keys) { return; }
|
|
|
|
|
var viewHash = Hash.getViewHashFromKeys(hrefsecret);
|
|
|
|
|
return base + viewHash;
|
|
|
|
|
};
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
// Disable middle click in the context menu to avoid opening /drive/inner.html# in new tabs
|
|
|
|
|
$(window).click(function (e) {
|
|
|
|
@ -2717,12 +2720,14 @@ define([
|
|
|
|
|
if (!filesOp.isFile(el)) {
|
|
|
|
|
return void cb('NOT_FILE');
|
|
|
|
|
}
|
|
|
|
|
var ro = filesOp.isReadOnlyFile(el);
|
|
|
|
|
//var ro = filesOp.isReadOnlyFile(el);
|
|
|
|
|
var base = APP.origin;
|
|
|
|
|
var data = JSON.parse(JSON.stringify(filesOp.getFileData(el)));
|
|
|
|
|
if (!data || !data.href) { return void cb('INVALID_FILE'); }
|
|
|
|
|
data.href = base + data.href;
|
|
|
|
|
data.roHref = base + data.roHref;
|
|
|
|
|
|
|
|
|
|
/* XXX
|
|
|
|
|
var roUrl;
|
|
|
|
|
if (ro) {
|
|
|
|
|
data.roHref = data.href;
|
|
|
|
@ -2731,6 +2736,7 @@ define([
|
|
|
|
|
roUrl = getReadOnlyUrl(el);
|
|
|
|
|
if (roUrl) { data.roHref = base + roUrl; }
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
UIElements.getProperties(common, data, cb);
|
|
|
|
|
};
|
|
|
|
@ -2806,8 +2812,9 @@ define([
|
|
|
|
|
var el = filesOp.find(p.path);
|
|
|
|
|
if (filesOp.isPathIn(p.path, [FILES_DATA])) { el = el.href; }
|
|
|
|
|
if (!el || filesOp.isFolder(el)) { return; }
|
|
|
|
|
var roUrl = getReadOnlyUrl(el);
|
|
|
|
|
openFile(null, roUrl);
|
|
|
|
|
// var roUrl = getReadOnlyUrl(el);
|
|
|
|
|
openFile(el);
|
|
|
|
|
//, roUrl); XXX
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if ($(this).hasClass('cp-app-drive-context-newfolder')) {
|
|
|
|
@ -2847,7 +2854,7 @@ define([
|
|
|
|
|
el = filesOp.find(paths[0].path);
|
|
|
|
|
var data = filesOp.getFileData(el);
|
|
|
|
|
if (!data) { return void console.error("Expected to find a file"); }
|
|
|
|
|
var href = data.href;
|
|
|
|
|
var href = data.href || data.roHref;
|
|
|
|
|
common.updateTags(href);
|
|
|
|
|
}
|
|
|
|
|
else if ($(this).hasClass("cp-app-drive-context-empty")) {
|
|
|
|
|