2007-02-16 Sancho Lerena <slerena@artica.es>

* pandoradb.sql: added unixtime field to tagente_datos,
	tagente_datos_string and tagente_estado tables. Future queries
	will use UNIX time instead of "Human" timestamp strings.
	
	* index.php: Small fix of duplicated body html tag.

	* agentes/estado_ultimopaquete.php: [DEBUG] Add a debug ICON for new
	graph... need to be delted.

	* /active_console/styles/main.css, and many .js: Style correction
	(massive changes), only indented and commented, no changes in
	code.

	* reporting/fgraph.php: CURRENTLY CHANGING CODE, NOT USE.

	* reporting/stat_win.php: Unified parameter parsing.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@374 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-02-16 18:29:37 +00:00
parent cae70f66b5
commit 51c2517a46
15 changed files with 1390 additions and 251 deletions

View File

@ -1,3 +1,22 @@
2007-02-16 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: added unixtime field to tagente_datos,
tagente_datos_string and tagente_estado tables. Future queries
will use UNIX time instead of "Human" timestamp strings.
* index.php: Small fix of duplicated body html tag.
* agentes/estado_ultimopaquete.php: [DEBUG] Add a debug ICON for new
graph... need to be delted.
* /active_console/styles/main.css, and many .js: Style correction
(massive changes), only indented and commented, no changes in
code.
* reporting/fgraph.php: CURRENTLY CHANGING CODE, NOT USE.
* reporting/stat_win.php: Unified parameter parsing.
2007-02-06 Sancho Lerena <slerena@artica.es>
* include/functions.php: Pagination function now works fine.

View File

