Skip to content
Permalink
Browse files

Minor updates

* Blockly fixes
* Objects fixes
  • Loading branch information...
sergejey committed Sep 10, 2019
1 parent ab883ed commit b3ba737b34bb53b722ada129cf74516bd0ab6c58
@@ -154,7 +154,7 @@ function init() {
if (xmlDom) {
Blockly.mainWorkspace.clear();
try {
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, xmlDom);
Blockly.Xml.domToWorkspace(xmlDom,Blockly.mainWorkspace);
} catch (e) {
Blockly.mainWorkspace.clear();
alert('Error loading script: ' + e);
@@ -26,6 +26,9 @@
$method = $_SERVER['REQUEST_METHOD'];
$url = $_SERVER['REQUEST_URI'];
if (preg_match('/\/api\.php\?/',$url)) {
$url=preg_replace('/\/api\.php\?/','/api.php/',$url);
}
$url = preg_replace('/\?.+/', '', $url);
$request = explode('/', trim($url, '/'));
@@ -48,7 +51,7 @@
include_once("./lib/loader.php");
include_once("./load_settings.php");
StartMeasure('TOTAL');
startMeasure('TOTAL');
$startedTime=getmicrotime();
register_shutdown_function('apiShutdown');
@@ -204,7 +207,7 @@
foreach($locations as $k=>$v) {
$location=array();
$location['id']=$v['ID'];
$location['title']=$v['TITLE'];
$location['title']=processTitle($v['TITLE']);
$location['priority']=$v['PRIORITY'];
$location['object']=getRoomObjectByLocation($v['ID'],1);
$result['rooms'][]=$location;
@@ -1012,7 +1012,7 @@ function callAPI($api_url, $method = 'GET', $params = 0)
curl_setopt($api_ch, CURLOPT_POST, 1);
curl_setopt($api_ch, CURLOPT_POSTFIELDS, $params);
}
$url = str_replace('/api/', '/api.php/', $url);
$url = preg_replace('/^\/api\//', ROOTHTML.'api.php/', $url);
curl_setopt($api_ch, CURLOPT_URL, $url);
curl_exec($api_ch);
@@ -168,6 +168,10 @@ function admin(&$out) {
}
$out['XML']=$rec['XML'];
//$out['XML']='';
//dprint($rec);
$out['CODE_TYPE']=(int)$rec['CODE_TYPE'];
@@ -929,10 +929,8 @@ function setProperty($property, $value, $no_linked = 0, $source = '')
$property_linked_history[$this->object_title . '.' . $property][$prop['ONCHANGE']] = 1;
$params = array();
$params['PROPERTY'] = $property;
if ($value!=$old_value) {
$params['NEW_VALUE'] = (string)$value;
$params['OLD_VALUE'] = (string)$old_value;
}
$params['NEW_VALUE'] = (string)$value;
$params['OLD_VALUE'] = (string)$old_value;
$params['SOURCE'] = (string)$source;
//$this->callMethod($prop['ONCHANGE'], $params);
$this->callMethodSafe($prop['ONCHANGE'], $params);
@@ -1,42 +1,42 @@
<?php
chdir(dirname(__FILE__) . '/../');
include_once './config.php';
include_once './lib/loader.php';
include_once './lib/threads.php';
set_time_limit(0);
include_once("./load_settings.php");
include_once(DIR_MODULES . "control_modules/control_modules.class.php");
$ctl = new control_modules();
include_once(DIR_MODULES . 'pinghosts/pinghosts.class.php');
$pinghosts = new pinghosts();
$checked_time = 0;
echo date("H:i:s") . " running " . basename(__FILE__) . PHP_EOL;
while (1)
{
if (time() - $checked_time > 10)
{
$checked_time = time();
setGlobal((str_replace('.php', '', basename(__FILE__))) . 'Run', time(), 1);
// checking all hosts
$pinghosts->checkAllHosts(1);
}
if (file_exists('./reboot') || IsSet($_GET['onetime']))
{
exit;
}
sleep(1);
}
DebMes("Unexpected close of cycle: " . basename(__FILE__));
<?php
chdir(dirname(__FILE__) . '/../');
include_once './config.php';
include_once './lib/loader.php';
include_once './lib/threads.php';
set_time_limit(0);
include_once("./load_settings.php");
include_once(DIR_MODULES . "control_modules/control_modules.class.php");
$ctl = new control_modules();
include_once(DIR_MODULES . 'pinghosts/pinghosts.class.php');
$pinghosts = new pinghosts();
$checked_time = 0;
echo date("H:i:s") . " running " . basename(__FILE__) . PHP_EOL;
while (1)
{
if (time() - $checked_time > 10)
{
$checked_time = time();
setGlobal((str_replace('.php', '', basename(__FILE__))) . 'Run', time(), 1);
// checking all hosts
$pinghosts->checkAllHosts();
}
if (file_exists('./reboot') || IsSet($_GET['onetime']))
{
exit;
}
sleep(1);
}
DebMes("Unexpected close of cycle: " . basename(__FILE__));
@@ -141,8 +141,12 @@

[#if TYPE=="php"#]
<div id="xml_row"[#if CODE_TYPE!="1"#] style="display:none"[#endif#]>
[ <a href="#" onClick="return [#CODE_FIELD#]_editBlocklyUpdated();"><#LANG_EDIT#></a> ]
<textarea name="xml" id="xml_code" rows="5" cols="60" class="span10" style="display:none">[#XML#]</textarea>
<a href="#" onClick="return [#CODE_FIELD#]_editBlocklyUpdated();" class="btn btn-default btn-success"><#LANG_EDIT#></a>
<br/>
<small><a href="#" onClick="$('#xml_area').toggle();return false;"><#LANG_SHOW#> XML</a></small>
<div id="xml_area" style="display:none">
<textarea name="xml" id="xml_code" rows="5" cols="60" class="form-control">[#XML#]</textarea>
</div>
</div>
[#endif TYPE#]

0 comments on commit b3ba737

Please sign in to comment.
You can’t perform that action at this time.