gunnar: server/patches/horde-webmail/1.2.0/tg t_dimp_HK_GW_ItipHandling.diff, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Mon Feb 9 11:01:32 CET 2009


Author: gunnar

Update of /kolabrepository/server/patches/horde-webmail/1.2.0/tg
In directory doto:/tmp/cvs-serv25005

Added Files:
	t_dimp_HK_GW_ItipHandling.diff 
Log Message:
Rough draft to fix kolab/issue3329

--- NEW FILE: t_dimp_HK_GW_ItipHandling.diff ---
From: Gunnar Wrobel <p at rdus.de>
Subject: [PATCH] t/dimp/HK/GW/ItipHandling

Allow handling iTip messages in dimp.

Signed-off-by: Gunnar Wrobel <p at rdus.de>

---
 horde-webmail/config/kolab.local.php       |   12 +++++++++
 horde-webmail/dimp/imp.php                 |   23 +++++++++++++++++
 horde-webmail/dimp/js/DimpBase.js          |   14 ++++++++++
 horde-webmail/imp/lib/MIME/Viewer/itip.php |   37 ++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/horde-webmail/config/kolab.local.php b/horde-webmail/config/kolab.local.php
new file mode 100644
index 0000000..9652733
--- /dev/null
+++ b/horde-webmail/config/kolab.local.php
@@ -0,0 +1,12 @@
+<?php
+$conf['cookie']['domain'] = 'ec2-67-202-20-255.compute-1.amazonaws.com';
+$conf['cookie']['path'] = '/horde-release/horde-webmail';
+$conf['problems']['email'] = 'postmaster at ec2-67-202-20-255.compute-1.amazonaws.com';
+$conf['problems']['maildomain'] = 'ec2-67-202-20-255.compute-1.amazonaws.com';
+$conf['kolab']['ldap']['server'] = 'ec2-67-202-20-255.compute-1.amazonaws.com';
+$conf['kolab']['ldap']['basedn'] = 'dc=ec2-67-202-20-255,dc=compute-1,dc=amazonaws,dc=com';
+$conf['kolab']['ldap']['phpdn'] = 'cn=nobody,cn=internal,dc=ec2-67-202-20-255,dc=compute-1,dc=amazonaws,dc=com';
+$conf['kolab']['ldap']['phppw'] = 'J7STTChPDQhcq+9n83/mBAtV7siu2CqrEoU5OHGC';
+$conf['kolab']['imap']['server'] = 'ec2-67-202-20-255.compute-1.amazonaws.com';
+$conf['kolab']['imap']['maildomain'] = 'ec2-67-202-20-255.compute-1.amazonaws.com';
+?>
diff --git a/horde-webmail/dimp/imp.php b/horde-webmail/dimp/imp.php
index f8b9b5c..70264fe 100644
--- a/horde-webmail/dimp/imp.php
+++ b/horde-webmail/dimp/imp.php
@@ -710,6 +710,29 @@ case 'SendMDN':
     $imp_ui = new IMP_UI_Message();
     $imp_ui->MDNCheck($ob->header, true);
     break;
+
+case 'iTip':
+    $selection = Util::getPost('selection');
+    $component = Util::getPost('component');
+    $action = str_replace('_', '-', $selection);
+    $_POST['action'] = array($component => $action);
+
+    if (empty($indices)) {
+        break;
+    }
+    $idx_string = _getIdxString($indices);
+
+    /* Parse MIME info and create the body of the message. */
+    require_once IMP_BASE . '/lib/MIME/Contents.php';
+    $imp_contents = &IMP_Contents::singleton($idx_string);
+
+    $cr = !$imp_contents->buildMessage();
+
+    if (is_a($cr, 'PEAR_Error')) {
+        $notification->push($cr, 'horde.error');
+    }
+
+    break;
 }
 
 // Clear the output buffer that we started above, and log any unexpected
diff --git a/horde-webmail/dimp/js/DimpBase.js b/horde-webmail/dimp/js/DimpBase.js
index 96cd917..39a728b 100644
--- a/horde-webmail/dimp/js/DimpBase.js
+++ b/horde-webmail/dimp/js/DimpBase.js
@@ -1663,6 +1663,20 @@ var DimpBase = {
         nf.setStyle({ height: (document.viewport.getHeight() - nf.cumulativeOffset()[1] - 10) + 'px' });
     },
 
