Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -r4330 -r4357 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4330) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4357) @@ -11,7 +11,7 @@ var submitted = false; var $edit_mode = false; var $init_made = true; // in case of double inclusion of script.js :) - + // hook processing var hBEFORE = 1; // this is const, but including this twice causes errors var hAFTER = 2; // this is const, but including this twice causes errors @@ -57,7 +57,7 @@ { var $i = 0; var $local_hooks = getArrayValue($hooks, $function_name, $hook_type); - + while($i < $local_hooks.length) { $local_hooks[$i]($function_name, $prefix_special); $i++; @@ -162,11 +162,26 @@ return (typeof(variable)=='undefined')?false:true; } -function print_pre(variable) +function in_array(needle, haystack) { - var s = ""; + return array_search(needle, haystack) != -1; +} + +function array_search(needle, haystack) +{ + for (var i=0; i "+variable[prop] + ""; + s += prop+" => "+variable[prop] + "\n"; } alert(s); } @@ -803,30 +818,31 @@ var $dst_html = $aSelect.options[$dst_num].innerHTML; var $src_value = $aSelect.options[$src_num].value; var $dst_value = $aSelect.options[$dst_num].value; - + var $src_option = document.createElement('OPTION'); var $dst_option = document.createElement('OPTION'); - + $aSelect.remove($src_num); $aSelect.options.add($dst_option, $src_num); $dst_option.innerText = $dst_html; $dst_option.value = $dst_value; $dst_option.innerHTML = $dst_html; - + $aSelect.remove($dst_num); $aSelect.options.add($src_option, $dst_num); $src_option.innerText = $src_html; $src_option.value = $src_value; $src_option.innerHTML = $src_html; } - - function getXMLHTTPObject() + + function getXMLHTTPObject(content_type) { + if (!isset(content_type)) content_type = 'text/plain'; var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { - http_request.overrideMimeType('text/plain'); + http_request.overrideMimeType(content_type); // See note below about this line } } else if (window.ActiveXObject) { // IE @@ -840,8 +856,8 @@ } return http_request; } - - function str_repeat($symbol, $count) + + function str_repeat($symbol, $count) { var $i = 0; var $ret = ''; @@ -850,4 +866,18 @@ $i++; } return $ret; + } + + function getDocumentFromXML(xml) + { + if (window.ActiveXObject) { + var doc = new ActiveXObject("Microsoft.XMLDOM"); + doc.async=false; + doc.loadXML(xml); + } + else { + var parser = new DOMParser(); + var doc = parser.parseFromString(xml,"text/xml"); + } + return doc; } \ No newline at end of file