[Rt-devel] RT3.5.5: Calendar links [PATCH]

Peter Popovics pop at eik.bme.hu
Tue Oct 4 02:09:28 EDT 2005



> -----Eredeti üzenet-----
> Feladó: rt-devel-bounces at lists.bestpractical.com [mailto:rt-devel-
> bounces at lists.bestpractical.com] Meghatalmazó Drew Barnes
> Küldve: Monday, October 03, 2005 10:16 PM
> Címzett: Jesse Vincent
> Másolatot kap: Joseph_Micciche at Progressive.com; rt-
> devel at lists.bestpractical.com
> Tárgy: Re: [Rt-devel] RT3.5.5: Calendar links
> 
> It works in firefox 1.5beta for me.  It does not work on IE6 on Windows
> XP SP2, even with popup blockers disabled.  Strangely, the "window
> shading" works perfectly in both.  Perhaps it is being bitten by some
> IE-specific javascript bug in that one script?

:) It's not a bug it's a feature ;)

Here is the patch for that:

--- /home/thuthu/rt_install/3.5.5/rt-3.5.5/html/NoAuth/js/util.js
2005-07-
25 12:26:34.000000000 +0200
+++ /home/rt3/share/html/NoAuth/js/util.js      2005-09-23
13:29:25.000000000 +0
200
@@ -67,7 +67,9 @@
 }

 function openCalWindow(field) {
-    var objWindow =
window.open('<%$RT::WebPath%>/Helpers/CalPopup.html?field='
+field, '<% loc("Choose a date") %>', 'height=235,width=285,scrollbars=1');
+    var objWindow =
window.open('<%$RT::WebPath%>/Helpers/CalPopup.html?field='
+field,
+                                'RT_Calendar',
+                                'height=235,width=285,scrollbars=1');
     objWindow.focus();
 }

@@ -78,21 +80,36 @@
     }
 }

+function addEvent(obj, sType, fn){
+    if (obj.addEventListener){
+        obj.addEventListener(sType, fn, false);
+    } else if (obj.attachEvent) {
+        var r = obj.attachEvent("on"+sType, fn);
+    } else {
+       return false;
+    }
+    return true;
+}
+
 function createCalendarLink(input) {
     var e = document.getElementById(input);
     if (e) {
         var link = document.createElement('a');
         link.setAttribute('href', '#');
-        link.setAttribute('onclick', "openCalWindow('"+input+"'); return
false;
");
+
+        clickevent = function clickevent(e) { openCalWindow(input); return
fals
e; };
+        if (! addEvent(link, "click", clickevent)) {
+            return false;
+        }

         var text = document.createTextNode('<% loc("Choose a date") %>');
         link.appendChild(text);
-
+
         var space = document.createTextNode(' ');

         e.parentNode.insertBefore(link, e.nextSibling);
         e.parentNode.insertBefore(space, e.nextSibling);
-
+
         return true;
     }
     return false;




P.Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: js.patch
Type: application/octet-stream
Size: 1742 bytes
Desc: not available
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20051004/4f975e09/js-0001.obj


More information about the Rt-devel mailing list