+    itip: function(action, index, folder, component)
+    {
+        var args, vs;
+
+	vs = this.viewport.getViewportSelection().search({ imapuid: { equal: [ index ] }, view: { equal: [ folder ] } });
+	if (!vs.size() && folder != this.folder) {
+	    vs = this.viewport.getViewportSelection(folder).search({ imapuid: { equal: [ index ] } });
+	}
+
+	args = this.viewport.addRequestParams({ selection: action, component: component });
+
+	DimpCore.doAction('iTip', args, DimpCore.toUIDArray(vs));
+    },
+
     /* Flag actions for message list. */
     flag: function(action, index, folder)
     {
diff --git a/horde-webmail/imp/lib/MIME/Viewer/itip.php b/horde-webmail/imp/lib/MIME/Viewer/itip.php
index 1f8fe1e..8cc63c3 100644
--- a/horde-webmail/imp/lib/MIME/Viewer/itip.php
+++ b/horde-webmail/imp/lib/MIME/Viewer/itip.php
@@ -709,6 +709,43 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
             $desc = sprintf($desc, htmlspecialchars($sender), htmlspecialchars($summary));
         }
 
+        if ($_SESSION['imp']['viewmode'] == 'dimp') {
+            require_once DIMP_BASE . '/lib/DIMP.php';
+
+            function _createMEntry($text, $image, $id, $class = '', $show_text = true, $app = null)
+            {
+                $params = array('icon' => $image, 'id' => $id, 'class' => $class);
+                if ($show_text) {
+                    $params['title'] = $text;
+                } else {
+                    $params['tooltip'] = $text;
+                }
+                if (isset($app)) {
+                    $params['app'] = $app;
+                }
+                return DIMP::actionButton($params);
+            }
+
+            $script = 'if (DIMP.baseWindow) {var B = DIMP.baseWindow.DimpBase;} else {B = DimpBase;};var x=document.getElementById(\'button_invitation_img\');if (!x) {DimpCore.addPopdown(\'button_invitation\', \'itippopdown\');[ \'accept_import\', \'import\', \'accept\', \'tentative\', \'deny\' ].each(function(a) {var d = $(\'ctx_itippopdown_\' + a); if (d) { DimpCore.clickObserveHandler({ d: d, f: function(a) { B.itip(a, DIMP.conf.msg_index, DIMP.conf.msg_folder, ' . $id . '); window.close(); }.curry(a) });}});}';
+
+            $html .= '<span id="button_invitation_cont" onmouseover="' . $script . '">' . _createMEntry(_("Invitation"), 'kronolith.png', 'button_invitation', 'hasmenu', true, 'kronolith') . '</span>';
+
+            $html .= '<div class="context" id="ctx_itippopdown">';
+            $html .= '<div>' . _createMEntry(_("Accept and update in my calendar"), 'kronolith.png', 'ctx_itippopdown_accept_import', '', true, 'kronolith') . '</div>';
+            $html .= '<div>' . _createMEntry(_("Update in my calendar"), 'kronolith.png', 'ctx_itippopdown_import', '', true, 'kronolith') . '</div>';
+            $html .= '<div>' . _createMEntry(_("Accept request"), 'kronolith.png', 'ctx_itippopdown_accept', '', true, 'kronolith') . '</div>';
+            $html .= '<div>' . _createMEntry(_("Tentatively Accept request"), 'kronolith.png', 'ctx_itippopdown_tentative', '', true, 'kronolith') . '</div>';
+            $html .= '<div>' . _createMEntry(_("Deny request"), 'kronolith.png', 'ctx_itippopdown_deny', '', true, 'kronolith') . '</div>';
+            $html .= '</div>';
+
+            if ($this->_msgs) {
+                global $notification;
+                foreach ($this->_msgs[$id] as $msg) {
+                    $notification->push($msg[1], 'horde.' . $msg[0]);
+                }
+            }
+        }
+
         $html .= '<h2 class="header">' . $desc . '</h2>';
 
         if ($this->_msgs) {
-- 
tg: (12a42ba..) t/dimp/HK/GW/ItipHandling (depends on: master t/dimp/H/MS/FixBrokenFolderImages)





More information about the commits mailing list