@ -58,8 +58,8 @@ if (isset ($_GET["refr"])){
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
</head>
<body>
<?php
<?php
// Show custom background
echo '<body background="images/backgrounds/' . $config_bgimage . '">';
$REMOTE_ADDR = getenv ("REMOTE_ADDR");

View File

@ -24,7 +24,7 @@ global $dbpassword;
global $dbtype;
global $dbhost;
require("lib/db_functions.php"); // añadimos el php que contiene las funciones de acceso a base de datos
require("lib/db_functions.php"); // Add external functions to database
require("lib/extra_functions.php");
//Variables globales
@ -32,52 +32,43 @@ require("lib/extra_functions.php");
$widthGraph=200;
$heigthGraph=200;
// session_start();
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head id="idHead">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<?php // Añadimos esta linea que fuerza el refresco cada 10 segundos si se está en modo monitor.
if ($_GET["mode"]=="monitor")
{
<?php // Add this line to refresh each X seconds
// *TODO* Adjust a variable interval
if ($_GET["mode"] == "monitor"){
echo ("<meta http-equiv=\"refresh\" content=\"10\">");
}
?>
<title>Pandora Console </title>
<title>Pandora FMS Active Console </title>
<meta name="author" content="Jonathan Barajas">
<meta name="author" content="Jonathan Barajas, Sancho Lerena">
<meta name="description" content="Pandora Web Console">
<link rel="stylesheet" href="styles/main.css" type="text/css">
<script type="text/javascript" src="scripts/x_core.js"></script>
<script type="text/javascript" src="scripts/x_event.js"></script>
<script type="text/javascript" src="scripts/x_slide.js"></script>
<script type='text/javascript' src='scripts/x_drag.js'></script>
<script type='text/javascript' src='scripts/objeto.php'></script>
<script type="text/javascript" src="scripts/xmenu2.js"></script>
<script type="text/javascript" src="scripts/xmenu2_html.js"></script>
<script type="text/javascript" src="scripts/xformulario.js"></script>
<script type="text/javascript" src="scripts/xformulario_html.php"></script>
<script type="text/javascript" src="scripts/onunload.php"></script>
<script type='text/javascript' src='scripts/x_dom.js'></script>
<script type='text/javascript' src='scripts/xtabpanelgroup.js'></script>
<script type="text/javascript" src="scripts/wz_jsgraphics.js"></script>
<script type="text/javascript">
// Obtenemos la cookie estado que define el valor de: pestaña selecionada,
// Get the cookie that stores about what topslide its selected
vistaActiva=0;
selectedIndex=0;
@ -86,12 +77,8 @@ $heigthGraph=200;
menuTop=0;
perfil=0;
cookieEstado=GetCookie("estado");
// Comprobamos que existe una cookie de estado
if (cookieEstado != null)
{
if (cookieEstado != null){
if (cookieEstado.length > 0){
var params=cookieEstado.split("&");
for (var i=0 ; i < params.length ; i++){
@ -113,44 +100,32 @@ $heigthGraph=200;
menuLeft = value.substring(0, coor);
menuTop = value.substring(coor + 1);
}
}
}
}else{ // Cargamos los valores de la base de datos
} // for
}
} else { // Cargamos los valores de la base de datos
<?php
//////////////////////////////////////////////////////////////////////////////////////////
// $usuario = dameUsuarioActivo(); Es una fase que siemrpe retorna admin hay que implementarla bien cuando se haga la integración real con Pandora
//////////////////////////////////////////////////////////////////////////////////////////
// $usuario = dameUsuarioActivo();
// Es una fase que siemrpe retorna admin hay que implementarla bien cuando
// se haga la integracion real con Pandora
$usuario="admin";
$estado_consola=dameEstadoConsola($usuario);
echo "vista_activa='".$estado_consola["idVistaActiva"]."';";
echo "menuLeft='".$estado_consola["menuX"]."';";
echo "menuTop='".$estado_consola["menuY"]."';";
?>
}
} //else
var highZ = 3;
//creamos un array en javascript que contendrá la relacion entre el numero de pestaña y el id de la vista que se representa en dicha pestaña
var relacionPestaVista=new Array();
aRelacionesObjetos=new Array(); // Este array almacena el nombre de las relaciones (lineas)
// Create an array in javascript that stores relation between number of tabs
// and ID of view that it's showed in that tab.
var highZ = 3;
var relacionPestaVista = new Array();
aRelacionesObjetos = new Array(); // This array stores name of relationships (lines)
</script>
<!-- Absolutely Positioned Elements -->
<script type="text/javascript">
<?php
///////////////ON-LOAD////////////////////
//Necesitamos declarar globalmente las variables que cuentan el número de objetos que hay en el array
@ -1255,8 +1230,10 @@ if (($_GET["mode"]=="monitor" ) or ($_GET["mode"]==""))
}
echo "</script>\n";
echo "</head>\n";
//background='/images/console/background/europa.jpg'
echo "<body onUnload=\"javascript:guardarEstado()\" >
<div>
<div id='tpg2' class='tabPanelGroup'>

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,204 @@
/* x_dom.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xAppendChild(oParent, oChild){if (oParent.appendChild) return oParent.appendChild(oChild);else return null;}function xCreateElement(sTag){if (document.createElement) return document.createElement(sTag);else return null;}function xFirstChild(e, t){var c = e ? e.firstChild : null;if (t) while (c && c.nodeName != t) { c = c.nextSibling; }else while (c && c.nodeType != 1) { c = c.nextSibling; }return c;}function xGetComputedStyle(oEle, sProp, bInt){var s, p = 'undefined';var dv = document.defaultView;if(dv && dv.getComputedStyle){s = dv.getComputedStyle(oEle,'');if (s) p = s.getPropertyValue(sProp);}else if(oEle.currentStyle) {var a = sProp.split('-');sProp = a[0];for (var i=1; i<a.length; ++i) {c = a[i].charAt(0);sProp += a[i].replace(c, c.toUpperCase());} p = oEle.currentStyle[sProp];}else return null;return bInt ? (parseInt(p) || 0) : p;}function xGetElementsByAttribute(sTag, sAtt, sRE, fn){var a, list, found = new Array(), re = new RegExp(sRE, 'i');list = xGetElementsByTagName(sTag);for (var i = 0; i < list.length; ++i) {a = list[i].getAttribute(sAtt);if (!a) {a = list[i][sAtt];}if (typeof(a)=='string' && a.search(re) != -1) {found[found.length] = list[i];if (fn) fn(list[i]);}}return found;}function xGetElementsByClassName(c,p,t,f){var found = new Array();var re = new RegExp('\\b'+c+'\\b', 'i');var list = xGetElementsByTagName(t, p);for (var i = 0; i < list.length; ++i) {if (list[i].className && list[i].className.search(re) != -1) {found[found.length] = list[i];if (f) f(list[i]);}}return found;}function xGetElementsByTagName(t,p){var list = null;t = t || '*';p = p || document;if (xIE4 || xIE5) {if (t == '*') list = p.all;else list = p.all.tags(t);}else if (p.getElementsByTagName) list = p.getElementsByTagName(t);return list || new Array();}function xInnerHtml(e,h){if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;var s = e.innerHTML;if (xStr(h)) {e.innerHTML = h;}return s;}function xNextSib(e,t){var s = e ? e.nextSibling : null;if (t) while (s && s.nodeName != t) { s = s.nextSibling; }else while (s && s.nodeType != 1) { s = s.nextSibling; }return s;}function xPrevSib(e,t){var s = e ? e.previousSibling : null;if (t) while(s && s.nodeName != t) {s=s.previousSibling;}else while(s && s.nodeType != 1) {s=s.previousSibling;}return s;}function xWalkEleTree(n,f,d,l,b){if (typeof l == 'undefined') l = 0;if (typeof b == 'undefined') b = 0;var v = f(n,l,b,d);if (!v) return 0;if (v == 1) {for (var c = n.firstChild; c; c = c.nextSibling) {if (c.nodeType == 1) {if (!l) ++b;if (!xWalkEleTree(c,f,d,l+1,b)) return 0;}}}return 1;}function xWalkTree(n, f){f(n);for (var c = n.firstChild; c; c = c.nextSibling) {if (c.nodeType == 1) xWalkTree(c, f);}}
/* x_dom.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xAppendChild (oParent, oChild)
{
if (oParent.appendChild)
return oParent.appendChild (oChild);
else
return null;
}
function
xCreateElement (sTag)
{
if (document.createElement)
return document.createElement (sTag);
else
return null;
}
function
xFirstChild (e, t)
{
var c = e ? e.firstChild : null;
if (t)
while (c && c.nodeName != t)
{
c = c.nextSibling;
}
else
while (c && c.nodeType != 1)
{
c = c.nextSibling;
}
return c;
}
function
xGetComputedStyle (oEle, sProp, bInt)
{
var s, p = 'undefined';
var dv = document.defaultView;
if (dv && dv.getComputedStyle)
{
s = dv.getComputedStyle (oEle, '');
if (s)
p = s.getPropertyValue (sProp);
}
else if (oEle.currentStyle)
{
var a = sProp.split ('-');
sProp = a[0];
for (var i = 1; i < a.length; ++i)
{
c = a[i].charAt (0);
sProp += a[i].replace (c, c.toUpperCase ());
}
p = oEle.currentStyle[sProp];
}
else
return null;
return bInt ? (parseInt (p) || 0) : p;
}
function
xGetElementsByAttribute (sTag, sAtt, sRE, fn)
{
var a, list, found = new Array (), re = new RegExp (sRE, 'i');
list = xGetElementsByTagName (sTag);
for (var i = 0; i < list.length; ++i)
{
a = list[i].getAttribute (sAtt);
if (!a)
{
a = list[i][sAtt];
}
if (typeof (a) == 'string' && a.search (re) != -1)
{
found[found.length] = list[i];
if (fn)
fn (list[i]);
}
}
return found;
}
function
xGetElementsByClassName (c, p, t, f)
{
var found = new Array ();
var re = new RegExp ('\\b' + c + '\\b', 'i');
var list = xGetElementsByTagName (t, p);
for (var i = 0; i < list.length; ++i)
{
if (list[i].className && list[i].className.search (re) != -1)
{
found[found.length] = list[i];
if (f)
f (list[i]);
}
}
return found;
}
function
xGetElementsByTagName (t, p)
{
var list = null;
t = t || '*';
p = p || document;
if (xIE4 || xIE5)
{
if (t == '*')
list = p.all;
else
list = p.all.tags (t);
}
else if (p.getElementsByTagName)
list = p.getElementsByTagName (t);
return list || new Array ();
}
function
xInnerHtml (e, h)
{
if (!(e = xGetElementById (e)) || !xStr (e.innerHTML))
return null;
var s = e.innerHTML;
if (xStr (h))
{
e.innerHTML = h;
}
return s;
}
function
xNextSib (e, t)
{
var s = e ? e.nextSibling : null;
if (t)
while (s && s.nodeName != t)
{
s = s.nextSibling;
}
else
while (s && s.nodeType != 1)
{
s = s.nextSibling;
}
return s;
}
function
xPrevSib (e, t)
{
var s = e ? e.previousSibling : null;
if (t)
while (s && s.nodeName != t)
{
s = s.previousSibling;
}
else
while (s && s.nodeType != 1)
{
s = s.previousSibling;
}
return s;
}
function
xWalkEleTree (n, f, d, l, b)
{
if (typeof l == 'undefined')
l = 0;
if (typeof b == 'undefined')
b = 0;
var v = f (n, l, b, d);
if (!v)
return 0;
if (v == 1)
{
for (var c = n.firstChild; c; c = c.nextSibling)
{
if (c.nodeType == 1)
{
if (!l)
++b;
if (!xWalkEleTree (c, f, d, l + 1, b))
return 0;
}
}
}
return 1;
}
function
xWalkTree (n, f)
{
f (n);
for (var c = n.firstChild; c; c = c.nextSibling)
{
if (c.nodeType == 1)
xWalkTree (c, f);
}
}

View File

@ -1,2 +1,99 @@
/* x_drag.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xDisableDrag(id, last){if (!window._xDrgMgr) return;var ele = xGetElementById(id);ele.xDraggable = false;ele.xODS = null;ele.xOD = null;ele.xODE = null;xRemoveEventListener(ele, 'mousedown', _xOMD, false);if (_xDrgMgr.mm && last) {_xDrgMgr.mm = false;xRemoveEventListener(document, 'mousemove', _xOMM, false);}}var _xDrgMgr = {ele:null, mm:false};function xEnableDrag(id,fS,fD,fE){var ele = xGetElementById(id);ele.xDraggable = true;ele.xODS = fS;ele.xOD = fD;ele.xODE = fE;xAddEventListener(ele, 'mousedown', _xOMD, false);if (!_xDrgMgr.mm) {_xDrgMgr.mm = true;xAddEventListener(document, 'mousemove', _xOMM, false);}}function _xOMD(e) {var evt = new xEvent(e);var ele = evt.target;while(ele && !ele.xDraggable) {ele = xParent(ele);}if (ele) {xPreventDefault(e);ele.xDPX = evt.pageX;ele.xDPY = evt.pageY;_xDrgMgr.ele = ele;xAddEventListener(document, 'mouseup', _xOMU, false);if (ele.xODS) {ele.xODS(ele, evt.pageX, evt.pageY);}}}function _xOMM(e) {var evt = new xEvent(e);if (_xDrgMgr.ele) {xPreventDefault(e);var ele = _xDrgMgr.ele;var dx = evt.pageX - ele.xDPX;var dy = evt.pageY - ele.xDPY;ele.xDPX = evt.pageX;ele.xDPY = evt.pageY;if (ele.xOD) {ele.xOD(ele, dx, dy);}else {xMoveTo(ele, xLeft(ele) + dx, xTop(ele) + dy);}} }function _xOMU(e) {if (_xDrgMgr.ele) {xPreventDefault(e);xRemoveEventListener(document, 'mouseup', _xOMU, false);if (_xDrgMgr.ele.xODE) {var evt = new xEvent(e);_xDrgMgr.ele.xODE(_xDrgMgr.ele, evt.pageX, evt.pageY);}_xDrgMgr.ele = null;} }
/*
* x_drag.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL.
* For copyrights, license, documentation and more visit Cross-Browser.com
*/
function xDisableDrag (id, last)
{
if (!window._xDrgMgr)
return;
var ele = xGetElementById (id);
ele.xDraggable = false;
ele.xODS = null;
ele.xOD = null;
ele.xODE = null;
xRemoveEventListener (ele, 'mousedown', _xOMD, false);
if (_xDrgMgr.mm && last)
{
_xDrgMgr.mm = false;
xRemoveEventListener (document, 'mousemove', _xOMM, false);
}
}
var _xDrgMgr = { ele: null, mm:false };
function
xEnableDrag (id, fS, fD, fE)
{
var ele = xGetElementById (id);
ele.xDraggable = true;
ele.xODS = fS;
ele.xOD = fD;
ele.xODE = fE;
xAddEventListener (ele, 'mousedown', _xOMD, false);
if (!_xDrgMgr.mm)
{
_xDrgMgr.mm = true;
xAddEventListener (document, 'mousemove', _xOMM, false);
}
}
function
_xOMD (e)
{
var evt = new xEvent (e);
var ele = evt.target;
while (ele && !ele.xDraggable)
{
ele = xParent (ele);
}
if (ele)
{
xPreventDefault (e);
ele.xDPX = evt.pageX;
ele.xDPY = evt.pageY;
_xDrgMgr.ele = ele;
xAddEventListener (document, 'mouseup', _xOMU, false);
if (ele.xODS)
{
ele.xODS (ele, evt.pageX, evt.pageY);
}
}
}
function
_xOMM (e)
{
var evt = new xEvent (e);
if (_xDrgMgr.ele)
{
xPreventDefault (e);
var ele = _xDrgMgr.ele;
var dx = evt.pageX - ele.xDPX;
var dy = evt.pageY - ele.xDPY;
ele.xDPX = evt.pageX;
ele.xDPY = evt.pageY;
if (ele.xOD)
{
ele.xOD (ele, dx, dy);
}
else
{
xMoveTo (ele, xLeft (ele) + dx, xTop (ele) + dy);
}
}
}
function
_xOMU (e)
{
if (_xDrgMgr.ele)
{
xPreventDefault (e);
xRemoveEventListener (document, 'mouseup', _xOMU, false);
if (_xDrgMgr.ele.xODE)
{
var evt = new xEvent (e);
_xDrgMgr.ele.xODE (_xDrgMgr.ele, evt.pageX, evt.pageY);
}
_xDrgMgr.ele = null;
}
}

