Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 8 years ago
commit f168433db0

@ -142,12 +142,14 @@ define(function () {
out.fm_templateName = "Modèles";
out.fm_newButton = "Nouveau";
out.fm_newFolder = "Nouveau dossier";
out.fm_newFile = "Nouveau document";
out.fm_folder = "Dossier";
out.fm_folderName = "Nom du dossier";
out.fm_numberOfFolders = "# de dossiers";
out.fm_numberOfFiles = "# de fichiers";
out.fm_fileName = "Nom du fichier";
out.fm_title = "Titre";
out.fm_type = "Type";
out.fm_lastAccess = "Dernier accès";
out.fm_creation = "Création";
out.fm_forbidden = "Action interdite";
@ -162,6 +164,7 @@ define(function () {
out.fm_unknownFolderError = "Le dossier sélectionné ou le dernier dossier visité n'existe plus. Ouverture du dossier parent...";
out.fm_contextMenuError = "Impossible d'ouvrir le menu contextuel pour cet élément. Si le problème persiste, essayez de rechercher la page.";
out.fm_selectError = "Impossible de sélectionner l'élément ciblé. Si le problème persiste, essayez de recharger la page.";
out.fm_categoryError = "Impossible d'afficher la catégorie sélectionnée, affichage de Documents";
out.fm_info_root = "Créez ici autant de dossiers que vous le souhaitez pour trier vos fichiers.";
out.fm_info_unsorted = 'Contient tous les documents que vous avez ouvert et qui ne sont pas triés dans "Documents" ou déplacés vers la "Corbeille".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName"
out.fm_info_template = "Contient tous les fichiers que vous avez sauvés en tant que modèle afin de les réutiliser lors de la création d'un nouveau document.";

@ -145,12 +145,14 @@ define(function () {
out.fm_templateName = "Templates";
out.fm_newButton = "New";
out.fm_newFolder = "New folder";
out.fm_newFile = "New document";
out.fm_folder = "Folder";
out.fm_folderName = "Folder name";
out.fm_numberOfFolders = "# of folders";
out.fm_numberOfFiles = "# of files";
out.fm_fileName = "File name";
out.fm_title = "Title";
out.fm_type = "Type";
out.fm_lastAccess = "Last access";
out.fm_creation = "Creation";
out.fm_forbidden = "Forbidden action";
@ -165,6 +167,7 @@ define(function () {
out.fm_unknownFolderError = "The selected or last visited directory no longer exist. Opening the parent folder...";
out.fm_contextMenuError = "Unable to open the context menu for that element. If the problem persist, try to reload the page.";
out.fm_selectError = "Unable to select the targetted element. If the problem persist, try to reload the page.";
out.fm_categoryError = "Unable to open the selected category, displaying root.";
out.fm_info_root = "Create as many nested folders here as you want to sort your files.";
out.fm_info_unsorted = 'Contains all the files you\'ve visited that are not yet sorted in "Documents" or moved to the "Trash".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName"
out.fm_info_template = 'Contains all the pads stored as templates and that you can re-use when you create a new document.';

@ -706,6 +706,7 @@ define([
common.initialName = sessionStorage[newPadNameKey];
delete sessionStorage[newPadNameKey];
}
// Deprecated
if (sessionStorage[newPadPathKey]) {
common.initialPath = sessionStorage[newPadPathKey];
delete sessionStorage[newPadPathKey];

@ -17,6 +17,7 @@ define([
var FILES_DATA = Cryptpad.storageKey;
var NEW_FOLDER_NAME = Messages.fm_newFolder;
var NEW_FILE_NAME = Messages.fm_newFile;
var DEBUG = config.DEBUG || false;
var logging = function () {
@ -579,6 +580,28 @@ define([
});
};
var pushNewFileData = function (href, title) {
files[FILES_DATA].push({
href: href,
title: title,
atime: new Date().toISOString(),
ctime: new Date().toISOString()
});
};
var createNewFile = exp.createNewFile = function (filePath, name, type, cb) {
var parentEl = findElement(files, filePath);
var fileName = getAvailableName(parentEl, name || NEW_FILE_NAME);
var href = '/' + type + '/#' + Cryptpad.createRandomHash();
parentEl[fileName] = href;
pushNewFileData(href, fileName);
var newPath = filePath.slice();
newPath.push(fileName);
cb({
newPath: newPath
});
};
// Remove an element from the trash root
var removeFromTrashArray = function (element, name) {

@ -94,7 +94,7 @@ span.fa-folder-open {
background: #fff;
overflow: auto;
resize: horizontal;
width: 250px;
width: auto;
white-space: nowrap;
max-width: 500px;
min-width: 200px;
@ -229,6 +229,7 @@ span.fa-folder-open {
width: 140px;
text-align: center;
vertical-align: top;
overflow: hidden;
}
#content div.grid li .name {
width: 100%;

@ -128,7 +128,7 @@ span {
background: @tree-bg;
overflow: auto;
resize: horizontal;
width: 250px;
width: auto;
white-space: nowrap;
max-width: 500px;
min-width: 200px;
@ -274,6 +274,7 @@ span {
width: 140px;
text-align: center;
vertical-align: top;
overflow: hidden;
.name {
width: 100%;

@ -39,6 +39,7 @@
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;">
<li><a tabindex="-1" href="#" class="open dropdown-item" data-localization="fc_open">Open</a></li>
<li><a tabindex="-1" href="#" class="open_ro dropdown-item" data-localization="fc_open_ro">Open (read-only)</a></li>
<li><a tabindex="-1" href="#" class="delete dropdown-item" data-localization="fc_delete">Delete</a></li>
</ul>
</div>
<div id="trashTreeContextMenu" class="contextMenu dropdown clearfix" oncontextmenu="return false;">

@ -202,6 +202,12 @@ define([
// FILE MANAGER
// _WORKGROUP_ and other people drive : display Documents as main page
var currentPath = module.currentPath = isOwnDrive() ? getLastOpenedFolder() : [ROOT];
// Categories dislayed in the menu
// _WORKGROUP_ : do not display unsorted
var displayedCategories = [ROOT, UNSORTED, TRASH];
if (isWorkgroup()) { displayedCategories = [ROOT, TRASH]; }
var lastSelectTime;
var selectedElement;
@ -262,7 +268,10 @@ define([
return ret;
};
var openFile = function (fileEl) {
var openFile = function (fileEl, name) {
if (name) {
sessionStorage[Cryptpad.newPadNameKey] = name;
}
window.open(fileEl);
};
@ -732,7 +741,7 @@ define([
return;
}
if (isTrash) { return; }
openFile(root[key]);
openFile(root[key], key);
});
$element.addClass(liClass);
$element.data('path', newPath);
@ -890,25 +899,9 @@ define([
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) {
if (!APP.editable) { return; }
// Create dropdown
var options = [];
if (isInRoot) {
@ -948,14 +941,18 @@ define([
// Handlers
if (isInRoot) {
var onCreated = function (info) {
module.newFolder = info.newPath;
refresh();
};
$block.find('a.newFolder').click(function () {
var onCreated = function (info) {
module.newFolder = info.newPath;
refresh();
};
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;
@ -1052,7 +1049,7 @@ define([
var $fhIcon = $('<span>', {'class': 'icon'});
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 $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 $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
@ -1284,8 +1281,8 @@ define([
if (!APP.editable) { debug("Read-only mode"); }
if (!appStatus.isReady && !force) { return; }
// Only Trash and Root are available in not-owned files manager
if (isWorkgroup() && !filesOp.isPathInTrash(path) && !filesOp.isPathInRoot(path)) {
log("Unable to open the selected category, displaying root"); //TODO translate
if (displayedCategories.indexOf(path[0]) === -1) {
log(Messages.categoryError);
currentPath = [ROOT];
displayDirectory(currentPath);
return;
@ -1404,6 +1401,7 @@ define([
var element = filesOp.findElement(files, path);
if (!filesOp.isFile(element)) { return; }
var data = filesOp.getFileData(element);
if (!data) { return; }
$el.find('.title').attr('title', data.title).text(data.title);
$el.find('.atime').attr('title', getDate(data.atime)).text(getDate(data.atime));
$el.find('.ctime').attr('title', getDate(data.ctime)).text(getDate(data.ctime));
@ -1532,13 +1530,11 @@ define([
var resetTree = module.resetTree = function () {
$tree.html('');
createTree($tree, [ROOT]);
if (!isWorkgroup()) {
createUnsorted($tree, [UNSORTED]);
//createTemplate($tree, [TEMPLATE]);
createAllFiles($tree, [FILES_DATA]);
}
createTrash($tree, [TRASH]);
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); }
if (displayedCategories.indexOf(UNSORTED) !== -1) { createUnsorted($tree, [UNSORTED]); }
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); }
if (displayedCategories.indexOf(FILES_DATA) !== -1) { createAllFiles($tree, [FILES_DATA]); }
if (displayedCategories.indexOf(TRASH) !== -1) { createTrash($tree, [TRASH]); }
};
var hideMenu = module.hideMenu = function () {
@ -1648,23 +1644,26 @@ define([
var roUrl = getReadOnlyUrl(el);
openFile(roUrl);
}
else if ($(this).hasClass('delete')) {
moveElements([path], [TRASH], false, refresh);
}
module.hideMenu();
});
$contentContextMenu.on('click', 'a', function (e) {
e.stopPropagation();
var path = $(this).data('path');
var onCreated = function (info) {
module.newFolder = info.newPath;
refresh();
};
if ($(this).hasClass("newfolder")) {
var onCreated = function (info) {
module.newFolder = info.newPath;
refresh();
};
filesOp.createNewFolder(path, null, onCreated);
}
else if ($(this).hasClass("newdoc")) {
var type = $(this).data('type') || 'pad';
createPadFromRootHandler.apply(this);
e.preventDefault();
var name = Cryptpad.getDefaultName({type: type});
filesOp.createNewFile(path, name, type, onCreated);
}
module.hideMenu();
});

@ -357,7 +357,7 @@ define([
};
if (!initializing) {
hjson[3].metadata.title = document.title;
} else if (Cryptpad.initialName) {
} else if (Cryptpad.initialName && !hjson[3].metadata.title) {
hjson[3].metadata.title = Cryptpad.initialName;
}
return stringify(hjson);

@ -568,6 +568,7 @@ define([
APP.proxy.info.defaultTitle = defaultName;
}
if (Cryptpad.initialName && !APP.proxy.info.title) {
APP.proxy.info.title = Cryptpad.initialName;
updateTitle(Cryptpad.initialName);
} else {
updateTitle(APP.proxy.info.title || defaultName);

Loading…
Cancel
Save