diff --git a/Web/css/librebooking.css b/Web/css/librebooking.css index f80bf04eb..32e68e601 100644 --- a/Web/css/librebooking.css +++ b/Web/css/librebooking.css @@ -86,11 +86,6 @@ img.logo { color: var(--primary-hover) !important; } -/* -.dropdown-toggle.show { - color: var(--primary-hover) !important; -} -*/ .dropdown-menu { --bs-dropdown-link-active-bg: var(--primary); font-size: 12px; @@ -298,7 +293,6 @@ li.ui-timepicker-selected, background: var(--primary); } -.horizontal-list li, .updateCustomAttribute, .reservation-list-dates div { min-width: 240px; @@ -611,6 +605,22 @@ input.mid-number { margin: 0; } +.trumbowyg-modal-submit { + background-color: var(--primary) !important; + color: var(--text-color-btn) !important; +} + +.descriptionValue a, +.descriptionContent a, +.notesValue a, +.noteContent a, +.announcement a, +.announcementText a, +.announcementContent a, +.trumbowyg-editor a { + color: var(--primary); +} + .editable-container.editable-popup { max-width: 50% !important; } diff --git a/Web/scripts/admin/announcement.js b/Web/scripts/admin/announcement.js index d272c54f3..990143eab 100644 --- a/Web/scripts/admin/announcement.js +++ b/Web/scripts/admin/announcement.js @@ -20,20 +20,20 @@ function AnnouncementManagement(opts) { editPriority: $('#editPriority'), editUserGroups: $('#editUserGroups'), editResourceGroups: $('#editResourceGroups'), - editUserGroupsDiv: $('#editUserGroupsDiv'), - editResourceGroupsDiv: $('#editResourceGroupsDiv'), + editUserGroupsDiv: $('#editUserGroupsDiv'), + editResourceGroupsDiv: $('#editResourceGroupsDiv'), emailCount: $('#emailCount'), - displayPage: $('#addPage'), - moreOptions: $('#moreOptions') + displayPage: $('#addPage'), + moreOptions: $('#moreOptions') }; var announcements = new Object(); AnnouncementManagement.prototype.init = function () { - elements.announcementList.on( 'click', 'a.update', function (e) { + elements.announcementList.on('click', 'a.update', function (e) { setActiveId($(this)); e.preventDefault(); }); @@ -48,15 +48,14 @@ function AnnouncementManagement(opts) { deleteAnnouncement(); }); - elements.displayPage.change(function(e){ - if ($(this).val() == '5') - { - elements.moreOptions.hide(); - } - else { - elements.moreOptions.show(); - } - }); + elements.displayPage.change(function (e) { + if ($(this).val() == '5') { + elements.moreOptions.hide(); + } + else { + elements.moreOptions.show(); + } + }); $(".save").click(function () { $(this).closest('form').submit(); @@ -68,9 +67,19 @@ function AnnouncementManagement(opts) { ConfigureAsyncForm(elements.addForm, getSubmitCallback(options.actions.add)); ConfigureAsyncForm(elements.deleteForm, getSubmitCallback(options.actions.deleteAnnouncement)); - ConfigureAsyncForm(elements.form, getSubmitCallback(options.actions.edit)); - ConfigureAsyncForm(elements.emailForm, getSubmitCallback(options.actions.email), function() { - elements.emailDialog.modal('hide');} + ConfigureAsyncForm(elements.form, function () { + // Sanitize the content of the Trumbowyg before sending it + const rawContent = $('#editText').trumbowyg('html'); + const sanitizedHtml = DOMPurify.sanitize(rawContent); + + // Update the textarea with clean content before submitting + $('#editText').val(sanitizedHtml); + + return options.submitUrl + "?aid=" + getActiveId() + "&action=" + options.actions.edit; + }); + ConfigureAsyncForm(elements.emailForm, getSubmitCallback(options.actions.email), function () { + elements.emailDialog.modal('hide'); + } ); }; @@ -91,41 +100,43 @@ function AnnouncementManagement(opts) { var editAnnouncement = function () { var announcement = getActiveAnnouncement(); + // date formatting, temporary? + var startDateFormatted = moment(announcement.start, 'DD/MM/YYYY').format('YYYY-MM-DD'); + var endDateFormatted = moment(announcement.end, 'DD/MM/YYYY').format('YYYY-MM-DD'); + elements.editText.val(HtmlDecode(announcement.text)); - elements.editBegin.val(announcement.start); + elements.editBegin.val(startDateFormatted); elements.editBegin.trigger('change'); - elements.editEnd.val(announcement.end); + elements.editEnd.val(endDateFormatted); elements.editEnd.trigger('change'); elements.editPriority.val(announcement.priority); - if (announcement.displayPage == 5) - { - elements.editUserGroupsDiv.hide(); - elements.editResourceGroupsDiv.hide(); - } - else - { - elements.editUserGroupsDiv.show(); - elements.editResourceGroupsDiv.show(); - - elements.editUserGroups.val($.map(announcement.groupIds, function(i){ - return i + ""; - })); - elements.editUserGroups.trigger('change'); - - elements.editResourceGroups.val($.map(announcement.resourceIds, function(i){ - return i + ""; - })); - elements.editResourceGroups.trigger('change'); - } + if (announcement.displayPage == 5) { + elements.editUserGroupsDiv.hide(); + elements.editResourceGroupsDiv.hide(); + } + else { + elements.editUserGroupsDiv.show(); + elements.editResourceGroupsDiv.show(); + + elements.editUserGroups.val($.map(announcement.groupIds, function (i) { + return i + ""; + })); + elements.editUserGroups.trigger('change'); + + elements.editResourceGroups.val($.map(announcement.resourceIds, function (i) { + return i + ""; + })); + elements.editResourceGroups.trigger('change'); + } elements.editDialog.modal('show'); }; - var emailAnnouncement = function() { + var emailAnnouncement = function () { var announcement = getActiveAnnouncement(); - ajaxGet(options.getEmailCountUrl + '&aid=' +announcement.id, function(){}, function(data) { + ajaxGet(options.getEmailCountUrl + '&aid=' + announcement.id, function () { }, function (data) { elements.emailCount.text(data.users); elements.emailDialog.modal('show'); }); @@ -140,6 +151,6 @@ function AnnouncementManagement(opts) { }; AnnouncementManagement.prototype.addAnnouncement = function (id, text, start, end, priority, groupIds, resourceIds, displayPage) { - announcements[id] = {id: id, text: text, start: start, end: end, priority: priority, groupIds: groupIds, resourceIds: resourceIds, displayPage: displayPage}; + announcements[id] = { id: id, text: text, start: start, end: end, priority: priority, groupIds: groupIds, resourceIds: resourceIds, displayPage: displayPage }; }; } diff --git a/Web/scripts/admin/email-templates.js b/Web/scripts/admin/email-templates.js index fdbdf39bf..e0aa80d5b 100644 --- a/Web/scripts/admin/email-templates.js +++ b/Web/scripts/admin/email-templates.js @@ -8,6 +8,7 @@ function EmailTemplateManagement(opts) { updateEmailForm: $('#updateEmailForm'), reloadEmailContents: $('#reloadEmailContents'), templatePath: $('#templatePath'), + selectedLanguage: $('#selectedLanguage'), updateSuccess: $('#updateSuccess'), updateFailed: $('#updateFailed'), @@ -17,14 +18,6 @@ function EmailTemplateManagement(opts) { EmailTemplateManagement.prototype.init = function () { - $(".save").click(function () { - $(this).closest('form').submit(); - }); - - $(".cancel").click(function () { - $(this).closest('.dialog').dialog("close"); - }); - elements.languageOpts.on('change', function (e) { document.location = options.scriptUrl + '?lang=' + elements.languageOpts.val(); }); @@ -36,6 +29,7 @@ function EmailTemplateManagement(opts) { } else { elements.templatePath.val(templateName); + elements.selectedLanguage.val(elements.languageOpts.val()); ajaxGet(options.scriptUrl + '?dr=template&lang=' + elements.languageOpts.val() + '&tn=' + templateName, null, loadTemplate); } }); diff --git a/lang/en_us/AccountCreation-custom.tpl b/lang/en_us/AccountCreation-custom.tpl deleted file mode 100644 index cc63b5c67..000000000 --- a/lang/en_us/AccountCreation-custom.tpl +++ /dev/null @@ -1,11 +0,0 @@ -
{$To},
- -A new user has registered with the following information:
- Email: {$EmailAddress}
- Name: {$FullName}
- Phone: {$Phone}
- Organization: {$Organization}
- Position: {$Position}