diff options
Diffstat (limited to '')
-rw-r--r-- | ajax.js | 47 | ||||
-rw-r--r-- | host.php | 11 | ||||
-rw-r--r-- | inc/html.inc.php | 1 | ||||
-rw-r--r-- | layout/style.css | 4 | ||||
-rw-r--r-- | plugin.php | 16 |
5 files changed, 75 insertions, 4 deletions
@@ -0,0 +1,47 @@ | |||
1 | function getP(host, plugin) { | ||
2 | getData(host, plugin, 'load'); | ||
3 | } | ||
4 | |||
5 | function rmP(host, plugin) { | ||
6 | getData(host, plugin, 'del'); | ||
7 | } | ||
8 | |||
9 | var xmlHttp | ||
10 | |||
11 | function getData(obj, id, action) { | ||
12 | xmlHttp=GetXmlHttpObject(); | ||
13 | if (xmlHttp==null) { | ||
14 | alert ("Your browser does not support AJAX!"); | ||
15 | return; | ||
16 | } | ||
17 | |||
18 | var url="plugin.php"; | ||
19 | url=url+"?h="+obj+"&p="+id+"&a="+action; | ||
20 | xmlHttp.onreadystatechange=function(){setData(id)} | ||
21 | xmlHttp.open("GET",url,true); | ||
22 | xmlHttp.send(null); | ||
23 | } | ||
24 | |||
25 | function setData(obj) { | ||
26 | if (xmlHttp.readyState==4) { | ||
27 | div = document.getElementById(obj); | ||
28 | |||
29 | div.innerHTML=xmlHttp.responseText; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | function GetXmlHttpObject() { | ||
34 | var xmlHttp=null; | ||
35 | try { | ||
36 | // Firefox, Opera 8.0+, Safari | ||
37 | xmlHttp=new XMLHttpRequest(); | ||
38 | } catch (e) { | ||
39 | // Internet Explorer | ||
40 | try { | ||
41 | xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); | ||
42 | } catch (e) { | ||
43 | xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); | ||
44 | } | ||
45 | } | ||
46 | return xmlHttp; | ||
47 | } | ||
@@ -21,21 +21,24 @@ if(!$plugins) { | |||
21 | # first the ones defined in overview | 21 | # first the ones defined in overview |
22 | foreach($CONFIG['overview'] as $plugin) { | 22 | foreach($CONFIG['overview'] as $plugin) { |
23 | if (in_array($plugin, $plugins)) { | 23 | if (in_array($plugin, $plugins)) { |
24 | printf("<h3><img src=\"%s/layout/minus.gif\" alt=\"[-]\"> %s</h3>\n", $CONFIG['weburl'], $plugin); | 24 | printf('<div id="%s">'."\n", $plugin); |
25 | printf("<h3><span class=\"point\" onclick=\"javascript:rmP('%s','%s')\"><img src=\"%s/layout/minus.gif\" alt=\"[-]\"> %s</span></h3>\n", $host, $plugin, $CONFIG['weburl'], $plugin); | ||
25 | graphs_from_plugin($host, $plugin); | 26 | graphs_from_plugin($host, $plugin); |
27 | print "</div>\n"; | ||
26 | } | 28 | } |
27 | } | 29 | } |
28 | 30 | ||
29 | # other plugins | 31 | # other plugins |
30 | foreach($plugins as $plugin) { | 32 | foreach($plugins as $plugin) { |
31 | if (!in_array($plugin, $CONFIG['overview'])) { | 33 | if (!in_array($plugin, $CONFIG['overview'])) { |
32 | $url = sprintf('<a href="%s/host.php?h=%s&p=%s">%s</a>'."\n", $CONFIG['weburl'], $host, $plugin, $plugin); | 34 | printf('<div id="%s">'."\n", $plugin); |
33 | if ($splugin == $plugin) { | 35 | if ($splugin == $plugin) { |
34 | printf("<h3><img src=\"%s/layout/minus.gif\" alt=\"[-]\"> %s</h3>\n", $CONFIG['weburl'], $url); | 36 | printf("<h3><span class=\"point\" onclick=\"javascript:rmP('%s','%s')\"><img src=\"%s/layout/minus.gif\" alt=\"[-]\"> %s</span></h3>\n", $host, $plugin, $CONFIG['weburl'], $plugin); |
35 | graphs_from_plugin($host, $plugin); | 37 | graphs_from_plugin($host, $plugin); |
36 | } else { | 38 | } else { |
37 | printf("<h3><img src=\"%s/layout/plus.gif\" alt=\"[+]\"> %s</h3>\n", $CONFIG['weburl'], $url); | 39 | printf("<h3><span class=\"point\" onclick=\"javascript:getP('%s','%s')\"><img src=\"%s/layout/plus.gif\" alt=\"[+]\"> %s</span></h3>\n", $host, $plugin, $CONFIG['weburl'], $plugin); |
38 | } | 40 | } |
41 | print "</div>\n"; | ||
39 | } | 42 | } |
40 | } | 43 | } |
41 | 44 | ||
diff --git a/inc/html.inc.php b/inc/html.inc.php index 09da518..b1cb80f 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
@@ -16,6 +16,7 @@ function html_start() { | |||
16 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 16 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
17 | <title>CGP{$path}</title> | 17 | <title>CGP{$path}</title> |
18 | <link rel="stylesheet" href="{$CONFIG['weburl']}/layout/style.css" type="text/css"> | 18 | <link rel="stylesheet" href="{$CONFIG['weburl']}/layout/style.css" type="text/css"> |
19 | <script type="text/javascript" src="{$CONFIG['weburl']}/ajax.js"></script> | ||
19 | </head> | 20 | </head> |
20 | <body> | 21 | <body> |
21 | 22 | ||
diff --git a/layout/style.css b/layout/style.css index 3b61a68..2e2003e 100644 --- a/layout/style.css +++ b/layout/style.css | |||
@@ -74,6 +74,10 @@ hr { | |||
74 | border-top: 1px solid #000; | 74 | border-top: 1px solid #000; |
75 | } | 75 | } |
76 | 76 | ||
77 | .point { | ||
78 | cursor: pointer; | ||
79 | } | ||
80 | |||
77 | .small { | 81 | .small { |
78 | font-size: 0.7em; | 82 | font-size: 0.7em; |
79 | } | 83 | } |
diff --git a/plugin.php b/plugin.php new file mode 100644 index 0000000..036dbb5 --- /dev/null +++ b/plugin.php | |||
@@ -0,0 +1,16 @@ | |||
1 | <?php | ||
2 | |||
3 | require_once 'conf/common.inc.php'; | ||
4 | require_once 'inc/html.inc.php'; | ||
5 | |||
6 | $host = $_GET['h']; | ||
7 | $plugin = $_GET['p']; | ||
8 | |||
9 | if ($_GET['a'] == 'del') { | ||
10 | printf("<h3><span class=\"point\" onclick=\"javascript:getP('%s','%s')\"><img src=\"%s/layout/plus.gif\" alt=\"[+]\"> %s</span></h3>\n", $host, $plugin, $CONFIG['weburl'], $plugin); | ||
11 | } else { | ||
12 | printf("<h3><span class=\"point\" onclick=\"javascript:rmP('%s','%s')\"><img src=\"%s/layout/minus.gif\" alt=\"[-]\"> %s</span></h3>\n", $host, $plugin, $CONFIG['weburl'], $plugin); | ||
13 | graphs_from_plugin($host, $plugin); | ||
14 | } | ||
15 | |||
16 | ?> | ||