summaryrefslogtreecommitdiff
path: root/patches/horde-webmail/1.2.0/merges/issue3329.patch
blob: 80f38a7f1c81d37e5e7f431c840c2ad5326eaa8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff --git a/horde-webmail/imp/lib/MIME/Viewer/itip.php b/horde-webmail/imp/lib/MIME/Viewer/itip.php
index 3227519..48769a2 100644
--- a/horde-webmail/imp/lib/MIME/Viewer/itip.php
+++ b/horde-webmail/imp/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>';
             }
         }