diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-24 06:01:07 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-24 06:01:07 +0000 |
commit | 166452b0335dcf136cd2d296abf8473786df2af1 (patch) | |
tree | a7210c64e6f5533cbd603227894ca78cd236da2d | |
parent | d93527bece43eb4a3a564d892ba9ddc653ac11b0 (diff) | |
download | ampache-166452b0335dcf136cd2d296abf8473786df2af1.tar.gz ampache-166452b0335dcf136cd2d296abf8473786df2af1.tar.bz2 ampache-166452b0335dcf136cd2d296abf8473786df2af1.zip |
updated ajax so it works with IE
-rw-r--r-- | lib/ui.lib.php | 4 | ||||
-rwxr-xr-x | modules/kajax/ajax.js | 54 |
2 files changed, 30 insertions, 28 deletions
diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 9fdd2cdb..1d11ea7f 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -1321,11 +1321,11 @@ function xml_from_array($array,$callback=0) { if (is_numeric($key)) { $key = 'item'; } if (is_array($value)) { $value = xml_from_array($value,1); - $string .= "\t<$key>$value</$key>\n"; + $string .= "\t<content div=\"$key\">$value</content>\n"; } else { /* We need to escape the value */ - $string .= "\t<$key><![CDATA[$value]]></$key>\n"; + $string .= "\t<content div=\"$key\"><![CDATA[$value]]></content>\n"; } } // end foreach elements diff --git a/modules/kajax/ajax.js b/modules/kajax/ajax.js index 84704400..73cb9064 100755 --- a/modules/kajax/ajax.js +++ b/modules/kajax/ajax.js @@ -3,47 +3,49 @@ // Origional Author: Kevin Riker
// Added Multi-Value XML based GET/POST replacement * Karl Vollmer
// Added Auto-Detects source/target information based on XML Doc Elements and
-// Form Elements if it's a post call * Karl Vollmer
+// Form Elements if it's a post call * Karl Vollmer
// Licensed under the GNU/GPL
-
+
var http_request = false;
var IE = true;
// uid is an array of uids that need to be replaced
function ajaxPut(url) {
+
if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- }
+ try {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- }
+ try {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
catch (e) {}
- }
- }
+ }
+ }
else { // Mozilla
IE = false;
http_request = new XMLHttpRequest();
}
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('GET', url, true);
- http_request.send(null);
- }
+ if (!http_request) {
+ return false;
+ }
+ http_request.onreadystatechange = function() { getContents(http_request); };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ }
- function getContents(http_request,uid) {
- if (http_request.readyState == 4) {
- data = http_request.responseXML;
- for(i=0;i<data.childNodes[0].childNodes.length;i++) {
- if (data.childNodes[0].childNodes[i].nodeType == '1') {
- var txt_node = data.childNodes[0].childNodes[i];
- var new_txt = txt_node.firstChild.nodeValue;
- document.getElementById(txt_node.localName).innerHTML = new_txt;
+ function getContents(http_request) {
+ if (http_request.readyState == 4) {
+ if (http_request.status == 200) {
+ var data = http_request.responseXML;
+ var newContent = http_request.responseXML.getElementsByTagName('content');
+
+ for(var i=0; i < newContent.length; i++) {
+ document.getElementById(newContent[i].getAttribute('div')).innerHTML=newContent[i].firstChild.nodeValue;
}
- }
+
+ }
}
}
|