From b4cc525ca614e6466ab3486d6f999b67a2ec63ae Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 13 Nov 2019 16:52:54 +0100 Subject: [PATCH 01/75] Press enter to add a new item in kanban --- www/kanban/inner.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 74abb7f8d..fb3ed93c1 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -152,6 +152,9 @@ define([ e.preventDefault(); e.stopPropagation(); save(); + if (!$input.val()) { return; } + if (!$(el).closest('.kanban-item').is(':last-child')) { return; } + $(el).closest('.kanban-board').find('.kanban-title-button.fa-plus').click(); return; } if (e.which === 27) { @@ -301,6 +304,8 @@ define([ e.preventDefault(); e.stopPropagation(); save(); + if (!$input.val()) { return; } + $(el).closest('.kanban-board').find('.kanban-title-button.fa-plus').click(); return; } if (e.which === 27) { From 8d3e6293cef9aafbab0601a362679b4195a29e54 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 13 Nov 2019 16:52:54 +0100 Subject: [PATCH 02/75] Press enter to add a new item in kanban --- www/kanban/inner.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 74abb7f8d..fb3ed93c1 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -152,6 +152,9 @@ define([ e.preventDefault(); e.stopPropagation(); save(); + if (!$input.val()) { return; } + if (!$(el).closest('.kanban-item').is(':last-child')) { return; } + $(el).closest('.kanban-board').find('.kanban-title-button.fa-plus').click(); return; } if (e.which === 27) { @@ -301,6 +304,8 @@ define([ e.preventDefault(); e.stopPropagation(); save(); + if (!$input.val()) { return; } + $(el).closest('.kanban-board').find('.kanban-title-button.fa-plus').click(); return; } if (e.which === 27) { From 99f46888d37b688c4aa1dfa87e6c13f4c99a9fd9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 14 Nov 2019 08:30:17 -0500 Subject: [PATCH 03/75] add changelog that I forgot to commit/push --- CHANGELOG.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 714d02d59..12df2ec6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,43 @@ -# Elasmotherium release notes +# FalklandWolf release (3.5.0) + +## Goals + +This release features work that we've been planning for a long time centered around sharing collections of documents in a more granular way. + +This is our first release since David Benqué joined our team, so in addition to these team-centric updates we also worked on integrating some UI/UX improvements. + +## Update notes + +Updating to 3.5.0 from 3.4.0 is simple. + +1. stop your server +2. pull the latest code via git +3. run `bower update` +4. restart your server + +## Features + +* We restyled some elements throughout the platform: + * our tooltips have a sleeker flat design + * the quota bar which appears in the drive, teams, and settings pages has also been improved + * we've begun improving the look and feel of various popup dialogs +* We've added support for password-change for owned uploaded files and owned shared folders: + * changing passwords for encrypted files means that the original file will be removed from the server and a new file will be encrypted with a new key and uploaded to a new location on the server. References to the original file will be broken. This includes links, media-tags embedded within pads, and items in other users' drives or shared folders to which you do not have access. + * the process is very similar for shared folders stored in users' CryptDrives, except that users will have the opportunity to enter the new password when they visit the platform. +* We're very happy to finally introduce the notion of _read-only shared folders_. While we've had the capacity to make shared folders read-only for some time, it was only in the same sense as pads were read-only. + * This is to say that while a viewer cannot modify the document, any links to encrypted documents within that document would confer their natural editing rights to viewers, making it possible to accidentally leak access when a single pad was shared. + * Our new read-only shared folders encrypt the editing keys for the documents they contain, such that only those with the ability to change the folder structure itself have the inherent capacity to edit the documents contained within. We think this is more intuitive than the alternative, but it took a lot of work to make it happen! + * Unfortunately, older shared folders created before this release will already contain the cryptographic keys which confer editing rights. Pads which are added to shared folders from this release onward will have the keys for their editing rights encrypted. We'll offer the ability for owners to migrate these shared folders in an upcoming release once we've added the ability to selectively trim document history. +* Similarly, we've introduced the notion of _viewers_ in teams. Viewers are listed in the team roster and have the ability to view the contents of the team's drive, but not to edit them or add new documents. + * Unfortunately, the notion of viewers is also complicated by the fact that documents added to team drives or shared folders in team drives did not have their editing keys encrypted. The first team member to open the team drive since we've deployed this release will run a migration that will encrypt the keys saved within the team drive, however, the encryption keys will remain in the drive's history until we develop a means of selectively trimming history. + +## Bug fixes + +* We discovered and fixed some bugs in the serverside code responsible for handling some aspects of file upload related to starting a new upload after having cancelled a previous session. +* We also identified a regression in Our _slides_ app related to the rendering of `
` tags, such as you might create with a `****` sequence in the corresponding markdown. This was introduced with some overly broad CSS that was intended to style our notifications page. We've since made the notifications styles more specific such that they can't interfere with other applications. +* We've become aware of some mysterious behaviour in Firefox that seems to cause some tabs or functionality to reconnect to the server after going offline while other aspects of the platform did not. Until now we've always assumed that users were connected or not, and this partial connection has revealed some bugs in our implementation. Consequently, we've begun adding some measures to detect odd behaviour if it occurs. We expect to have determined the cause of this behaviour and to have proposed a solution by our next release. + +# Elasmotherium release (3.4.0) ## Goals From 2fd31e8d8929fcf6fa5bf576403cb6240fab648a Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 18 Nov 2019 10:56:24 +0100 Subject: [PATCH 04/75] Improve password prompt UI --- .../src/less2/include/password-input.less | 23 +++++++++- www/common/common-interface.js | 42 +++++++++++++------ www/common/common-ui-elements.js | 2 +- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/customize.dist/src/less2/include/password-input.less b/customize.dist/src/less2/include/password-input.less index a2f2fb044..79824bac7 100644 --- a/customize.dist/src/less2/include/password-input.less +++ b/customize.dist/src/less2/include/password-input.less @@ -9,8 +9,27 @@ flex: 1; min-width: 0; } - label, .fa { - margin-left: 10px; + .fa { + width: 30px; + height: 30px; + display: inline-flex; + align-items: center; + justify-content: center; + cursor: pointer; + &:hover { + background-color: rgba(0,0,0,0.1); + } + } + } + .cp-password-change-container { + display: flex; + align-items: center; + .cp-password-container { + margin-bottom: 0 !important; + flex: 1; + } + button { + margin: 0 !important; } } } diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 72851a8cc..fbeb6a3cc 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -590,9 +590,10 @@ define([ }, opts); var input = h('input.cp-password-input', attributes); - var reveal = UI.createCheckbox('cp-password-reveal', Messages.password_show); + //var reveal = UI.createCheckbox('cp-password-reveal', Messages.password_show); var eye = h('span.fa.fa-eye.cp-password-reveal'); + /* $(reveal).find('input').on('change', function () { if($(this).is(':checked')) { $(input).prop('type', 'text'); @@ -602,26 +603,41 @@ define([ $(input).prop('type', 'password'); $(input).focus(); }); + */ - $(eye).mousedown(function () { - $(input).prop('type', 'text'); - $(input).focus(); - }).mouseup(function(){ - $(input).prop('type', 'password'); - $(input).focus(); - }).mouseout(function(){ - $(input).prop('type', 'password'); - $(input).focus(); - }); if (displayEye) { + $(eye).mousedown(function () { + $(input).prop('type', 'text'); + $(input).focus(); + }).mouseup(function(){ + $(input).prop('type', 'password'); + $(input).focus(); + }).mouseout(function(){ + $(input).prop('type', 'password'); + $(input).focus(); + }); + } else { + $(eye).click(function () { + if ($(this).hasClass('fa-eye')) { + $(input).prop('type', 'text'); + $(input).focus(); + $(this).removeClass('fa-eye').addClass('fa-eye-slash'); + return; + } + $(input).prop('type', 'password'); + $(input).focus(); + $(this).removeClass('fa-eye-slash').addClass('fa-eye'); + }); + } + /*if (displayEye) { $(reveal).hide(); } else { $(eye).hide(); - } + }*/ return h('span.cp-password-container', [ input, - reveal, + //reveal, eye ]); }; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index df8836788..8943f67b5 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -570,7 +570,7 @@ define([ style: 'flex: 1;' }); var passwordOk = h('button', Messages.properties_changePasswordButton); - var changePass = h('span.cp-password-container', [ + var changePass = h('span.cp-password-change-container', [ newPassword, passwordOk ]); From e7ba8904793e0764ab7f3129fa5c92e4ea9baef5 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 18 Nov 2019 14:56:46 +0100 Subject: [PATCH 05/75] Fix href re-encryption on setPadTitle --- www/common/outer/userObject.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index 6ba0cd6d2..dd1f30692 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -45,6 +45,8 @@ define([ var ids = id ? [id] : exp.findChannels([channel]); ids.forEach(function (i) { var data = exp.getFileData(i, true); + var oldHref = exp.getHref(data); + if (oldHref === href) { return; } data.href = exp.cryptor.encrypt(href); }); }; From 3bdca60c7697fdc67dac834cfbaec2f27fe073d4 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 10:40:55 +0100 Subject: [PATCH 06/75] Display the prefilled password page when receiving a password-protected pad --- www/common/common-ui-elements.js | 9 +++++++-- www/common/sframe-common-outer.js | 13 ++++++++----- www/common/sframe-common.js | 4 ++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 8943f67b5..126450f0f 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3463,19 +3463,24 @@ define([ (cb || function () {})(); }; - UIElements.displayPasswordPrompt = function (common, isError) { + UIElements.displayPasswordPrompt = function (common, cfg, isError) { var error; if (isError) { error = setHTML(h('p.cp-password-error'), Messages.password_error); } var info = h('p.cp-password-info', Messages.password_info); var password = UI.passwordInput({placeholder: Messages.password_placeholder}); var button = h('button', Messages.password_submit); + cfg = cfg || {}; + + if (cfg.value && !isError) { + $(password).find('.cp-password-input').val(cfg.value); + } var submit = function () { var value = $(password).find('.cp-password-input').val(); UI.addLoadingScreen(); common.getSframeChannel().query('Q_PAD_PASSWORD_VALUE', value, function (err, data) { if (!data) { - UIElements.displayPasswordPrompt(common, true); + UIElements.displayPasswordPrompt(common, cfg, true); } }); }; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 224a9f73c..a2c50ca6b 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -206,7 +206,7 @@ define([ // 2c: 'view' pad and '/p/' and a wrong password stored --> the seed is incorrect // 2d: 'view' pad and '/p/' and password never stored (security feature) --> password-prompt - var askPassword = function (wrongPasswordStored) { + var askPassword = function (wrongPasswordStored, cfg) { // Ask for the password and check if the pad exists // If the pad doesn't exist, it means the password isn't correct // or the pad has been deleted @@ -250,11 +250,14 @@ define([ // Not a file, so we can use `isNewChannel` Cryptpad.isNewChannel(window.location.href, password, next); }); - sframeChan.event("EV_PAD_PASSWORD"); + sframeChan.event("EV_PAD_PASSWORD", cfg); }; var done = waitFor(); var stored = false; + var passwordCfg = { + value: '' + }; nThen(function (w) { Cryptpad.getPadAttribute('title', w(function (err, data) { stored = (!err && typeof (data) === "string"); @@ -264,7 +267,7 @@ define([ }), parsed.getUrl()); }).nThen(function (w) { if (!password && !stored && sessionStorage.newPadPassword) { - password = sessionStorage.newPadPassword; + passwordCfg.value = sessionStorage.newPadPassword; delete sessionStorage.newPadPassword; } @@ -274,7 +277,7 @@ define([ Cryptpad.getFileSize(window.location.href, password, w(function (e, size) { if (size !== 0) { return void todo(); } // Wrong password or deleted file? - askPassword(true); + askPassword(true, passwordCfg); })); return; } @@ -293,7 +296,7 @@ define([ return void todo(); } // Wrong password or deleted file? - askPassword(true); + askPassword(true, passwordCfg); })); }).nThen(done); } diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index c73e43996..f8bbb205b 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -595,8 +595,8 @@ define([ UI.addTooltips(); - ctx.sframeChan.on("EV_PAD_PASSWORD", function () { - UIElements.displayPasswordPrompt(funcs); + ctx.sframeChan.on("EV_PAD_PASSWORD", function (cfg) { + UIElements.displayPasswordPrompt(funcs, cfg); }); ctx.sframeChan.on("EV_PAD_PASSWORD_ERROR", function () { From b5ff5a3b20170e5c14174bf8b4fef78b9ba945ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 10:18:18 +0000 Subject: [PATCH 07/75] open share modal on ready temporary to make working easier --- www/common/toolbar3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 224f7eeb6..7dcfafda2 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -533,7 +533,7 @@ MessengerUI, Messages) { Common.getSframeChannel().event('EV_SHARE_OPEN', { hidden: true }); - $shareBlock.click(function () { + $shareBlock.ready(function () { var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From fd36825f451af0407aa242f2546ef07553f3fbaa Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 12:07:05 +0100 Subject: [PATCH 08/75] Fix Team Drive is read only even for owners #464 --- www/common/outer/sharedfolder.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index e4d8d152c..b6b961428 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -309,7 +309,9 @@ define([ isNewChannel: Store.isNewChannel }, id, sf, waitFor()); }); - }).nThen(waitFor()); + }).nThen(function () { + setTimeout(waitFor()); + }); }; return SF; From a297336746870d398be11da7ac3421802e7cbaf0 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 14:01:56 +0100 Subject: [PATCH 09/75] Fix broken link in cryptpad-docker.md --- docs/cryptpad-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cryptpad-docker.md b/docs/cryptpad-docker.md index 12018902e..5998dc143 100644 --- a/docs/cryptpad-docker.md +++ b/docs/cryptpad-docker.md @@ -2,7 +2,7 @@ Cryptpad includes support for building a Docker image and running it to provide a Cryptpad instance. You can manage the container manually, or let Docker Compose manage it for you. -A full tutorial is available [on the Cryptpad Github wiki](https://github.com/xwiki-labs/cryptpad/wiki/Docker-(with-Nginx-and-Traefik)). This document provides a brief overview. +A full tutorial is available [on the Cryptpad Github wiki](https://github.com/xwiki-labs/cryptpad/wiki/Docker). This document provides a brief overview. ## Features From 870607c338a802a0bd16acab7ffb8222ed4e8263 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 15:20:39 +0100 Subject: [PATCH 10/75] Preserve kanban title edition when receiving remote changes --- www/kanban/inner.js | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 2b469cb3f..c2d845557 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -399,18 +399,24 @@ define([ try { var el = getSelectedElement(); var input = $(el).is('input') ? el : $(el).find('input')[0]; - var $item = $(el).closest('.kanban-item'); + if (!input) { return; } + var $input = $(input); - var pos = kanban.findElementPosition($item[0]); - var board = $item.closest('.kanban-board').attr('data-id'); - var val = ($(input).val && $(input).val()) || ''; + var pos; + var $item = $(el).closest('.kanban-item'); + if ($item.length) { + pos = kanban.findElementPosition($item[0]); + } + var board = $input.closest('.kanban-board').attr('data-id'); + var val = ($input.val && $input.val()) || ''; var start = input.selectionStart; var end = input.selectionEnd; + var boardEl = kanban.options.boards.find(function (b) { return b.id === board; }); - var oldVal = boardEl.item[pos] || {}; + var oldVal = ((pos ? boardEl.item[pos] : boardEl) || {}).title; return { board: board, @@ -418,7 +424,7 @@ define([ value: val, start: start, end: end, - oldValue: oldVal.title + oldValue: oldVal }; } catch (e) { return {}; @@ -431,9 +437,25 @@ define([ }); if (!boardEl) { return; } + var $board = $('.kanban-board[data-id="'+data.board+'"'); + + // Editing a board title... + if (!data.pos && $board.length) { + if (boardEl.title !== data.oldValue) { return; } + $board.find('.kanban-title-board').click(); + var $boardInput = $board.find('.kanban-title-board input'); + $boardInput.val(data.value); + $boardInput[0].selectionStart = data.start; + $boardInput[0].selectionEnd = data.end; + return; + } + // Editing a deleted board title: abort + if (!data.pos) { + return; + } + // An item was added: add a new item if (!data.oldValue) { - var $board = $('.kanban-board[data-id="'+data.board+'"'); $board.find('.kanban-title-button.fa-plus').click(); var $newInput = $board.find('.kanban-item:last-child input'); $newInput.val(data.value); From 741acbd6efb2ff12952981efa409cab1fca8453b Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 15:21:11 +0100 Subject: [PATCH 11/75] Remove XXX --- www/common/sframe-common-outer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index a2c50ca6b..efa904d6e 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -223,7 +223,6 @@ define([ if (wrongPasswordStored) { // Store the correct password nThen(function (w) { - // XXX noPasswordStored: return; ? Cryptpad.setPadAttribute('password', password, w(), parsed.getUrl()); Cryptpad.setPadAttribute('channel', secret.channel, w(), parsed.getUrl()); if (parsed.hashData.mode === 'edit') { From da328644132aebfc11850d660da875a1d7c57428 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 15:45:37 +0100 Subject: [PATCH 12/75] Fix other read-only teams issues --- www/common/outer/profile.js | 4 ++-- www/common/outer/team.js | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/www/common/outer/profile.js b/www/common/outer/profile.js index 0e1e1f35e..dd56db6e9 100644 --- a/www/common/outer/profile.js +++ b/www/common/outer/profile.js @@ -20,11 +20,11 @@ define([ } profile.edit = Hash.getEditHashFromKeys(secret); profile.view = Hash.getViewHashFromKeys(secret); - cb(); + setTimeout(cb); }); return; } - cb(); + setTimeout(cb); }; var openChannel = function (ctx) { diff --git a/www/common/outer/team.js b/www/common/outer/team.js index b1be2baea..314d33f88 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -25,10 +25,6 @@ define([ var Nacl = window.nacl; - var initializeTeams = function (ctx, cb) { - cb(); - }; - var registerChangeEvents = function (ctx, team, proxy, fId) { if (!team) { return; } if (!fId) { @@ -338,7 +334,7 @@ define([ }; var openChannel = function (ctx, teamData, id, _cb) { - var cb = Util.once(_cb); + var cb = Util.once(Util.mkAsync(_cb)); var hash = teamData.hash || teamData.roHash; var secret = Hash.getSecrets('team', hash, teamData.password); @@ -1277,10 +1273,6 @@ define([ var teams = store.proxy.teams = store.proxy.teams || {}; - initializeTeams(ctx, waitFor(function (err) { - if (err) { return; } - })); - // Listen for changes in our access rights (if another worker receives edit access) ctx.store.proxy.on('change', ['teams'], function (o, n, p) { if (p[2] !== 'hash') { return; } From 874dce748d089469074c508d1ec855700e6916b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 15:30:23 +0000 Subject: [PATCH 13/75] split share modal into 3 tabs --- www/common/common-ui-elements.js | 72 ++++++++++++++++++--------- www/common/translations/messages.json | 8 ++- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index df8836788..706940e90 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1023,6 +1023,7 @@ define([ return div; }; + /// Share Modal Creation UIElements.createShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1031,40 +1032,42 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } + function createAccessRights(group_name) { + var rights = [ + h('label', Messages.share_linkAccess), + h('br'), + UI.createRadio(group_name, 'cp-share-editable-false', + Messages.share_linkView, true, { mark: {tabindex:1} }), + UI.createRadio(group_name, 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + UI.createRadio(group_name, 'cp-share-editable-true', + Messages.share_linkEdit, false, { mark: {tabindex:1} }), + + h('br'), + ]; + return rights; + }; + // Share link tab - var hasFriends = Object.keys(config.friends || {}).length !== 0; - var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; - var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; var content = []; var sfContent = [ h('label', Messages.sharedFolders_share), h('br'), ]; - var shareContent = [ - h('label', Messages.share_linkAccess), - h('br'), - UI.createRadio('cp-share-editable', 'cp-share-editable-true', - Messages.share_linkEdit, true, { mark: {tabindex:1} }), - UI.createRadio('cp-share-editable', 'cp-share-editable-false', - Messages.share_linkView, false, { mark: {tabindex:1} }), - h('br'), - ]; + var linkAccessRights = createAccessRights('link-rights'); var padContent = [ - h('label', Messages.share_linkOptions), - h('br'), UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), - UI.createCheckbox('cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }), h('br'), ]; if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content, shareContent); + Array.prototype.push.apply(content, linkAccessRights); if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); - var mainShareColumn = h('div.cp-share-column.contains-nav', content); - var link = h('div.cp-share-modal' + friendsUIClass); + // XXX remove LESS code for cp-share-columns if not using anymore + //var mainShareColumn = h('div.cp-share-column.contains-nav', content); + var link = h('div.cp-share-modal', content); var saveValue = function () { var edit = Util.isChecked($(link).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); @@ -1075,7 +1078,7 @@ define([ present: present }); }; - onFriendShare.reg(saveValue); + var getLinkValue = function (initValue) { var val = initValue || {}; var edit = val.edit !== undefined ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true')); @@ -1118,9 +1121,8 @@ define([ } var $link = $(link); - $(mainShareColumn).append(UI.dialog.getButtons(shareButtons, config.onClose)).appendTo($link); - $(friendsList).appendTo($link); - + $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); + if (!hashes.editHash) { $(link).find('#cp-share-editable-false').attr('checked', true); $(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); @@ -1139,6 +1141,26 @@ define([ onClose: config.onClose, }); + // Share with contacts tab + + var hasFriends = Object.keys(config.friends || {}).length !== 0; + var onFriendShare = Util.mkEvent(); + var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; + // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; + + onFriendShare.reg(saveValue); + + contactsAccessRights = createAccessRights('contact-rights'); + var contacts = h('.cp-share-modal', contactsAccessRights); + var $contacts = $(contacts); + + $(friendsList).appendTo($contacts); + + var frameContacts = UI.dialog.customModal(contacts, { + buttons: linkButtons, + onClose: config.onClose, + }); + // Embed tab var getEmbedValue = function () { var hash = hashes.viewHash || hashes.editHash; @@ -1148,7 +1170,6 @@ define([ return ''; }; var embed = h('div.cp-share-modal', [ - h('h3', Messages.viewEmbedTitle), h('p', Messages.viewEmbedTag), h('br'), UI.dialog.selectable(getEmbedValue()) @@ -1177,6 +1198,9 @@ define([ var tabs = [{ title: Messages.share_linkCategory, content: frameLink + }, { + title: "Contacts", + content: frameContacts }, { title: Messages.share_embedCategory, content: frameEmbed diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 769f5a52d..0718f666a 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -173,7 +173,6 @@ "viewOpenTitle": "Open this pad in read-only mode in a new tab", "fileShare": "Copy link", "getEmbedCode": "Get embed code", - "viewEmbedTitle": "Embed the pad in an external page", "viewEmbedTag": "To embed this pad, include this iframe in your page wherever you want. You can style it using CSS or HTML attributes.", "fileEmbedTitle": "Embed the file in an external page", "fileEmbedScript": "To embed this file, include this script once in your page to load the Media Tag:", @@ -980,13 +979,12 @@ "properties_passwordWarning": "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.
Press OK to reload and update your access rights.", "properties_passwordSuccess": "The password was successfully changed.
Press OK to reload and update your access rights.", "properties_changePasswordButton": "Submit", - "share_linkCategory": "Share link", + "share_linkCategory": "Link", "share_linkAccess": "Access rights", "share_linkEdit": "Edit", "share_linkView": "View", - "share_linkOptions": "Link options", - "share_linkEmbed": "Embed mode (toolbar and userlist hidden)", - "share_linkPresent": "Present mode (editable sections hidden)", + "share_linkEmbed": "Embed mode (hide toolbar and user list)", + "share_linkPresent": "Present (hide editable sections)", "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", "share_embedCategory": "Embed", From 4f145aed004f33b8a85f367c6dc46efe4aa4c3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 15:31:11 +0000 Subject: [PATCH 14/75] remove wide size for share modal --- www/share/inner.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/www/share/inner.js b/www/share/inner.js index dd6607a45..f8c7fa112 100644 --- a/www/share/inner.js +++ b/www/share/inner.js @@ -59,9 +59,7 @@ define([ } }); $('button.cancel').click(); // Close any existing alertify - UI.openCustomModal(UI.dialog.tabs(modal), { - wide: _wide - }); + UI.openCustomModal(UI.dialog.tabs(modal)); }; sframeChan.on('EV_SHARE_REFRESH', function (data) { createShareDialog(data); From 0044d622f134702307b29f6da0f7e95d8a819569 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 15:33:12 +0100 Subject: [PATCH 15/75] Fix missing title in notification history --- www/common/common-ui-elements.js | 1 + www/common/notifications.js | 3 ++- www/notifications/inner.js | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 126450f0f..80dcb0e63 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -4035,6 +4035,7 @@ define([ common.mailbox.sendTo("INVITE_TO_TEAM_ANSWER", { answer: yes, teamChannel: msg.content.team.channel, + teamName: teamName, user: { displayName: user.name, avatar: user.avatar, diff --git a/www/common/notifications.js b/www/common/notifications.js index ed44c2917..192d2b4c6 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -294,7 +294,8 @@ define([ // Display the notification var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; - var teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || ''); + var teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || '') || + Util.fixHTML(Util.find(msg, ['content', 'teamName'])); var key = 'team_' + (msg.content.answer ? 'accept' : 'decline') + 'Invitation'; content.getFormatText = function () { return Messages._getKey(key, [name, teamName]); diff --git a/www/notifications/inner.js b/www/notifications/inner.js index 6fc8bf1ca..2e89c5078 100644 --- a/www/notifications/inner.js +++ b/www/notifications/inner.js @@ -93,6 +93,10 @@ define([ return ud.content.hash === data.content.hash; }); notifsData.push(data); + if (data.content.msg.type === 'REQUEST_PAD_ACCESS') { return; } // FIXME find a way to display this notifications wihtout knowing the title + if (data.content.msg.type === 'INVITE_TO_TEAM_ANSWER') { console.log(data); } + if (data.content.msg.type === 'INVITE_TO_TEAM_ANSWER' + && !data.content.msg.content.teamName) { return; } // FIXME find a way to display this notifications wihtout knowing the team name var el = common.mailbox.createElement(data); var time = new Date(data.content.time); $(el).find(".cp-notification-content").append(h("span.notification-time", time.toLocaleString())); From aa743d5c909afd937e8543c6b9034172a10bb2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:24:29 +0000 Subject: [PATCH 16/75] use messages for contacts tab title --- www/common/common-ui-elements.js | 2 +- www/common/translations/messages.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 706940e90..5ee0d0d8d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1199,7 +1199,7 @@ define([ title: Messages.share_linkCategory, content: frameLink }, { - title: "Contacts", + title: Messages.share_contactCategory, content: frameContacts }, { title: Messages.share_embedCategory, diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 0718f666a..8de498439 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -987,6 +987,7 @@ "share_linkPresent": "Present (hide editable sections)", "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", + "share_contactCategory": "Contacts", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From db104d6610cd9e5c7b9d2b13ab3cfcd8aca015fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:28:05 +0000 Subject: [PATCH 17/75] align button array in Link tab --- www/common/common-ui-elements.js | 33 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5ee0d0d8d..43ffbbaf3 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1032,7 +1032,7 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - function createAccessRights(group_name) { + var createAccessRights = function (group_name) { var rights = [ h('label', Messages.share_linkAccess), h('br'), @@ -1049,7 +1049,6 @@ define([ }; // Share link tab - var content = []; var sfContent = [ h('label', Messages.sharedFolders_share), @@ -1090,12 +1089,15 @@ define([ var parsed = Hash.parsePadUrl(href); return origin + parsed.getUrl({embed: embed, present: present}); }; - var linkButtons = [{ + + var cancelButton = { className: 'cancel', name: Messages.cancel, onClick: function () {}, keys: [27] - }]; + }; + + var linkButtons = [cancelButton]; var shareButtons = [{ className: 'primary', name: Messages.share_linkCopy, @@ -1108,8 +1110,8 @@ define([ keys: [13] }]; if (!config.sharedFolder) { - shareButtons.push({ - className: 'primary', + shareButtons.unshift({ + className: 'secondary', // XXX style this diferently than cancel name: Messages.share_linkOpen, onClick: function () { saveValue(); @@ -1121,7 +1123,6 @@ define([ } var $link = $(link); - $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); if (!hashes.editHash) { $(link).find('#cp-share-editable-false').attr('checked', true); @@ -1136,6 +1137,12 @@ define([ $(link).find('#cp-share-link-preview').val(getLinkValue()); }); + // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); + shareButtons.forEach(function(button){ + linkButtons.push(button); + }); + console.log(linkButtons); + var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, onClose: config.onClose, @@ -1156,8 +1163,10 @@ define([ $(friendsList).appendTo($contacts); + var contactButtons = [cancelButton] + var frameContacts = UI.dialog.customModal(contacts, { - buttons: linkButtons, + buttons: contactButtons, onClose: config.onClose, }); @@ -1174,12 +1183,8 @@ define([ h('br'), UI.dialog.selectable(getEmbedValue()) ]); - var embedButtons = [{ - className: 'cancel', - name: Messages.cancel, - onClick: function () {}, - keys: [27] - }, { + var embedButtons = [ + cancelButton, { className: 'primary', name: Messages.share_linkCopy, onClick: function () { From 718fdb556befb99f00363556b5735b7c0d3c30ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Tue, 19 Nov 2019 16:48:37 +0000 Subject: [PATCH 18/75] show message in Contacts tab if user has no contacts --- www/common/common-ui-elements.js | 4 ++-- www/common/translations/messages.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 43ffbbaf3..056e81808 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1152,12 +1152,12 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : undefined; + var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : h('p', Messages.share_noContacts); // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; onFriendShare.reg(saveValue); - contactsAccessRights = createAccessRights('contact-rights'); + var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; var contacts = h('.cp-share-modal', contactsAccessRights); var $contacts = $(contacts); diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 8de498439..032a2d87c 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -988,6 +988,7 @@ "share_linkOpen": "Open in new tab", "share_linkCopy": "Copy to clipboard", "share_contactCategory": "Contacts", + "share_noContacts": "You have no friends, learn how to get some. // XXX", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From 1e2b2a27cfc4118b55a7d85c5a6c1da188ee7fcd Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 19 Nov 2019 17:55:33 +0100 Subject: [PATCH 19/75] Fix synchronous nthen callback --- www/common/outer/sharedfolder.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index b6b961428..28780065a 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -21,7 +21,8 @@ define([ // No version: visible edit // Version 2: encrypted edit links - SF.checkMigration = function (secondaryKey, proxy, uo, cb) { + SF.checkMigration = function (secondaryKey, proxy, uo, _cb) { + var cb = Util.once(Util.mkAsync(_cb)); var drive = proxy.drive || proxy; // View access: can't migrate if (!secondaryKey) { return void cb(); } From 33b16ffcdf7d49907f49c875ee7595bf373e6d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 09:47:57 +0000 Subject: [PATCH 20/75] address notes --- www/common/common-ui-elements.js | 47 ++++++++++++++++---------------- www/common/drive-ui.js | 4 +-- www/common/toolbar3.js | 2 +- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 056e81808..fdadce5de 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -877,7 +877,7 @@ define([ return friends[c].curvePublic.slice(0,8); }); - var div = h('div.cp-share-column.contains-nav'); + var div = h('div.contains-nav'); var $div = $(div); // Replace "copy link" by "share with friends" if at least one friend is selected // Also create the "share with friends" button if it doesn't exist @@ -1067,6 +1067,7 @@ define([ // XXX remove LESS code for cp-share-columns if not using anymore //var mainShareColumn = h('div.cp-share-column.contains-nav', content); var link = h('div.cp-share-modal', content); + var saveValue = function () { var edit = Util.isChecked($(link).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); @@ -1090,27 +1091,17 @@ define([ return origin + parsed.getUrl({embed: embed, present: present}); }; - var cancelButton = { - className: 'cancel', + var makeCancelButton = function() { + return {className: 'cancel', name: Messages.cancel, onClick: function () {}, - keys: [27] + keys: [27]}; }; - var linkButtons = [cancelButton]; - var shareButtons = [{ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - saveValue(); - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13] - }]; + var linkButtons = [makeCancelButton()]; + if (!config.sharedFolder) { - shareButtons.unshift({ + linkButtons.push({ className: 'secondary', // XXX style this diferently than cancel name: Messages.share_linkOpen, onClick: function () { @@ -1120,7 +1111,19 @@ define([ }, keys: [[13, 'ctrl']] }); - } + }; + + linkButtons.push({ + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13]} + ); var $link = $(link); @@ -1138,10 +1141,6 @@ define([ }); // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); - shareButtons.forEach(function(button){ - linkButtons.push(button); - }); - console.log(linkButtons); var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, @@ -1163,7 +1162,7 @@ define([ $(friendsList).appendTo($contacts); - var contactButtons = [cancelButton] + var contactButtons = [makeCancelButton()] var frameContacts = UI.dialog.customModal(contacts, { buttons: contactButtons, @@ -1184,7 +1183,7 @@ define([ UI.dialog.selectable(getEmbedValue()) ]); var embedButtons = [ - cancelButton, { + makeCancelButton(), { className: 'primary', name: Messages.share_linkCopy, onClick: function () { diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index b0add7044..ebfe5f106 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4120,9 +4120,7 @@ define([ modal = padType === 'file' ? UIElements.createFileShareModal(padData) : UIElements.createShareModal(padData); modal = UI.dialog.tabs(modal); - UI.openCustomModal(modal, { - wide: _wide - }); + UI.openCustomModal(modal); } } else if ($this.hasClass('cp-app-drive-context-savelocal')) { diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 7dcfafda2..7ec2f54c0 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -533,7 +533,7 @@ MessengerUI, Messages) { Common.getSframeChannel().event('EV_SHARE_OPEN', { hidden: true }); - $shareBlock.ready(function () { + $shareBlock.ready(function () { // XXX put .click back when done var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From 96f82c8e7cfd5d38fbf8c917fd6c8ff9f2136f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 11:01:19 +0000 Subject: [PATCH 21/75] fix modal buttons and functions --- www/common/common-ui-elements.js | 110 +++++++++++++++---------------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index fdadce5de..40bb1d4c3 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1032,21 +1032,18 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - var createAccessRights = function (group_name) { - var rights = [ - h('label', Messages.share_linkAccess), - h('br'), - UI.createRadio(group_name, 'cp-share-editable-false', - Messages.share_linkView, true, { mark: {tabindex:1} }), - UI.createRadio(group_name, 'cp-share-present', - Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad - UI.createRadio(group_name, 'cp-share-editable-true', - Messages.share_linkEdit, false, { mark: {tabindex:1} }), - - h('br'), - ]; - return rights; - }; + var rights = h('div', [ + h('label', Messages.share_linkAccess), + h('br'), + UI.createRadio('accessRights', 'cp-share-editable-false', + Messages.share_linkView, true, { mark: {tabindex:1} }), + UI.createRadio('accessRights', 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + UI.createRadio('accessRights', 'cp-share-editable-true', + Messages.share_linkEdit, false, { mark: {tabindex:1} }), + + h('br'), + ]); // Share link tab var content = []; @@ -1054,13 +1051,13 @@ define([ h('label', Messages.sharedFolders_share), h('br'), ]; - var linkAccessRights = createAccessRights('link-rights'); + var padContent = [ UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), h('br'), ]; if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content, linkAccessRights); + Array.prototype.push.apply(content); if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); @@ -1069,9 +1066,9 @@ define([ var link = h('div.cp-share-modal', content); var saveValue = function () { - var edit = Util.isChecked($(link).find('#cp-share-editable-true')); + var edit = Util.isChecked($(rights).find('#cp-share-editable-true')); var embed = Util.isChecked($(link).find('#cp-share-embed')); - var present = Util.isChecked($(link).find('#cp-share-present')); + var present = Util.isChecked($(rights).find('#cp-share-present')); common.setAttribute(['general', 'share'], { edit: edit, embed: embed, @@ -1081,10 +1078,9 @@ define([ var getLinkValue = function (initValue) { var val = initValue || {}; - var edit = val.edit !== undefined ? val.edit : Util.isChecked($(link).find('#cp-share-editable-true')); + var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true')); var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed')); - var present = val.present !== undefined ? val.present : Util.isChecked($(link).find('#cp-share-present')); - + var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present')); var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash; var href = origin + pathname + '#' + hash; var parsed = Hash.parsePadUrl(href); @@ -1098,41 +1094,40 @@ define([ keys: [27]}; }; - var linkButtons = [makeCancelButton()]; - - if (!config.sharedFolder) { - linkButtons.push({ - className: 'secondary', // XXX style this diferently than cancel - name: Messages.share_linkOpen, - onClick: function () { - saveValue(); - var v = getLinkValue(); - window.open(v); - }, - keys: [[13, 'ctrl']] - }); - }; + var linkButtons = [ + makeCancelButton(), + !config.sharedFolder && { + className: 'secondary', // XXX style this diferently than cancel + name: Messages.share_linkOpen, + onClick: function () { + saveValue(); + var v = getLinkValue(); + window.open(v); + }, + keys: [[13, 'ctrl']] + }, + { + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13] + } + ]; - linkButtons.push({ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - saveValue(); - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13]} - ); - var $link = $(link); - + // disable edit share options if you don't have edit rights if (!hashes.editHash) { - $(link).find('#cp-share-editable-false').attr('checked', true); - $(link).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-false').attr('checked', true); + $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); } else if (!hashes.viewHash) { - $(link).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); - $(link).find('#cp-share-editable-true').attr('checked', true); + $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-true').attr('checked', true); } $(link).find('#cp-share-link-preview').val(getLinkValue()); @@ -1156,8 +1151,9 @@ define([ onFriendShare.reg(saveValue); - var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; - var contacts = h('.cp-share-modal', contactsAccessRights); + // XXX Don't display access rights if no contacts + /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; + var contacts = h('div.cp-share-modal'); var $contacts = $(contacts); $(friendsList).appendTo($contacts); @@ -1187,7 +1183,9 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - var v = getEmbedValue(); + var v = getLinkValue({ + embed: true + }); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, From ae6f5074a7bd6fa64433cf38fd49d63879a31c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 11:27:47 +0000 Subject: [PATCH 22/75] align button to share with contacts split the output of createShareWithFriends in content and button --- www/common/common-ui-elements.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 40bb1d4c3..5767ad35e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -932,7 +932,7 @@ define([ }, refreshButtons); $div.append(teamsList.div); - var shareButtons = [{ + var shareButton = { className: 'primary cp-share-with-friends', name: Messages.share_withFriends, onClick: function () { @@ -992,7 +992,7 @@ define([ } }, keys: [13] - }]; + }; common.getAttribute(['general', 'share-friends'], function (err, val) { order = val || []; @@ -1017,10 +1017,12 @@ define([ // Display them $(friendDiv).find('.cp-usergrid-grid').detach(); $(friendDiv).append(h('div.cp-usergrid-grid', others)); - $div.append(UI.dialog.getButtons(shareButtons, config.onClose)); refreshButtons(); }); - return div; + return { + content: div, + button: shareButton + }; }; /// Share Modal Creation @@ -1146,11 +1148,16 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsList = hasFriends ? createShareWithFriends(config, onFriendShare) : h('p', Messages.share_noContacts); - // var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; + var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { + content: h('p', Messages.share_noContacts) + }; + var friendsList = friendsObject.content; + onFriendShare.reg(saveValue); + + // XXX Don't display access rights if no contacts /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; var contacts = h('div.cp-share-modal'); @@ -1158,7 +1165,8 @@ define([ $(friendsList).appendTo($contacts); - var contactButtons = [makeCancelButton()] + var contactButtons = [makeCancelButton(), + friendsObject.button]; var frameContacts = UI.dialog.customModal(contacts, { buttons: contactButtons, @@ -1240,6 +1248,7 @@ define([ }); return tabs; }; + UIElements.createFileShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1338,6 +1347,7 @@ define([ return tabs; }; + UIElements.createInviteTeamModal = function (config) { var common = config.common; var hasFriends = Object.keys(config.friends || {}).length !== 0; From 598ce5a32918d88e98ca7a7a8bc618a3b6d51daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 13:11:38 +0000 Subject: [PATCH 23/75] create share modal in common-ui --- www/common/common-ui-elements.js | 4 +++- www/common/drive-ui.js | 8 +------- www/share/inner.js | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5767ad35e..9296bb747 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1222,6 +1222,8 @@ define([ pathname: pathname }); } + + var modal = UI.dialog.tabs(tabs); common.getAttribute(['general', 'share'], function (err, val) { val = val || {}; if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { @@ -1246,7 +1248,7 @@ define([ hashes = _hashes; $(link).find('#cp-share-link-preview').val(getLinkValue()); }); - return tabs; + return modal; }; UIElements.createFileShareModal = function (config) { diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index ebfe5f106..6b764e7a5 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2560,7 +2560,6 @@ define([ if (!parsed.hash && !roParsed.hash) { return void console.error("Invalid href: "+(data.href || data.roHref)); } var friends = common.getFriends(); var teams = common.getMetadataMgr().getPrivateData().teams; - var _wide = Object.keys(friends).length || Object.keys(teams).length; var ro = folders[id] && folders[id].version >= 2; var modal = UIElements.createShareModal({ teamId: APP.team, @@ -2580,11 +2579,8 @@ define([ // can't share the read-only URL and we don't have access to the edit one. // We should hide the share button. if (!modal) { return; } - modal = UI.dialog.tabs(modal); $shareBlock.click(function () { - UI.openCustomModal(modal, { - wide: _wide - }); + UI.openCustomModal(modal); }); $container.append($shareBlock); }; @@ -4054,7 +4050,6 @@ define([ var parsed, modal; var friends = common.getFriends(); var teams = common.getMetadataMgr().getPrivateData().teams; - var _wide = Object.keys(friends).length || Object.keys(teams).length; if (manager.isFolder(el) && !manager.isSharedFolder(el)) { // Folder // if folder is inside SF @@ -4119,7 +4114,6 @@ define([ }; modal = padType === 'file' ? UIElements.createFileShareModal(padData) : UIElements.createShareModal(padData); - modal = UI.dialog.tabs(modal); UI.openCustomModal(modal); } } diff --git a/www/share/inner.js b/www/share/inner.js index f8c7fa112..d5e7428c8 100644 --- a/www/share/inner.js +++ b/www/share/inner.js @@ -59,7 +59,7 @@ define([ } }); $('button.cancel').click(); // Close any existing alertify - UI.openCustomModal(UI.dialog.tabs(modal)); + UI.openCustomModal(modal); }; sframeChan.on('EV_SHARE_REFRESH', function (data) { createShareDialog(data); From b8753f1fd7226c9ea3623421ceef23e5a2db2dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 13:14:25 +0000 Subject: [PATCH 24/75] clean up share modal - share access rights buttons between all tabs - handle present mode when available - general clean up of code to be more readable --- www/common/common-ui-elements.js | 135 +++++++++++++------------- www/common/translations/messages.json | 2 +- 2 files changed, 68 insertions(+), 69 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 9296bb747..b501f5cd4 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1034,46 +1034,28 @@ define([ if (!hashes || (!hashes.editHash && !hashes.viewHash)) { return; } - var rights = h('div', [ + var parsed = Hash.parsePadUrl(pathname); + var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; + + var rights = h('div.msg', [ h('label', Messages.share_linkAccess), h('br'), UI.createRadio('accessRights', 'cp-share-editable-false', Messages.share_linkView, true, { mark: {tabindex:1} }), - UI.createRadio('accessRights', 'cp-share-present', - Messages.share_linkPresent, false, { mark: {tabindex:1} }), // XXX only show this if code or slide pad + canPresent ? UI.createRadio('accessRights', 'cp-share-present', + Messages.share_linkPresent, false, { mark: {tabindex:1} }) : undefined, UI.createRadio('accessRights', 'cp-share-editable-true', Messages.share_linkEdit, false, { mark: {tabindex:1} }), h('br'), ]); - // Share link tab - var content = []; - var sfContent = [ - h('label', Messages.sharedFolders_share), - h('br'), - ]; - - var padContent = [ - UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), - h('br'), - ]; - if (config.sharedFolder) { Array.prototype.push.apply(content, sfContent); } - Array.prototype.push.apply(content); - if (!config.sharedFolder) { Array.prototype.push.apply(content, padContent); } - content.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); - - // XXX remove LESS code for cp-share-columns if not using anymore - //var mainShareColumn = h('div.cp-share-column.contains-nav', content); - var link = h('div.cp-share-modal', content); var saveValue = function () { var edit = Util.isChecked($(rights).find('#cp-share-editable-true')); - var embed = Util.isChecked($(link).find('#cp-share-embed')); var present = Util.isChecked($(rights).find('#cp-share-present')); common.setAttribute(['general', 'share'], { edit: edit, - embed: embed, present: present }); }; @@ -1081,7 +1063,7 @@ define([ var getLinkValue = function (initValue) { var val = initValue || {}; var edit = val.edit !== undefined ? val.edit : Util.isChecked($(rights).find('#cp-share-editable-true')); - var embed = val.embed !== undefined ? val.embed : Util.isChecked($(link).find('#cp-share-embed')); + var embed = val.embed; var present = val.present !== undefined ? val.present : Util.isChecked($(rights).find('#cp-share-present')); var hash = (!hashes.viewHash || (edit && hashes.editHash)) ? hashes.editHash : hashes.viewHash; var href = origin + pathname + '#' + hash; @@ -1096,6 +1078,18 @@ define([ keys: [27]}; }; + // Share link tab + var linkContent = config.sharedFolder ? [ + h('label', Messages.sharedFolders_share), + h('br'), + ] : [ + UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }), + h('br'), + ]; + linkContent.push(UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })); + + var link = h('div.cp-share-modal', linkContent); + var linkButtons = [ makeCancelButton(), !config.sharedFolder && { @@ -1103,7 +1097,9 @@ define([ name: Messages.share_linkOpen, onClick: function () { saveValue(); - var v = getLinkValue(); + var v = getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + }); window.open(v); }, keys: [[13, 'ctrl']] @@ -1113,7 +1109,9 @@ define([ name: Messages.share_linkCopy, onClick: function () { saveValue(); - var v = getLinkValue(); + var v = getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + }); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, @@ -1121,23 +1119,14 @@ define([ } ]; - - // disable edit share options if you don't have edit rights - if (!hashes.editHash) { - $(rights).find('#cp-share-editable-false').attr('checked', true); - $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); - } else if (!hashes.viewHash) { - $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); - $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); - $(rights).find('#cp-share-editable-true').attr('checked', true); - } - + // update values for link preview when radio btns change $(link).find('#cp-share-link-preview').val(getLinkValue()); - $(link).find('input[type="radio"], input[type="checkbox"]').on('change', function () { + $(rights).find('input[type="radio"]').on('change', function () { + $(link).find('#cp-share-link-preview').val(getLinkValue()); + }); + $(link).find('input[type="checkbox"]').on('change', function () { $(link).find('#cp-share-link-preview').val(getLinkValue()); }); - - // $link.append(UI.dialog.getButtons(shareButtons, config.onClose)); var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, @@ -1149,39 +1138,34 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { - content: h('p', Messages.share_noContacts) + content: h('p', Messages.share_noContacts), + button: {} }; var friendsList = friendsObject.content; - onFriendShare.reg(saveValue); - - // XXX Don't display access rights if no contacts /// var contactsAccessRights = hasFriends ? createAccessRights('contact-rights') : ''; - var contacts = h('div.cp-share-modal'); - var $contacts = $(contacts); - - $(friendsList).appendTo($contacts); + var contactsContent = h('div.cp-share-modal'); + $(contactsContent).append(friendsList); var contactButtons = [makeCancelButton(), friendsObject.button]; - var frameContacts = UI.dialog.customModal(contacts, { + var frameContacts = UI.dialog.customModal(contactsContent, { buttons: contactButtons, onClose: config.onClose, }); // Embed tab var getEmbedValue = function () { - var hash = hashes.viewHash || hashes.editHash; - var href = origin + pathname + '#' + hash; - var parsed = Hash.parsePadUrl(href); - var url = origin + parsed.getUrl({embed: true, present: true}); + var url = getLinkValue({ + embed: true + }); return ''; }; - var embed = h('div.cp-share-modal', [ + var embedContent = h('div.cp-share-modal', [ h('p', Messages.viewEmbedTag), h('br'), UI.dialog.selectable(getEmbedValue()) @@ -1191,15 +1175,13 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - var v = getLinkValue({ - embed: true - }); + var v = getEmbedValue(); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } }, keys: [13] }]; - var frameEmbed = UI.dialog.customModal(embed, { + var frameEmbed = UI.dialog.customModal(embedContent, { buttons: embedButtons, onClose: config.onClose, }); @@ -1224,19 +1206,36 @@ define([ } var modal = UI.dialog.tabs(tabs); + $(modal).find('.alertify-tabs-titles').after(rights); + + // XXX + // disable edit share options if you don't have edit rights + if (!hashes.editHash) { + $(rights).find('#cp-share-editable-false').attr('checked', true); + $(rights).find('#cp-share-editable-true').removeAttr('checked').attr('disabled', true); + } else if (!hashes.viewHash) { + $(rights).find('#cp-share-editable-false').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-present').removeAttr('checked').attr('disabled', true); + $(rights).find('#cp-share-editable-true').attr('checked', true); + } + common.getAttribute(['general', 'share'], function (err, val) { val = val || {}; - if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { - $(link).find('#cp-share-editable-false').prop('checked', true); - $(link).find('#cp-share-editable-true').prop('checked', false); + if (val.present && canPresent) { + $(rights).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-editable-true').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', true); + } else if ((val.edit === false && hashes.viewHash) || !hashes.editHash) { + $(rights).find('#cp-share-editable-false').prop('checked', true); + $(rights).find('#cp-share-editable-true').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', false); } else { - $(link).find('#cp-share-editable-true').prop('checked', true); - $(link).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-editable-true').prop('checked', true); + $(rights).find('#cp-share-editable-false').prop('checked', false); + $(rights).find('#cp-share-present').prop('checked', false); } - if (val.embed) { $(link).find('#cp-share-embed').prop('checked', true); } - if (val.present) { $(link).find('#cp-share-present').prop('checked', true); } - if (config.sharedFolder) { - delete val.embed; + delete val.embed; + if (!canPresent) { delete val.present; } $(link).find('#cp-share-link-preview').val(getLinkValue(val)); diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 032a2d87c..6751fa8c3 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1002,7 +1002,7 @@ "sharedFolders_create_name": "Folder name", "sharedFolders_create_owned": "Owned folder", "sharedFolders_create_password": "Folder password", - "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.", + "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. // XXX change/delete?", "convertFolderToSF_SFParent": "This folder cannot be converted to a shared folder in its current location. Move it outside of the containing shared folder to continue.", "convertFolderToSF_SFChildren": "This folder cannot be converted to a shared folder because it already contains shared folders. Move those Shared folders elsewhere to continue.", "convertFolderToSF_confirm": "This folder must be converted to a Shared folder for others to view it. Continue?", From 8d46bbf3b492b3a031f5a50bc6bfe7e2cf86db54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 15:39:33 +0000 Subject: [PATCH 25/75] update link preview in embed tab --- www/common/common-ui-elements.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index b501f5cd4..ab435d1e8 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1165,11 +1165,11 @@ define([ }); return ''; }; - var embedContent = h('div.cp-share-modal', [ + var embedContent = [ h('p', Messages.viewEmbedTag), h('br'), - UI.dialog.selectable(getEmbedValue()) - ]); + UI.dialog.selectable(getEmbedValue(), { id: 'cp-embed-link-preview', tabindex: 1 }) + ]; var embedButtons = [ makeCancelButton(), { className: 'primary', @@ -1181,7 +1181,16 @@ define([ }, keys: [13] }]; - var frameEmbed = UI.dialog.customModal(embedContent, { + + var embed = h('div.cp-share-modal', embedContent); + + // update values for link preview when radio btns change + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + $(rights).find('input[type="radio"]').on('change', function () { + $(embed).find('#cp-embed-link-preview').val(getEmbedValue()); + }); + + var frameEmbed = UI.dialog.customModal(embed, { buttons: embedButtons, onClose: config.onClose, }); From 13246d64cefd26e010c1d649f035d468c5aee4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 15:57:30 +0000 Subject: [PATCH 26/75] get link from ShareWithFriends --- www/common/common-ui-elements.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ab435d1e8..88beb0109 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -864,7 +864,7 @@ define([ }; - var createShareWithFriends = function (config, onShare) { + var createShareWithFriends = function (config, onShare, linkGetter) { var common = config.common; var sframeChan = common.getSframeChannel(); var title = config.title; @@ -936,7 +936,8 @@ define([ className: 'primary cp-share-with-friends', name: Messages.share_withFriends, onClick: function () { - var href = Hash.getRelativeHref($('#cp-share-link-preview').val()); + var href = Hash.getRelativeHref(linkGetter()); + console.log(href); var $friends = $div.find('.cp-usergrid-user.cp-selected'); $friends.each(function (i, el) { var curve = $(el).attr('data-curve'); @@ -1025,7 +1026,7 @@ define([ }; }; - /// Share Modal Creation + /// Share Modal Creation XXX remove this flag UIElements.createShareModal = function (config) { var origin = config.origin; var pathname = config.pathname; @@ -1137,7 +1138,7 @@ define([ var hasFriends = Object.keys(config.friends || {}).length !== 0; var onFriendShare = Util.mkEvent(); - var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare) : { + var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare, getLinkValue) : { content: h('p', Messages.share_noContacts), button: {} }; From 2b4c3e9e90783ced8a760c40e806eb64b15ca062 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 20 Nov 2019 17:15:38 +0100 Subject: [PATCH 27/75] Fix team quota --- www/common/outer/sharedfolder.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index 28780065a..907c49cd0 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -83,7 +83,7 @@ define([ }; SF.load = function (config, id, data, _cb) { - var cb = Util.once(_cb); + var cb = Util.once(Util.mkAsync(_cb)); var network = config.network; var store = config.store; var isNew = config.isNew; @@ -189,7 +189,7 @@ define([ return; } sf.teams.forEach(function (obj) { - var leave = function () { SF.leave(secret.channel, teamId); }; + var leave = function () { SF.leave(secret.channel, obj.store.id); }; /* var uo = obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey); // NOTE: Shared folder migration, disable for now @@ -301,6 +301,7 @@ define([ */ SF.loadSharedFolders = function (Store, network, store, userObject, waitFor) { var shared = Util.find(store.proxy, ['drive', UserObject.SHARED_FOLDERS]) || {}; + var w = waitFor(); nThen(function (waitFor) { Object.keys(shared).forEach(function (id) { var sf = shared[id]; @@ -311,7 +312,7 @@ define([ }, id, sf, waitFor()); }); }).nThen(function () { - setTimeout(waitFor()); + setTimeout(w); }); }; From 682b8e4361a8a16ce7ec8a499fdfa080938984a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 16:47:06 +0000 Subject: [PATCH 28/75] refactor file share modal --- www/common/common-ui-elements.js | 84 ++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 88beb0109..9c96d84e9 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1270,49 +1270,65 @@ define([ if (!hashes.fileHash) { throw new Error("You must provide a file hash"); } var url = origin + pathname + '#' + hashes.fileHash; - - // Share link tab - var hasFriends = Object.keys(config.friends || {}).length !== 0; - var friendsList = hasFriends ? createShareWithFriends(config) : undefined; - var friendsUIClass = hasFriends ? '.cp-share-columns' : ''; - var mainShareColumn = h('div.cp-share-column.contains-nav', [ - h('div.cp-share-column', [ - hasFriends ? h('p', Messages.share_description) : undefined, - UI.dialog.selectable('', { id: 'cp-share-link-preview' }), - ]), - ]); - var link = h('div.cp-share-modal' + friendsUIClass); var getLinkValue = function () { return url; }; - $(mainShareColumn).find('#cp-share-link-preview').val(getLinkValue()); - var linkButtons = [{ - className: 'cancel', + + var makeCancelButton = function() { + return {className: 'cancel', name: Messages.cancel, onClick: function () {}, - keys: [27] - }]; - var shareButtons = [{ - className: 'primary', - name: Messages.share_linkCopy, - onClick: function () { - var v = getLinkValue(); - var success = Clipboard.copy(v); - if (success) { UI.log(Messages.shareSuccess); } - }, - keys: [13] - }]; + keys: [27]}; + }; - var $link = $(link); - $(mainShareColumn).append(UI.dialog.getButtons(shareButtons, config.onClose)).appendTo($link); - $(friendsList).appendTo($link); + // Share link tab + var linkContent = [ + UI.dialog.selectable(getLinkValue(), { id: 'cp-share-link-preview', tabindex: 1 }) + ]; + + var link = h('div.cp-share-modal', linkContent); + + var linkButtons = [ + makeCancelButton(), + { + className: 'primary', + name: Messages.share_linkCopy, + onClick: function () { + saveValue(); + var v = getLinkValue(); + var success = Clipboard.copy(v); + if (success) { UI.log(Messages.shareSuccess); } + }, + keys: [13] + } + ]; var frameLink = UI.dialog.customModal(link, { buttons: linkButtons, onClose: config.onClose, }); + // share with contacts tab + var hasFriends = Object.keys(config.friends || {}).length !== 0; + + var friendsObject = hasFriends ? createShareWithFriends(config, null, getLinkValue) : { + content: h('p', Messages.share_noContacts), + button: {} + }; + var friendsList = friendsObject.content; + + var contactsContent = h('div.cp-share-modal'); + $(contactsContent).append(friendsList); + + var contactButtons = [makeCancelButton(), + friendsObject.button]; + + var frameContacts = UI.dialog.customModal(contactsContent, { + buttons: contactButtons, + onClose: config.onClose, + }); + + // Embed tab var embed = h('div.cp-share-modal', [ - h('h3', Messages.fileEmbedTitle), h('p', Messages.fileEmbedScript), h('br'), UI.dialog.selectable(common.getMediatagScript()), @@ -1344,6 +1360,9 @@ define([ var tabs = [{ title: Messages.share_linkCategory, content: frameLink + }, { + title: Messages.share_contactCategory, + content: frameContacts }, { title: Messages.share_embedCategory, content: frameEmbed @@ -1355,7 +1374,8 @@ define([ pathname: pathname }); } - return tabs; + var modal = UI.dialog.tabs(tabs); + return modal; }; From 339030a84ebbe28b85fe56c9c439f22e8d68237c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Wed, 20 Nov 2019 17:03:16 +0000 Subject: [PATCH 29/75] bug fixes --- www/common/common-ui-elements.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 9c96d84e9..3c2fa3785 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1123,10 +1123,14 @@ define([ // update values for link preview when radio btns change $(link).find('#cp-share-link-preview').val(getLinkValue()); $(rights).find('input[type="radio"]').on('change', function () { - $(link).find('#cp-share-link-preview').val(getLinkValue()); + $(link).find('#cp-share-link-preview').val(getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + })); }); $(link).find('input[type="checkbox"]').on('change', function () { - $(link).find('#cp-share-link-preview').val(getLinkValue()); + $(link).find('#cp-share-link-preview').val(getLinkValue({ + embed: Util.isChecked($(link).find('#cp-share-embed')) + })); }); var frameLink = UI.dialog.customModal(link, { @@ -1292,7 +1296,6 @@ define([ className: 'primary', name: Messages.share_linkCopy, onClick: function () { - saveValue(); var v = getLinkValue(); var success = Clipboard.copy(v); if (success) { UI.log(Messages.shareSuccess); } From dc6ca9098e22626e657fee970e7153d6643589eb Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 21 Nov 2019 11:24:51 +0100 Subject: [PATCH 30/75] Improve small screen detection in toolbar --- customize.dist/src/less2/include/toolbar.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index ff588ff77..0df5823a0 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -507,7 +507,8 @@ } } .cp-toolbar-top { - @media screen and (max-width: @browser_media-medium-screen) { + @media screen and (max-width: @browser_media-medium-screen), + screen and (max-height: 500px) { flex-wrap: wrap; height: @toolbar_line-height; .cp-pad-not-pinned { From d38f5a16c2c6a8f21f6913a609758b08f17d303b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 10:26:30 +0000 Subject: [PATCH 31/75] add optional icon to modal tabs --- www/common/common-interface.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 72851a8cc..6cb4f4554 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -191,6 +191,10 @@ define([ if (!tab.content || !tab.title) { return; } var content = h('div.alertify-tabs-content', tab.content); var title = h('span.alertify-tabs-title', tab.title); + if (tab.icon) { + var icon = h('i', {class: 'fa ' + tab.icon}); + $(title).prepend(' ').prepend(icon); + }; $(title).click(function () { titles.forEach(function (t) { $(t).removeClass('alertify-tabs-active'); }); contents.forEach(function (c) { $(c).removeClass('alertify-tabs-content-active'); }); From 8a11cf9b3857438fdc871b02bafdc25ff2239b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 12:29:23 +0000 Subject: [PATCH 32/75] style share modal --- .../src/less2/include/alertify.less | 24 ++++++++++++++----- .../src/less2/include/colortheme.less | 2 +- www/common/common-ui-elements.js | 12 ++++++---- www/common/translations/messages.json | 8 +++---- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 142cc2509..a98572939 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -17,13 +17,14 @@ @alertify-btn-fg: @alertify-fore; + @alertify-light-bg: fade(@alertify-fore, 25%); @alertify-bg: @colortheme_modal-dim; @alertify-fg: @alertify-fore; @alertify-input-bg: @colortheme_modal-input; @alertify-input-fg: @colortheme_modal-input-fg; - @alertify_padding-base: @variables_padding; + @alertify_padding-base: 8px; // XXX to align tab contents with buttons. could change @variables-padding: 12px @alertify_box-shadow: @variables_shadow; // Logs to show that something has happened @@ -158,33 +159,44 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; + &.access-rights{ + .radio-group{ + display: flex; + flex-direction: row; + .cp-radio{ + margin-right: 30px; + } + } + } } .alertify-tabs { max-height: 100%; display: flex; flex-flow: column; .alertify-tabs-titles { - height: 30px; + height: 40px; display: flex; border-bottom: 1px solid @alertify-fore; - margin-bottom: 20px; + margin-bottom: 10px; box-sizing: content-box; span { font-size: 20px; - height: 30px; - line-height: 30px; + height: 40px; + line-height: 40px; box-sizing: border-box; padding: 0 15px; border-left: 1px solid lighten(@alertify-base, 10%); border-right: 1px solid lighten(@alertify-base, 10%); cursor: pointer; + &:hover { + background-color: @alertify-light-bg; + } } span.alertify-tabs-active { background-color: @alertify-fore; border-left: 1px solid @alertify-fore; border-right: 1px solid @alertify-fore; color: @alertify-base; - font-weight: bold; cursor: default; } } diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index 44719c2d6..2e0c6371c 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -23,7 +23,7 @@ @colortheme_form-bg: @colortheme_logo-2; @colortheme_form-color: #ffffff; @colortheme_form-bg-alt: #ffffff; -@colortheme_form-color-alt: @colortheme_logo-1; +@colortheme_form-color-alt: @colortheme_logo-2; @colortheme_form-warning: #f49842; @colortheme_form-warning-hov: darken(@colortheme_form-warning, 5%); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 3c2fa3785..0931980c2 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -899,7 +899,7 @@ define([ delete friends[curve]; }); - var friendsList = UIElements.getUserGrid(Messages.share_linkFriends, { + var friendsList = UIElements.getUserGrid(null, { common: common, data: friends, noFilter: false @@ -1038,17 +1038,16 @@ define([ var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; - var rights = h('div.msg', [ + var rights = h('div.msg.access-rights', [ h('label', Messages.share_linkAccess), h('br'), + h('div.radio-group',[ UI.createRadio('accessRights', 'cp-share-editable-false', Messages.share_linkView, true, { mark: {tabindex:1} }), canPresent ? UI.createRadio('accessRights', 'cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }) : undefined, UI.createRadio('accessRights', 'cp-share-editable-true', - Messages.share_linkEdit, false, { mark: {tabindex:1} }), - - h('br'), + Messages.share_linkEdit, false, { mark: {tabindex:1} })]) ]); @@ -1203,12 +1202,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, + icon: "fa-link", content: frameLink }, { title: Messages.share_contactCategory, + icon: "fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, + icon: "fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 6751fa8c3..83a64842a 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -984,11 +984,11 @@ "share_linkEdit": "Edit", "share_linkView": "View", "share_linkEmbed": "Embed mode (hide toolbar and user list)", - "share_linkPresent": "Present (hide editable sections)", - "share_linkOpen": "Open in new tab", - "share_linkCopy": "Copy to clipboard", + "share_linkPresent": "Present", + "share_linkOpen": "Preview", + "share_linkCopy": "Copy", "share_contactCategory": "Contacts", - "share_noContacts": "You have no friends, learn how to get some. // XXX", + "share_noContacts": "You do not have any contacts yet. // XXX", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", "loading_pad_1": "Initializing pad", From fae0a930e3b3c12e2dcf1e157a4d518c7423cc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 13:03:40 +0000 Subject: [PATCH 33/75] tab icons correction --- www/common/common-interface.js | 2 +- www/common/common-ui-elements.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 6cb4f4554..5eff5edcf 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -192,7 +192,7 @@ define([ var content = h('div.alertify-tabs-content', tab.content); var title = h('span.alertify-tabs-title', tab.title); if (tab.icon) { - var icon = h('i', {class: 'fa ' + tab.icon}); + var icon = h('i', {class: tab.icon}); $(title).prepend(' ').prepend(icon); }; $(title).click(function () { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 0931980c2..2fe470d5e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1202,15 +1202,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, - icon: "fa-link", + icon: "fa fa-link", content: frameLink }, { title: Messages.share_contactCategory, - icon: "fa-address-book", + icon: "fa fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, - icon: "fa-code", + icon: "fa fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { From 9f3aa25fdd6d44430ba3d49201df35fe96052a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 13:50:46 +0000 Subject: [PATCH 34/75] move modal styles to new file --- customize.dist/src/less2/include/alertify.less | 9 --------- .../src/less2/include/framework.less | 2 ++ .../src/less2/include/modals-ui-elements.less | 18 ++++++++++++++++++ www/common/common-ui-elements.js | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 customize.dist/src/less2/include/modals-ui-elements.less diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index a98572939..e9cd38ca1 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -159,15 +159,6 @@ margin-bottom: @alertify_padding-base; margin: 0; overflow: auto; - &.access-rights{ - .radio-group{ - display: flex; - flex-direction: row; - .cp-radio{ - margin-right: 30px; - } - } - } } .alertify-tabs { max-height: 100%; diff --git a/customize.dist/src/less2/include/framework.less b/customize.dist/src/less2/include/framework.less index 685bfcaf5..57cd84b0b 100644 --- a/customize.dist/src/less2/include/framework.less +++ b/customize.dist/src/less2/include/framework.less @@ -15,6 +15,7 @@ @import (reference) "./messenger.less"; @import (reference) "./cursor.less"; @import (reference) "./usergrid.less"; +@import (reference) "./modals-ui-elements.less"; .framework_main(@bg-color, @warn-color, @color) { --LessLoader_require: LessLoader_currentFile(); @@ -32,6 +33,7 @@ @color: @color ); .alertify_main(); + .modals-ui-elements_main(); .corner_main(); .contextmenu_main(); .fileupload_main(); diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less new file mode 100644 index 000000000..f173ae8d5 --- /dev/null +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -0,0 +1,18 @@ +@import (reference) "./colortheme-all.less"; + +.modals-ui-elements_main() { + --LessLoader_require: LessLoader_currentFile(); +}; +& { + // Share modal + .cp-inline-radio-group{ + .radio-group{ + display: flex; + flex-direction: row; + .cp-radio{ + margin-right: 30px; + } + } + } + +} \ No newline at end of file diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 2fe470d5e..e9863d030 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1038,7 +1038,7 @@ define([ var parsed = Hash.parsePadUrl(pathname); var canPresent = ['code', 'slide'].indexOf(parsed.type) !== -1; - var rights = h('div.msg.access-rights', [ + var rights = h('div.msg.cp-inline-radio-group', [ h('label', Messages.share_linkAccess), h('br'), h('div.radio-group',[ From 2a23359d8fee02f9fa651c30f5851c7477d73025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 14:31:57 +0000 Subject: [PATCH 35/75] fix import of modals-ui-elements --- customize.dist/src/less2/include/framework.less | 1 + customize.dist/src/less2/include/modals-ui-elements.less | 4 ++-- www/share/app-share.less | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/framework.less b/customize.dist/src/less2/include/framework.less index 57cd84b0b..0eefababb 100644 --- a/customize.dist/src/less2/include/framework.less +++ b/customize.dist/src/less2/include/framework.less @@ -72,6 +72,7 @@ ); .fileupload_main(); .alertify_main(); + .modals-ui-elements_main(); .corner_main(); .contextmenu_main(); .tippy_main(); diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index f173ae8d5..a3cc41004 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -2,10 +2,10 @@ .modals-ui-elements_main() { --LessLoader_require: LessLoader_currentFile(); -}; +} & { // Share modal - .cp-inline-radio-group{ + .msg.cp-inline-radio-group{ .radio-group{ display: flex; flex-direction: row; diff --git a/www/share/app-share.less b/www/share/app-share.less index cab03b7ce..8efdd17f3 100644 --- a/www/share/app-share.less +++ b/www/share/app-share.less @@ -4,10 +4,12 @@ @import (reference) '../../customize/src/less2/include/checkmark.less'; @import (reference) '../../customize/src/less2/include/password-input.less'; @import (reference) '../../customize/src/less2/include/usergrid.less'; +@import (reference) '../../customize/src/less2/include/modals-ui-elements.less'; &.cp-app-share { .tippy_main(); .alertify_main(); + .modals-ui-elements_main(); .checkmark_main(20px); .password_main(); .modal_main(); From cc5d6260dcbce8a2c703b5b0069710748aad7609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:09:38 +0000 Subject: [PATCH 36/75] re-align buttons and modal content --- .../src/less2/include/alertify.less | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index e9cd38ca1..91e75fe17 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -24,7 +24,7 @@ @alertify-input-bg: @colortheme_modal-input; @alertify-input-fg: @colortheme_modal-input-fg; - @alertify_padding-base: 8px; // XXX to align tab contents with buttons. could change @variables-padding: 12px + @alertify_padding-base: @variables_padding; // XXX to align tab contents with buttons. could change @variables-padding: 12px @alertify_box-shadow: @variables_shadow; // Logs to show that something has happened @@ -219,10 +219,9 @@ color: darken(@alertify-input-fg, 15%); } input:not(.form-control), textarea { - background-color: @alertify-input-bg; - color: @alertify-input-fg; - border: 0px; - + background-color: @alertify-input-fg; + color: @alertify-input-bg; + border: 1px solid @alertify-input-bg; margin-bottom: 15px; width: 100%; font-size: 100%; @@ -242,6 +241,7 @@ } } + input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; @@ -264,7 +264,7 @@ display: inline-block; align-items: center; padding: 0 6px; - margin: 6px 8px; + //margin: 6px 8px; line-height: 36px; min-height: 36px; white-space: nowrap; @@ -340,12 +340,15 @@ } } - button.btn { - margin: 6px 4px; - } - nav { + padding: @alertify_padding-base; text-align: right; + button{ + margin:0px; + &:not(:last-child) { + margin-right: @alertify_padding-base; + } + } } } } From 6a663c5d353933636ba29cb899b2a75fb01f02c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:16:25 +0000 Subject: [PATCH 37/75] re-re-align buttons --- customize.dist/src/less2/include/alertify.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 91e75fe17..e4e1d24d6 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -264,7 +264,7 @@ display: inline-block; align-items: center; padding: 0 6px; - //margin: 6px 8px; + margin: 6px 8px; line-height: 36px; min-height: 36px; white-space: nowrap; @@ -344,9 +344,9 @@ padding: @alertify_padding-base; text-align: right; button{ - margin:0px; + margin:0px !important; // XXX was not overriding the button margin &:not(:last-child) { - margin-right: @alertify_padding-base; + margin-right: @alertify_padding-base !important; } } } From 8cfc108276b7ffca86d3f1b2ec71523b795b33d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:33:15 +0000 Subject: [PATCH 38/75] text input styling differentiate between input and readonly --- customize.dist/src/less2/include/alertify.less | 11 ++++++++--- customize.dist/src/less2/include/usergrid.less | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index e4e1d24d6..a2418f05a 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -209,14 +209,14 @@ } ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; opacity: 1; /* Firefox */ } :-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; } ::-ms-input-placeholder { /* Microsoft Edge */ - color: darken(@alertify-input-fg, 15%); + color: @cryptpad_color_grey; } input:not(.form-control), textarea { background-color: @alertify-input-fg; @@ -226,6 +226,11 @@ width: 100%; font-size: 100%; padding: @alertify_padding-base; + &[readonly="readonly"]{ + background-color: @alertify-light-bg; + color: @cryptpad_text_col; + border-color: @alertify-input-fg; + } } span.cp-password-container { diff --git a/customize.dist/src/less2/include/usergrid.less b/customize.dist/src/less2/include/usergrid.less index a2d2c8fc5..38202de86 100644 --- a/customize.dist/src/less2/include/usergrid.less +++ b/customize.dist/src/less2/include/usergrid.less @@ -24,7 +24,7 @@ min-width: 0; margin-bottom: 0 !important; &::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: @colortheme_alertify-primary-text; + color: @cryptpad_color_grey; opacity: 1; /* Firefox */ } } From c4f84b9ee962b7166a0a001671cd2dba5f36094c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 15:39:23 +0000 Subject: [PATCH 39/75] add icons to filesharemodal tabs --- www/common/common-ui-elements.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index e9863d030..1512cb761 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1364,12 +1364,15 @@ define([ // Create modal var tabs = [{ title: Messages.share_linkCategory, + icon: "fa fa-link", content: frameLink }, { title: Messages.share_contactCategory, + icon: "fa fa-address-book", content: frameContacts }, { title: Messages.share_embedCategory, + icon: "fa fa-code", content: frameEmbed }]; if (typeof(AppConfig.customizeShareOptions) === 'function') { From 730c4e02cf47313be12e07d206d38236f61d858f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 16:37:06 +0000 Subject: [PATCH 40/75] re-enable click to open share modal --- www/common/toolbar3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 7ec2f54c0..b6cb3c125 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -533,7 +533,7 @@ MessengerUI, Messages) { Common.getSframeChannel().event('EV_SHARE_OPEN', { hidden: true }); - $shareBlock.ready(function () { // XXX put .click back when done + $shareBlock.click(function () { var title = (config.title && config.title.getTitle && config.title.getTitle()) || (config.title && config.title.defaultName) || ""; From dfcf6d71557f63e8830bc30aa2b495798dfacf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 21 Nov 2019 17:07:38 +0000 Subject: [PATCH 41/75] remove text fields in properties modal --- .../src/less2/include/modals-ui-elements.less | 9 ++++++ www/common/common-ui-elements.js | 28 ++++--------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index a3cc41004..86074f4ad 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -15,4 +15,13 @@ } } + // Properties modal + .cp-app-prop{ + margin-bottom: 10px; + } + + .cp-app-prop-content{ + color: @cryptpad_text_col; + } + } \ No newline at end of file diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 1512cb761..089e10880 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -684,26 +684,15 @@ define([ } if (data.tags && Array.isArray(data.tags)) { - $('