Skip to content

Commit a4d5e2e

Browse files
committed
Update 66_EPG.pm
- fix Ch_sort after restart FHEM and run command aviable channels
1 parent 4d61c30 commit a4d5e2e

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

FHEM/66_EPG.pm

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#################################################################
2-
# $Id: 66_EPG.pm 15699 2019-12-18 00:01:50Z HomeAuto_User $
2+
# $Id: 66_EPG.pm 15699 2019-12-19 00:01:50Z HomeAuto_User $
33
#
44
# Github - FHEM Home Automation System
55
# https://github.com/fhem/EPG
@@ -14,7 +14,7 @@
1414
# *.xz -> ohne Dateiendung nach unpack
1515
#################################################################
1616
# Note´s
17-
# - check define Sort in FAV and restart FHEM
17+
# -
1818
#
1919
# Features:
2020
# - definierbare CommandFunktion bei Onklick
@@ -272,7 +272,7 @@ sub EPG_Define($$) {
272272
CommandAttr($hash,"$name room $typ") if (!defined AttrVal($name, "room", undef)); # set room, if only undef --> new def
273273
}
274274

275-
$hash->{VERSION} = "20191218";
275+
$hash->{VERSION} = "20191219";
276276

277277
### default value´s ###
278278
readingsBeginUpdate($hash);
@@ -760,17 +760,28 @@ sub EPG_FW_Popup_Channels {
760760
my $name = shift;
761761
my $html_site_ch = "";
762762
my $Ch_select = AttrVal($name, "Ch_select", undef);
763-
my $Ch_sort = "";
763+
my $Ch_sort = AttrVal($name, "Ch_sort", undef);
764+
my @Ch_sort = split(",",$Ch_sort) if (AttrVal($name, "Ch_sort", undef));
765+
$Ch_sort = "";
764766
my $checked = "";
767+
my $checked_cnt = -1;
765768

766769
Log3 $name, 4, "$name: FW_Channels is running";
767770

768771
$html_site_ch.= "<div id=\"table_ch\"><table class=\"block wide\">";
769772
$html_site_ch.= "<tr class=\"even\" style=\"text-decoration-line: underline;\"><th>".$EPG_tt->{"no"}."</th><th>".$EPG_tt->{"active"}."</th><th>".$EPG_tt->{"tv_name"}."</th><th>".$EPG_tt->{"tv_fav"}."</th></tr>";
770773

771774
for (my $i=0; $i<scalar(@channel_available); $i++) {
772-
$checked = "checked" if ($Ch_select && index($Ch_select,$channel_available[$i]) >= 0);
773-
$Ch_sort = $HTML->{$channel_available[$i]}{ch_wish} if($HTML->{$channel_available[$i]}{ch_wish} && $HTML->{$channel_available[$i]}{ch_wish} < 999);
775+
if ($Ch_select && index($Ch_select,$channel_available[$i]) >= 0) {
776+
$checked_cnt++;
777+
$checked = "checked";
778+
if($HTML->{$channel_available[$i]}{ch_wish} && $HTML->{$channel_available[$i]}{ch_wish} < 999) {
779+
$Ch_sort = $HTML->{$channel_available[$i]}{ch_wish};
780+
} else {
781+
$Ch_sort = $Ch_sort[$checked_cnt] if ($Ch_sort[$checked_cnt] && $Ch_sort[$checked_cnt] ne 0);
782+
}
783+
}
784+
774785
$html_site_ch.= sprintf("<tr class=\"%s\">", ($i & 1)?"even":"odd");
775786
$html_site_ch.= "<td align=\"center\">".($i + 1)."</td><td align=\"center\"><input type=\"checkbox\" id=\"".$i."\" name=\"".$channel_available[$i]."\" onclick=\"Checkbox(".$i.")\" $checked></td><td>". $channel_available[$i] ."</td><td> <input type=\"text\" pattern=\"[0-9]+\" id=\"".$i."\" value=\"$Ch_sort\" maxlength=\"3\" size=\"3\"> </td></tr>";
776787
$checked = "";

0 commit comments

Comments
 (0)