From 9e1f49c1779d1e66b3a9c09a6e54fd0acd42a827 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 15 Jan 2020 15:33:52 +0100 Subject: [PATCH 1/6] Enable spreadsheets for anonymous users --- www/common/application_config_internal.js | 2 +- www/common/onlyoffice/inner.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index d4c1954e4..900a9ec28 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -20,7 +20,7 @@ define(function() { * users and these users will be redirected to the login page if they still try to access * the app */ - config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'sheet', 'notifications']; + config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications']; /* CryptPad is available is multiple languages, but only English and French are maintained * by the developers. The other languages may be outdated, and any missing string for a langauge diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index a40ccccae..c22ca019c 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -584,7 +584,9 @@ define([ ooChannel.cpIndex++; ooChannel.lastHash = hash; // Check if a checkpoint is needed - if (ooChannel.cpIndex % CHECKPOINT_INTERVAL === 0) { + var lastCp = getLastCp(); + if (common.isLoggedIn() && (ooChannel.cpIndex % CHECKPOINT_INTERVAL === 0 || + (ooChannel.cpIndex - lastCp.index) > CHECKPOINT_INTERVAL)) { makeCheckpoint(); } // Remove my lock @@ -662,7 +664,7 @@ define([ var startOO = function (blob, file) { if (APP.ooconfig) { return void console.error('already started'); } var url = URL.createObjectURL(blob); - var lock = readOnly || !common.isLoggedIn(); + var lock = readOnly;// || !common.isLoggedIn(); // Config APP.ooconfig = { From b80d3cf24f232f33e448e849df9daa444b07f832 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 16 Jan 2020 14:52:04 +0100 Subject: [PATCH 2/6] Ability to provide a dropdown container to a text input. Applied to framework export. --- .../src/less2/include/alertify.less | 3 ++ customize.dist/src/less2/include/buttons.less | 17 ++++++++++ .../src/less2/include/dropdown.less | 3 +- www/common/common-interface.js | 15 +++++++- www/common/common-ui-elements.js | 11 ++++-- www/common/sframe-app-framework.js | 34 ++++++++++++++++++- 6 files changed, 76 insertions(+), 7 deletions(-) diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index a2b787e1c..83c9068eb 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -168,6 +168,9 @@ margin-bottom: 0; } } + .cp-alertify-type-container { + overflow: visible !important; + } .alertify-tabs { max-height: 100%; display: flex; diff --git a/customize.dist/src/less2/include/buttons.less b/customize.dist/src/less2/include/buttons.less index fb99471b6..ad6aaf9cc 100644 --- a/customize.dist/src/less2/include/buttons.less +++ b/customize.dist/src/less2/include/buttons.less @@ -23,6 +23,23 @@ } } + div.cp-alertify-type { + display: flex; + input { + margin: 0; + flex: 1; + min-width: 0; + } + span { + button { + margin: 0; + height: 100%; + margin-left: -1px; + text-transform: unset !important; + } + } + } + textarea { padding: 8px; &[readonly] { diff --git a/customize.dist/src/less2/include/dropdown.less b/customize.dist/src/less2/include/dropdown.less index 10044528e..271603216 100644 --- a/customize.dist/src/less2/include/dropdown.less +++ b/customize.dist/src/less2/include/dropdown.less @@ -17,8 +17,7 @@ button { .fa-caret-down { - margin-right: 0px; - margin-left: 5px; + margin-right: 1em !important; } * { .tools_unselectable(); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 55d7e6939..d4b3059b4 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -161,6 +161,17 @@ define([ return h('p.msg', h('input', attrs)); }; + dialog.textTypeInput = function (dropdown) { + var attrs = { + type: 'text', + 'class': 'cp-text-type-input', + }; + return h('p.msg.cp-alertify-type-container', h('div.cp-alertify-type', [ + h('input', attrs), + dropdown // must be a "span" + ])); + }; + dialog.nav = function (content) { return h('nav', content || [ dialog.cancelButton(), @@ -186,6 +197,7 @@ define([ }); }; return $frame.click(function (e) { + $frame.find('.cp-dropdown-content').hide(); e.stopPropagation(); })[0]; }; @@ -480,7 +492,8 @@ define([ cb = cb || function () {}; opt = opt || {}; - var inputBlock = opt.password ? UI.passwordInput() : dialog.textInput(); + var inputBlock = opt.password ? UI.passwordInput() : + (opt.typeInput ? dialog.textTypeInput(opt.typeInput) : dialog.textInput()); var input = $(inputBlock).is('input') ? inputBlock : $(inputBlock).find('input')[0]; input.value = typeof(def) === 'string'? def: ''; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index a195a1ba9..eb032bfaf 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2896,9 +2896,11 @@ define([ var $button = $('