[TikiWiki-commits] [Git][tikiwiki/tiki][master] [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 <68ac6625e868b_2c130c4a091316@gitlab-sidekiq-low-urgency-cpu-bound-v2-5b4bb8c664-rtfph.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
e376342c by christer77 at 2025-08-25T13:25:02+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
=====================================
@@ -418,6 +418,7 @@ class Hm_Output_add_rsvp_actions extends Hm_Output_Module
                         $options[] = "<option value='" . $row['calendarId'] . "'>" . $row['name'] . "</option>";
                     }
                     $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('<div class="row g-0 py-0 py-sm-1 small_header d-flex"><div class="col-md-2"><span class="text-muted">%s</span></div><div class="col-md-10 col-12 header_links"><a href="tiki-calendar.php?calitemId=%s" data-external="1">%s</a></div></div>', tr('Event'), $existing['calitemId'], tr('View event in my calendar'));


=====================================
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/e376342c2d9bde3c17c09466f0c2adae3036aa40

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e376342c2d9bde3c17c09466f0c2adae3036aa40
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.