a lot of bugs corrected\nrdc_wc_eclairage
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once "events.php";
|
||||
|
||||
function webDashboard($socket, $n="Général", $page="/")
|
||||
function webDashboard($socket, $n="Général")
|
||||
{
|
||||
global $dashboards, $indexDevices;
|
||||
require_once "webserver/javascript.php";
|
||||
@@ -18,13 +18,8 @@ function webDashboard($socket, $n="Général", $page="/")
|
||||
$property = $array[1];
|
||||
if (array_key_exists($array[1], $device->properties))
|
||||
{
|
||||
|
||||
$propertyObject = $device->properties[$property];
|
||||
$value = $propertyObject["value"];
|
||||
if ($value === null)
|
||||
{
|
||||
$value = "null";
|
||||
}
|
||||
logger(DEBUG, $device->friendlyName . " => " . bool2string(_($value)));
|
||||
$response .= $device->friendlyName . aliases($device->friendlyName, $property) . " => " . bool2string(_($value)) . EOL;
|
||||
if (array_key_exists("access", $propertyObject))
|
||||
@@ -33,17 +28,15 @@ function webDashboard($socket, $n="Général", $page="/")
|
||||
if(($propertyObject["access"] & 2))
|
||||
{
|
||||
logger(DEBUG, _("Write Access OK ") . ($propertyObject["access"] & 2), __FILE__ . ":" . __LINE__);
|
||||
$response .= " " . displayChoice($device, $property) . EOL;
|
||||
$response .= " " . displayChoice($device, $property);
|
||||
}
|
||||
if(($propertyObject["access"] & 4))
|
||||
{
|
||||
logger(DEBUG, _("can get value") . ($propertyObject["access"] & 4), __FILE__ . ":" . __LINE__);
|
||||
$response .= ' <input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyObject["name"] . '" value="' . _("Update") . "\" onmouseup=\"getPropertyValue('" . $device->topic . "','" . $device->friendlyName . "','" . $propertyObject["name"] . "')\"><br>" . EOL;
|
||||
$response .= ' <input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyObject["name"] . '" value="' . _("Update") . "\" onmouseup=\"getPropertyValue('" . $device->topic . "','" . $device->friendlyName . "','" . $propertyObject["name"] . "')\">";
|
||||
}
|
||||
}else
|
||||
{
|
||||
$response .= EOLH;
|
||||
}
|
||||
$response .= EOLH;
|
||||
}else
|
||||
{
|
||||
logger(ERROR, _("Property do not exist"), __FILE__ . ":" . __LINE__);
|
||||
@@ -167,25 +160,7 @@ function webBrowse($socket, $argList, $page="/browse")
|
||||
$response .= insertJavascript();
|
||||
foreach($device->properties as $key => $value)
|
||||
{
|
||||
$response .= $key . " ";
|
||||
if (array_key_exists("access", $value))
|
||||
{
|
||||
if(($value["access"] & 2))
|
||||
{
|
||||
logger(DEBUG, _("Write Access OK ") . ($value["access"] & 2), __FILE__ . ":" . __LINE__);
|
||||
$response .= displayChoice($device, $key);
|
||||
}
|
||||
if(($value["access"] & 4))
|
||||
{
|
||||
logger(DEBUG, _("can get value") . ($value["access"] & 4), __FILE__ . ":" . __LINE__);
|
||||
$response .= ' <input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $key . '" value="' . _("Update") . "\" onmouseup=\"getPropertyValue('" . $device->topic . "', '" . $device->friendlyName . "', '" . $key . "')\">";
|
||||
}
|
||||
}
|
||||
$response .= "<br>\n" . $tab . "[<br>\n";
|
||||
//echo memory_get_usage();
|
||||
//$response = value($key, $value, $response);
|
||||
iterateProperty($device, $key, $value, $response, $tab);
|
||||
$response .= $tab . "]<br>\n";
|
||||
$response = displayProperty($device, $key, $value, $response);
|
||||
}
|
||||
/*foreach($device->properties as $key => $value)
|
||||
{
|
||||
@@ -228,6 +203,30 @@ function webBrowse($socket, $argList, $page="/browse")
|
||||
htmlSend($socket, $response);
|
||||
}
|
||||
|
||||
function displayProperty($device, $key, $value, $response)
|
||||
{
|
||||
$response .= $key . " ";
|
||||
if (array_key_exists("access", $value))
|
||||
{
|
||||
if(($value["access"] & 2))
|
||||
{
|
||||
logger(DEBUG, _("Write Access OK ") . ($value["access"] & 2), __FILE__ . ":" . __LINE__);
|
||||
$response .= displayChoice($device, $key);
|
||||
}
|
||||
if(($value["access"] & 4))
|
||||
{
|
||||
logger(DEBUG, _("can get value") . ($value["access"] & 4), __FILE__ . ":" . __LINE__);
|
||||
$response .= ' <input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $key . '" value="' . _("Update") . "\" onmouseup=\"getPropertyValue('" . $device->topic . "', '" . $device->friendlyName . "', '" . $key . "')\">";
|
||||
}
|
||||
}
|
||||
$response .= "<br>\n" . $tab . "[<br>\n";
|
||||
//echo memory_get_usage();
|
||||
//$response = value($key, $value, $response);
|
||||
iterateProperty($device, $key, $value, $response, $tab);
|
||||
$response .= $tab . "]<br>\n";
|
||||
return $response;
|
||||
}
|
||||
|
||||
function iterateProperty($device, $property, $value, &$response, $tab="")
|
||||
{
|
||||
$tab .= " ";
|
||||
@@ -367,5 +366,21 @@ function webNotify($argList)
|
||||
$response = _("notify command have been set");
|
||||
$monitored[] = new watch($argList["topic"], $argList["fn"], $argList["property"], $argList["condition"], $argList["value"]);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
/*
|
||||
function webDisplayByType($argList)
|
||||
{
|
||||
global $indexTypes, $config;
|
||||
require_once $config . "porpertiesbytype.php";
|
||||
require_once "webserver/javascript.php";
|
||||
|
||||
$response .= insertJavascript();
|
||||
foreach($indexTypes[$argList["type"]] as $device)
|
||||
{
|
||||
foreach($)
|
||||
displayProperty($device, $device->, $value, $response)
|
||||
}
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
Reference in New Issue
Block a user