View File

@ -1,2 +1,169 @@
/* x_event.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))) return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7Up) && e==window) {if(eT=='resize') { window.xPCW=xClientWidth(); window.xPCH=xClientHeight(); window.xREL=eL; xResizeEvent(); return; }if(eT=='scroll') { window.xPSL=xScrollLeft(); window.xPST=xScrollTop(); window.xSEL=eL; xScrollEvent(); return; }}var eh='e.on'+eT+'=eL';if(e.addEventListener) e.addEventListener(eT,eL,cap);else if(e.attachEvent) e.attachEvent('on'+eT,eL);else eval(eh);}function xResizeEvent(){if (window.xREL) setTimeout('xResizeEvent()', 250);var cw = xClientWidth(), ch = xClientHeight();if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); }}function xScrollEvent(){if (window.xSEL) setTimeout('xScrollEvent()', 250);var sl = xScrollLeft(), st = xScrollTop();if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); }}function xEvent(evt) {var e = evt || window.event;if(!e) return;if(e.type) this.type = e.type;if(e.target) this.target = e.target;else if(e.srcElement) this.target = e.srcElement;if (e.relatedTarget) this.relatedTarget = e.relatedTarget;else if (e.type == 'mouseover' && e.fromElement) this.relatedTarget = e.fromElement;else if (e.type == 'mouseout') this.relatedTarget = e.toElement;if(xOp6Dn) { this.pageX = e.clientX; this.pageY = e.clientY; }else if(xDef(e.pageX,e.pageY)) { this.pageX = e.pageX; this.pageY = e.pageY; }else if(xDef(e.clientX,e.clientY)) { this.pageX = e.clientX + xScrollLeft(); this.pageY = e.clientY + xScrollTop(); }if (xDef(e.offsetX,e.offsetY)) {this.offsetX = e.offsetX;this.offsetY = e.offsetY;}else if (xDef(e.layerX,e.layerY)) {this.offsetX = e.layerX;this.offsetY = e.layerY;}else {this.offsetX = this.pageX - xPageX(this.target);this.offsetY = this.pageY - xPageY(this.target);}if (e.keyCode) { this.keyCode = e.keyCode; } else if (xDef(e.which) && e.type.indexOf('key')!=-1) { this.keyCode = e.which; }this.shiftKey = e.shiftKey;this.ctrlKey = e.ctrlKey;this.altKey = e.altKey;}function xPreventDefault(e){if (e && e.preventDefault) e.preventDefault();else if (window.event) window.event.returnValue = false;}function xRemoveEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))) return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7Up) && e==window) {if(eT=='resize') { window.xREL=null; return; }if(eT=='scroll') { window.xSEL=null; return; }}var eh='e.on'+eT+'=null';if(e.removeEventListener) e.removeEventListener(eT,eL,cap);else if(e.detachEvent) e.detachEvent('on'+eT,eL);else eval(eh);}function xStopPropagation(evt){if (evt && evt.stopPropagation) evt.stopPropagation();else if (window.event) window.event.cancelBubble = true;}
/* x_event.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xAddEventListener (e, eT, eL, cap)
{
if (!(e = xGetElementById (e)))
return;
eT = eT.toLowerCase ();
if ((!xIE4Up && !xOp7Up) && e == window)
{
if (eT == 'resize')
{
window.xPCW = xClientWidth ();
window.xPCH = xClientHeight ();
window.xREL = eL;
xResizeEvent ();
return;
}
if (eT == 'scroll')
{
window.xPSL = xScrollLeft ();
window.xPST = xScrollTop ();
window.xSEL = eL;
xScrollEvent ();
return;
}
}
var eh = 'e.on' + eT + '=eL';
if (e.addEventListener)
e.addEventListener (eT, eL, cap);
else if (e.attachEvent)
e.attachEvent ('on' + eT, eL);
else
eval (eh);
}
function
xResizeEvent ()
{
if (window.xREL)
setTimeout ('xResizeEvent()', 250);
var cw = xClientWidth (), ch = xClientHeight ();
if (window.xPCW != cw || window.xPCH != ch)
{
window.xPCW = cw;
window.xPCH = ch;
if (window.xREL)
window.xREL ();
}
}
function
xScrollEvent ()
{
if (window.xSEL)
setTimeout ('xScrollEvent()', 250);
var sl = xScrollLeft (), st = xScrollTop ();
if (window.xPSL != sl || window.xPST != st)
{
window.xPSL = sl;
window.xPST = st;
if (window.xSEL)
window.xSEL ();
}
}
function
xEvent (evt)
{
var e = evt || window.event;
if (!e)
return;
if (e.type)
this.type = e.type;
if (e.target)
this.target = e.target;
else if (e.srcElement)
this.target = e.srcElement;
if (e.relatedTarget)
this.relatedTarget = e.relatedTarget;
else if (e.type == 'mouseover' && e.fromElement)
this.relatedTarget = e.fromElement;
else if (e.type == 'mouseout')
this.relatedTarget = e.toElement;
if (xOp6Dn)
{
this.pageX = e.clientX;
this.pageY = e.clientY;
}
else if (xDef (e.pageX, e.pageY))
{
this.pageX = e.pageX;
this.pageY = e.pageY;
}
else if (xDef (e.clientX, e.clientY))
{
this.pageX = e.clientX + xScrollLeft ();
this.pageY = e.clientY + xScrollTop ();
}
if (xDef (e.offsetX, e.offsetY))
{
this.offsetX = e.offsetX;
this.offsetY = e.offsetY;
}
else if (xDef (e.layerX, e.layerY))
{
this.offsetX = e.layerX;
this.offsetY = e.layerY;
}
else
{
this.offsetX = this.pageX - xPageX (this.target);
this.offsetY = this.pageY - xPageY (this.target);
}
if (e.keyCode)
{
this.keyCode = e.keyCode;
}
else if (xDef (e.which) && e.type.indexOf ('key') != -1)
{
this.keyCode = e.which;
}
this.shiftKey = e.shiftKey;
this.ctrlKey = e.ctrlKey;
this.altKey = e.altKey;
}
function
xPreventDefault (e)
{
if (e && e.preventDefault)
e.preventDefault ();
else if (window.event)
window.event.returnValue = false;
}
function
xRemoveEventListener (e, eT, eL, cap)
{
if (!(e = xGetElementById (e)))
return;
eT = eT.toLowerCase ();
if ((!xIE4Up && !xOp7Up) && e == window)
{
if (eT == 'resize')
{
window.xREL = null;
return;
}
if (eT == 'scroll')
{
window.xSEL = null;
return;
}
}
var eh = 'e.on' + eT + '=null';
if (e.removeEventListener)
e.removeEventListener (eT, eL, cap);
else if (e.detachEvent)
e.detachEvent ('on' + eT, eL);
else
eval (eh);
}
function
xStopPropagation (evt)
{
if (evt && evt.stopPropagation)
evt.stopPropagation ();
else if (window.event)
window.event.cancelBubble = true;
}

View File

@ -1,2 +1,56 @@
/* x_slide.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xSlideTo(e, x, y, uTime){if (!(e=xGetElementById(e))) return;if (!e.timeout) e.timeout = 25;e.xTarget = x; e.yTarget = y; e.slideTime = uTime; e.stop = false;e.yA = e.yTarget - xTop(e); e.xA = e.xTarget - xLeft(e); if (e.slideLinear) e.B = 1/e.slideTime;else e.B = Math.PI / (2 * e.slideTime); e.yD = xTop(e); e.xD = xLeft(e); var d = new Date(); e.C = d.getTime();if (!e.moving) _xSlideTo(e);}function _xSlideTo(e){if (!(e=xGetElementById(e))) return;var now, s, t, newY, newX;now = new Date();t = now.getTime() - e.C;if (e.stop) { e.moving = false; }else if (t < e.slideTime) {setTimeout("_xSlideTo('"+e.id+"')", e.timeout);if (e.slideLinear) s = e.B * t;else s = Math.sin(e.B * t);newX = Math.round(e.xA * s + e.xD);newY = Math.round(e.yA * s + e.yD);xMoveTo(e, newX, newY);e.moving = true;} else {xMoveTo(e, e.xTarget, e.yTarget);e.moving = false;} }
/* x_slide.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
function xSlideTo (e, x, y, uTime)
{
if (!(e = xGetElementById (e)))
return;
if (!e.timeout)
e.timeout = 25;
e.xTarget = x;
e.yTarget = y;
e.slideTime = uTime;
e.stop = false;
e.yA = e.yTarget - xTop (e);
e.xA = e.xTarget - xLeft (e);
if (e.slideLinear)
e.B = 1 / e.slideTime;
else
e.B = Math.PI / (2 * e.slideTime);
e.yD = xTop (e);
e.xD = xLeft (e);
var d = new Date ();
e.C = d.getTime ();
if (!e.moving)
_xSlideTo (e);
}
function
_xSlideTo (e)
{
if (!(e = xGetElementById (e)))
return;
var now, s, t, newY, newX;
now = new Date ();
t = now.getTime () - e.C;
if (e.stop)
{
e.moving = false;
}
else if (t < e.slideTime)
{
setTimeout ("_xSlideTo('" + e.id + "')", e.timeout);
if (e.slideLinear)
s = e.B * t;
else
s = Math.sin (e.B * t);
newX = Math.round (e.xA * s + e.xD);
newY = Math.round (e.yA * s + e.yD);
xMoveTo (e, newX, newY);
e.moving = true;
}
else
{
xMoveTo (e, e.xTarget, e.yTarget);
e.moving = false;
}
}

View File

@ -15,51 +15,48 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-->
function FormSetup()
{
function FormSetup(){
var cBtn = xGetElementById('formCerrBtn');
var xForm = xGetElementById('xForm');
var cBtn = xGetElementById('formCerrBtn');
var xForm = xGetElementById('xForm');
posLeft = 0;
posTop = 0;
posLeft = 0;
posTop = 0;
if (xClientWidth()>xWidth(xForm))
{
posLeft = xClientWidth()/2 -xWidth(xForm)/2;
if (xClientWidth()>xWidth(xForm)) {
posLeft = xClientWidth()/2 -xWidth(xForm)/2;
}
if (xClientHeight()>xHeight(xForm)) {
posTop = xClientHeight()/2 -xHeight(xForm)/2
}
xMoveTo('xForm',posLeft ,posTop);
formPaint();
xEnableDrag('xFormBar', formOnDragStart, formOnDrag, null);
xZIndex('xForm', highZ++);
cBtn.onclick = cBtnOnClick;
xShow('xForm');
}
if (xClientHeight()>xHeight(xForm))
{
posTop = xClientHeight()/2 -xHeight(xForm)/2
}
xMoveTo('xForm',posLeft ,posTop);
formPaint();
xEnableDrag('xFormBar', formOnDragStart, formOnDrag, null);
xZIndex('xForm', highZ++);
cBtn.onclick = cBtnOnClick;
xShow('xForm');
}
function formPaint()
{
var xForm = xGetElementById('xForm');
var cBtn = xGetElementById('formCerrBtn');
xMoveTo(cBtn, xWidth(xForm) - xWidth(cBtn), 0);
function formPaint(){
var xForm = xGetElementById('xForm');
var cBtn = xGetElementById('formCerrBtn');
xMoveTo(cBtn, xWidth(xForm) - xWidth(cBtn), 0);
}
function formOnDragStart(ele, mx, my)
{
xZIndex('xForm', highZ++);
}
function formOnDrag(ele, mdx, mdy)
{
xMoveTo('xForm', xLeft('xForm') + mdx, xTop('xForm') + mdy);
}
function cBtnOnClick()
{
var cBtn = xGetElementById('formCerrBtn');
var xForm = xGetElementById('xForm');
xHide(xForm);
function formOnDragStart(ele, mx, my){
xZIndex('xForm', highZ++);
}
function formOnDrag(ele, mdx, mdy){
xMoveTo('xForm', xLeft('xForm') + mdx, xTop('xForm') + mdy);
}
function cBtnOnClick(){
var cBtn = xGetElementById('formCerrBtn');
var xForm = xGetElementById('xForm');
xHide(xForm);
}

View File

@ -26,7 +26,6 @@ if (n == '3')
// MENU EDICION
document.write("<div id='menu"+n+"' class='"+p+"Menu'><!-- menu "+n+" -->"
+"<div id='label"+n+"1' class='mLabel'>Objeto</div>"
+"<div id='box"+n+"1' class='mBox'>"
+" <a class='m' href=''><b><i>NUEVO: </b></i></a>"

View File

@ -6,6 +6,7 @@ body {
font-family:verdana,arial,sans-serif,helvetica; font-size:12px;
color:#000; background:#bba;
margin:0; padding:0;
/* background-image: url("/images/console/background/europa.jpg"); */
}
p {
font-family:verdana,arial,sans-serif,helvetica; font-size:12px;

View File

@ -172,15 +172,18 @@ AND ($row3["id_tipo_modulo"] != 17)){
$win_handle=dechex(crc32($nombre_agente.$row3["nombre"]));
echo "<td class=".$tdcolor." width='78'>";
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?tipo=mes&id=".$row3["id_agente_modulo"]."&refresh=180000\", \"mes_".$win_handle."\")'><img src='images/grafica_m.gif' border=0></a>&nbsp;";
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?range=mes&id=".$row3["id_agente_modulo"]."&refresh=180000\", \"mes_".$win_handle."\")'><img src='images/grafica_m.gif' border=0></a>&nbsp;";
$link ="winopeng('reporting/stat_win.php?range=mesg&id=".$row3["id_agente_modulo"]."&refresh=6000','sem_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/b_green.gif" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?tipo=semana&id=".$row3["id_agente_modulo"]."&refresh=6000','sem_".$win_handle."')";
$link ="winopeng('reporting/stat_win.php?range=semana&id=".$row3["id_agente_modulo"]."&refresh=6000','sem_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_w.gif" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?tipo=dia&id=".$row3["id_agente_modulo"]."&refresh=800','dia_".$win_handle."')";
$link ="winopeng('reporting/stat_win.php?range=dia&id=".$row3["id_agente_modulo"]."&refresh=800','dia_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_d.gif" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?tipo=hora&id=".$row3["id_agente_modulo"]."&refresh=30','hora_".$win_handle."')";
$link ="winopeng('reporting/stat_win.php?tipo=range&id=".$row3["id_agente_modulo"]."&refresh=30','hora_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_h.gif" border=0></a>';
}
else { # Writing string data in different way :)

View File

@ -11,6 +11,7 @@ CREATE TABLE `tagent_access` (
`id_ac` bigint(20) unsigned NOT NULL auto_increment,
`id_agent` int(11) NOT NULL default '0',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_ac`),
KEY `agent_index` (`id_agent`)
) TYPE=InnoDB;
@ -46,6 +47,7 @@ CREATE TABLE `tagente_datos` (
`datos` double(18,2) default NULL,
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`id_agente` bigint(4) unsigned NOT NULL default '0',
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_agente_datos`),
KEY `data_index_1` (`id_agente_modulo`),
KEY `data_index_2` (`id_agente`),
@ -73,6 +75,7 @@ CREATE TABLE `tagente_datos_string` (
`datos` tinytext NOT NULL default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`id_agente` bigint(4) unsigned NOT NULL default '0',
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_tagente_datos_string`),
KEY `data_string_index_1` (`id_agente_modulo`),
KEY `data_string_index_2` (`id_agente`),
@ -91,8 +94,8 @@ CREATE TABLE `tagente_estado` (
`estado` int(11) NOT NULL default '0',
`id_agente` int(11) NOT NULL default '0',
`last_try` datetime default NULL,
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id_agente_estado`),
KEY `status_index_1` (`id_agente_modulo`),
KEY `status_index_2` (`id_agente_modulo`,`estado`)
) TYPE=InnoDB;

