[Rt-commit] r4068 - in rt/branches/3.5-TESTING: . html/NoAuth/js

jesse at bestpractical.com jesse at bestpractical.com
Mon Nov 14 12:54:14 EST 2005


Author: jesse
Date: Mon Nov 14 12:54:13 2005
New Revision: 4068

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/html/NoAuth/js/util.js
Log:
 r18884 at truegrounds:  jesse | 2005-11-14 12:51:29 -0500
 RT-Ticket: 7056
 RT-Status: resolved
 RT-Update: correspond
 
 * Patch from Peter Popovics to improve calendar popup browser compatibility


Modified: rt/branches/3.5-TESTING/html/NoAuth/js/util.js
==============================================================================
--- rt/branches/3.5-TESTING/html/NoAuth/js/util.js	(original)
+++ rt/branches/3.5-TESTING/html/NoAuth/js/util.js	Mon Nov 14 12:54:13 2005
@@ -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 false; };
+        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;


More information about the Rt-commit mailing list