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

jesse at bestpractical.com jesse at bestpractical.com
Tue Feb 21 16:25:01 EST 2006


Author: jesse
Date: Tue Feb 21 16:25:00 2006
New Revision: 4563

Added:
   rt/branches/3.5-TESTING/html/NoAuth/js/ahah.js
Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/html/Elements/Header

Log:
 r24478 at truegrounds:  jesse | 2006-02-21 14:43:51 -0500
 * merge touchups


Modified: rt/branches/3.5-TESTING/html/Elements/Header
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/Header	(original)
+++ rt/branches/3.5-TESTING/html/Elements/Header	Tue Feb 21 16:25:00 2006
@@ -60,6 +60,8 @@
     <link rel="alternate" href="<%$RSSAutoDiscovery%>" type="application/rss+xml" title="RSS RT Search" />
 % }
     <script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/js/util.js"></script>
+
+    <script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/js/ahah.js"></script>
     <script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/js/titlebox-state.js"></script>
     <script type="text/javascript"><!--
         onLoadHook("loadTitleBoxStates()");

Added: rt/branches/3.5-TESTING/html/NoAuth/js/ahah.js
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/NoAuth/js/ahah.js	Tue Feb 21 16:25:00 2006
@@ -0,0 +1,33 @@
+/*
+% $r->content_type('application/x-javascript');
+*/
+// Fetched from http://www.opendarwin.org/~drernie/src/ahah.js
+function ahah(url, target, delay) {
+  document.getElementById(target).innerHTML = 'Loading <a href="'+url+'">'+url +'</a>...';
+  if (window.XMLHttpRequest) {
+    req = new XMLHttpRequest();
+  } else if (window.ActiveXObject) {
+    req = new ActiveXObject("Microsoft.XMLHTTP");
+  }
+  if (req != undefined) {
+    req.onreadystatechange = function() {ahahDone(url, target, delay);};
+    req.open("GET", url, true);
+    req.send("");
+  }
+}  
+
+function ahahDone(url, target, delay) {
+  if (req.readyState == 4) { // only if req is "loaded"
+    if (req.status == 200) { // only if "OK"
+      document.getElementById(target).innerHTML = req.responseText;
+    } else {
+      document.getElementById(target).innerHTML="Error loading '"+url+"':\n"+req.statusText;
+    }
+    if (delay != undefined) {
+       setTimeout("ahah(url,target,delay)", delay); // resubmit after delay
+	    //server should ALSO delay before responding
+    }
+  }
+}
+
+% $m->abort();


More information about the Rt-commit mailing list