View File

@ -50,18 +50,22 @@ function dame_fecha_grafico($mh){ // Devuelve fecha formateada en funcion de un
function dame_fecha_grafico_timestamp ($timestamp) { return date('d/m H:i', $timestamp); }
function grafico_modulo_sparse($id_agente_modulo, $periodo, $intervalo, $etiqueta, $color, $zoom=1, $draw_events=0){
function grafico_modulo_sparse_ORIGINAL(
$id_agente_modulo,
$periodo, $intervalo,
$etiqueta, $color,
$zoom=1, $draw_events=0){
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_line.php");
include ("jpgraph/jpgraph_scatter.php");
require ("../include/languages/language_".$language_code.".php");
// WHere periodo is lapse of time in minutes that we want to show in a graph, this could be a week, 1 hour, a day, etc
// 30.06.06 dervitx
// $draw_events behaves as a boolean: 1 implies that events for that module in that period of time
// will be represented with a line in the graph
// Where periodo is lapse of time in minutes that we want to show in a
// graph, this could be a week, 1 hour, a day, etc
// 30.06.06 dervitx:
// $draw_events behaves as a boolean: 1 implies that events for that
// module in that period of time will be represented with a line in the graph
$fechatope = dame_fecha($periodo); // Max old-date limit
$horasint = $periodo / $intervalo; // Each intervalo is $horasint seconds length
$nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo);
$id_agente = dame_agente_id($nombre_agente);
@ -261,10 +265,139 @@ function grafico_modulo_sparse($id_agente_modulo, $periodo, $intervalo, $etiquet
_reference to true in your INI file.  However, future versions may not
support this any longer.  */
}
function grafico_modulo_sparse(
$id_agente_modulo,
$periodo, $intervalo,
$etiqueta, $color,
$zoom, $draw_events,
$width, $height , $title ){
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
include 'Image/Graph.php';
// Where periodo is lapse of time in minutes that we want to show in a
// graph, this could be a week, 1 hour, a day, etc
// 30.06.06 dervitx:
// $draw_events behaves as a boolean: 1 implies that events for that
// module in that period of time will be represented with a line in the graph
$fechatope = time - $periodo; // limit date
$horasint = $periodo / $intervalo; // Each intervalo is $horasint seconds length
$nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo);
$id_agente = dame_agente_id($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo);
// intervalo - This is the number of "rows" we are divided the time to fill data.
// more interval, more resolution, and slower.
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
// Init tables
for ($x = 0; $x <= $intervalo; $x++) {
$valores[$x][0] = 0; // real value
$valores[$x][1] = 0; // min
$valores[$x][2] = $horasint * $x; // [2] Top limit for this range
$valores[$x][3] = $horasint*($x+1); // [3] Botom limit
$etiq_base[] = dame_fecha_grafico($horasint * $x);
$valores[$x][5] = 0; // max
}
// Init other general variables
$max_value = 0;
$min_value = 9999999999999;
function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data, $MGD_event_data ) {
// Get the last value, the last known value (the more recent or last stored)
$sql1 = "SELECT * FROM tagente_estado WHERE id_agente_modulo = ".$id_agente_modulo;
if ($result=mysql_query($sql1)){
$row=mysql_fetch_array($result);
$old_value=$row["datos"];
$old_date = $row["utimestamp"];
} else {
$old_value=0;
}
// Get the last first date (most far to now) for lastcontact in this module
// there is no data far away, so value must be 0 before this date
$sql1 = "SELECT * FROM tagente_datos WHERE id_agente_modulo = ".$id_agente_modulo." order by timestamp asc limit 1";
if ($result=mysql_query($sql1)){
$row=mysql_fetch_array($result);
$first_date = $row["timestamp"];
}
for ($i = $intervalo; $i >= 0; $i--){
$sql1 = "SELECT AVG(datos),MAX(datos),MIN(datos) FROM tagente_datos
WHERE id_agente_modulo = ".$id_agente_modulo." AND utimestamp >= ".$valores[$i][3]."' and utimestamp < ".$valores[$i][2];
$result=mysql_query($sql1);
$row=mysql_fetch_array($result);
#echo "AVG MAX MIN (old_value) ".$valores[$i][3]."<br>";
#echo $row[0]." ".$row[1]." ".$row[2]." old-".$old_value." ".$old_date;
#echo "<br><br>";
if ($row[0] != ""){
$valores[$i][0] = $row[0];
$valores[$i][1] = $row[2];
$valores[$i][5] = $row[1];
}
// Check max. value
if ($valores[$i][5] > $max_value)
$max_value = $valores[$i][5];
// Check min. value... not needed I think..
// if ($valores[$i][1] < $min_value)
//$min_value = $valores[$i][1];
}
// 29.06.06 dervitx
// let's see if the module in this agent has some events associated
// if it has, let's fill $datax and $datay to scatter the events
// in the graphic
/*
if ($draw_events) {
$initial_time = strtotime($fechatope);
$graph_duration = $periodo * 60; // in seconds
$final_time = $initial_time + $graph_duration; // now
// careful here! next sql sentence looks for the module by name in the "evento" field
// tevento database table SHOULD have module_id !!
$sql1 = "SELECT * FROM tevento WHERE id_agente = ".$id_agente." and timestamp > '".$fechatope."' and evento like '%" . $nombre_modulo . "%' ";
// we populate two arrays with validated and no validated events of the module:
// $datax[1] and $datax[0], respectively. There are $datay arrays for y values.
if ($result=mysql_query($sql1)){
while ($row=mysql_fetch_array($result)) {
if ($row["estado"]) { $estado=1; } else { $estado=0; }
$datax[$estado][count($datax[$estado])] = strtotime( $row["timestamp"] );
$datay[$estado][count($datay[$estado])] = ceil($valor_maximo / 6) + $valor_maximo;
}
}
}
// end 29.06.06 dervitx
*/
/*
$Graph_param = array (
'title' => " $etiqueta - $nombre_agente / $nombre_modulo",
'size_x' => intval(550 * $zoom) ,
'size_y' => intval(220 * $zoom) ,
'id_agente_modulo' => $id_agente_modulo ,
'valor_maximo' => $max_value ,
'periodo' => $periodo ,
'draw_events' => 0
);
*/
/* modulo_grafico_draw ( $Graph_param,
$etiq_base,
array('Maximum','Average','Minimum'),
array ( &$valores_max, &$grafica, &$valores_min ),
$datax
); // Replaced pass by reference (slerena, 11 Jul06)
/* PHP Warning:  Call-time pass-by-reference has
been deprecated - argument pass
ed by value;  If you would like to pass it by reference, modify the
declaration of [runtime function
  name]().  If you would like to enable call-time pass-by-reference,
you can set allow_call_time_pass
_reference to true in your INI file.  However, future versions may not
support this any longer.  */
/* function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data, $MGD_event_data ) {
*/
// draws the graph corresponding to the data of a module
// arguments:
@ -283,33 +416,24 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data
// $MGD_data_name = array ( name1, name2, ... ) // name of the datasets (for the legend only)
// $MGD_data = array ( &array(data1), &array(data2), ... ); // data to be represented
// $MGD_event_data = array ( (notvalidated) &array(data_x), (validated) => &array(data_x) );
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
include 'Image/Graph.php';
// initializing parameters
if (!isset( $MGD_param['title'] )) { $MGD_param['title'] = '- no title -'; }
if (!isset( $MGD_param['size_x'] )) { $MGD_param['size_x'] = 550; }
if (!isset( $MGD_param['size_y'] )) { $MGD_param['size_y'] = 220; }
$count_datasets = count( $MGD_data_name ); // number of datasets to represent
// creating the graph with PEAR Image_Graph
$Graph =& Image_Graph::factory('graph',
array( $MGD_param['size_x'],
$MGD_param['size_y']
array( $width,
$height
)
);
$Font =& $Graph->addNew('font', $config_fontpath);
$Font->setSize(8);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
$Title = Image_Graph::factory('title', array ($MGD_param['title'] , 10)),
$Title = Image_Graph::factory('title', array ($title , 10)),
Image_Graph::horizontal(
$Plotarea = Image_Graph::factory('plotarea','axis'),
$Legend = Image_Graph::factory('legend'),
@ -322,32 +446,32 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
$Grid =& $Plotarea->addNew('line_grid', false, IMAGE_GRAPH_AXIS_X);
$Grid->setBackgroundColor('silver@0.3');
$Grid->setBackgroundColor('silver@0.6');
$Grid->setBorderColor('black');
$Plotarea->addNew('line_grid', false, IMAGE_GRAPH_AXIS_Y);
// the next grid is only necessary for drawing the right black line of the PlotArea
$Grid_sec =& $Plotarea->addNew('line_grid', IMAGE_GRAPH_AXIS_Y_SECONDARY);
$Grid_sec->setBorderColor('black');
// now, datasets are created ...
for ($cc=0; $cc<$count_datasets; $cc++) {
$Datasets[$cc] = Image_Graph::factory('dataset') ;
$Datasets[$cc]->setName( $MGD_data_name[$cc] );
}
$dataset[0] = Image_Graph::factory('dataset');
$dataset[0]->setName("Avg.");
$dataset[1] = Image_Graph::factory('dataset');
$dataset[1]->setName("Min.");
$dataset[2] = Image_Graph::factory('dataset');
$dataset[2]->setName("Max.");
$Legend->setPlotarea($Plotarea);
// ... and populated with data ...
// next line suposes that all $MGD_data have the same number of points
for ($cc=0; $cc<count($MGD_data[0]); $cc++) {
$tdate=strtotime( $MGD_labels[$cc] );
for ($dd=0; $dd<$count_datasets; $dd++) {
$Datasets[$dd]->addPoint($tdate, $MGD_data[$dd][$cc]);
}
}
for ($cc=0; $cc<$intervalo; $cc++) {
$tdate = strtotime( $valores[$cc][2] );
$dataset[0]->addPoint($tdate, $valores[$cc][0]);
$dataset[1]->addPoint($tdate, $valores[$cc][1]);
$dataset[2]->addPoint($tdate, $valores[$cc][5]);
}
// ... and added to the Graph
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array($Datasets));
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array($dataset));
// some other properties of the Graph
$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
@ -357,14 +481,14 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data
$Plot->setFillStyle($FillArray);
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisX->setLabelInterval($MGD_param['periodo']*60/10);
$AxisX->setLabelInterval($periodo*60/10);
$AxisX->setFontAngle(45);
$AxisX->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'dame_fecha_grafico_timestamp'));
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->forceMaximum(ceil($MGD_param['valor_maximo'] / 4) + $MGD_param['valor_maximo']);
$AxisY->forceMaximum(ceil($max_value / 4) + $max_value);
// let's draw the alerts zones
$sql1 = "SELECT dis_min, dis_max FROM talerta_agente_modulo WHERE id_agente_modulo = ".$MGD_param['id_agente_modulo'];
$sql1 = "SELECT dis_min, dis_max FROM talerta_agente_modulo WHERE id_agente_modulo = ".$id_agente_modulo;
if ($result=mysql_query($sql1)){
while ($row=mysql_fetch_array($result)) {
$Marker_alertzone =& $Plotarea->addNew('Image_Graph_Axis_Marker_Area', IMAGE_GRAPH_AXIS_Y);
@ -375,6 +499,7 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data
}
// if there are some events to draw let's scatter them!
/*
if ($MGD_param['draw_events']) {
for ($cc=1; $cc>=0; $cc--) {
if (isset($MGD_event_data[$cc])) {
@ -394,7 +519,7 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data
}
}
}
*/
$Graph->done();
// 30.06.06 dervitx end
}
@ -1370,6 +1495,7 @@ function drawWarning($width,$height) {
imagedestroy($image);
}
function progress_bar($progress,$width,$height) {
// Copied from the PHP manual:
// http://us3.php.net/manual/en/function.imagefilledrectangle.php
@ -1385,7 +1511,7 @@ function progress_bar($progress,$width,$height) {
if ($height == 0) {
$height = 20;
}
//$rating = $_GET['rating'];
$ratingbar = (($rating/100)*$width)-2;
$image = imagecreate($width,$height);
@ -1396,59 +1522,196 @@ function progress_bar($progress,$width,$height) {
$fill = ImageColorAllocate($image,44,81,150);
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
ImageRectangle($image,0,0,$width-1,$height-1,$border);
if (($rating > 100) || ($rating < 0)){
ImageFilledRectangle($image,1,1,$width-1,$height-1,$red);
ImageTTFText($image, 8, 0, ($width/3)-($width/10), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]);
}
else {
if ($rating > 100)
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$red);
else
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
if ($rating > 50)
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%");
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%");
}
ImageRectangle($image,0,0,$width-1,$height-1,$border);
if ($rating > 50)
if ($rating > 100)
ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]);
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%");
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%");
imagePNG($image);
imagedestroy($image);
}
// Show header
Header("Content-type: image/png");
// If progress is out limits, show static image, beware of image size!
}
Header("Content-type: image/png");
if ($progress > 100 || $progress < 0){
// HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng("../images/outlimits.png");
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
} else
drawRating($progress,$width,$height);
imagePng($imgPng);
} else
drawRating($progress,$width,$height);
}
function graphic_test ($id, $period, $interval, $label, $width, $height){
require_once 'Image/Graph.php';
include ("../include/config.php");
$color ="#437722"; // Green pandora 1.1 octopus color
$intervalo = 500; // We want 30 slices for graph resolution.
$now_date = dame_fecha(0);
$horasint = $period / $intervalo;
$top_date = dame_fecha($period);
// Para crear las graficas vamos a crear un array de Ax4 elementos, donde
// A es el numero de posiciones diferentes en la grafica (30 para un mes, 7 para una semana, etc)
// y los 4 valores en el ejeY serian los detallados a continuacion:
// Rellenamos la tabla con un solo select, y los calculos se hacen todos sobre memoria
// esto acelera el tiempo de calculo al maximo, aunque complica el algoritmo :-)
$total_items=5000;
$factor = rand(1,10); $b=0;
// This is my temporal data (only a simple static test by now)
for ($a=0; $a < $total_items; $a++){
$valor = 1 + cos(deg2rad($b));
$b = $b + $factor/10;
if ($b > 180){
$b =0;
}
$valor = $valor * $b ;
$valores[$a][0] = $valor;
$valores[$a][1] = $a;
}
// Creamos la tabla (array) con los valores para el grafico. Inicializacion
$valor_maximo = 0;
$maxvalue=0;
$minvalue=100000000;
for ($i = $intervalo-1; $i >0; $i--) { // 30 entries in graph, one by day
$grafica[]=$valores[$i][0];
$legend[]=$valores[$i][1];
if ($valores[$i][0] < $minvalue)
$minvalue = $valores[$i][0];
if ($valores[$i][0] > $maxvalue)
$maxvalue = $valores[$i][0];
}
// Create graph
// Create graph
// create the graph
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
Image_Graph::factory('title', array("", 2)),
$Plotarea = Image_Graph::factory('plotarea'),
0)
);
// Create the dataset
// Merge data into a dataset object (sancho)
$Dataset =& Image_Graph::factory('dataset');
for ($a=0;$a < sizeof($grafica); $a++){
$Dataset->addPoint($legend[$a],$grafica[$a]);
}
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('area', array(&$Dataset));
// set a line color
$Plot->setLineColor('gray');
// set a standard fill style
$Plot->setFillColor('green@0.4');
// $Plotarea->hideAxis();
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
// $AxisX->Hide();
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->setLabelOption("showtext",true);
$AxisY->setLabelInterval(ceil(($maxvalue-$minvalue)/4));
$AxisX->setLabelInterval($intervalo / 5);
$AxisY->forceMinimum($minvalue);
$GridY2 =& $Plotarea->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y_SECONDARY);
$GridY2->setLineColor('blue');
$GridY2->setFillColor('blue@0.1');
$AxisY2 =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY);
$Graph->done();
}
// *****************************************************************************************************************
// MAIN Code
// parse get parameters
// *****************************************************************************************************************
// **************************************************************************
// **************************************************************************
// MAIN Code - Parse get parameters
// **************************************************************************
// **************************************************************************
// Generic parameter handling
// **************************
if (isset($_GET["tipo"]))
$tipo = entrada_limpia($_GET["tipo"]);
else
$tipo = ""; // 1 day default period
if (isset($_GET["periodo"]))
$periodo = entrada_limpia($_GET["periodo"]);
else
$periodo = 86400; // 1 day default period
if (isset($_GET["intervalo"]))
$intervalo = entrada_limpia($_GET["intervalo"]);
else
$intervalo = 300; // 1 day default period
if (isset($_GET["id"]))
$id = entrada_limpia($_GET["id"]);
else
$id = 0;
if (isset($_GET["width"]))
$width = entrada_limpia($_GET["width"]);
else
$width = 300;
if (isset($_GET["height"]))
$height = entrada_limpia ($_GET["height"]);
else
$height = 200;
if (isset($_GET["label"]))
$label = entrada_limpia ($_GET["label"]);
else
$label = "";
if (isset($_GET["color"]))
$color = entrada_limpia ($_GET["color"]);
else
$color = "#226677";
if (isset($_GET["percent"]))
$percent = entrada_limpia ($_GET["percent"]);
else
$percent = "100";
// Zoom
if (isset($_GET['zoom']) and
is_numeric($_GET['zoom']) and
$_GET['zoom']>100)
$zoom = $_GET['zoom'] / 100 ;
else
$zoom = 1;
// Draw Events ?
if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==0 )
$draw_events = 0;
else
$draw_events = 1;
// Image handler
// *****************
if (isset($_GET["tipo"])){
if ($_GET["tipo"]=="sparse"){
if (isset($_GET["id"]) and (isset($_GET["label"])) and ( isset($_GET["periodo"])) and (isset ($_GET["intervalo"])) AND (isset ($_GET["color"])) ){
$id = $_GET["id"];
$color = $_GET["color"];
$tipo = $_GET["tipo"];
$periodo = $_GET["periodo"];
$intervalo = $_GET["intervalo"];
$label = $_GET["label"];
$color = "#".$color;
if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==0 )
{ $draw_events = 0; } else { $draw_events = 1; }
if (isset($_GET['zoom']) and is_numeric($_GET['zoom']) and $_GET['zoom']>100) {
$zoom = $_GET['zoom'] / 100 ;
} else { $zoom = 1; }
grafico_modulo_sparse($id, $periodo, $intervalo, $label, $color, $zoom, $draw_events);
}
if ($_GET["tipo"] == "sparse"){
grafico_modulo_sparse($id, $periodo, $intervalo, $label, $color, $zoom, $draw_events, $width, $height , $title );
}
elseif ($_GET["tipo"] =="estado_incidente")
grafico_incidente_estados();
@ -1478,10 +1741,10 @@ if (isset($_GET["tipo"])){
graphic_agentaccess($_GET["id"], $_GET["periodo"]);
elseif ($_GET["tipo"] == "agentmodules")
graphic_agentmodules($_GET["id"]);
elseif ($_GET["tipo"] == "gdirect")
graphic_test ($id, $periodo, $intervalo, $label, $width, $height);
elseif ( $_GET["tipo"] =="progress"){
$percent= $_GET["percent"];
$width= $_GET["width"];
$height= $_GET["height"];
progress_bar($percent,$width,$height);
}
}

View File

@ -35,8 +35,8 @@ if (comprueba_login() == 0) {
include("../include/styles/pandora.css");
echo '</style>';
if (isset($_GET["tipo"]) AND isset($_GET["id"])) {
$tipo =entrada_limpia($_GET["tipo"]);
if (isset($_GET["range"]) AND isset($_GET["id"])) {
$range =entrada_limpia($_GET["range"]);
$id_agente_modulo = entrada_limpia($_GET["id"]);
}
else {
@ -55,8 +55,22 @@ if (comprueba_login() == 0) {
$module_interval = $module_interval / 60; // Convert to resol / minute
// Please be caution, interval now is in MINUTES not in seconds
// interval is the number of rows that will store data. more rows, more resolution
// Testing 16Feb06
$param['tipo']='sparse';
switch ($tipo) {
switch ($range) {
case "mesg": $intervalo = 30 * $config_graph_res;
$intervalo_real = (43200 / $module_interval);
if ($intervalo_real < $intervalo ){
$intervalo = $intervalo_real;
}
$param['color'] = '6e90ff';
$param['periodo'] = 43200;
$param['intervalo'] = $intervalo;
$param['label'] = $lang_label["month_graph"];
$param['tipo']='gdirect';
break;
case "mes": $intervalo = 30 * $config_graph_res;
$intervalo_real = (43200 / $module_interval);
if ($intervalo_real < $intervalo ){
@ -103,11 +117,10 @@ if (comprueba_login() == 0) {
}
foreach ($_GET as $key => $value) {
$param[$key] = $value;
}
$param['tipo']='sparse';
$param['zoom']=isset($param['zoom'])?$param['zoom']:100;
$param['draw_events']=isset($param['draw_events'])?$param['draw_events']:1;
@ -115,7 +128,7 @@ if (comprueba_login() == 0) {
$param['draw_events'] = 0;
}*/
$imgtag = "<img src='fgraph.php?tipo=sparse&id=". $id_agente_modulo ;
$imgtag = "<img src='fgraph.php?id=". $id_agente_modulo ;
foreach ($param as $key => $value) {
$imgtag .= "&" . $key . "=" . $value;
}
@ -123,80 +136,82 @@ if (comprueba_login() == 0) {
echo $imgtag;
$param['tipo'] = $_GET['tipo'];
$param['id'] = $_GET['id'];
}
?>
<script type='text/javascript' src='../include/styles/cb/x_core.js'></script>
<script type='text/javascript' src='../include/styles/cb/x_event.js'></script>
<script type='text/javascript' src='../include/styles/cb/x_slide.js'></script>
<script type='text/javascript' src='../operation/active_console/scripts/x_core.js'></script>
<script type='text/javascript' src='../operation/active_console/scripts/x_event.js'></script>
<script type='text/javascript' src='../operation/active_console/scripts/x_slide.js'></script>
<style type='text/css'><!--
.menu {
color:#000; background:#ccc; margin:2px; padding:2px;
font-family:verdana,arial,sans-serif,helvetica; font-size:10px;
border:1px solid #000;
position:absolute;
margin:0; width:550px; height:220px;
visibility:hidden;
filter:alpha(opacity=95);
-moz-opacity: 0.95;
opacity: 0.95;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
color:#000; background:#ccc; margin:2px; padding:2px;
font-family:verdana,arial,sans-serif,helvetica; font-size:10px;
border:1px solid #000;
position:absolute;
margin:0; width:550px; height:220px;
visibility:hidden;
filter:alpha(opacity=95);
-moz-opacity: 0.95;
opacity: 0.95;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
--></style>
<script type='text/javascript'><!--
var defOffset = 2;
var defSlideTime = 200;
var tnActive = 0;
var visibleMargin = 5;
var menuW = 550;
var menuH = 220;
window.onload = function() {
var d;
d = xGetElementById('divmenu');
d.termNumber = 1;
xMoveTo(d, visibleMargin - menuW, 0);
xShow(d);
xAddEventListener(document, 'mousemove', docOnMousemove, false);
}
function docOnMousemove(evt) {
var e = new xEvent(evt);
var d = getTermEle(e.target);
if (!tnActive) { // no def is active
if (d) { // mouse is over a term, activate its def
xSlideTo('divmenu', 0, xPageY(d), defSlideTime);
tnActive = 1;
}
}
else { // a def is active
if (!d) { // mouse is not over a term, deactivate active def
xSlideTo('divmenu', visibleMargin - menuW, xPageY(d), defSlideTime);
tnActive = 0;
}
}
}
function getTermEle(ele) {
//window.status = ele;
while(ele && !ele.termNumber) {
if (ele == document) return null;
ele = xParent(ele);
}
return ele;
}
//--></script>
var defOffset = 2;
var defSlideTime = 200;
var tnActive = 0;
var visibleMargin = 5;
var menuW = 550;
var menuH = 220;
window.onload = function() {
var d;
d = xGetElementById('divmenu');
d.termNumber = 1;
xMoveTo(d, visibleMargin - menuW, 0);
xShow(d);
xAddEventListener(document, 'mousemove', docOnMousemove, false);
}
function docOnMousemove(evt) {
var e = new xEvent(evt);
var d = getTermEle(e.target);
if (!tnActive) { // no def is active
if (d) { // mouse is over a term, activate its def
xSlideTo('divmenu', 0, xPageY(d), defSlideTime);
tnActive = 1;
}
}
else { // a def is active
if (!d) { // mouse is not over a term, deactivate active def
xSlideTo('divmenu', visibleMargin - menuW, xPageY(d), defSlideTime);
tnActive = 0;
}
}
}
function getTermEle(ele) {
//window.status = ele;
while(ele && !ele.termNumber) {
if (ele == document) return null;
ele = xParent(ele);
}
return ele;
}
//-->
</script>
</head>
<body>
<div id='divmenu' class='menu'>
<b>Configuration Menu</b><br>Please, make your changes and apply with <i>Reload</i> button<BR><BR>