|
|
@ -268,7 +268,10 @@ define([
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var openFile = function (fileEl) {
|
|
|
|
var openFile = function (fileEl, name) {
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
|
|
|
sessionStorage[Cryptpad.newPadNameKey] = name;
|
|
|
|
|
|
|
|
}
|
|
|
|
window.open(fileEl);
|
|
|
|
window.open(fileEl);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -738,7 +741,7 @@ define([
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isTrash) { return; }
|
|
|
|
if (isTrash) { return; }
|
|
|
|
openFile(root[key]);
|
|
|
|
openFile(root[key], key);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$element.addClass(liClass);
|
|
|
|
$element.addClass(liClass);
|
|
|
|
$element.data('path', newPath);
|
|
|
|
$element.data('path', newPath);
|
|
|
@ -896,25 +899,9 @@ define([
|
|
|
|
return $block;
|
|
|
|
return $block;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createPadFromRootHandler = function (e) {
|
|
|
|
|
|
|
|
var type = $(this).data('type');
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
|
|
|
|
throw new Error("Unable to get the pad type...");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var onNamed = function (name) {
|
|
|
|
|
|
|
|
if (!name) { return; }
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath);
|
|
|
|
|
|
|
|
sessionStorage[Cryptpad.newPadNameKey] = name;
|
|
|
|
|
|
|
|
sessionStorage[Cryptpad.newPadPathKey] = currentPath;
|
|
|
|
|
|
|
|
window.open('/' + type + '/');
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Cryptpad.prompt(Messages.fm_nameFile, Cryptpad.getDefaultName({type: type}), onNamed);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var createNewButton = function (isInRoot) {
|
|
|
|
var createNewButton = function (isInRoot) {
|
|
|
|
if (!APP.editable) { return; }
|
|
|
|
if (!APP.editable) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create dropdown
|
|
|
|
// Create dropdown
|
|
|
|
var options = [];
|
|
|
|
var options = [];
|
|
|
|
if (isInRoot) {
|
|
|
|
if (isInRoot) {
|
|
|
@ -954,14 +941,18 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// Handlers
|
|
|
|
// Handlers
|
|
|
|
if (isInRoot) {
|
|
|
|
if (isInRoot) {
|
|
|
|
$block.find('a.newFolder').click(function () {
|
|
|
|
|
|
|
|
var onCreated = function (info) {
|
|
|
|
var onCreated = function (info) {
|
|
|
|
module.newFolder = info.newPath;
|
|
|
|
module.newFolder = info.newPath;
|
|
|
|
refresh();
|
|
|
|
refresh();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
$block.find('a.newFolder').click(function () {
|
|
|
|
filesOp.createNewFolder(currentPath, null, onCreated);
|
|
|
|
filesOp.createNewFolder(currentPath, null, onCreated);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$block.find('a.newdoc').click(createPadFromRootHandler);
|
|
|
|
$block.find('a.newdoc').click(function (e) {
|
|
|
|
|
|
|
|
var type = $(this).attr('data-type') || 'pad';
|
|
|
|
|
|
|
|
var name = Cryptpad.getDefaultName({type: type});
|
|
|
|
|
|
|
|
filesOp.createNewFile(currentPath, name, type, onCreated);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $block;
|
|
|
|
return $block;
|
|
|
@ -1058,7 +1049,7 @@ define([
|
|
|
|
var $fhIcon = $('<span>', {'class': 'icon'});
|
|
|
|
var $fhIcon = $('<span>', {'class': 'icon'});
|
|
|
|
var $fhName = $('<span>', {'class': 'name filename clickable'}).text(Messages.fm_fileName).click(onSortByClick);
|
|
|
|
var $fhName = $('<span>', {'class': 'name filename clickable'}).text(Messages.fm_fileName).click(onSortByClick);
|
|
|
|
var $fhTitle = $('<span>', {'class': 'title clickable'}).text(Messages.fm_title).click(onSortByClick);
|
|
|
|
var $fhTitle = $('<span>', {'class': 'title clickable'}).text(Messages.fm_title).click(onSortByClick);
|
|
|
|
var $fhType = $('<span>', {'class': 'type clickable'}).text(Messages.table_type).click(onSortByClick);
|
|
|
|
var $fhType = $('<span>', {'class': 'type clickable'}).text(Messages.fm_type).click(onSortByClick);
|
|
|
|
var $fhAdate = $('<span>', {'class': 'atime clickable'}).text(Messages.fm_lastAccess).click(onSortByClick);
|
|
|
|
var $fhAdate = $('<span>', {'class': 'atime clickable'}).text(Messages.fm_lastAccess).click(onSortByClick);
|
|
|
|
var $fhCdate = $('<span>', {'class': 'ctime clickable'}).text(Messages.fm_creation).click(onSortByClick);
|
|
|
|
var $fhCdate = $('<span>', {'class': 'ctime clickable'}).text(Messages.fm_creation).click(onSortByClick);
|
|
|
|
// If displayTitle is false, it means the "name" is the title, so do not display the "name" header
|
|
|
|
// If displayTitle is false, it means the "name" is the title, so do not display the "name" header
|
|
|
@ -1410,6 +1401,7 @@ define([
|
|
|
|
var element = filesOp.findElement(files, path);
|
|
|
|
var element = filesOp.findElement(files, path);
|
|
|
|
if (!filesOp.isFile(element)) { return; }
|
|
|
|
if (!filesOp.isFile(element)) { return; }
|
|
|
|
var data = filesOp.getFileData(element);
|
|
|
|
var data = filesOp.getFileData(element);
|
|
|
|
|
|
|
|
if (!data) { return; }
|
|
|
|
$el.find('.title').attr('title', data.title).text(data.title);
|
|
|
|
$el.find('.title').attr('title', data.title).text(data.title);
|
|
|
|
$el.find('.atime').attr('title', getDate(data.atime)).text(getDate(data.atime));
|
|
|
|
$el.find('.atime').attr('title', getDate(data.atime)).text(getDate(data.atime));
|
|
|
|
$el.find('.ctime').attr('title', getDate(data.ctime)).text(getDate(data.ctime));
|
|
|
|
$el.find('.ctime').attr('title', getDate(data.ctime)).text(getDate(data.ctime));
|
|
|
@ -1652,23 +1644,26 @@ define([
|
|
|
|
var roUrl = getReadOnlyUrl(el);
|
|
|
|
var roUrl = getReadOnlyUrl(el);
|
|
|
|
openFile(roUrl);
|
|
|
|
openFile(roUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($(this).hasClass('delete')) {
|
|
|
|
|
|
|
|
moveElements([path], [TRASH], false, refresh);
|
|
|
|
|
|
|
|
}
|
|
|
|
module.hideMenu();
|
|
|
|
module.hideMenu();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$contentContextMenu.on('click', 'a', function (e) {
|
|
|
|
$contentContextMenu.on('click', 'a', function (e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
var path = $(this).data('path');
|
|
|
|
var path = $(this).data('path');
|
|
|
|
if ($(this).hasClass("newfolder")) {
|
|
|
|
|
|
|
|
var onCreated = function (info) {
|
|
|
|
var onCreated = function (info) {
|
|
|
|
module.newFolder = info.newPath;
|
|
|
|
module.newFolder = info.newPath;
|
|
|
|
refresh();
|
|
|
|
refresh();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if ($(this).hasClass("newfolder")) {
|
|
|
|
filesOp.createNewFolder(path, null, onCreated);
|
|
|
|
filesOp.createNewFolder(path, null, onCreated);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($(this).hasClass("newdoc")) {
|
|
|
|
else if ($(this).hasClass("newdoc")) {
|
|
|
|
var type = $(this).data('type') || 'pad';
|
|
|
|
var type = $(this).data('type') || 'pad';
|
|
|
|
createPadFromRootHandler.apply(this);
|
|
|
|
var name = Cryptpad.getDefaultName({type: type});
|
|
|
|
e.preventDefault();
|
|
|
|
filesOp.createNewFile(path, name, type, onCreated);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.hideMenu();
|
|
|
|
module.hideMenu();
|
|
|
|
});
|
|
|
|
});
|
|
|
|