Skip to content

Commit 42977d6

Browse files
committed
Updates
* Fix of missing module constructor call (PHP8) * Fix of scenes slider * Devices: new group filter (inactive devices) * Devices: light sensor min value remove
1 parent efcb1f3 commit 42977d6

14 files changed

Lines changed: 81 additions & 92 deletions

js/easySlider1.7.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,25 @@
6060

6161
this.each(function() {
6262
var obj = $(this);
63-
var s = $("li", obj).length;
64-
var w = $("li", obj).width();
65-
var h = $("li", obj).height();
63+
var s = $("li.scenes_li", obj).length;
64+
var w = $("li.scenes_li", obj).width();
65+
var h = $("li.scenes_li", obj).height();
6666
var clickable = true;
6767
obj.width(w);
6868
obj.height(h);
6969
obj.css("overflow","hidden");
7070
var ts = s-1;
7171
var t = 0;
72-
$("ul", obj).css('width',s*w);
73-
72+
$("ul.scenes_ul", obj).css('width',s*w);
73+
74+
7475
if(options.continuous){
75-
$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
76-
$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
77-
$("ul", obj).css('width',(s+1)*w);
76+
$("ul.scenes_ul", obj).prepend($("ul.scenes_ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
77+
$("ul.scenes_ul", obj).append($("ul.scenes_ul li:nth-child(2)", obj).clone());
78+
$("ul.scenes_ul", obj).css('width',(s+1)*w);
7879
};
7980

80-
if(!options.vertical) $("li", obj).css('float','left');
81+
if(!options.vertical) $("li.scenes_li", obj).css('float','left');
8182

8283
if(options.controlsShow){
8384
var html = options.controlsBefore;
@@ -121,17 +122,17 @@
121122

122123
function setCurrent(i){
123124
i = parseInt(i)+1;
124-
$("li", "#" + options.numericId).removeClass("current");
125-
$("li#" + options.numericId + i).addClass("current");
125+
$("li.scenes_li", "#" + options.numericId).removeClass("current");
126+
$("li.scenes_li#" + options.numericId + i).addClass("current");
126127
};
127128

128129
function adjust(){
129130
if(t>ts) t=0;
130131
if(t<0) t=ts;
131132
if(!options.vertical) {
132-
$("ul",obj).css("margin-left",(t*w*-1));
133+
$("ul.scenes_ul",obj).css("margin-left",(t*w*-1));
133134
} else {
134-
$("ul",obj).css("margin-left",(t*h*-1));
135+
$("ul.scenes_ul",obj).css("margin-left",(t*h*-1));
135136
}
136137
clickable = true;
137138
if(options.numeric) setCurrent(t);
@@ -162,13 +163,13 @@
162163
var speed = diff*options.speed;
163164
if(!options.vertical) {
164165
p = (t*w*-1);
165-
$("ul",obj).animate(
166+
$("ul.scenes_ul",obj).animate(
166167
{ marginLeft: p },
167168
{ queue:false, duration:speed, complete:adjust }
168169
);
169170
} else {
170171
p = (t*h*-1);
171-
$("ul",obj).animate(
172+
$("ul.scenes_ul",obj).animate(
172173
{ marginTop: p },
173174
{ queue:false, duration:speed, complete:adjust }
174175
);

languages/default.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,7 @@
13991399
'FAVORITE_DEVICE' => 'Favorite device',
14001400
'SYSTEM_DEVICE' => 'System device',
14011401
'ARCHIVED_DEVICE' => 'Archived device',
1402+
'INACTIVE_DEVICE' => 'Inactive device',
14021403

14031404
'ROOMS' => 'Rooms',
14041405
'APPEARANCE' => 'Appearance',

languages/ru.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@
13961396
'FAVORITE_DEVICE' => 'В списке быстрого доступа',
13971397
'SYSTEM_DEVICE' => 'Системное устройство',
13981398
'ARCHIVED_DEVICE' => 'Архивное утройство',
1399+
'INACTIVE_DEVICE' => 'Неактивное устройство',
13991400

14001401
'ROOMS' => 'Комнаты',
14011402
'APPEARANCE' => 'Внешний вид',

lib/jTemplate.class.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class jTemplate
5252
public function __construct($template, &$data, &$owner = '')
5353
{
5454

55-
$this->phpversion = (float)phpversion();
56-
5755
// set current directory for template includes
5856
if (strpos($template, "/") !== false) {
5957
$root = preg_replace("/\/[^\/]*?$/", "", $template) . "/";
@@ -607,10 +605,6 @@ function parseModules(&$res, &$hash, $dir)
607605
$code = "";
608606
$code .= "$obj=new " . $module_data["name"] . "();\n";
609607

610-
if ($this->phpversion >= 8) {
611-
$code .= "if (method_exists($obj,'" . $module_data["name"] . "')) $obj->" . $module_data["name"] . "();\n";
612-
}
613-
614608
$code .= $obj . "->owner=&\$this->owner;\n";
615609

616610
// setting module parameters from module including directive

lib/module.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ class module
8282
*/
8383
public function __construct()
8484
{
85+
$php_version = (float)phpversion();
86+
if ($php_version >= 8) {
87+
$class_name = get_class($this);
88+
if (method_exists($this, $class_name)) {
89+
$this->$class_name();
90+
}
91+
}
8592
}
8693

8794
/**

modules/devices/SLightSensors_periodMinValueUpdated.php

Lines changed: 0 additions & 2 deletions
This file was deleted.

modules/devices/SLightSensors_valueUpdated.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

modules/devices/devices_search.inc.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@
3030
$qry .= " AND devices.ARCHIVED=1";
3131
} elseif ($group_name == 'is:system') {
3232
$qry .= " AND devices.SYSTEM_DEVICE=1";
33+
} elseif ($group_name == 'is:inactive') {
34+
$object_names = getObjectsByProperty('alive');
35+
if (!is_array($object_names)) {
36+
$object_names = array(0);
37+
}
38+
$total = count($object_names);
39+
if ($total > 0) {
40+
for ($i = 0; $i < $total; $i++) {
41+
$val = getGlobal($object_names[$i].'.alive');
42+
if (!$val) {
43+
$res_object_names[] = "'" . $object_names[$i] . "'";
44+
}
45+
}
46+
$qry .= " AND devices.LINKED_OBJECT IN (" . implode(',', $res_object_names) . ")";
47+
} else {
48+
$qry .= " AND 0";
49+
}
3350
} elseif ($group_name == 'is:battery') {
3451
$object_names = getObjectsByProperty('batteryOperated', 1);
3552
if (!is_array($object_names)) {
@@ -99,7 +116,7 @@
99116
if ($res[0]['ID']) {
100117
//paging($res, 100, $out); // search result paging
101118
$total = count($res);
102-
$out['TOTAL_FOUND']=$total;
119+
$out['TOTAL_FOUND'] = $total;
103120
for ($i = 0; $i < $total; $i++) {
104121
// some action for every record if required
105122
if ($res[$i]['LOCATION_TITLE'] != $loc_title) {

modules/devices/devices_structure.inc.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,7 @@
490490
'CLASS'=>'SLightSensors',
491491
'PROPERTIES'=>array(
492492
'unit'=>array('DESCRIPTION'=>LANG_DEVICES_UNIT,'_CONFIG_TYPE'=>'text'),
493-
'periodMinValue'=>array('DESCRIPTION'=>'Minimum value for period','ONCHANGE'=>'periodMinValueUpdated','KEEP_HISTORY'=>365),
494-
'periodTime'=>array('DESCRIPTION'=>'Period to calculate minimum value (seconds)','_CONFIG_TYPE'=>'num','_CONFIG_HELP'=>'SdSensorPeriodTime'),
495493
),
496-
'METHODS'=>array(
497-
'valueUpdated'=>array('DESCRIPTION'=>'Value Updated','CALL_PARENT'=>1),
498-
'periodMinValueUpdated'=>array('DESCRIPTION'=>'Period Min value updated'),
499-
),
500494
),
501495
);
502496

modules/scenes/scenes.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,12 @@ function clone_scene($id)
563563
function usual(&$out)
564564
{
565565

566+
566567
if ($this->owner->action == 'apps') {
567568
$this->redirect(ROOTHTML . "popup/scenes.html");
568569
}
569570

570-
global $ajax;
571+
$ajax = gr('ajax');
571572
if ($ajax) {
572573
global $op;
573574
header("HTTP/1.0: 200 OK\n");

0 commit comments

Comments
 (0)