feat(core): Add message of the day

This commit is contained in:
smizrahi
2024-01-22 14:34:22 +01:00
parent 0d0eda2698
commit eee50697b0
32 changed files with 1362 additions and 326 deletions
@@ -4,7 +4,7 @@
(function() {
'use strict';
angular.module('SOGo.AdministrationUI', ['ui.router', 'SOGo.Common', 'SOGo.Authentication', 'SOGo.PreferencesUI', 'SOGo.ContactsUI', 'SOGo.SchedulerUI'])
angular.module('SOGo.AdministrationUI', ['ui.router', 'SOGo.Common', 'SOGo.Authentication', 'SOGo.PreferencesUI', 'SOGo.ContactsUI', 'SOGo.SchedulerUI', 'sgCkeditor'])
.config(configure)
.run(runBlock);
@@ -56,6 +56,16 @@
controllerAs: 'ctrl'
}
}
})
.state('administration.motd', {
url: '/motd',
views: {
module: {
templateUrl: 'UIxAdministrationMotd', // UI/Templates/Administration/UIxAdministrationMotd.wox
controller: 'AdministrationMotdController',
controllerAs: 'ctrl'
}
}
});
// if none of the above states are matched, use this as the fallback
@@ -29,6 +29,34 @@
return new Administration(); // return unique instance
}];
/**
* @function $getMotd
* @memberof Administration.prototype
* @desc Get the motd to the server.
*/
Administration.prototype.$getMotd = function () {
var _this = this;
return Administration.$$resource.fetch("Administration/getMotd")
.then(function (data) {
return data;
});
};
/**
* @function $saveMotd
* @memberof Administration.prototype
* @desc Save the motd to the server.
*/
Administration.prototype.$saveMotd = function (message) {
var _this = this;
return Administration.$$resource.save("Administration", { motd: message }, { action: "saveMotd" })
.then(function (data) {
return data;
});
};
/* Initialize module if necessary */
try {
angular.module('SOGo.AdministrationUI');
@@ -0,0 +1,48 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* JavaScript for SOGoAdministration */
(function() {
'use strict';
/**
* @ngInject
*/
AdministrationMotdController.$inject = ['$timeout', '$state', '$mdMedia', '$mdToast', 'sgConstant', 'Administration', 'sgSettings'];
function AdministrationMotdController($timeout, $state, $mdMedia, $mdToast, sgConstant, Administration, Settings) {
var vm = this;
vm.administration = Administration;
vm.motd = null;
vm.save = save;
vm.clear = clear;
vm.ckConfig = {
'autoGrow_minHeight': 200,
removeButtons: 'Save,NewPage,Preview,Print,Templates,Cut,Copy,Paste,PasteText,PasteFromWord,Undo,Redo,Find,Replace,SelectAll,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,Image,HiddenField,CopyFormatting,RemoveFormat,NumberedList,BulletedList,Outdent,Indent,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,Styles,Format,Maximize,ShowBlocks,About,Strike,Subscript,Superscript,Underline,Emojipanel,Emoji,'
};
this.administration.$getMotd().then(function (data) {
if (data && data.motd) {
vm.motd = data.motd;
}
});
function save() {
this.administration.$saveMotd(vm.motd).then(function () {
$mdToast.show(
$mdToast.simple()
.textContent(l('Message of the day has been saved'))
.position(sgConstant.toastPosition)
.hideDelay(3000));
});
}
function clear() {
console.log('HEY');
vm.motd = '';
}
}
angular
.module('SOGo.AdministrationUI')
.controller('AdministrationMotdController', AdministrationMotdController);
})();