final cleanup before merging support-categories

pull/1/head
ansuz 3 years ago
parent 45d2eb0267
commit 4e571e0e8e

@ -107,10 +107,10 @@ define([
var customURLs = Pages.customURLs = {}; var customURLs = Pages.customURLs = {};
(function () { (function () {
var defaultURLs = { var defaultURLs = {
//imprint: '/imprint.html', // XXX cryptpad.org/default-imprint.html? //imprint: '/imprint.html',
//privacy: '/privacy.html', // XXX cryptpad.org/default-privacy.html? //privacy: '/privacy.html',
terms: '/terms.html', // XXX cryptpad.org/default-terms.html? terms: '/terms.html',
//roadmap: '/roadmap.html', // XXX cryptpad.org/default-roadmap.html? //roadmap: '/roadmap.html',
source: 'https://github.com/xwiki-labs/cryptpad', source: 'https://github.com/xwiki-labs/cryptpad',
}; };
var l = Msg._getLanguage(); var l = Msg._getLanguage();
@ -133,8 +133,6 @@ define([
}); });
}()); }());
Msg.footer_source = 'Source code'; // XXX
// used for the about menu // used for the about menu
Pages.imprintLink = footLink(customURLs.imprint, 'imprint'); Pages.imprintLink = footLink(customURLs.imprint, 'imprint');
Pages.privacyLink = footLink(customURLs.privacy, 'privacy'); Pages.privacyLink = footLink(customURLs.privacy, 'privacy');

@ -78,8 +78,8 @@ var processLang = function (map, lang, primary) {
}); });
var weirdCapitalization; var weirdCapitalization;
s.replace(/cryptpad(\.fr)*/gi, function (brand) { s.replace(/cryptpad(\.fr|\.org)*/gi, function (brand) {
if (['CryptPad', 'cryptpad.fr'].includes(brand)) { return; } if (['CryptPad', 'cryptpad.fr', 'cryptpad.org'].includes(brand)) { return; }
weirdCapitalization = true; weirdCapitalization = true;
}); });

