diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 5325a53e2..015adff6e 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -386,6 +386,7 @@ define(function () { out.fm_newFolder = "Nouveau dossier"; out.fm_newFile = "Nouveau pad"; out.fm_folder = "Dossier"; + out.fm_sharedFolder = "Dossier partagé"; out.fm_folderName = "Nom du dossier"; out.fm_numberOfFolders = "# de dossiers"; out.fm_numberOfFiles = "# de fichiers"; @@ -446,6 +447,7 @@ define(function () { out.fm_tags_used = "Nombre d'utilisations"; // File - Context menu out.fc_newfolder = "Nouveau dossier"; + out.fc_newsharedfolder = "Nouveau dossier partagé"; out.fc_rename = "Renommer"; out.fc_open = "Ouvrir"; out.fc_open_ro = "Ouvrir (lecture seule)"; @@ -453,12 +455,13 @@ define(function () { out.fc_delete_owned = "Supprimer du serveur"; out.fc_restore = "Restaurer"; out.fc_remove = "Supprimer de votre CryptDrive"; + out.fc_remove_sharedfolder = "Supprimer"; out.fc_empty = "Vider la corbeille"; out.fc_prop = "Propriétés"; out.fc_hashtag = "Mots-clés"; out.fc_sizeInKilobytes = "Taille en kilo-octets"; // fileObject.js (logs) - out.fo_moveUnsortedError = "La liste des éléments non triés ne peut pas contenir de dossiers."; + out.fo_moveUnsortedError = "La liste des modèles ne peut pas contenir de dossiers."; out.fo_existingNameError = "Ce nom est déjà utilisé dans ce répertoire. Veuillez en choisir un autre."; out.fo_moveFolderToChildError = "Vous ne pouvez pas déplacer un dossier dans un de ses descendants"; out.fo_unableToRestore = "Impossible de restaurer ce fichier à son emplacement d'origine. Vous pouvez essayer de le déplacer à un nouvel emplacement."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index b16e6d876..3cf9348a4 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -387,6 +387,7 @@ define(function () { out.fm_newFolder = "New folder"; out.fm_newFile = "New pad"; out.fm_folder = "Folder"; + out.fm_sharedFolder = "Shared folder"; out.fm_folderName = "Folder name"; out.fm_numberOfFolders = "# of folders"; out.fm_numberOfFiles = "# of files"; @@ -447,6 +448,7 @@ define(function () { out.fm_tags_used = "Number of uses"; // File - Context menu out.fc_newfolder = "New folder"; + out.fc_newsharedfolder = "New shared folder"; out.fc_rename = "Rename"; out.fc_open = "Open"; out.fc_open_ro = "Open (read-only)"; @@ -454,12 +456,13 @@ define(function () { out.fc_delete_owned = "Delete from the server"; out.fc_restore = "Restore"; out.fc_remove = "Remove from your CryptDrive"; + out.fc_remove_sharedfolder = "Remove"; out.fc_empty = "Empty the trash"; out.fc_prop = "Properties"; out.fc_hashtag = "Tags"; out.fc_sizeInKilobytes = "Size in Kilobytes"; // fileObject.js (logs) - out.fo_moveUnsortedError = "You can't move a folder to the list of unsorted pads"; + out.fo_moveUnsortedError = "You can't move a folder to the list of templates"; out.fo_existingNameError = "Name already used in that directory. Please choose another one."; out.fo_moveFolderToChildError = "You can't move a folder into one of its descendants"; out.fo_unableToRestore = "Unable to restore that file to its original location. You can try to move it to a new location."; @@ -1209,5 +1212,15 @@ define(function () { out.loading_drive_2 = "Updating data format"; out.loading_drive_3 = "Verifying data integrity"; + // Shared folders + // XXX + out.sharedFolders_forget = "This pad is only stored in a shared folder, you can't move it to the trash. You can use your CryptDrive if you want to delete it from the folder."; + out.sharedFolders_duplicate = "Some of the pads you were trying to move were already stored."; + out.sharedFolders_create = "Create a shared folder"; + out.sharedFolders_create_name = "Folder name"; + out.sharedFolders_create_owned = "Owned folder"; + out.sharedFolders_create_password = "Folder password"; + out.sharedFolders_share = "Share this URL with other registered users to give them access to the shared folder. Once they open this URL, the shared folder will be added to the root directory of their CryptDrive."; + return out; }); diff --git a/www/common/common-hash.js b/www/common/common-hash.js index 4b0c2c607..d5066b757 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -398,10 +398,16 @@ Version 1 Hash.findWeaker = function (href, channel, recents) { var parsed = parsePadUrl(href); if (!parsed.hash) { return false; } + // We can't have a weaker hash if we're already in view mode + if (parsed.hashData && parsed.hashData.mode === 'view') { return; } var weaker; Object.keys(recents).some(function (id) { var pad = recents[id]; - var p = parsePadUrl(pad.href); + if (pad.href || !pad.roHref) { + // This pad has an edit link, so it can't be weaker + return; + } + var p = parsePadUrl(pad.roHref); if (p.type !== parsed.type) { return; } // Not the same type if (p.hash === parsed.hash) { return; } // Same hash, not stronger if (channel !== pad.channel) { return; } // Not the same channel @@ -430,6 +436,10 @@ Version 1 var stronger; Object.keys(recents).some(function (id) { var pad = recents[id]; + if (!pad.href) { + // This pad doesn't have an edit link, so it can't be stronger + return; + } var p = parsePadUrl(pad.href); if (p.type !== parsed.type) { return; } // Not the same type if (p.hash === parsed.hash) { return; } // Same hash, not stronger diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 7b05d22fe..b1308bc7b 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -665,7 +665,7 @@ define([ // Update the current state loading.driveState = data.state; data.progress = data.progress || 100; - data.msg = Messages['loading_drive_'+data.state] || ''; + data.msg = Messages['loading_drive_'+ Math.floor(data.state)] || ''; $progress.html(data.msg); if (data.progress) { $progress.append(h('div.cp-loading-progress-bar', [ @@ -761,7 +761,7 @@ define([ UI.getFileIcon = function (data) { var $icon = UI.getIcon(); if (!data) { return $icon; } - var href = data.href; + var href = data.href || data.roHref; var type = data.type; if (!href && !type) { return $icon; } @@ -826,13 +826,13 @@ define([ var out = false; var xId = $(x).attr('aria-describedby'); if (xId) { - if (xId.indexOf('tippy-tooltip-') === 0) { + if (xId.indexOf('tippy-') === 0) { return true; } } $(x).find('[aria-describedby]').each(function (i, el) { var id = el.getAttribute('aria-describedby'); - if (id.indexOf('tippy-tooltip-') !== 0) { return; } + if (id.indexOf('tippy-') !== 0) { return; } out = true; }); return out; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 16b45c4f8..6a3e29684 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -73,26 +73,14 @@ define([ data.password = val; })); }).nThen(function (waitFor) { + var base = common.getMetadataMgr().getPrivateData().origin; common.getPadAttribute('href', waitFor(function (err, val) { - var base = common.getMetadataMgr().getPrivateData().origin; - - var parsed = Hash.parsePadUrl(val); - if (parsed.hashData.mode === "view") { - data.roHref = base + val; - return; - } - - // We're not in a read-only pad + if (!val) { return; } data.href = base + val; - - // Get Read-only href - if (parsed.hashData.type !== "pad") { return; } - var i = data.href.indexOf('#') + 1; - var hBase = data.href.slice(0, i); - var hrefsecret = Hash.getSecrets(parsed.type, parsed.hash, data.password); - if (!hrefsecret.keys) { return; } - var viewHash = Hash.getViewHashFromKeys(hrefsecret); - data.roHref = hBase + viewHash; + })); + common.getPadAttribute('roHref', waitFor(function (err, val) { + if (!val) { return; } + data.roHref = base + val; })); common.getPadAttribute('channel', waitFor(function (err, val) { data.channel = val; @@ -162,7 +150,7 @@ define([ $d.append(password); } - var parsed = Hash.parsePadUrl(data.href); + var parsed = Hash.parsePadUrl(data.href || data.roHref); if (owned && parsed.hashData.type === 'pad') { var sframeChan = common.getSframeChannel(); var changePwTitle = Messages.properties_changePassword; @@ -191,7 +179,7 @@ define([ UI.confirm(changePwConfirm, function (yes) { if (!yes) { return; } sframeChan.query("Q_PAD_PASSWORD_CHANGE", { - href: data.href, + href: data.href || data.roHref, password: newPass }, function (err, data) { if (err || data.error) { @@ -203,11 +191,11 @@ define([ // If we had a password and we removed it, we have to remove the /p/ if (data.warning) { return void UI.alert(Messages.properties_passwordWarning, function () { - common.gotoURL(hasPassword && newPass ? undefined : data.href); + common.gotoURL(hasPassword && newPass ? undefined : (data.href || data.roHref)); }, {force: true}); } return void UI.alert(Messages.properties_passwordSuccess, function () { - common.gotoURL(hasPassword && newPass ? undefined : data.href); + common.gotoURL(hasPassword && newPass ? undefined : (data.href || data.roHref)); }, {force: true}); }); }); @@ -242,17 +230,21 @@ define([ })); } - $('