Allow Header entries and AJAX
bernd

bernd commited on 2008-09-18 15:24:23
Zeige 4 geänderte Dateien mit 42 Einfügungen und 2 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1148 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -42,6 +42,7 @@ $prefix = $prefix.str_repeat("../", $count);
42 42
 require_once('session/start.php');
43 43
 
44 44
 $output = "";
45
+$html_header = "";
45 46
 require_once("inc/base.php");
46 47
 /* setup module include path */
47 48
 ini_set('include_path',ini_get('include_path').':./modules/'.dirname($go).'/include:');
... ...
@@ -49,6 +49,11 @@ function logger($scriptname, $scope, $message)
49 49
   db_query("INSERT INTO misc.scriptlog (remote, user,scriptname,scope,message) VALUES ('{$remote}', {$user}, '{$scriptname}', '{$scope}', '{$message}');");
50 50
 }
51 51
 
52
+function html_header($arg)
53
+{
54
+  global $html_header;
55
+  $html_header .= $arg;
56
+}
52 57
 
53 58
 function output($arg)
54 59
 {
... ...
@@ -75,9 +75,10 @@ else
75 75
         echo '<title>Administration</title>';
76 76
 
77 77
 echo '
78
-<link rel="stylesheet" href="'.$prefix.'css/admin.css" type="text/css" media="screen" title="Normal" />'
79
-?>
78
+<link rel="stylesheet" href="'.$prefix.'css/admin.css" type="text/css" media="screen" title="Normal" />';
80 79
 
80
+echo $html_header;
81
+?>
81 82
 </head>
82 83
 <body>
83 84
 
... ...
@@ -0,0 +1,33 @@
1
+var xmlHttp = null;
2
+
3
+function ajax_request(from, query_string, target_function) {
4
+  if (window.ActiveXObject) {
5
+    try {
6
+      xmlHttp= new ActiveXObject("Msxml2.XMLHTTP");
7
+    } catch (e) {
8
+      try {
9
+        xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
10
+      } catch (e) {
11
+      }
12
+    }
13
+  } else if (window.XMLHttpRequest) {
14
+    try {
15
+      xmlHttp= new XMLHttpRequest();
16
+    } catch (e) {
17
+    }
18
+  }
19
+
20
+  if (xmlHttp) {
21
+    xmlHttp.open('GET', from + '?' + query_string, true);
22
+    xmlHttp.onreadystatechange = target_function;
23
+    xmlHttp.send(null);
24
+  }
25
+}
26
+
27
+
28
+function foo() {
29
+  if (xmlHttp.readyState == 4) {
30
+    text = 'Gefundene Begriffe: <br \/>' + xmlHttp.responseText;
31
+    document.getElementById('output').innerHTML = text;
32
+  }
33
+} 
0 34