[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [ENH] Cypht: calendar invitation by email: archive mail when confirmed (and added to Calendar)

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <690b6f506f41a_2ce26949816@gitlab-sidekiq-low-urgency-cpu-bound-v2-675f7f6dbf-w6l4g.mail>

Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
c3f2d39f by christer77 at 2025-11-05T15:29:50+00:00
[ENH] Cypht: calendar invitation by email: archive mail when confirmed (and added to Calendar)
---
* [ENH] Cypht: calendar invitation by email: archive mail when confirmed (and added to Calendar)

See merge request tikiwiki/tiki!8329

- - - - -


3 changed files:

- lib/cypht/modules/tiki/calendar_modules.php
- lib/cypht/modules/tiki/js_modules/DOM_events/message_content.js
- lib/cypht/modules/tiki/site.js


Changes:

=====================================
lib/cypht/modules/tiki/calendar_modules.php
=====================================
@@ -417,11 +417,8 @@ class Hm_Output_add_rsvp_actions extends Hm_Output_Module
                     foreach ($calendars['data'] as $row) {
                         $options[] = "<option value='" . $row['calendarId'] . "'>" . $row['name'] . "</option>";
                     }
-                    $res .= sprintf(
-                        '<tr class="header_event_addtocal"><th>%s</th><td class="header_links"><select name="calendarId" class="event_calendar_select">%s</select></td></tr>',
-                        tr('Add to calendar'),
-                        implode('', $options)
-                    );
+                    $res .= sprintf('<div class="row g-0 py-0 py-sm-1 small_header d-flex header_event_addtocal"><div class="col-md-2"><span class="text-muted">%s</span></div><div class="col-md-10 col-12"><select name="calendarId" class="event_calendar_select">%s</select></div></div>', tr('Add to calendar'), implode('', $options));
+                    $res .= sprintf('<div class="row g-0 py-0 py-sm-1 small_header d-flex" id="event_calendar_to_rsvp" style="display:none"><div class="col-md-12"><span class="text-muted">%s</span><span class="text-danger">*</span><select class="event_calendar_select_rsvp">%s</select></div></div>', tr('Calendar'), implode('', array_slice($options, 1)));
                 } else {
                     $existing = TikiLib::lib('calendar')->get_item($existing['calitemId']);
                     $res .= sprintf(


=====================================
lib/cypht/modules/tiki/js_modules/DOM_events/message_content.js
=====================================
@@ -1,4 +1,5 @@
 function RSVPButtonClick() {
+    let adding_to_calendar_content = null;
     $(document).on('click', '.rsvp-button', function() {
         const value = $(this).data('value');
         const comment = $(this).data('comment');
@@ -35,6 +36,9 @@ function RSVPButtonClick() {
                         if (values[action] === value) {
                             return;
                         }
+                        if (action == "accept" && $('.event_calendar_select_rsvp').val()) {
+                            tiki_event_calendar($('.event_calendar_select_rsvp').val());
+                        }
                         const detail = Hm_Utils.parse_folder_path(getListPathParam(), 'imap');
                         $.tikiModal("Please wait...");
                         Hm_Ajax.request(
@@ -50,6 +54,9 @@ function RSVPButtonClick() {
                                 $.tikiModal();
                                 sessionStorage.removeItem(window.location.pathname + getMessageStorageKey(getMessageUidParam()));
                                 get_message_content(false, getMessageUidParam(), getListPathParam(), detail);
+                                if (action === "accept") {
+                                    imap_archive_message();
+                                }
                             },
                             [],
                             false,
@@ -64,5 +71,16 @@ function RSVPButtonClick() {
                 }
             ],
         });
+        adding_to_calendar_content = $('#event_calendar_to_rsvp');
+        $('.calendar_content').append(adding_to_calendar_content);
+        $('#event_calendar_to_rsvp').removeAttr("style");
+    });
+    $(document).on('change', '#rsvp-action', function() {
+        if (this.value == "accept") {
+            $('.calendar_content').append(adding_to_calendar_content);
+        } else {
+            $('.event_calendar_select_rsvp').val("");
+            $('.calendar_content').html("");
+        }
     });
 }
\ No newline at end of file


=====================================
lib/cypht/modules/tiki/site.js
=====================================
@@ -65,23 +65,27 @@ var tiki_groupmail_put_back = function(btn, id) {
     );
 };
 
+var tiki_event_calendar = function(calendar_id) {
+    var uid = getMessageUidParam();
+    var detail = Hm_Utils.parse_folder_path(getListPathParam(), 'imap');
+    Hm_Ajax.request(
+        [{'name': 'hm_ajax_hook', 'value': 'ajax_add_to_calendar'},
+        {'name': 'calendar_id', 'value': calendar_id},
+        {'name': 'imap_msg_uid', 'value': uid},
+        {'name': 'imap_server_id', 'value': detail.server_id},
+        {'name': 'folder', 'value': detail.folder}],
+        function(res) {
+            // noop
+        },
+        [],
+        false
+    );
+};
+
 var tiki_event_rsvp_actions = function() {
     $(document).on("change", 'select.event_calendar_select', function(e) {
-        var uid = getMessageUidParam();
-        var detail = Hm_Utils.parse_folder_path(getListPathParam(), 'imap');
         var $btn = $(this);
-        Hm_Ajax.request(
-            [{'name': 'hm_ajax_hook', 'value': 'ajax_add_to_calendar'},
-            {'name': 'calendar_id', 'value': $(this).val()},
-            {'name': 'imap_msg_uid', 'value': uid},
-            {'name': 'imap_server_id', 'value': detail.server_id},
-            {'name': 'folder', 'value': detail.folder}],
-            function(res) {
-                // noop
-            },
-            [],
-            false
-        );
+        tiki_event_calendar($(this).val());
     });
     $(document).on("click", '.event_calendar_update', function(e) {
         var uid = getMessageUidParam();



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c3f2d39f8695fa3dfe7e3cbb98de7ebff00d569e

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c3f2d39f8695fa3dfe7e3cbb98de7ebff00d569e
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.