gunnar: server/kolab-webclient/imp/patches/imp-4.3.6 t_imp_HK_GW_ItipHandling.diff, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Fri Jan 22 19:37:58 CET 2010
Author: gunnar
Update of /kolabrepository/server/kolab-webclient/imp/patches/imp-4.3.6
In directory doto:/tmp/cvs-serv15450/kolab-webclient/imp/patches/imp-4.3.6
Added Files:
t_imp_HK_GW_ItipHandling.diff
Log Message:
MFB: kolab/issue3329 (Can not accept/deny invitations in Dimp) - missing patch
--- NEW FILE: t_imp_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>
---
lib/MIME/Viewer/itip.php | 98 ++++++++++++++++++++--------
3 files changed, 108 insertions(+), 27 deletions(-)
diff --git a/lib/MIME/Viewer/itip.php b/lib/MIME/Viewer/itip.php
index 1f8fe1e..e030413 100644
--- a/lib/MIME/Viewer/itip.php
+++ b/lib/MIME/Viewer/itip.php
@@ -122,7 +122,7 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
break;
case 'import':
- case 'accept-import':
+ case 'acceptimport':
// vFreebusy reply.
// vFreebusy publish.
// vEvent request.
@@ -202,12 +202,12 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
$this->_msgs[$key][] = array('warning', _("This action is not yet implemented."));
}
- if ($action != 'accept-import') {
+ if ($action != 'acceptimport') {
break;
}
case 'accept':
- case 'accept-import':
+ case 'acceptimport':
case 'deny':
case 'tentative':
// vEvent request.
@@ -279,7 +279,7 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
switch ($action) {
case 'accept':
- case 'accept-import':
+ case 'acceptimport':
$message = sprintf(_("%s has accepted."), $name);
$subject = _("Accepted: ") . $vEvent->getAttribute('SUMMARY');
$params['PARTSTAT'] = 'ACCEPTED';
@@ -622,7 +622,7 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
case 'PUBLISH':
$desc = _("%s wishes to make you aware of \"%s\".");
if ($registry->hasMethod('calendar/import')) {
- $options[] = '<option value="import">' . _("Add this to my calendar") . '</option>';
+ $options['import'] = _("Add this to my calendar");
}
break;
@@ -655,35 +655,35 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
: _("%s wishes to make you aware of \"%s\".");
}
if ($is_update && $registry->hasMethod('calendar/replace')) {
- $options[] = '<option value="accept-import">' . _("Accept and update in my calendar") . '</option>';
- $options[] = '<option value="import">' . _("Update in my calendar") . '</option>';
+ $options['acceptimport'] = _("Accept and update in my calendar");
+ $options['import'] = _("Update in my calendar");
} elseif ($registry->hasMethod('calendar/import')) {
- $options[] = '<option value="accept-import">' . _("Accept and add to my calendar") . '</option>';
- $options[] = '<option value="import">' . _("Add to my calendar") . '</option>';
+ $options['acceptimport'] = _("Accept and add to my calendar");
+ $options['import'] = _("Add to my calendar");
}
- $options[] = '<option value="accept">' . _("Accept request") . '</option>';
- $options[] = '<option value="tentative">' . _("Tentatively Accept request") . '</option>';
- $options[] = '<option value="deny">' . _("Deny request") . '</option>';
- // $options[] = '<option value="delegate">' . _("Delegate position") . '</option>';
+ $options['accept'] = _("Accept request");
+ $options['tentative'] = _("Tentatively Accept request");
+ $options['deny'] = _("Deny request");
+ // $options['delegate'] = _("Delegate position");
break;
case 'ADD':
$desc = _("%s wishes to ammend \"%s\".");
if ($registry->hasMethod('calendar/import')) {
- $options[] = '<option value="import">' . _("Update this event on my calendar") . '</option>';
+ $options['import'] = _("Update this event on my calendar");
}
break;
case 'REFRESH':
$desc = _("%s wishes to receive the latest information about \"%s\".");
- $options[] = '<option value="send">' . _("Send Latest Information") . '</option>';
+ $options['send'] = _("Send Latest Information");
break;
case 'REPLY':
$desc = _("%s has replied to the invitation to \"%s\".");
$sender = $this->_headers->getValue('From');
if ($registry->hasMethod('calendar/updateAttendee')) {
- $options[] = '<option value="update">' . _("Update respondent status") . '</option>';
+ $options['update'] = _("Update respondent status");
}
break;
@@ -691,12 +691,12 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
if (is_a($instance = $vevent->getAttribute('RECURRENCE-ID'), 'PEAR_Error')) {
$desc = _("%s has cancelled \"%s\".");
if ($registry->hasMethod('calendar/delete')) {
- $options[] = '<option value="delete">' . _("Delete from my calendar") . '</option>';
+ $options['delete'] = _("Delete from my calendar");
}
} else {
$desc = _("%s has cancelled an instance of the recurring \"%s\".");
if ($registry->hasMethod('calendar/replace')) {
- $options[] = '<option value="import">' . _("Update in my calendar") . '</option>';
+ $options['import'] = _("Update in my calendar");
}
}
break;
@@ -709,6 +709,36 @@ 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;};DimpCore.addMouseEvents({ id: \'button_invitation_cont\', type: \'itippopdown\', offset: \'button_invitation_cont\', left: true});';
+ $script .= '[ \'acceptimport\', \'import\', \'accept\', \'tentative\', \'deny\', \'update\', \'send\' ].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 .= '<div><span id="button_invitation_cont">' . _createMEntry(_("Invitation"), 'kronolith.png', 'button_invitation', 'hasmenu', true, 'kronolith') . Horde::img('popdown.png', '', array(), $GLOBALS['registry']->getImageDir('dimp')) . '</span></div><p/><script type="text/javascript">' . $script . '</script>';
+
+ 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) {
@@ -796,16 +826,30 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
$html .= '</tbody></table>';
}
- if ($_SESSION['imp']['viewmode'] != 'imp') {
- return $html;
- }
-
if ($options) {
- $html .= '<h2 class="smallheader">' . _("Actions") . '</h2>' .
- '<label for="action_' . $id . '" class="hidden">' . _("Actions") . '</label>' .
- '<select id="action_' . $id . '" name="action[' . $id . ']">' .
- implode("\n", $options) .
- '</select> <input type="submit" class="button" value="' . _("Go") . '" />';
+
+ if ($_SESSION['imp']['viewmode'] == 'imp') {
+
+ $html .= '<h2 class="smallheader">' . _("Actions") . '</h2>' .
+ '<label for="action_' . $id . '" class="hidden">' . _("Actions") . '</label>' .
+ '<select id="action_' . $id . '" name="action[' . $id . ']">';
+
+ foreach ($options as $key => $description) {
+ $html .= '<option value="' . $key .'">' . $description . "</option>\n";
+ }
+
+ $html .= '</select> <input type="submit" class="button" value="' . _("Go") . '" />';
+
+ } else if ($_SESSION['imp']['viewmode'] == 'dimp') {
+
+ $html .= '<div class="context" id="ctx_itippopdown">';
+
+ foreach ($options as $key => $description) {
+ $html .= '<div>' . _createMEntry($description, 'kronolith.png', 'ctx_itippopdown_' . $key, '', true, 'kronolith') . '</div>';
+ }
+
+ $html .= '</div>';
+ }
}
return $html;
diff --git a/lib/MIME/Viewer/itip.php b/lib/MIME/Viewer/itip.php
index 3227519..48769a2 100644
--- a/lib/MIME/Viewer/itip.php
+++ b/lib/MIME/Viewer/itip.php
@@ -752,8 +752,6 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
}
$script = 'if (DIMP.baseWindow) {var B = DIMP.baseWindow.DimpBase;} else {B = DimpBase;};DimpCore.addMouseEvents({ id: \'button_invitation_cont\', type: \'itippopdown\', offset: \'button_invitation_cont\', left: true});';
- $script .= '[ \'acceptimport\', \'import\', \'accept\', \'tentative\', \'deny\', \'update\', \'send\' ].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 .= '<div><span id="button_invitation_cont">' . _createMEntry(_("Invitation"), 'kronolith.png', 'button_invitation', 'hasmenu', true, 'kronolith') . Horde::img('popdown.png', '', array(), $GLOBALS['registry']->getImageDir('dimp')) . '</span></div><p/><script type="text/javascript">' . $script . '</script>';
if ($this->_msgs) {
@@ -866,14 +864,30 @@ class IMP_MIME_Viewer_itip extends MIME_Viewer {
$html .= '</select> <input type="submit" class="button" value="' . _("Go") . '" />';
} else if ($_SESSION['imp']['viewmode'] == 'dimp') {
+ // the div of the context menu
+ $script = "var itipContextMenu = document.createElement('div');\n";
+ $script .= "itipContextMenu.setAttribute('class', 'context');\n";
+ $script .= "itipContextMenu.setAttribute('id', 'ctx_itippopdown');\n";
+ $script .= "itipContextMenu.setAttribute('style', 'display:none');\n";
- $html .= '<div class="context" id="ctx_itippopdown">';
-
+ // all the context menu items
foreach ($options as $key => $description) {
- $html .= '<div>' . _createMEntry($description, 'kronolith.png', 'ctx_itippopdown_' . $key, '', true, 'kronolith') . '</div>';
+ $script .= "var itipContextMenuItem = document.createElement('a');\n";
+ $script .= "itipContextMenuItem.setAttribute('id', 'ctx_itippopdown" . $key . "');\n";
+ $script .= "var linkText = document.createTextNode('" . $description . "');\n";
+ $script .= "itipContextMenuItem.appendChild(linkText);\n";
+ $script .= "itipContextMenu.appendChild(itipContextMenuItem);\n";
+ $script .= "var d = $(itipContextMenuItem);\n";
+ $script .= "DimpCore.clickObserveHandler({ d: d,\n";
+ $script .= " f: function(a) {\n";
+ $script .= " B.itip(a, DIMP.conf.msg_index, DIMP.conf.msg_folder, '" . $id . "');\n";
+ $script .= " window.close();\n";
+ $script .= " }.curry('" . $key . "'),\n";
+ $script .= " ns: true,\n";
+ $script .= " });\n";
}
-
- $html .= '</div>';
+ $script .= "document.getElementById('dimpPage').appendChild(itipContextMenu);\n";
+ $html .= '<script type="text/javascript">' . $script . '</script>';
}
}
More information about the commits
mailing list