diff --git a/CHANGELOG.md b/CHANGELOG.md index ea1d3ced2..4a72d02c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ * Add DAPSI to our sponsor list * checkup * check for duplicate or incorrect headers +* save rendered markmap, mathjax, and mermaid as images +* guard against incorrect iPhone behaviour that broke the ability to toggle between grid and list mode # 4.4.0 diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 9b9294e86..d287951b5 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -606,7 +606,7 @@ } } - .cp-app-drive-content-list { + div.cp-app-drive-content-list { .cp-app-drive-element-grid { display: none; } @@ -896,7 +896,13 @@ .cp-toolbar-bottom { .cp-toolbar-bottom-right { .fa-history { order: 50; } - .fa-list, .fa-th-large { order: 25; } + // .fa-list, .fa-th-large, + .cp-app-drive-viewmode-button { + order: 25; + i { + margin-right: 0; + } + } #cp-app-drive-toolbar-context-mobile, #cp-app-drive-toolbar-contextbuttons { order: 0; } #cp-app-drive-toolbar-context-mobile { .fa { margin: 0 !important; } diff --git a/www/admin/inner.js b/www/admin/inner.js index f4ec5a795..a1979da70 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -253,36 +253,32 @@ define([ create['registration'] = function () { var key = 'registration'; - var $div = makeBlock(key, true); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton - var $button = $div.find('button'); // XXX restricted-registration: a checkbox might be better. it's easy to misinterpret the verb "OPEN" as an adjective + var $div = makeBlock(key); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton + var state = APP.instanceStatus.restrictRegistration; - if (state) { - $button.text(Messages.admin_registrationAllow); - } else { - $button.removeClass('btn-primary').addClass('btn-danger'); - } - var called = false; - $div.find('button').click(function () { - called = true; + var $cbox = $(UI.createCheckbox('cp-settings-userfeedback', + Messages.admin_registrationTitle, + state, { label: { class: 'noTitle' } })); + var spinner = UI.makeSpinner($cbox); + var $checkbox = $cbox.find('input').on('change', function() { + spinner.spin(); + var val = $checkbox.is(':checked') || false; + $checkbox.attr('disabled', 'disabled'); sFrameChan.query('Q_ADMIN_RPC', { cmd: 'ADMIN_DECREE', - data: ['RESTRICT_REGISTRATION', [!state]] + data: ['RESTRICT_REGISTRATION', [val]] }, function (e) { if (e) { UI.warn(Messages.error); console.error(e); } APP.updateStatus(function () { - called = false; + spinner.done(); state = APP.instanceStatus.restrictRegistration; - if (state) { - console.log($button); - $button.text(Messages.admin_registrationAllow); - $button.addClass('btn-primary').removeClass('btn-danger'); - } else { - $button.text(Messages.admin_registrationButton); - $button.removeClass('btn-primary').addClass('btn-danger'); - } + $checkbox[0].checked = state; + $checkbox.removeAttr('disabled'); }); }); }); + $cbox.appendTo($div); + return $div; }; diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 34e76fb16..58262f956 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -375,7 +375,7 @@ define([ } }); } - if (data.teams.indexOf(1) === -1 || teamId === 0) { + if (APP.loggedIn && (data.teams.indexOf(1) === -1 || teamId === 0)) { options.push({ tag: 'a', attributes: { @@ -387,10 +387,10 @@ define([ importCalendar({ id: id, teamId: teamId - }, function (obj) { - if (obj && obj.error) { - console.error(obj.error); - return void UI.warn(obj.error); + }, function (err) { + if (err) { + console.error(err); + return void UI.warn(Messages.error); } }); return true; @@ -677,14 +677,16 @@ define([ importCalendar({ id: tempCalendars[0], teamId: 0 - }, function (obj) { - if (obj && obj.error) { - console.error(obj.error); - return void UI.warn(obj.error); + }, function (err) { + if (err) { + console.error(err); + return void UI.warn(Messages.error); } }); }); - APP.$calendars.append(h('div.cp-calendar-entry.cp-ghost', importTemp)); + if (APP.loggedIn) { + APP.$calendars.append(h('div.cp-calendar-entry.cp-ghost', importTemp)); + } return; } var myCalendars = filter(1); @@ -1111,6 +1113,8 @@ define([ var privateData = metadataMgr.getPrivateData(); var user = metadataMgr.getUserData(); + APP.loggedIn = common.isLoggedIn(); + common.setTabTitle(Messages.calendar); // Fix flatpickr selection @@ -1248,6 +1252,11 @@ define([ var store = window.cryptpadStore; APP.module.execCommand('SUBSCRIBE', null, function (obj) { if (obj.empty && !privateData.calendarHash) { + if (!privateData.loggedIn) { + return void UI.errorLoadingScreen(Messages.mustLogin, false, function () { + common.setLoginRedirect('login'); + }); + } // No calendar yet, create one newCalendar({ teamId: 1, @@ -1255,7 +1264,7 @@ define([ color: user.color, title: Messages.calendar_default }, function (err) { - if (err) { return void UI.errorLoadingScreen(Messages.error); } // XXX + if (err) { return void UI.errorLoadingScreen(Messages.error); } store.get('calendarView', makeCalendar); UI.removeLoadingScreen(); }); diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index f1b2f94bf..c7b66c1e5 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', 'notifications', 'support', 'calendar']; + config.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support']; /* 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/common-ui-elements.js b/www/common/common-ui-elements.js index d63bb8c91..887eb147a 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -575,12 +575,18 @@ define([ } else if (callback) {*/ // Old import button, used in settings - button - .click(common.prepareFeedback(type)) - .click(importContent((data && data.binary) ? 'application/octet-stream' : 'text/plain', callback, { + var importer = importContent((data && data.binary) ? 'application/octet-stream' : 'text/plain', callback, { accept: data ? data.accept : undefined, binary: data ? data.binary : undefined - })); + }); + + var handler = data.first? function () { + data.first(importer); + }: importer; //importContent; + + button + .click(common.prepareFeedback(type)) + .click(handler); //} break; case 'upload': diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 2d128b468..87c40ffd4 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -122,8 +122,8 @@ define([ var $trashEmptyIcon = $('', {"class": "fa fa-trash-o"}); //var $collapseIcon = $('', {"class": "fa fa-minus-square-o cp-app-drive-icon-expcol"}); var $expandIcon = $('', {"class": "fa fa-plus-square-o cp-app-drive-icon-expcol"}); - var $listIcon = $('