2020-07-20 13:30:35 +03:00
|
|
|
window.addEventListener('DOMContentLoaded', function(){
|
2014-09-09 19:06:50 +04:00
|
|
|
$('#excludedGroups').each(function (index, element) {
|
2014-09-09 20:00:53 +04:00
|
|
|
OC.Settings.setupGroupsSelect($(element));
|
2014-09-10 16:30:02 +04:00
|
|
|
$(element).change(function(ev) {
|
|
|
|
var groups = ev.val || [];
|
2015-10-01 16:37:55 +03:00
|
|
|
groups = JSON.stringify(groups);
|
2016-09-20 12:17:13 +03:00
|
|
|
OCP.AppConfig.setValue('core', $(this).attr('name'), groups);
|
2014-09-10 16:30:02 +04:00
|
|
|
});
|
2014-05-13 17:22:18 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2011-10-16 23:08:44 +04:00
|
|
|
$('#loglevel').change(function(){
|
2014-12-21 00:44:41 +03:00
|
|
|
$.post(OC.generateUrl('/settings/admin/log/level'), {level: $(this).val()},function(){
|
2012-04-16 14:27:21 +04:00
|
|
|
OC.Log.reload();
|
|
|
|
} );
|
2012-08-09 12:41:10 +04:00
|
|
|
});
|
|
|
|
|
2016-07-13 10:59:42 +03:00
|
|
|
$('#backgroundjobs span.crondate').tooltip({placement: 'top'});
|
2015-02-28 23:48:19 +03:00
|
|
|
|
2012-08-09 12:41:10 +04:00
|
|
|
$('#backgroundjobs input').change(function(){
|
2016-04-19 16:13:37 +03:00
|
|
|
if($(this).is(':checked')){
|
2012-08-27 06:05:34 +04:00
|
|
|
var mode = $(this).val();
|
2013-04-17 17:32:03 +04:00
|
|
|
if (mode === 'ajax' || mode === 'webcron' || mode === 'cron') {
|
2017-03-13 17:52:16 +03:00
|
|
|
OCP.AppConfig.setValue('core', 'backgroundjobs_mode', mode, {
|
|
|
|
success: function() {
|
|
|
|
// clear cron errors on background job mode change
|
|
|
|
OCP.AppConfig.deleteKey('core', 'cronErrors');
|
|
|
|
}
|
|
|
|
});
|
2012-08-27 06:05:34 +04:00
|
|
|
}
|
2012-08-09 12:41:10 +04:00
|
|
|
}
|
|
|
|
});
|
2012-08-28 04:36:34 +04:00
|
|
|
|
|
|
|
$('#shareAPIEnabled').change(function() {
|
2014-06-13 19:41:45 +04:00
|
|
|
$('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked);
|
2012-08-28 04:36:34 +04:00
|
|
|
});
|
|
|
|
|
2015-05-05 11:38:09 +03:00
|
|
|
$('#enableEncryption').change(function() {
|
2015-05-04 14:00:17 +03:00
|
|
|
$('#encryptionAPI div#EncryptionWarning').toggleClass('hidden');
|
2015-01-14 22:39:23 +03:00
|
|
|
});
|
|
|
|
|
2015-05-05 11:38:09 +03:00
|
|
|
$('#reallyEnableEncryption').click(function() {
|
|
|
|
$('#encryptionAPI div#EncryptionWarning').toggleClass('hidden');
|
|
|
|
$('#encryptionAPI div#EncryptionSettingsArea').toggleClass('hidden');
|
2016-09-20 12:17:13 +03:00
|
|
|
OCP.AppConfig.setValue('core', 'encryption_enabled', 'yes');
|
2015-05-05 11:38:09 +03:00
|
|
|
$('#enableEncryption').attr('disabled', 'disabled');
|
2015-01-14 22:39:23 +03:00
|
|
|
});
|
|
|
|
|
2015-04-09 17:07:15 +03:00
|
|
|
$('#startmigration').click(function(event){
|
|
|
|
$(window).on('beforeunload.encryption', function(e) {
|
|
|
|
return t('settings', 'Migration in progress. Please wait until the migration is finished');
|
|
|
|
});
|
|
|
|
event.preventDefault();
|
|
|
|
$('#startmigration').prop('disabled', true);
|
|
|
|
OC.msg.startAction('#startmigration_msg', t('settings', 'Migration started …'));
|
|
|
|
$.post(OC.generateUrl('/settings/admin/startmigration'), '', function(data){
|
|
|
|
OC.msg.finishedAction('#startmigration_msg', data);
|
|
|
|
if (data['status'] === 'success') {
|
|
|
|
$('#encryptionAPI div#selectEncryptionModules').toggleClass('hidden');
|
|
|
|
$('#encryptionAPI div#migrationWarning').toggleClass('hidden');
|
|
|
|
} else {
|
|
|
|
$('#startmigration').prop('disabled', false);
|
|
|
|
}
|
|
|
|
$(window).off('beforeunload.encryption');
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-10-29 21:34:41 +03:00
|
|
|
$('#shareapiExpireAfterNDays').on('input', function() {
|
|
|
|
this.value = this.value.replace(/\D/g, '');
|
2015-02-06 18:27:42 +03:00
|
|
|
});
|
|
|
|
|
2016-09-08 10:13:59 +03:00
|
|
|
$('#shareAPI input:not(.noJSAutoUpdate)').change(function() {
|
2014-10-30 16:59:13 +03:00
|
|
|
var value = $(this).val();
|
2013-04-17 17:32:03 +04:00
|
|
|
if ($(this).attr('type') === 'checkbox') {
|
2012-08-28 04:45:36 +04:00
|
|
|
if (this.checked) {
|
2014-10-30 16:59:13 +03:00
|
|
|
value = 'yes';
|
2012-08-28 04:45:36 +04:00
|
|
|
} else {
|
2014-10-30 16:59:13 +03:00
|
|
|
value = 'no';
|
2012-08-28 04:45:36 +04:00
|
|
|
}
|
2012-08-28 04:36:34 +04:00
|
|
|
}
|
2016-09-20 12:17:13 +03:00
|
|
|
OCP.AppConfig.setValue('core', $(this).attr('name'), value);
|
2012-08-28 04:36:34 +04:00
|
|
|
});
|
2013-01-11 17:18:51 +04:00
|
|
|
|
2014-05-09 16:58:33 +04:00
|
|
|
$('#shareapiDefaultExpireDate').change(function() {
|
|
|
|
$("#setDefaultExpireDate").toggleClass('hidden', !this.checked);
|
|
|
|
});
|
|
|
|
|
2019-11-13 17:43:11 +03:00
|
|
|
$('#shareapiDefaultInternalExpireDate').change(function() {
|
|
|
|
$("#setDefaultInternalExpireDate").toggleClass('hidden', !this.checked);
|
|
|
|
});
|
|
|
|
|
2021-03-25 19:32:49 +03:00
|
|
|
$('#shareapiDefaultRemoteExpireDate').change(function() {
|
|
|
|
$("#setDefaultRemoteExpireDate").toggleClass('hidden', !this.checked);
|
|
|
|
});
|
|
|
|
|
2016-09-08 10:13:59 +03:00
|
|
|
$('#publicShareDisclaimer').change(function() {
|
|
|
|
$("#publicShareDisclaimerText").toggleClass('hidden', !this.checked);
|
|
|
|
if(!this.checked) {
|
|
|
|
savePublicShareDisclaimerText('');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-12-01 13:35:01 +03:00
|
|
|
$('#shareApiDefaultPermissionsSection input').change(function(ev) {
|
|
|
|
var $el = $('#shareApiDefaultPermissions');
|
|
|
|
var $target = $(ev.target);
|
|
|
|
|
|
|
|
var value = $el.val();
|
|
|
|
if ($target.is(':checked')) {
|
|
|
|
value = value | $target.val();
|
|
|
|
} else {
|
|
|
|
value = value & ~$target.val();
|
|
|
|
}
|
|
|
|
|
|
|
|
// always set read permission
|
|
|
|
value |= OC.PERMISSION_READ;
|
|
|
|
|
|
|
|
// this will trigger the field's change event and will save it
|
|
|
|
$el.val(value).change();
|
|
|
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2016-09-08 10:13:59 +03:00
|
|
|
var savePublicShareDisclaimerText = _.debounce(function(value) {
|
2016-09-19 20:43:47 +03:00
|
|
|
var options = {
|
|
|
|
success: function() {
|
|
|
|
OC.msg.finishedSuccess('#publicShareDisclaimerStatus', t('core', 'Saved'));
|
|
|
|
},
|
|
|
|
error: function() {
|
|
|
|
OC.msg.finishedError('#publicShareDisclaimerStatus', t('core', 'Not saved'));
|
|
|
|
}
|
2016-09-08 10:13:59 +03:00
|
|
|
};
|
2016-09-19 20:43:47 +03:00
|
|
|
|
|
|
|
OC.msg.startSaving('#publicShareDisclaimerStatus');
|
2016-09-08 10:13:59 +03:00
|
|
|
if (_.isString(value) && value !== '') {
|
2016-09-19 20:43:47 +03:00
|
|
|
OCP.AppConfig.setValue('core', 'shareapi_public_link_disclaimertext', value, options);
|
2016-09-08 10:13:59 +03:00
|
|
|
} else {
|
|
|
|
$('#publicShareDisclaimerText').val('');
|
2016-09-19 20:43:47 +03:00
|
|
|
OCP.AppConfig.deleteKey('core', 'shareapi_public_link_disclaimertext', options);
|
2016-09-08 10:13:59 +03:00
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
$('#publicShareDisclaimerText').on('change, keyup', function() {
|
|
|
|
savePublicShareDisclaimerText(this.value);
|
|
|
|
});
|
|
|
|
|
2020-02-18 21:42:57 +03:00
|
|
|
$('#shareapi_allow_share_dialog_user_enumeration').on('change', function() {
|
|
|
|
$('#shareapi_restrict_user_enumeration_to_group_setting').toggleClass('hidden', !this.checked);
|
2021-03-09 23:46:42 +03:00
|
|
|
$('#shareapi_restrict_user_enumeration_to_phone_setting').toggleClass('hidden', !this.checked);
|
2021-03-10 17:17:36 +03:00
|
|
|
$('#shareapi_restrict_user_enumeration_combinewarning_setting').toggleClass('hidden', !this.checked);
|
2020-02-18 21:42:57 +03:00
|
|
|
})
|
|
|
|
|
2014-05-09 16:58:33 +04:00
|
|
|
$('#allowLinks').change(function() {
|
|
|
|
$("#publicLinkSettings").toggleClass('hidden', !this.checked);
|
2014-06-13 19:41:45 +04:00
|
|
|
$('#setDefaultExpireDate').toggleClass('hidden', !(this.checked && $('#shareapiDefaultExpireDate')[0].checked));
|
2014-05-09 16:58:33 +04:00
|
|
|
});
|
|
|
|
|
2014-02-12 20:21:41 +04:00
|
|
|
$('#mail_smtpauth').change(function() {
|
|
|
|
if (!this.checked) {
|
2014-02-19 20:42:05 +04:00
|
|
|
$('#mail_credentials').addClass('hidden');
|
2014-02-12 20:21:41 +04:00
|
|
|
} else {
|
2014-02-19 20:42:05 +04:00
|
|
|
$('#mail_credentials').removeClass('hidden');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#mail_smtpmode').change(function() {
|
2014-02-26 16:10:46 +04:00
|
|
|
if ($(this).val() !== 'smtp') {
|
2014-02-19 20:42:05 +04:00
|
|
|
$('#setting_smtpauth').addClass('hidden');
|
|
|
|
$('#setting_smtphost').addClass('hidden');
|
|
|
|
$('#mail_smtpsecure_label').addClass('hidden');
|
|
|
|
$('#mail_smtpsecure').addClass('hidden');
|
|
|
|
$('#mail_credentials').addClass('hidden');
|
2018-11-13 01:27:18 +03:00
|
|
|
$('#mail_sendmailmode_label, #mail_sendmailmode').removeClass('hidden');
|
2014-02-19 20:42:05 +04:00
|
|
|
} else {
|
|
|
|
$('#setting_smtpauth').removeClass('hidden');
|
|
|
|
$('#setting_smtphost').removeClass('hidden');
|
|
|
|
$('#mail_smtpsecure_label').removeClass('hidden');
|
|
|
|
$('#mail_smtpsecure').removeClass('hidden');
|
2016-04-19 16:13:37 +03:00
|
|
|
if ($('#mail_smtpauth').is(':checked')) {
|
2014-02-19 20:42:05 +04:00
|
|
|
$('#mail_credentials').removeClass('hidden');
|
|
|
|
}
|
2018-11-13 01:27:18 +03:00
|
|
|
$('#mail_sendmailmode_label, #mail_sendmailmode').addClass('hidden');
|
2014-02-12 20:21:41 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-19 19:40:47 +03:00
|
|
|
var changeEmailSettings = function() {
|
|
|
|
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
|
|
|
OC.PasswordConfirmation.requirePasswordConfirmation(changeEmailSettings);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-26 15:13:20 +04:00
|
|
|
OC.msg.startSaving('#mail_settings_msg');
|
2016-09-19 19:40:47 +03:00
|
|
|
$.ajax({
|
|
|
|
url: OC.generateUrl('/settings/admin/mailsettings'),
|
|
|
|
type: 'POST',
|
|
|
|
data: $('#mail_general_settings_form').serialize(),
|
2017-04-18 16:44:20 +03:00
|
|
|
success: function(){
|
|
|
|
OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'));
|
2016-09-19 19:40:47 +03:00
|
|
|
},
|
2017-04-18 16:44:20 +03:00
|
|
|
error: function(xhr){
|
|
|
|
OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON);
|
2016-09-19 19:40:47 +03:00
|
|
|
}
|
2014-02-12 20:21:41 +04:00
|
|
|
});
|
2016-09-19 19:40:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
var toggleEmailCredentials = function() {
|
|
|
|
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
|
|
|
OC.PasswordConfirmation.requirePasswordConfirmation(toggleEmailCredentials);
|
|
|
|
return;
|
|
|
|
}
|
2014-02-26 15:13:20 +04:00
|
|
|
|
2014-10-03 17:14:22 +04:00
|
|
|
OC.msg.startSaving('#mail_settings_msg');
|
2016-09-19 19:40:47 +03:00
|
|
|
$.ajax({
|
|
|
|
url: OC.generateUrl('/settings/admin/mailsettings/credentials'),
|
|
|
|
type: 'POST',
|
|
|
|
data: $('#mail_credentials_settings').serialize(),
|
2017-04-18 16:44:20 +03:00
|
|
|
success: function(){
|
|
|
|
OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'));
|
2016-09-19 19:40:47 +03:00
|
|
|
},
|
2017-04-18 16:44:20 +03:00
|
|
|
error: function(xhr){
|
|
|
|
OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON);
|
2016-09-19 19:40:47 +03:00
|
|
|
}
|
2014-10-03 17:14:22 +04:00
|
|
|
});
|
2016-09-19 19:40:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
$('#mail_general_settings_form').change(changeEmailSettings);
|
|
|
|
$('#mail_credentials_settings_submit').click(toggleEmailCredentials);
|
2017-04-18 16:44:20 +03:00
|
|
|
$('#mail_smtppassword').click(function() {
|
|
|
|
if (this.type === 'text' && this.value === '********') {
|
|
|
|
this.type = 'password';
|
|
|
|
this.value = '';
|
|
|
|
}
|
|
|
|
});
|
2014-10-03 17:14:22 +04:00
|
|
|
|
2014-06-25 17:32:40 +04:00
|
|
|
$('#sendtestemail').click(function(event){
|
|
|
|
event.preventDefault();
|
2017-04-18 16:44:20 +03:00
|
|
|
OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…'));
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: OC.generateUrl('/settings/admin/mailtest'),
|
|
|
|
type: 'POST',
|
|
|
|
success: function(){
|
|
|
|
OC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'));
|
|
|
|
},
|
|
|
|
error: function(xhr){
|
|
|
|
OC.msg.finishedError('#sendtestmail_msg', xhr.responseJSON);
|
|
|
|
}
|
|
|
|
});
|
2014-02-12 20:21:41 +04:00
|
|
|
});
|
2014-05-13 17:22:18 +04:00
|
|
|
|
2016-03-18 18:23:33 +03:00
|
|
|
$('#allowGroupSharing').change(function() {
|
|
|
|
$('#allowGroupSharing').toggleClass('hidden', !this.checked);
|
|
|
|
});
|
|
|
|
|
2014-05-13 17:22:18 +04:00
|
|
|
$('#shareapiExcludeGroups').change(function() {
|
|
|
|
$("#selectExcludedGroups").toggleClass('hidden', !this.checked);
|
|
|
|
});
|
2014-02-03 15:48:17 +04:00
|
|
|
|
2019-01-05 18:29:57 +03:00
|
|
|
var setupChecks = function () {
|
|
|
|
// run setup checks then gather error messages
|
|
|
|
$.when(
|
|
|
|
OC.SetupChecks.checkWebDAV(),
|
2020-12-14 17:56:07 +03:00
|
|
|
OC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/webfinger', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),
|
|
|
|
OC.SetupChecks.checkWellKnownUrl('GET', '/.well-known/nodeinfo', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true, [200, 404], true),
|
|
|
|
OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
|
|
|
OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/carddav', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
2019-05-14 12:14:29 +03:00
|
|
|
OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocm-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
|
|
|
OC.SetupChecks.checkProviderUrl(OC.getRootPath() + '/ocs-provider/', OC.theme.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
2019-01-05 18:29:57 +03:00
|
|
|
OC.SetupChecks.checkSetup(),
|
|
|
|
OC.SetupChecks.checkGeneric(),
|
2019-06-21 23:35:30 +03:00
|
|
|
OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), OC.theme.docPlaceholderUrl),
|
2019-01-05 18:29:57 +03:00
|
|
|
OC.SetupChecks.checkDataProtected()
|
2019-07-16 02:03:57 +03:00
|
|
|
).then(function (check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11) {
|
|
|
|
var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8, check9, check10, check11);
|
2019-01-05 18:29:57 +03:00
|
|
|
var $el = $('#postsetupchecks');
|
|
|
|
$('#security-warning-state-loading').addClass('hidden');
|
|
|
|
|
|
|
|
var hasMessages = false;
|
|
|
|
var $errorsEl = $el.find('.errors');
|
|
|
|
var $warningsEl = $el.find('.warnings');
|
|
|
|
var $infoEl = $el.find('.info');
|
|
|
|
|
|
|
|
for (var i = 0; i < messages.length; i++) {
|
|
|
|
switch (messages[i].type) {
|
|
|
|
case OC.SetupChecks.MESSAGE_TYPE_INFO:
|
|
|
|
$infoEl.append('<li>' + messages[i].msg + '</li>');
|
|
|
|
break;
|
|
|
|
case OC.SetupChecks.MESSAGE_TYPE_WARNING:
|
|
|
|
$warningsEl.append('<li>' + messages[i].msg + '</li>');
|
|
|
|
break;
|
|
|
|
case OC.SetupChecks.MESSAGE_TYPE_ERROR:
|
|
|
|
default:
|
|
|
|
$errorsEl.append('<li>' + messages[i].msg + '</li>');
|
|
|
|
}
|
2015-11-08 03:02:59 +03:00
|
|
|
}
|
|
|
|
|
2018-06-06 14:28:50 +03:00
|
|
|
if ($errorsEl.find('li').length > 0) {
|
2019-01-05 18:29:57 +03:00
|
|
|
$errorsEl.removeClass('hidden');
|
|
|
|
hasMessages = true;
|
2018-06-06 14:28:50 +03:00
|
|
|
}
|
2019-01-05 18:29:57 +03:00
|
|
|
if ($warningsEl.find('li').length > 0) {
|
|
|
|
$warningsEl.removeClass('hidden');
|
|
|
|
hasMessages = true;
|
|
|
|
}
|
|
|
|
if ($infoEl.find('li').length > 0) {
|
|
|
|
$infoEl.removeClass('hidden');
|
|
|
|
hasMessages = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasMessages) {
|
|
|
|
$('#postsetupchecks-hint').removeClass('hidden');
|
|
|
|
if ($errorsEl.find('li').length > 0) {
|
|
|
|
$('#security-warning-state-failure').removeClass('hidden');
|
|
|
|
} else {
|
|
|
|
$('#security-warning-state-warning').removeClass('hidden');
|
|
|
|
}
|
2018-06-06 13:20:44 +03:00
|
|
|
} else {
|
2019-01-05 18:29:57 +03:00
|
|
|
var securityWarning = $('#security-warning');
|
|
|
|
if (securityWarning.children('ul').children().length === 0) {
|
|
|
|
$('#security-warning-state-ok').removeClass('hidden');
|
|
|
|
} else {
|
|
|
|
$('#security-warning-state-failure').removeClass('hidden');
|
|
|
|
}
|
2015-08-18 17:42:25 +03:00
|
|
|
}
|
2019-01-05 18:29:57 +03:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
if (document.getElementById('security-warning') !== null) {
|
|
|
|
setupChecks();
|
|
|
|
}
|
2012-09-06 00:17:33 +04:00
|
|
|
});
|