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