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}

-{if !empty($CreatedBy)} - Created by: {$CreatedBy} -{/if} \ No newline at end of file diff --git a/tpl/Admin/Configuration/manage_email_templates.tpl b/tpl/Admin/Configuration/manage_email_templates.tpl index c3ae20d35..89e2fd09d 100644 --- a/tpl/Admin/Configuration/manage_email_templates.tpl +++ b/tpl/Admin/Configuration/manage_email_templates.tpl @@ -42,6 +42,7 @@ + {csrf_token} diff --git a/tpl/Admin/Resources/manage_resources.tpl b/tpl/Admin/Resources/manage_resources.tpl index 4dcb61056..17a2097b4 100644 --- a/tpl/Admin/Resources/manage_resources.tpl +++ b/tpl/Admin/Resources/manage_resources.tpl @@ -175,7 +175,6 @@ - {*{pagination pageInfo=$PageInfo showCount=true}*}
@@ -298,6 +297,10 @@ +
+ + {$id} +
@@ -2124,31 +2127,31 @@ container: 'body', html: true, placement: 'top', - trigger: 'manual', + trigger: 'manual', content: function() { var popoverId = $(this).data('popover-content'); return $(popoverId).html(); } }); - $('[rel="popover"]').on('click', function(e) { - e.preventDefault(); - e.stopPropagation(); + $('[rel="popover"]').on('click', function(e) { + e.preventDefault(); + e.stopPropagation(); - // Hide other popovers if needed - $('[rel="popover"]').not(this).popover('hide'); + // Hide other popovers if needed + $('[rel="popover"]').not(this).popover('hide'); - // Toggle the clicked one - $(this).popover('toggle'); - }); + // Toggle the clicked one + $(this).popover('toggle'); + }); - $('.descriptionValue').on('shown', function(e, editable) { - $(document).off('click.editable'); - }); + $('.descriptionValue').on('shown', function(e, editable) { + $(document).off('click.editable'); + }); - $('.notesValue').on('shown', function(e, editable) { - $(document).off('click.editable'); - }); + $('.notesValue').on('shown', function(e, editable) { + $(document).off('click.editable'); + }); } function setupCustomAttributesIcon() { @@ -2223,7 +2226,7 @@ }); $('.descriptionValue').editable({ -url: updateUrl + '{ManageResourcesActions::ActionChangeDescription}', + url: updateUrl + '{ManageResourcesActions::ActionChangeDescription}', emptytext: "{translate key='NoDescriptionLabel'|escape:'javascript'}" }); @@ -2402,4 +2405,4 @@ url: updateUrl + '{ManageResourcesActions::ActionChangeDescription}',
-{include file='globalfooter.tpl'} +{include file='globalfooter.tpl'} \ No newline at end of file diff --git a/tpl/Admin/Resources/view_resources.tpl b/tpl/Admin/Resources/view_resources.tpl index 6d830e4a2..5e7b81e33 100644 --- a/tpl/Admin/Resources/view_resources.tpl +++ b/tpl/Admin/Resources/view_resources.tpl @@ -201,6 +201,10 @@
{$resource->GetName()}
+
+ + {$id} +
{if $resource->IsAvailable()} diff --git a/tpl/Admin/manage_announcements.tpl b/tpl/Admin/manage_announcements.tpl index 841267aac..7e13025a1 100644 --- a/tpl/Admin/manage_announcements.tpl +++ b/tpl/Admin/manage_announcements.tpl @@ -1,4 +1,4 @@ -{include file='globalheader.tpl' Select2=true DataTable=true} +{include file='globalheader.tpl' Select2=true DataTable=true Trumbowyg=true}

{translate key=ManageAnnouncements}

@@ -114,8 +114,7 @@ {foreach from=$announcements item=announcement} - {*{cycle values='row0,row1' assign=rowCss}*} - + {$announcement->Text()|unescape:'html'} {$announcement->Priority()} @@ -179,7 +178,7 @@