@ -21,6 +21,11 @@
text-decoration: underline; text-decoration: underline;
} }
.alert.alert-info.cp-admin-bigger-alert {
font-size: 16px;
}
.cp-admin-setlimit-form, .cp-admin-broadcast-form { .cp-admin-setlimit-form, .cp-admin-broadcast-form {
label { label {
font-weight: normal !important; font-weight: normal !important;

@ -56,6 +56,8 @@ define([
'cp-admin-registration', 'cp-admin-registration',
'cp-admin-email', 'cp-admin-email',
'cp-admin-instance-info-notice',
'cp-admin-name', 'cp-admin-name',
'cp-admin-description', 'cp-admin-description',
'cp-admin-jurisdiction', 'cp-admin-jurisdiction',
@ -256,7 +258,7 @@ define([
cmd: archive ? 'ARCHIVE_DOCUMENT' : 'RESTORE_ARCHIVED_DOCUMENT', cmd: archive ? 'ARCHIVE_DOCUMENT' : 'RESTORE_ARCHIVED_DOCUMENT',
data: { data: {
id: channel, id: channel,
reason: $reason.val(), // XXX reason: $reason.val(),
}, },
}, function (err, obj) { }, function (err, obj) {
var e = err || (obj && obj.error); var e = err || (obj && obj.error);
@ -269,7 +271,8 @@ define([
UI.log(archive ? Messages.archivedFromServer : Messages.restoredFromServer); UI.log(archive ? Messages.archivedFromServer : Messages.restoredFromServer);
$input.val(''); $input.val('');
$pwInput.val(''); $pwInput.val('');
$reason.val(''); // disabled because it's actually pretty annoying to re-enter this each time if you are archiving many files
//$reason.val('');
}); });
}); });
}); });
@ -330,8 +333,6 @@ define([
var key = data.key; var key = data.key;
var $div = makeBlock(key); var $div = makeBlock(key);
// XXX support disabling this checkboxes in certain conditions, ie. when telemetry is off
var labelKey = 'admin_' + keyToCamlCase(key) + 'Label'; var labelKey = 'admin_' + keyToCamlCase(key) + 'Label';
var titleKey = 'admin_' + keyToCamlCase(key) + 'Title'; var titleKey = 'admin_' + keyToCamlCase(key) + 'Title';
var $cbox = $(UI.createCheckbox('cp-admin-' + key, var $cbox = $(UI.createCheckbox('cp-admin-' + key,
@ -375,9 +376,10 @@ define([
}, },
}); });
// XXX remove emailButton
create['email'] = function () { create['email'] = function () {
var key = 'email'; var key = 'email';
var $div = makeBlock(key, true); // Msg.admin_emailHint, Msg.admin_emailTitle, Msg.admin_emailButton // XXX drop 'emailButton' var $div = makeBlock(key, true); // Msg.admin_emailHint, Msg.admin_emailTitle
var $button = $div.find('button').text(Messages.settings_save); var $button = $div.find('button').text(Messages.settings_save);
var input = h('input', { var input = h('input', {
@ -429,12 +431,11 @@ define([
var spinner = UI.makeSpinner($(innerDiv)); var spinner = UI.makeSpinner($(innerDiv));
$button.click(function () { $button.click(function () {
if (!$input.val()) { return; } // XXX
spinner.spin(); spinner.spin();
$button.attr('disabled', 'disabled'); $button.attr('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_INSTANCE_JURISDICTION', [$input.val()]] // XXX data: ['SET_INSTANCE_JURISDICTION', [$input.val().trim()]]
}, function (e, response) { }, function (e, response) {
$button.removeAttr('disabled'); $button.removeAttr('disabled');
if (e || response.error) { if (e || response.error) {
@ -454,6 +455,19 @@ define([
return $div; return $div;
}; };
Messages.admin_infoNotice1 = "The following fields describe your instance. Data entered will only be included in your server's telemetry if you opt in to inclusion in the list of public CryptPad instances."; // XXX
Messages.admin_infoNotice2 = "See the 'Network' tab for more details."; // XXX
create['instance-info-notice'] = function () {
return $(h('div.cp-admin-instance-info-notice.cp-sidebarlayout-element',
h('div.alert.alert-info.cp-admin-bigger-alert', [
Messages.admin_infoNotice1,
' ',
Messages.admin_infoNotice2,
])
));
};
create['name'] = function () { create['name'] = function () {
var key = 'name'; var key = 'name';
var $div = makeBlock(key, true); var $div = makeBlock(key, true);
@ -463,20 +477,19 @@ define([
var input = h('input.cp-listing-info', { var input = h('input.cp-listing-info', {
type: 'text', type: 'text',
value: APP.instanceStatus.instanceName || ApiConfig.httpUnsafeOrigin || '', value: APP.instanceStatus.instanceName || ApiConfig.httpUnsafeOrigin || '',
placeholder: ApiConfig.httpUnsafeOrigin, //Messages.admin_namePlaceholder, // XXX placeholder: ApiConfig.httpUnsafeOrigin,
style: 'margin-bottom: 5px;', style: 'margin-bottom: 5px;',
}); });
var $input = $(input); var $input = $(input);
var innerDiv = h('div.cp-admin-setname-form', input); // XXX fix styles var innerDiv = h('div.cp-admin-setname-form', input);
var spinner = UI.makeSpinner($(innerDiv)); var spinner = UI.makeSpinner($(innerDiv));
$button.click(function () { $button.click(function () {
if (!$input.val()) { return; } // XXX
spinner.spin(); spinner.spin();
$button.attr('disabled', 'disabled'); $button.attr('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_INSTANCE_NAME', [$input.val()]] // XXX not implemented data: ['SET_INSTANCE_NAME', [$input.val().trim()]]
}, function (e, response) { }, function (e, response) {
$button.removeAttr('disabled'); $button.removeAttr('disabled');
if (e || response.error) { if (e || response.error) {
@ -498,19 +511,17 @@ define([
create['description'] = function () { create['description'] = function () {
var key = 'description'; var key = 'description';
var $div = makeBlock(key, true); var $div = makeBlock(key, true); // Msg.admin_descriptionHint
var textarea = h('textarea.cp-admin-description-text.cp-listing-info', { // XXX use something from UI elements? var textarea = h('textarea.cp-admin-description-text.cp-listing-info', {
placeholder: Messages.home_host || '', // XXX placeholder: Messages.home_host || '',
}, APP.instanceStatus.instanceDescription || ''); }, APP.instanceStatus.instanceDescription || '');
var $button = $div.find('button').text(Messages.settings_save); var $button = $div.find('button').text(Messages.settings_save);
$button.addClass('cp-listing-action'); $button.addClass('cp-listing-action');
var innerDiv = h('div.cp-admin-setdescription-form', { var innerDiv = h('div.cp-admin-setdescription-form', [
//style: 'margin-bottom: 5px', // XXX LOL NO
}, [
textarea, textarea,
]); ]);
$button.before(innerDiv); $button.before(innerDiv);
@ -519,12 +530,11 @@ define([
var spinner = UI.makeSpinner($(innerDiv)); var spinner = UI.makeSpinner($(innerDiv));
$button.click(function () { $button.click(function () {
if (!$input.val()) { return; } // XXX
spinner.spin(); spinner.spin();
$button.attr('disabled', 'disabled'); $button.attr('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_INSTANCE_DESCRIPTION', [$input.val()]] // XXX data: ['SET_INSTANCE_DESCRIPTION', [$input.val().trim()]]
}, function (e, response) { }, function (e, response) {
$button.removeAttr('disabled'); $button.removeAttr('disabled');
if (e || response.error) { if (e || response.error) {
@ -1915,9 +1925,9 @@ define([
}; };
Messages.admin_enableDiskMeasurementsTitle = "Measure disk performance"; // XXX Messages.admin_enableDiskMeasurementsTitle = "Measure disk performance"; // XXX
Messages.admin_enableDiskMeasurementsHint = "If enabled, a JSON endpoint will be exposed under /api/profiling which keeps a running measurement of disk I/O within a configurable window. This setting can impact server performance and may reveal data you'd rather keep hidden. It is recommended that you leave it disabled unless you know what you are doing."; // XXX Messages.admin_enableDiskMeasurementsHint = "If enabled, a JSON endpoint will be exposed under /api/profiling which keeps a running measurement of disk I/O within a configurable window (set below). This setting can impact server performance and may reveal data you'd rather keep hidden. It is recommended that you leave it disabled unless you know what you are doing."; // XXX
create['enable-disk-measurements'] = makeAdminCheckbox({ create['enable-disk-measurements'] = makeAdminCheckbox({ // Msg.admin_enableDiskMeasurementsTitle.admin_enableDiskMeasurementsHint
key: 'enable-disk-measurements', key: 'enable-disk-measurements',
getState: function () { getState: function () {
return APP.instanceStatus.enableProfiling; return APP.instanceStatus.enableProfiling;
@ -1938,10 +1948,10 @@ define([
}, },
}); });
Messages.admin_bytesWrittenTitle = "Disk performance measurement window"; Messages.admin_bytesWrittenTitle = "Disk performance measurement window"; // XXX
Messages.admin_bytesWrittenHint = "If you have enabled disk performance measurements then the duration of the window can be configured below."; // XXX Messages.admin_bytesWrittenHint = "If you have enabled disk performance measurements then the duration of the window can be configured below."; // XXX
Messages.admin_bytesWrittenDuration = "Duration of the window in milliseconds: {0}"; // XXX Messages.admin_bytesWrittenDuration = "Duration of the window in milliseconds: {0}"; // XXX
Messages.admin_defaultDuration = "admin_defaultDuration"; // XXX //Messages.admin_defaultDuration = "admin_defaultDuration"; // XXX
Messages.admin_setDuration = "Set duration"; // XXX Messages.admin_setDuration = "Set duration"; // XXX
var isPositiveInteger = function (n) { var isPositiveInteger = function (n) {
@ -1985,7 +1995,7 @@ define([
UI.warn(Messages.error); UI.warn(Messages.error);
return void console.error(e, response); return void console.error(e, response);
} }
$div.find('.cp-admin-bytes-written-duration').text(Messages._getKey('admin_limit', [d])); $div.find('.cp-admin-bytes-written-duration').text(Messages._getKey('admin_bytesWrittenDuration', [d]));
}); });
}); });
@ -2037,7 +2047,6 @@ define([
}, },
}); });
// XXX disable this checkbox if server telemetry is disabled?
create['list-my-instance'] = makeAdminCheckbox({ // Messages.admin_listMyInstanceTitle.admin_listMyInstanceHint.admin_listMyInstanceLabel create['list-my-instance'] = makeAdminCheckbox({ // Messages.admin_listMyInstanceTitle.admin_listMyInstanceHint.admin_listMyInstanceLabel
key: 'list-my-instance', key: 'list-my-instance',
getState: function () { getState: function () {
@ -2274,6 +2283,7 @@ define([
APP.instanceStatus = data[0]; APP.instanceStatus = data[0];
console.log("Status", APP.instanceStatus); console.log("Status", APP.instanceStatus);
/*
var isListed = Boolean(APP.instanceStatus.listMyInstance); var isListed = Boolean(APP.instanceStatus.listMyInstance);
var $actions = $('.cp-listing-action'); var $actions = $('.cp-listing-action');
var $fields = $('.cp-listing-info'); var $fields = $('.cp-listing-info');
@ -2285,7 +2295,7 @@ define([
$actions.attr('disabled', 'disabled'); $actions.attr('disabled', 'disabled');
$fields.attr('disabled', 'disabled'); $fields.attr('disabled', 'disabled');
} }
*/
cb(); cb();
}); });
}; };

@ -48,48 +48,63 @@ define(function() {
*/ */
//AppConfig.availableLanguages = ['en', 'fr', 'de']; //AppConfig.availableLanguages = ['en', 'fr', 'de'];
/*
* AppConfig.imprint, AppConfig.privacy, AppConfig.terms, AppConfig.source, and AppConfig.roadmap
* define values used in at least one of the static pages' footer or the 'About CryptPad' menu.
*
* They can each be configured in one of three manners:
*
* 1. set their value to `false` to cause them not to be displayed, even if a default value exists
* example:
* AppConfig.privacy = false;
* 2. set their value to `true` to use the default value if it exists.
* example:
* AppConfig.privacy = true;
* 3. set their value to an object which maps language codes or a default setting to the relevant URL (as a string)
* example:
* AppConfig.privacy = {
* "default": 'https://example.com/privacy.html',
* "en": 'https://example.com/privacy.en.html', // in case English is not your default language
* "fr": 'https://example.com/privacy.fr.html', // another language
* "de": 'https://example.com/privacy.de.html', // you get the idea?
* };
*
*/
/* You can display a link to the imprint (legal notice) of your website in the static pages /* You can display a link to the imprint (legal notice) of your website in the static pages
* footer. To do so, you can either set the following value to `true` and create an imprint.html page * footer. Since this is different for each individual or organization there is
* in the `customize` directory. You can also set it to an absolute URL if your imprint page already exists. * no default value.
*
* See the comments above for a description of possible configurations.
*/ */
AppConfig.imprint = false; AppConfig.imprint = false;
// AppConfig.imprint = true;
// AppConfig.imprint = 'https://xwiki.com/en/company/legal-notice';
/* You can display a link to your own privacy policy in the static pages footer. /* You can display a link to your own privacy policy in the static pages footer.
* To do so, set the following value to the absolute URL of your privacy policy. * Since this is different for each individual or organization there is no default value.
*/ * See the comments above for a description of possible configurations.
// AppConfig.privacy = 'https://xwiki.com/en/company/PrivacyPolicy';
/* We (the project's developers) include the ability to display a 'Roadmap' in static pages footer.
* This is disabled by default.
* We use this to publish the project's development roadmap, but you can use it however you like.
* To do so, set the following value to an absolute URL.
*/ */
//AppConfig.roadmap = 'https://cryptpad.fr/kanban/#/2/kanban/view/PLM0C3tFWvYhd+EPzXrbT+NxB76Z5DtZhAA5W5hG9wo/';
// XXX
/*
AppConfig.imprint, AppConfig.privacy, AppConfig.terms, AppConfig.source, and AppConfig.roadmap can each be configured in one of three manners:
// to prevent the display of privacy policy entirely:
AppConfig.privacy = false; AppConfig.privacy = false;
// to display the default privacy policy: /* You can display a link to your instances's terms of service in the static pages footer.
AppConfig.privacy = true; * Since this is different for each individual or organization there is no default value.
*
// to display translated versions of the privacy policy depending on * See the comments above for a description of possible configurations.
// the user's configured or inferred language */
AppConfig.privacy = { AppConfig.terms = false;
'default': '...', // displayed if there is no exact match
'en': '/privacy.en.html', /* The terms of CryptPad's license require that its source code be made available
'fr': '/privacy.fr.html', * to anyone who uses the software. If you have not made any modifications to the platform
}; * then it is sufficient to leave this as-is. If you have made changes, customize
* this value to a software repository which includes the source code including your modifications.
*
* See the comments above for a description of possible configurations.
*/ */
AppConfig.source = 'https://github.com/xwiki-labs/cryptpad/'; // XXX AppConfig.source = true;
/* If you wish to communicate your organization's roadmap to your users you may use the setting below.
* Since this is different for each individual or organization there is no default value.
*/
AppConfig.roadmap = false;
/* Cryptpad apps use a common API to display notifications to users /* Cryptpad apps use a common API to display notifications to users
* by default, notifications are hidden after 5 seconds * by default, notifications are hidden after 5 seconds

@ -147,6 +147,7 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
var makeCategoryDropdown = function (ctx, container, onChange, all) { var makeCategoryDropdown = function (ctx, container, onChange, all) {
var categories = [ var categories = [
// Msg.support_cat_data is left included because old tickets may still use it
'account', // Msg.support_cat_account 'account', // Msg.support_cat_account
'drives', // Msg.support_cat_drives 'drives', // Msg.support_cat_drives
'document', // Msg.support_cat_document, 'document', // Msg.support_cat_document,
@ -213,7 +214,8 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
makeCategoryDropdown(ctx, catContainer, function (key) { makeCategoryDropdown(ctx, catContainer, function (key) {
$(category).val(key); $(category).val(key);
console.log(key); //console.log(key);
// Msg.support_warning_abuse.support_warning_account.support_warning_bug.support_warning_document.support_warning_drives.support_warning_other
var warning = Messages['support_warning_' + key] || ''; var warning = Messages['support_warning_' + key] || '';
var warningLink = warningLinks[key]; var warningLink = warningLinks[key];
if (!warningLink) { if (!warningLink) {

Loading…
Cancel
Save