";
- my @dashboardgroups = split(",", $dashboardgroups);
- for (my $i=0;$i<@dashboardgroups;$i++){
- $dashboardgroups[$i] = trim($dashboardgroups[$i]); #remove white space from both ends of a string
- $dashboardgroups[$i] =~ tr/<+>/ /; #Fix Groupname if use wrong Groupnames from Bestpractice beginner configuration
- $ret .= "
";
+ for (my $t=0;$t<$tabcount;$t++){
+ my @tabgroup = split(",", $tabgroups[$t]); #Set temp. position for groups without an stored position
+ for (my $i=0;$i<@tabgroup;$i++){
+ if (index($tabsortings[$t],trim($tabgroup[$i])) < 0) { $tabsortings[$t] = $tabsortings[$t]."t".$t."c".GetMaxColumnId($row,$colcount).",".trim($tabgroup[$i]).",true,0,0:"; }
}
- $ret .= "
";
+ $counter++;
+ }
+ }
+
+ return $ret;
}
sub BuildGroupList($) {
-#----------------------------------------------------------------------------------------------------------
my @dashboardgroups = split(",", $_[0]); #array for all groups to build an widget
my %group = ();
@@ -247,7 +355,6 @@ sub BuildGroupList($) {
}
}
}
-#----------------------------------------------------------------------------------------------------------
return %group;
}
@@ -318,38 +425,33 @@ sub BuildGroup($)
return $ret;
}
-sub BuildEmptyColumn($) {
- my ($colcount) = @_;
- my $ret = "";
- my $id = 1;
-
- if ($colcount == 1) { return $ret } else { $colcount = $colcount -1};
- for (my $i=0;$i<$colcount;$i++){
- ########### Empty Column ##################
- $id = $id+$i;
- $ret .= "";
- ###########################################
- }
- return $ret;
+sub GetMaxColumnId($$) {
+ my ($row, $colcount) = @_;
+ my $maxcolid = "0";
+
+ if (index($row,"bottom") > 0) { $maxcolid = "200"; }
+ elsif (index($row,"center") > 0) { $maxcolid = $colcount-1; }
+ elsif (index($row,"top") > 0) { $maxcolid = "100"; }
+ return $maxcolid;
}
sub CheckInstallation($) {
my ($hash) = @_;
unless (-e $FW_dir."/pgm2/".$fwjquery) {
- Log3 $hash, 3, "[".$hash->{NAME}. "] Missing File ".$FW_dir."/pgm2/".$fwjquery;
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."] Missing File ".$FW_dir."/pgm2/".$fwjquery;
$hash->{STATE} = 'Missing File, see LogFile for Details';
}
unless (-e $FW_dir."/pgm2/".$fwjqueryui) {
- Log3 $hash, 3, "[".$hash->{NAME}. "] Missing File ".$FW_dir."/pgm2/".$fwjqueryui;
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."] Missing File ".$FW_dir."/pgm2/".$fwjqueryui;
$hash->{STATE} = 'Missing File, see LogFile for Details';
}
unless (-e $FW_dir."/pgm2/dashboard.js") {
- Log3 $hash, 3, "[".$hash->{NAME}. "] Missing File ".$FW_dir."/pgm2/dashboard.js";
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."] Missing File ".$FW_dir."/pgm2/dashboard.js";
$hash->{STATE} = 'Missing File, see LogFile for Details';
}
unless (-e $FW_icondir."/default/dashboardicons.png") {
- Log3 $hash, 3, "[".$hash->{NAME}. "] Missing File ".$FW_icondir."/default/dashboardicons.png";
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."] Missing File ".$FW_icondir."/default/dashboardicons.png";
$hash->{STATE} = 'Missing File, see LogFile for Details';
}
}
@@ -364,18 +466,75 @@ sub CheckDashboardEntry($) {
InternalTimer ($timeToExec, 'CheckDashboardAttributUssage', $hash, 0);
}
-sub CheckDashboardAttributUssage($) { # replaces old disused attributes and their values
+sub CheckDashboardAttributUssage($) { # replaces old disused attributes and their values | set minimal attributes
my ($hash) = @_;
my $d = $hash->{NAME};
+ my $detailnote = "";
- # Replae older dashboard_showbuttonbar value (outdated 01.2014)
+ # --------- Set minimal Attributes in the hope to make it easier for beginners --------------------
+ my $tabcount = AttrVal($defs{$d}{NAME}, "dashboard_tabcount", "0");
+ if ($tabcount eq "0") { FW_fC("attr ".$d." dashboard_tabcount 1"); }
+ my $tab1groups = AttrVal($defs{$d}{NAME}, "dashboard_tab1groups", "");
+ if ($tab1groups eq "") { FW_fC("attr ".$d." dashboard_tab1groups Set Your Groups - See Attribute dashboard_tab1groups-"); }
+ # -------------------------------------------------------------------------------------------------
+
+ # -------------- Replace older dashboard_showbuttonbar value (outdated 01.2014) ------------------------------
my $showbuttonbarvalue = AttrVal($defs{$d}{NAME}, "dashboard_showbuttonbar", "top");
if ($showbuttonbarvalue eq "0") { FW_fC("attr ".$d." dashboard_showbuttonbar hidden"); }
if ($showbuttonbarvalue eq "1") { FW_fC("attr ".$d." dashboard_showbuttonbar top"); }
+ # ------------------------------------------------------------------------------------------------------------------------
+
+ # ---- detached / transferred from the old attribute to the tab extension (outdated 02.2014) ------
+ my $colheight = AttrVal($defs{$d}{NAME}, "dashboard_colheight", "");
+ if ($colheight ne "") {
+ { FW_fC("attr ".$d." dashboard_rowcenterheight ".$colheight); }
+ { FW_fC("deleteattr ".$d." dashboard_colheight"); }
+ $detailnote = $detailnote." [dashboard_colheight -> dashboard_rowcenterheight]";
+ }
+ my $groups = AttrVal($defs{$d}{NAME}, "dashboard_groups", "");
+ if ($groups ne "") {
+ { FW_fC("attr ".$d." dashboard_tab1groups ".$groups); }
+ { FW_fC("deleteattr ".$d." dashboard_groups"); }
+ $detailnote = $detailnote." [dashboard_groups -> dashboard_tab1groups]";
+ }
+
+ my $sorting = AttrVal($defs{$d}{NAME}, "dashboard_sorting", "");
+ if ($sorting ne "") { #convert old sorting in new
+ my @sortings = split(":", $sorting);
+ my $newsorting = "";
+ my $groupcounter = 0;
+ for (my $s=0;$s<@sortings;$s++){ #0,590w3,true,246,826, 590w0,true,183,258:
+ my @groups = split(",", $sortings[$s]);
+ for (my $g=1;$g<@groups;$g+=4){
+ my $row = AttrVal($defs{$d}{NAME}, "dashboard_row", "center");
+ my $colcount = AttrVal($defs{$d}{NAME}, "dashboard_colcount", "1");
+ my @dbgroups = split(",", AttrVal($defs{$d}{NAME}, "dashboard_tab1groups", ",")); #1. gruppeneintrag = 1. gespeicherte gruppe
+ my @dbgroup = split("w",$groups[$g]);
+ my $column = "";
+ #Map old Column Count to new Count
+ if ($row eq "top" && $groups[0] == 0) { $column = "t0c100"; }
+ if ($row eq "center") { $column = "t0c".$groups[0]; }
+ if ($row eq "bottom" && $groups[0] == 0) { $column = "200"; }
+ if ($row eq "top-center" && $groups[0] == 0) { $column = "t0c100"; }
+ if ($row eq "top-center" && $groups[0] != 0) { $column = "t0c".($groups[0]-1); }
+ if ($row eq "center-bottom" && $groups[0] <= $colcount-1) { $column = "t0c".$groups[0]; }
+ if ($row eq "center-bottom" && $groups[0] > $colcount-1) { $column = "t0c200"; }
+ if ($row eq "top-center-bottom" && $groups[0] == "0") { $column = "t0c100"; }
+ if ($row eq "top-center-bottom" && $groups[0] != 0 && $groups[0] <= $colcount) { $column = "t0c".($groups[0]-1); }
+ if ($row eq "top-center-bottom" && $groups[0] > $colcount) { $column = "t0c200"; }
+ $newsorting = $newsorting.$column.",".$dbgroups[$dbgroup[1]].",".$groups[$g+1].",".$groups[$g+3].",".$groups[$g+2].":";
+ $groupcounter = $groupcounter +1;
+ }
+ }
+ { FW_fC("attr ".$d." dashboard_tab1sorting ".$newsorting); }
+ { FW_fC("deleteattr ".$d." dashboard_sorting"); }
+ $detailnote = $detailnote." [dashboard_sorting -> dashboard_tab1sorting]";
+ }
+ # ------------------------------------------------------------------------------------------------------------------------
# Get out any change to the Logfile
- if ($showbuttonbarvalue eq "0" || $showbuttonbarvalue eq "1") {
- Log3 $hash, 3, "[".$hash->{NAME}. "]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config.";
+ if ($showbuttonbarvalue eq "0" || $showbuttonbarvalue eq "1" || $groups ne "" || $sorting ne "") {
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Using an outdated no longer used Attribute or Value. This has been corrected. Don't forget to save config. ".$detailnote;
}
}
@@ -385,7 +544,7 @@ sub CreateDashboardEntry($) {
my $h = $hash->{NAME};
if (!defined $defs{$h."_weblink"}) {
FW_fC("define ".$h."_weblink weblink htmlCode {DashboardAsHtml(\"".$h."\")}");
- Log3 $hash, 3, "[".$hash->{NAME}. "]"." Weblink dosen't exists. Created weblink ".$h."_weblink. Don't forget to save config.";
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Weblink dosen't exists. Created weblink ".$h."_weblink. Don't forget to save config.";
}
FW_fC("attr ".$h."_weblink room ".$dashboardhiddenroom);
@@ -397,14 +556,14 @@ sub CreateDashboardEntry($) {
if (index($hr,$dashboardname) != -1 && index($hr,$dashboardhiddenroom) == -1) {
$hr =~ s/$dashboardname/$dashboardhiddenroom/g;
FW_fC("attr ".$defs{$dn}{NAME}." hiddenroom ".$hr);
- Log3 $hash, 3, "[".$hash->{NAME}. "]"." Corrected hiddenroom '".$dashboardname."' -> '".$dashboardhiddenroom."' in ".$defs{$dn}{NAME}.". Don't forget to save config.";
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Corrected hiddenroom '".$dashboardname."' -> '".$dashboardhiddenroom."' in ".$defs{$dn}{NAME}.". Don't forget to save config.";
}
#-------------------------------------------------------------------------------------------------
if (index($hr,$dashboardhiddenroom) == -1){
if ($hr eq "") {FW_fC("attr ".$defs{$dn}{NAME}." hiddenroom ".$dashboardhiddenroom);}
else {FW_fC("attr ".$defs{$dn}{NAME}." hiddenroom ".$hr.",".$dashboardhiddenroom);}
- Log3 $hash, 3, "[".$hash->{NAME}. "]"." Added hiddenroom '".$dashboardhiddenroom."' to ".$defs{$dn}{NAME}.". Don't forget to save config.";
+ Log3 $hash, 3, "[".$hash->{NAME}. " V".$dashboardversion."]"." Added hiddenroom '".$dashboardhiddenroom."' to ".$defs{$dn}{NAME}.". Don't forget to save config.";
}
}
}
@@ -420,8 +579,10 @@ sub Dashboard_define ($$) {
$data{FWEXT}{testjs}{SCRIPT} = "/pgm2/dashboard.js";
$hash->{STATE} = 'Initialized';
+
CheckInstallation($hash);
CheckDashboardEntry($hash);
+
return;
}
@@ -436,7 +597,18 @@ sub Dashboard_Undef ($$) {
sub Dashboard_detailFn() {
my ($name, $d, $room, $pageHash) = @_;
my $hash = $defs{$name};
- return DashboardAsHtml($d);
+ #return DashboardAsHtml($d); #creates confusion and leads to incorrect storage of items
+ return;
+}
+
+sub Dashboard_Attr($$$) {
+ my ($cmd, $name, $attrName, $attrVal) = @_;
+
+#if ($cmd eq "set") {
+# $dashboarddata{$attrName} = $attrVal;
+# Log 1, "[DASHBOARD simple debug] ".$attrName." - ".$attrVal;
+# }
+ return;
}
1;
@@ -467,7 +639,7 @@ sub Dashboard_detailFn() {
define anyViews Dashboard
attr anyViews dashboard_colcount 2
attr anyViews dashboard_colwidth 400
- attr anyViews dashboard_groups <Group1>,<Group2>,<Group3>
+ attr anyViews dashboard_tab1groups <Group1>,<Group2>,<Group3>
attr anyViews dashboard_lockstate unlock
attr anyViews dashboard_showhelper 1
@@ -486,15 +658,76 @@ sub Dashboard_detailFn() {
Attributes
+
+
dashboard_tabcount
+ Returns the number of displayed tabs.
+ Default: 1
+
+
+
dashboard_activetab
+ Specifies which tab is activated. Can be set manually, but is also set by the switch "Set" to the currently active tab.
+ Default: 1
+
+
+
dashboard_tab1name
+ Title of Tab 1.
+ Default: Dashboard-Tab 1
+
+
+
dashboard_tab2name
+ Title of Tab 2.
+ Default: Dashboard-Tab 2
+
+
+
dashboard_tab3name
+ Title of Tab 3.
+ Default: Dashboard-Tab 3
+
+
+
dashboard_tab4name
+ Title of Tab 4.
+ Default: Dashboard-Tab 4
+
+
+
dashboard_tab5name
+ Title of Tab 5.
+ Default: Dashboard-Tab 5
+
dashboard_sorting
- Contains the position of each group. Value is written by the "Set" button. It is not recommended to take manual changes.
+ This attribute is no longer used and will be removed at a later date. It was replaced with
+ dashboard_tab1sorting, dashboard_tab2sorting, dashboard_tab3sorting, dashboard_tab4sorting, dashboard_tab5sorting
+
+
dashboard_tab1sorting
+ Contains the position of each group in Tab 1. Value is written by the "Set" button. It is not recommended to take manual changes.
+
+
+
dashboard_tab2sorting
+ Contains the position of each group in Tab 2. Value is written by the "Set" button. It is not recommended to take manual changes.
+
+
+
dashboard_tab3sorting
+ Contains the position of each group in Tab 3. Value is written by the "Set" button. It is not recommended to take manual changes.
+
+
+
dashboard_tab4sorting
+ Contains the position of each group in Tab 4. Value is written by the "Set" button. It is not recommended to take manual changes.
+
+
+
dashboard_tab5sorting
+ Contains the position of each group in Tab 5. Value is written by the "Set" button. It is not recommended to take manual changes.
+
dashboard_row
To select which rows are displayed. top only; center only; bottom only; top and center; center and bottom; top,center and bottom.
Default: center
-
+
+
+
dashboard_width
+ To determine the Dashboardwidth. The value can be specified, or an absolute width value (eg 1200) in pixels in% (eg 80%).
+ Default: 100%
+
dashboard_colwidth
Width of each column in which the groups may be positioned.
@@ -502,23 +735,49 @@ sub Dashboard_detailFn() {
dashboard_colheight
- Height of each column in which the groups may be positioned.
- Default: 400
+ This attribute is no longer used and will be removed at a later date. It was replaced with
+ dashboard_rowcenterheight
+
+
+
dashboard_rowcenterheight
+ Height of the center row in which the groups may be positioned.
+ Default: 400
dashboard_rowtopheight
Height of the top row in which the groups may be positioned.
Default: 250
-
+
"dashboard_rowbottomheight
Height of the bottom row in which the groups may be positioned.
Default: 250
dashboard_groups
- Comma-separated list of the names of the groups to be displayed.
+ This attribute is no longer used and will be removed at a later date. It was replaced with
+ dashboard_tab1groups, dashboard_tab2groups, dashboard_tab3groups, dashboard_tab4groups, dashboard_tab5groups
+
+
+
dashboard_tab1groups
+ Comma-separated list of the names of the groups to be displayed in Tab 1.
+
+
dashboard_tab1groups
+ Comma-separated list of the names of the groups to be displayed in Tab 2.
+
+
+
dashboard_tab1groups
+ Comma-separated list of the names of the groups to be displayed in Tab 3.
+
+
+
dashboard_tab1groups
+ Comma-separated list of the names of the groups to be displayed in Tab 4.
+
+
+
dashboard_tab1groups
+ Comma-separated list of the names of the groups to be displayed in Tab 5.
+
dashboard_lockstate
When set to "unlock" you can edit the Dashboard. When set to "lock" no change can be made.
@@ -580,7 +839,7 @@ sub Dashboard_detailFn() {
define anyViews Dashboard
attr anyViews dashboard_colcount 2
attr anyViews dashboard_colwidth 400
- attr anyViews dashboard_groups <Group1>,<Group2>,<Group3>
+ attr anyViews dashboard_tab1groups <Group1>,<Group2>,<Group3>
attr anyViews dashboard_lockstate unlock
attr anyViews dashboard_showhelper 1
@@ -599,15 +858,76 @@ sub Dashboard_detailFn() {
Attributes
+
+
dashboard_tabcount
+ Gibt die Anzahl der angezeigten Tabs an.
+ Default: 1
+
+
+
dashboard_activetab
+ Gibt an welches Tab aktiviert ist. Kann manuell gesetzt werden, wird aber auch durch den Schalter "Set" auf das gerade aktive Tab gesetzt.
+ Default: 1
+
+
+
dashboard_tab1name
+ Titel des 1. Tab.
+ Default: Dashboard-Tab 1
+
+
+
dashboard_tab2name
+ Titel des 2. Tab.
+ Default: Dashboard-Tab 2
+
+
+
dashboard_tab3name
+ Titel des 3. Tab.
+ Default: Dashboard-Tab 3
+
+
+
dashboard_tab4name
+ Titel des 4. Tab.
+ Default: Dashboard-Tab 4
+
+
+
dashboard_tab5name
+ Titel des 5. Tab.
+ Default: Dashboard-Tab 5
+
dashboard_sorting
- Enthält die Poistionierung jeder Gruppe. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+ Dieses Attribut ist nicht mehr zu verwenden und wird zu einem späteren Zeitpunkt entfernt. Es wurde ersetzt durch
+ dashboard_tab1sorting, dashboard_tab2sorting, dashboard_tab3sorting, dashboard_tab4sorting, dashboard_tab5sorting
+
+
dashboard_tab1sorting
+ Enthält die Poistionierung jeder Gruppe im Tab 1. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+
+
+
dashboard_tab2sorting
+ Enthält die Poistionierung jeder Gruppe im Tab 2. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+
+
+
dashboard_tab3sorting
+ Enthält die Poistionierung jeder Gruppe im Tab 3. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+
+
+
dashboard_tab4sorting
+ Enthält die Poistionierung jeder Gruppe im Tab 4. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+
+
+
dashboard_tab5sorting
+ Enthält die Poistionierung jeder Gruppe im Tab 5. Der Wert wird mit der Schaltfläche "Set" geschrieben. Es wird nicht empfohlen dieses Attribut manuelle zu ändern
+
dashboard_row
Auswahl welche Zeilen angezeigt werden sollen. top (nur Oben), center (nur Mitte), bottom (nur Unten) und den Kombinationen daraus.
Standard: center
-
+
+
+
dashboard_width
+ Zum bestimmen der Dashboardbreite. Der Wert kann in % (z.B. 80%) angegeben werden oder als absolute Breite (z.B. 1200) in Pixel.
+ Standard: 100%
+
dashboard_colwidth
Breite der Spalte, in der die Gruppen angeordnet werden. Gilt für "dashboard_row center, top-center-bottom, center-bottom".
@@ -616,7 +936,12 @@ sub Dashboard_detailFn() {
dashboard_colheight
- Höhe der Spalten, in der die Gruppen angeordnet werden. Gilt nur für "dashboard_row center, top-center-bottom, center-bottom".
+ Dieses Attribut ist nicht mehr zu verwenden und wird zu einem späteren Zeitpunkt entfernt. Es wurde ersetzt durch
+ dashboard_rowcenterheight
+
+
+
dashboard_rowcenterheight
+ Höhe der mittleren Zeile, in der die Gruppen angeordnet werden.
Standard: 400
@@ -624,14 +949,35 @@ sub Dashboard_detailFn() {
Höhe der oberen Zeile, in der die Gruppen angeordnet werden.
Standard: 250
-
+
"dashboard_rowbottomheight
Höhe der unteren Zeile, in der die Gruppen angeordnet werden.
Standard: 250
dashboard_groups
- Durch Komma getrennte Liste mit den Namen der Gruppen, die angezeigt werden. Falsche Gruppennamen werden hervorgehoben.
+ Dieses Attribut ist nicht mehr zu verwenden und wird zu einem späteren Zeitpunkt entfernt. Es wurde ersetzt durch
+ dashboard_tab1groups, dashboard_tab2groups, dashboard_tab3groups, dashboard_tab4groups, dashboard_tab5groups.
+
+
+
dashboard_tab1groups
+ Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 1 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.
+
+
+
dashboard_tab2groups
+ Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 2 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.
+
+
+
dashboard_tab3groups
+ Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 3 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.
+
+
+
dashboard_tab4groups
+ Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 4 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.
+
+
+
dashboard_tab5groups
+ Durch Komma getrennte Liste mit den Namen der Gruppen, die im Tab 5 angezeigt werden. Falsche Gruppennamen werden hervorgehoben.