mirror of https://github.com/xwiki-labs/cryptpad
activeapps >appstodisable
This commit is contained in:
parent
0072aaa8a5
commit
a0f101ce45
|
@ -10,17 +10,13 @@
|
||||||
but you should not change it directly (/common/application_config_internal.js)
|
but you should not change it directly (/common/application_config_internal.js)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define([
|
define(['/common/application_config_internal.js'], function (AppConfig) {
|
||||||
'/common/application_config_internal.js',
|
|
||||||
'/api/config'
|
|
||||||
], function (AppConfig, ApiConfig ) {
|
|
||||||
|
|
||||||
// Example: If you want to remove the survey link in the menu:
|
// Example: If you want to remove the survey link in the menu:
|
||||||
// AppConfig.surveyURL = "";
|
// AppConfig.surveyURL = "";
|
||||||
|
|
||||||
// To inform users of the support ticket panel which languages your admins speak:
|
// To inform users of the support ticket panel which languages your admins speak:
|
||||||
//AppConfig.supportLanguages = [ 'en', 'fr' ];
|
//AppConfig.supportLanguages = [ 'en', 'fr' ];
|
||||||
AppConfig.availablePadTypes = ['drive', 'teams', 'file', 'contacts', 'convert'].concat(ApiConfig.availableApps);
|
|
||||||
|
|
||||||
return AppConfig;
|
return AppConfig;
|
||||||
});
|
});
|
||||||
|
|
|
@ -468,7 +468,7 @@ var setLastEviction = function (Env, Server, cb, data, unsafeKey) {
|
||||||
var instanceStatus = function (Env, Server, cb) {
|
var instanceStatus = function (Env, Server, cb) {
|
||||||
cb(void 0, {
|
cb(void 0, {
|
||||||
|
|
||||||
availableApps: Env.availableApps,
|
appsToDisable: Env.appsToDisable,
|
||||||
restrictRegistration: Env.restrictRegistration,
|
restrictRegistration: Env.restrictRegistration,
|
||||||
restrictSsoRegistration: Env.restrictSsoRegistration,
|
restrictSsoRegistration: Env.restrictSsoRegistration,
|
||||||
dontStoreSSOUsers: Env.dontStoreSSOUsers,
|
dontStoreSSOUsers: Env.dontStoreSSOUsers,
|
||||||
|
|
|
@ -226,13 +226,9 @@ commands.SET_SUPPORT_MAILBOX = makeGenericSetter('supportMailbox', function (arg
|
||||||
|
|
||||||
|
|
||||||
commands.DISABLE_APPS = function (Env, args) {
|
commands.DISABLE_APPS = function (Env, args) {
|
||||||
const availableApps = args;
|
if (!Array.isArray(args)) { throw new Error("INVALID_ARGS"); }
|
||||||
// let validated = typeof(curvePublic) === "string" &&
|
const appsToDisable = args;
|
||||||
// (Core.isValidPublicKey(curvePublic) || !curvePublic) &&
|
Env.appsToDisable = appsToDisable;
|
||||||
// typeof(edPublic) === "string" &&
|
|
||||||
// (Core.isValidPublicKey(edPublic) || !edPublic);
|
|
||||||
// if (!validated) { throw new Error('INVALID_ARGS'); }
|
|
||||||
Env.availableApps = availableApps;
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -583,7 +583,7 @@ var serveConfig = makeRouteCache(function () {
|
||||||
maxUploadSize: Env.maxUploadSize,
|
maxUploadSize: Env.maxUploadSize,
|
||||||
premiumUploadSize: Env.premiumUploadSize,
|
premiumUploadSize: Env.premiumUploadSize,
|
||||||
restrictRegistration: Env.restrictRegistration,
|
restrictRegistration: Env.restrictRegistration,
|
||||||
availableApps: Env.availableApps,
|
appsToDisable: Env.appsToDisable,
|
||||||
restrictSsoRegistration: Env.restrictSsoRegistration,
|
restrictSsoRegistration: Env.restrictSsoRegistration,
|
||||||
httpSafeOrigin: Env.httpSafeOrigin,
|
httpSafeOrigin: Env.httpSafeOrigin,
|
||||||
enableEmbedding: Env.enableEmbedding,
|
enableEmbedding: Env.enableEmbedding,
|
||||||
|
|
|
@ -49,9 +49,6 @@ Stats.instanceData = function (Env) {
|
||||||
// do you allow registration?
|
// do you allow registration?
|
||||||
data.restrictRegistration = Boolean(Env.restrictRegistration);
|
data.restrictRegistration = Boolean(Env.restrictRegistration);
|
||||||
|
|
||||||
//which apps have you disabled?
|
|
||||||
data.availableApps = Env.availableApps
|
|
||||||
|
|
||||||
// have you removed the donate button?
|
// have you removed the donate button?
|
||||||
data.removeDonateButton = Boolean(Env.removeDonateButton);
|
data.removeDonateButton = Boolean(Env.removeDonateButton);
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,13 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.active-app {
|
.cp-active-app {
|
||||||
background-color: #323232!important;
|
background-color: #323232!important;
|
||||||
max-width:30%;
|
max-width:30%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inactive-app {
|
.cp-inactive-app {
|
||||||
background-color: #424242!important;
|
background-color:#424242!important;
|
||||||
max-width:30%;
|
max-width:30%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
define([
|
define([
|
||||||
'jquery',
|
'jquery',
|
||||||
'/common/toolbar.js',
|
'/common/toolbar.js',
|
||||||
|
'/common/pad-types.js',
|
||||||
'/components/nthen/index.js',
|
'/components/nthen/index.js',
|
||||||
'/common/sframe-common.js',
|
'/common/sframe-common.js',
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
|
@ -17,11 +18,11 @@ define([
|
||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
'/common/clipboard.js',
|
'/common/clipboard.js',
|
||||||
'json.sortify',
|
'json.sortify',
|
||||||
'/customize/application_config.js',
|
|
||||||
'/api/config',
|
'/api/config',
|
||||||
'/api/instance',
|
'/api/instance',
|
||||||
'/lib/datepicker/flatpickr.js',
|
'/lib/datepicker/flatpickr.js',
|
||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
|
|
||||||
'css!/lib/datepicker/flatpickr.min.css',
|
'css!/lib/datepicker/flatpickr.min.css',
|
||||||
'css!/components/bootstrap/dist/css/bootstrap.min.css',
|
'css!/components/bootstrap/dist/css/bootstrap.min.css',
|
||||||
'css!/components/components-font-awesome/css/font-awesome.min.css',
|
'css!/components/components-font-awesome/css/font-awesome.min.css',
|
||||||
|
@ -29,6 +30,7 @@ define([
|
||||||
], function(
|
], function(
|
||||||
$,
|
$,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
|
PadTypes,
|
||||||
nThen,
|
nThen,
|
||||||
SFCommon,
|
SFCommon,
|
||||||
UI,
|
UI,
|
||||||
|
@ -39,18 +41,18 @@ define([
|
||||||
Messages,
|
Messages,
|
||||||
Keys,
|
Keys,
|
||||||
h,
|
h,
|
||||||
|
|
||||||
Clipboard,
|
Clipboard,
|
||||||
Sortify,
|
Sortify,
|
||||||
AppConfig,
|
|
||||||
ApiConfig,
|
ApiConfig,
|
||||||
Instance,
|
Instance,
|
||||||
Flatpickr
|
Flatpickr,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
Messages.admin_appSelection = 'App configuration'
|
Messages.admin_appSelection = 'App configuration'
|
||||||
Messages.admin_appsTitle = "Choose your applications"
|
Messages.admin_appsTitle = "Choose your applications"
|
||||||
Messages.admin_appsHint = "Choose which apps are available to users on your instance."
|
Messages.admin_appsHint = "Choose which apps to disable on your instance."
|
||||||
Messages.admin_cat_apps = "Apps"
|
Messages.admin_cat_apps = "Apps"
|
||||||
|
|
||||||
var APP = window.APP = {};
|
var APP = window.APP = {};
|
||||||
|
@ -636,39 +638,44 @@ define([
|
||||||
|
|
||||||
sidebar.addItem('apps', function (cb) {
|
sidebar.addItem('apps', function (cb) {
|
||||||
const grid = blocks.block([], 'cp-admin-customize-apps-grid');
|
const grid = blocks.block([], 'cp-admin-customize-apps-grid');
|
||||||
const allApps = ['pad', 'code', 'kanban', 'slide', 'sheet', 'form', 'whiteboard', 'diagram'];
|
const allApps = PadTypes.appsToSelect;
|
||||||
const availableApps = [];
|
const appsToDisable = ApiConfig.appsToDisable || [];
|
||||||
|
|
||||||
function select(app, appBlock) {
|
function select(app, appBlock) {
|
||||||
if (availableApps.indexOf(app) === -1) {
|
if (appsToDisable.indexOf(app) === -1) {
|
||||||
availableApps.push(app);
|
appsToDisable.push(app);
|
||||||
var checkMark = h('div.cp-onboardscreen-checkmark');
|
var checkMark = h('div.cp-onboardscreen-checkmark');
|
||||||
$(checkMark).addClass('fa-check');
|
$(checkMark).addClass('fa.fa-check');
|
||||||
appBlock.append(checkMark);
|
appBlock.append(checkMark);
|
||||||
$(`#${app}-block`).addClass('active-app')
|
$(`#${app}-block`).addClass('cp-active-app')
|
||||||
$(`#${app}-block`).removeClass('inactive-app')
|
$(`#${app}-block`).removeClass('cp-inactive-app')
|
||||||
} else {
|
} else {
|
||||||
availableApps.splice(availableApps.indexOf(app), 1);
|
appsToDisable.splice(appsToDisable.indexOf(app), 1);
|
||||||
$(`#${app}-block`).addClass('inactive-app')
|
$(`#${app}-block`).addClass('cp-inactive-app')
|
||||||
$(`#${app}-block`).removeClass('active-app')
|
$(`#${app}-block`).removeClass('cp-active-app')
|
||||||
appBlock.find('.cp-onboardscreen-checkmark').remove();
|
appBlock.find('.cp-onboardscreen-checkmark').remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allApps.forEach(app => {
|
allApps.forEach(app => {
|
||||||
let appBlock = h('div.cp-appblock.inactive-app', {id: `${app.toString()}-block`}, app.charAt(0).toUpperCase() + app.slice(1))
|
|
||||||
$(grid).append(appBlock);
|
let appBlock = h('div.cp-appblock', {id: `${app.toString()}-block`}, app.charAt(0).toUpperCase() + app.slice(1))
|
||||||
$(appBlock).on('click', () => select(app, $(appBlock)));
|
if (appsToDisable.indexOf(app) === -1) {
|
||||||
});
|
$(appBlock).addClass('cp-inactive-app')
|
||||||
|
} else {
|
||||||
|
$(appBlock).addClass('cp-active-app')
|
||||||
|
}
|
||||||
|
$(grid).append(appBlock);
|
||||||
|
$(appBlock).on('click', () => select(app, $(appBlock)));
|
||||||
|
});
|
||||||
|
|
||||||
var save = blocks.activeButton('primary', '', Messages.settings_save, function (done) {
|
var save = blocks.activeButton('primary', '', Messages.settings_save, function (done) {
|
||||||
sFrameChan.query('Q_ADMIN_RPC', {
|
sFrameChan.query('Q_ADMIN_RPC', {
|
||||||
cmd: 'ADMIN_DECREE',
|
cmd: 'ADMIN_DECREE',
|
||||||
data: ['DISABLE_APPS', availableApps]
|
data: ['DISABLE_APPS', appsToDisable]
|
||||||
}, function (e, response) {
|
}, function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,6 +22,9 @@ define([
|
||||||
h
|
h
|
||||||
) {
|
) {
|
||||||
const Sidebar = {};
|
const Sidebar = {};
|
||||||
|
const keyToCamlCase = (key) => {
|
||||||
|
return key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
||||||
|
};
|
||||||
|
|
||||||
Sidebar.blocks = function (app) {
|
Sidebar.blocks = function (app) {
|
||||||
|
|
||||||
|
@ -214,9 +217,7 @@ define([
|
||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
|
|
||||||
const keyToCamlCase = (key) => {
|
|
||||||
return key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
|
||||||
};
|
|
||||||
blocks.activeCheckbox = (data) => {
|
blocks.activeCheckbox = (data) => {
|
||||||
const state = data.getState();
|
const state = data.getState();
|
||||||
const key = data.key;
|
const key = data.key;
|
||||||
|
@ -244,9 +245,6 @@ define([
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// let blocks = Sidebar.blocks(app) = {};
|
|
||||||
|
|
||||||
|
|
||||||
Sidebar.create = function (common, app, $container) {
|
Sidebar.create = function (common, app, $container) {
|
||||||
const $leftside = $(h('div#cp-sidebarlayout-leftside')).appendTo($container);
|
const $leftside = $(h('div#cp-sidebarlayout-leftside')).appendTo($container);
|
||||||
const $rightside = $(h('div#cp-sidebarlayout-rightside')).appendTo($container);
|
const $rightside = $(h('div#cp-sidebarlayout-rightside')).appendTo($container);
|
||||||
|
@ -258,9 +256,6 @@ define([
|
||||||
sidebar.blocks = Sidebar.blocks(app)
|
sidebar.blocks = Sidebar.blocks(app)
|
||||||
|
|
||||||
sidebar.addItem = (key, get, options) => {
|
sidebar.addItem = (key, get, options) => {
|
||||||
const keyToCamlCase = (key) => {
|
|
||||||
return key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
|
||||||
};
|
|
||||||
const safeKey = keyToCamlCase(key);
|
const safeKey = keyToCamlCase(key);
|
||||||
get((content) => {
|
get((content) => {
|
||||||
if (content === false) { return; }
|
if (content === false) { return; }
|
||||||
|
@ -288,7 +283,7 @@ define([
|
||||||
|
|
||||||
sidebar.addCheckboxItem = (data) => {
|
sidebar.addCheckboxItem = (data) => {
|
||||||
const key = data.key;
|
const key = data.key;
|
||||||
let blocks = Sidebar.blocks(app)
|
let blocks = sidebar.blocks
|
||||||
let box = blocks.activeCheckbox(data);
|
let box = blocks.activeCheckbox(data);
|
||||||
sidebar.addItem(key, function (cb) {
|
sidebar.addItem(key, function (cb) {
|
||||||
cb(box);
|
cb(box);
|
||||||
|
|
|
@ -12,12 +12,22 @@ define([
|
||||||
OOCurrentVersion.currentVersion,
|
OOCurrentVersion.currentVersion,
|
||||||
);
|
);
|
||||||
|
|
||||||
let availableTypes = AppConfig.availablePadTypes.filter(
|
let availablePadTypes = AppConfig.availablePadTypes.filter(
|
||||||
(t) => ooEnabled || !OO_APPS.includes(t),
|
(t) => ooEnabled || !OO_APPS.includes(t)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let availableTypes;
|
||||||
|
if (ApiConfig.appsToDisable) {
|
||||||
|
availableTypes = availablePadTypes.filter(value => !ApiConfig.appsToDisable.includes(value))
|
||||||
|
} else {
|
||||||
|
availableTypes = availablePadTypes
|
||||||
|
}
|
||||||
|
|
||||||
|
var appsToSelect = availablePadTypes.filter(value => !['drive', 'teams', 'file', 'contacts', 'convert'].includes(value))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
availableTypes,
|
availableTypes,
|
||||||
|
appsToSelect,
|
||||||
|
|
||||||
isAvailable: function (type) {
|
isAvailable: function (type) {
|
||||||
return availableTypes.includes(type);
|
return availableTypes.includes(type);
|
||||||
|
|
|
@ -1006,7 +1006,6 @@
|
||||||
"snapshots_cantMake": "The snapshot could not be created. You are disconnected.",
|
"snapshots_cantMake": "The snapshot could not be created. You are disconnected.",
|
||||||
"admin_registrationHint": "Do not allow any new users to register",
|
"admin_registrationHint": "Do not allow any new users to register",
|
||||||
"admin_registrationTitle": "Close registration",
|
"admin_registrationTitle": "Close registration",
|
||||||
"install_registrationTitle": "Close registration",
|
|
||||||
"admin_defaultlimitHint": "Maximum storage limit for CryptDrives (users and teams) when no custom rule is applied",
|
"admin_defaultlimitHint": "Maximum storage limit for CryptDrives (users and teams) when no custom rule is applied",
|
||||||
"admin_defaultlimitTitle": "Storage limit (MB)",
|
"admin_defaultlimitTitle": "Storage limit (MB)",
|
||||||
"admin_setlimitButton": "Set limit",
|
"admin_setlimitButton": "Set limit",
|
||||||
|
@ -1438,7 +1437,6 @@
|
||||||
"admin_uptimeHint": "Date and time at which the server was launched",
|
"admin_uptimeHint": "Date and time at which the server was launched",
|
||||||
"admin_cat_database": "Database",
|
"admin_cat_database": "Database",
|
||||||
"admin_generatedAt": "Report timestamp",
|
"admin_generatedAt": "Report timestamp",
|
||||||
"admin_cat_apps": "Apps",
|
|
||||||
"ui_true": "true",
|
"ui_true": "true",
|
||||||
"ui_false": "false",
|
"ui_false": "false",
|
||||||
"ui_undefined": "unknown",
|
"ui_undefined": "unknown",
|
||||||
|
@ -1682,7 +1680,6 @@
|
||||||
"kanban_showTags": "See all tags",
|
"kanban_showTags": "See all tags",
|
||||||
"kanban_hideTags": "See less tags",
|
"kanban_hideTags": "See less tags",
|
||||||
"admin_forcemfaTitle": "Mandatory Two-Factor Authentication",
|
"admin_forcemfaTitle": "Mandatory Two-Factor Authentication",
|
||||||
"install_forcemfaTitle": "Mandatory Two-Factor Authentication",
|
|
||||||
"admin_forcemfaHint": "All users on this instance will be asked to set up two-factor authentication to log in to their account.",
|
"admin_forcemfaHint": "All users on this instance will be asked to set up two-factor authentication to log in to their account.",
|
||||||
"loading_mfa_required": "Two-factor authentication is required on this instance. Please update your account using an authenticator app and the form below.",
|
"loading_mfa_required": "Two-factor authentication is required on this instance. Please update your account using an authenticator app and the form below.",
|
||||||
"admin_cat_users": "User directory",
|
"admin_cat_users": "User directory",
|
||||||
|
|
|
@ -203,10 +203,10 @@ nav.cp-onboardscreen-nav {
|
||||||
// padding: 10px;
|
// padding: 10px;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// .active-app {
|
.cp-active-app {
|
||||||
// background-color: #212121!important;
|
background-color: #212121!important;
|
||||||
// max-width:30%;
|
max-width:30%;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .cp-admin-customize-options-grid {
|
// .cp-admin-customize-options-grid {
|
||||||
// height:40%;
|
// height:40%;
|
||||||
|
|
|
@ -6,6 +6,8 @@ define([
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
'/common/common-util.js',
|
'/common/common-util.js',
|
||||||
'/common/common-ui-elements.js',
|
'/common/common-ui-elements.js',
|
||||||
|
'/common/pad-types.js',
|
||||||
|
'/api/instance',
|
||||||
|
|
||||||
'css!/components/bootstrap/dist/css/bootstrap.min.css',
|
'css!/components/bootstrap/dist/css/bootstrap.min.css',
|
||||||
'css!/components/components-font-awesome/css/font-awesome.min.css',
|
'css!/components/components-font-awesome/css/font-awesome.min.css',
|
||||||
|
@ -17,18 +19,21 @@ define([
|
||||||
h,
|
h,
|
||||||
UI,
|
UI,
|
||||||
Util,
|
Util,
|
||||||
UIElements
|
UIElements,
|
||||||
|
PadTypes
|
||||||
) {
|
) {
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
Messages.install_onboardingNameTitle = 'Welcome to your CryptPad instance';
|
Messages.admin_onboardingNameTitle = 'Welcome to your CryptPad instance';
|
||||||
Messages.install_onboardingNameHint = 'Please choose a title and description';
|
Messages.admin_onboardingNameHint = 'Please choose a title and description';
|
||||||
Messages.install_onboardingAppsTitle = "Choose your applications";
|
Messages.admin_onboardingAppsTitle = "Choose your applications";
|
||||||
Messages.install_onboardingAppsHint = "Choose which apps are available to users on your instance";
|
Messages.admin_onboardingAppsHint = "Choose which apps to disable on your instance";
|
||||||
Messages.install_onboardingRegistrationTitle = "Options";
|
Messages.admin_onboardingRegistrationTitle = "Options";
|
||||||
Messages.install_onboardingRegistrationHint = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id tristique justo";
|
Messages.admin_onboardingRegistrationHint = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id tristique justo";
|
||||||
Messages.install_onboardingRegistration = "Visitors to the instance are not able to create accounts. Invitations can be created by administrators";
|
Messages.admin_onboardingRegistration = "Visitors to the instance are not able to create accounts. Invitations can be created by administrators";
|
||||||
Messages.install_onboardingMfa = "All accounts on the instance have to use 2-factor authentication";
|
Messages.admin_onboardingMfa = "All accounts on the instance have to use 2-factor authentication";
|
||||||
|
Messages.admin_onboardingNamePlaceholder = 'Instance title'
|
||||||
|
Messages.admin_onboardingDescPlaceholder = 'Placeholder description text'
|
||||||
|
|
||||||
var OnboardScreen = {};
|
var OnboardScreen = {};
|
||||||
|
|
||||||
|
@ -52,21 +57,33 @@ define([
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var flushCache = () => {
|
||||||
|
console.log('flushcashe')
|
||||||
|
// sendAdminDecree('FLUSH_CACHE', function (e, response) {
|
||||||
|
// if (e || response.error) {
|
||||||
|
// UI.warn(Messages.error);
|
||||||
|
// console.error(e, response);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// })
|
||||||
|
};
|
||||||
|
|
||||||
OnboardScreen.titleConfig = function (sendAdminDecree, sendAdminRpc) {
|
OnboardScreen.titleConfig = function (sendAdminDecree, sendAdminRpc) {
|
||||||
|
|
||||||
const blocks = Sidebar.blocks('install');
|
const blocks = Sidebar.blocks('admin');
|
||||||
|
|
||||||
var titleDescBlock = function() {
|
var titleDescBlock = function() {
|
||||||
|
|
||||||
var input = blocks.input({
|
var input = blocks.input({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: '',
|
value: '',
|
||||||
placeholder: 'Instance title',
|
placeholder: Messages.admin_onboardingNamePlaceholder,
|
||||||
'aria-labelledby': 'cp-admin-name'
|
'aria-labelledby': 'cp-admin-name'
|
||||||
});
|
});
|
||||||
|
|
||||||
var desc = blocks.textarea({
|
var desc = blocks.textarea({
|
||||||
placeholder: 'Placeholder description text',
|
placeholder: Messages.admin_onboardingDescPlaceholder,
|
||||||
value: '',
|
value: '',
|
||||||
'aria-labelledby': 'cp-admin-description'
|
'aria-labelledby': 'cp-admin-description'
|
||||||
});
|
});
|
||||||
|
@ -123,11 +140,9 @@ define([
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$(inputLogo).val('');
|
$(inputLogo).val('');
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
// done(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
// done(true);
|
|
||||||
redraw();
|
redraw();
|
||||||
spinner.done();
|
spinner.done();
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
@ -192,12 +207,11 @@ define([
|
||||||
sendAdminDecree('SET_INSTANCE_NAME', [$(titleInput).val().trim()], function (e, response) {
|
sendAdminDecree('SET_INSTANCE_NAME', [$(titleInput).val().trim()], function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
done(true);
|
done(true);
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
|
||||||
|
@ -205,12 +219,11 @@ define([
|
||||||
sendAdminDecree('SET_INSTANCE_DESCRIPTION', [$(desc).val().trim()], function (e, response) {
|
sendAdminDecree('SET_INSTANCE_DESCRIPTION', [$(desc).val().trim()], function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
done(true);
|
done(true);
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
|
||||||
|
@ -254,41 +267,40 @@ define([
|
||||||
|
|
||||||
OnboardScreen.appConfig = function (sendAdminDecree) {
|
OnboardScreen.appConfig = function (sendAdminDecree) {
|
||||||
|
|
||||||
const blocks = Sidebar.blocks('install');
|
const blocks = Sidebar.blocks('admin');
|
||||||
const grid = blocks.block([], 'cp-admin-customize-apps-grid');
|
const grid = blocks.block([], 'cp-admin-customize-apps-grid');
|
||||||
const allApps = ['pad', 'code', 'kanban', 'slide', 'sheet', 'form', 'whiteboard', 'diagram'];
|
const allApps = PadTypes.appsToSelect;
|
||||||
const availableApps = [];
|
const appsToDisable = [];
|
||||||
|
|
||||||
function select(app, appBlock) {
|
function select(app, appBlock) {
|
||||||
if (availableApps.indexOf(app) === -1) {
|
if (appsToDisable.indexOf(app) === -1) {
|
||||||
availableApps.push(app);
|
appsToDisable.push(app);
|
||||||
var checkMark = h('div.cp-onboardscreen-checkmark');
|
var checkMark = h('div.cp-onboardscreen-checkmark');
|
||||||
$(checkMark).addClass('fa-check');
|
$(checkMark).addClass('fa-check');
|
||||||
appBlock.append(checkMark);
|
appBlock.append(checkMark);
|
||||||
$(`#${app}-block`).addClass('active-app')
|
$(`#${app}-block`).addClass('cp-active-app')
|
||||||
} else {
|
} else {
|
||||||
availableApps.splice(availableApps.indexOf(app), 1);
|
appsToDisable.splice(appsToDisable.indexOf(app), 1);
|
||||||
$(`#${app}-block`).addClass('inactive-app')
|
$(`#${app}-block`).addClass('cp-inactive-app')
|
||||||
appBlock.find('.cp-onboardscreen-checkmark').remove();
|
appBlock.find('.cp-onboardscreen-checkmark').remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allApps.forEach(app => {
|
allApps.forEach(app => {
|
||||||
let appBlock = h('div.cp-appblock.inactive-app', {id: `${app.toString()}-block`}, app.charAt(0).toUpperCase() + app.slice(1))
|
let appBlock = h('div.cp-appblock.cp-inactive-app', {id: `${app.toString()}-block`}, app.charAt(0).toUpperCase() + app.slice(1))
|
||||||
$(grid).append(appBlock);
|
$(grid).append(appBlock);
|
||||||
$(appBlock).on('click', () => select(app, $(appBlock)));
|
$(appBlock).on('click', () => select(app, $(appBlock)));
|
||||||
});
|
});
|
||||||
|
|
||||||
var save = blocks.activeButton('primary', '', Messages.settings_save, function (done) {
|
var save = blocks.activeButton('primary', '', Messages.settings_save, function (done) {
|
||||||
sendAdminDecree('DISABLE_APPS', availableApps, function (e, response) {
|
sendAdminDecree('DISABLE_APPS', appsToDisable, function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
done(true);
|
done(true);
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
|
||||||
|
@ -319,7 +331,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
OnboardScreen.mfaRegistrationScreen = function(sendAdminDecree, app) {
|
OnboardScreen.mfaRegistrationScreen = function(sendAdminDecree, app) {
|
||||||
const blocks = Sidebar.blocks('install');
|
const blocks = Sidebar.blocks('admin');
|
||||||
|
|
||||||
var restrict = blocks.activeCheckbox({
|
var restrict = blocks.activeCheckbox({
|
||||||
key: 'registration',
|
key: 'registration',
|
||||||
|
@ -331,13 +343,11 @@ define([
|
||||||
sendAdminDecree('RESTRICT_REGISTRATION', [val], function (e, response) {
|
sendAdminDecree('RESTRICT_REGISTRATION', [val], function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
// done(true);
|
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -354,13 +364,11 @@ define([
|
||||||
sendAdminDecree('ENFORCE_MFA', [val], function (e, response) {
|
sendAdminDecree('ENFORCE_MFA', [val], function (e, response) {
|
||||||
if (e || response.error) {
|
if (e || response.error) {
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
$input.val('');
|
|
||||||
console.error(e, response);
|
console.error(e, response);
|
||||||
done(false);
|
done(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// flushCache();
|
flushCache();
|
||||||
// done(true);
|
|
||||||
UI.log(Messages.saved);
|
UI.log(Messages.saved);
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -370,9 +378,9 @@ define([
|
||||||
const grid = blocks.block([], 'cp-admin-customize-options-grid');
|
const grid = blocks.block([], 'cp-admin-customize-options-grid');
|
||||||
const options = [restrict, forceMFA];
|
const options = [restrict, forceMFA];
|
||||||
|
|
||||||
let mfaOption = h('div.cp-appblock.inactive-app', forceMFA, h('br'), Messages.install_onboardingMfa);
|
let mfaOption = h('div.cp-appblock.cp-inactive-app', forceMFA, h('br'), Messages.admin_onboardingMfa);
|
||||||
$(grid).append(mfaOption);
|
$(grid).append(mfaOption);
|
||||||
let registrationOption = h('div.cp-appblock.inactive-app', restrict, h('br'), Messages.install_onboardingRegistration);
|
let registrationOption = h('div.cp-appblock.cp-inactive-app', restrict, h('br'), Messages.admin_onboardingRegistration);
|
||||||
$(grid).append(registrationOption);
|
$(grid).append(registrationOption);
|
||||||
|
|
||||||
var save = blocks.activeButton('primary', '', Messages.settings_save, function () {
|
var save = blocks.activeButton('primary', '', Messages.settings_save, function () {
|
||||||
|
|
Loading…
Reference in New Issue