Commit d64227e0 authored by nextime's avatar nextime

Better panel sizing and hide empty panels on standard GUI

parent 48736f78
......@@ -45,6 +45,8 @@ $PAGE_ADDFOOTJS = "";
$PAGE_ADDLEFT = "";
$PAGE_ADDRIGHT = "";
$SHOW_EMPTY_PANELS=TRUE;
function addFootJS($file)
{
ob_start();
......
......@@ -2,19 +2,15 @@
<div class="insider">
<?
$paneldimensions=array('dimensions' => array(4 => '50%'));
$SHOW_EMPTY_PANELS=FALSE;
$panels = array();
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Actions"),'panel_sections'=>'actions','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS;
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Outputs"),'panel_sections'=>'output','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS;
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Inputs"),'panel_sections'=>'input','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'50%')+$PANELDEFAULTS;
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Analogs"),'panel_sections'=>'analog','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'50%')+$PANELDEFAULTS;
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Inputs"),'panel_sections'=>'input','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS+$paneldimensions;
$panels[]=array('panel_title'=>$tr->Get($GUISUBSECTION)." - ".$tr->Get("Analogs"),'panel_sections'=>'analog','panel_websections'=>$GUISUBSECTION,'panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS+$paneldimensions;
foreach($panels as $panel) {
if(file_exists($FSPATH."/panels/head/".$panel['panel_type'].".php"))
addHead($FSPATH."/panels/head/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/content/".$panel['panel_type'].".php"))
include($FSPATH."/panels/content/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/footjs/".$panel['panel_type'].".php"))
addFootJS($FSPATH."/panels/footjs/".$panel['panel_type'].".php");
}
include($FSPATH."/panels/include.php");
?>
</div> <!-- insider -->
......@@ -54,13 +54,6 @@ if(!is_array($panels) or count($panels)<1) {
DB::query($q);
}
}
foreach($panels as $panel) {
if(file_exists($FSPATH."/panels/head/".$panel['panel_type'].".php"))
addHead($FSPATH."/panels/head/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/content/".$panel['panel_type'].".php"))
include($FSPATH."/panels/content/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/footjs/".$panel['panel_type'].".php"))
addFootJS($FSPATH."/panels/footjs/".$panel['panel_type'].".php");
}
include($FSPATH."/panels/include.php");
?>
</div> <!-- row -->
......@@ -25,13 +25,6 @@ if(!$panels or count($panels)<1) {
}
}
foreach($panels as $panel) {
if(file_exists($FSPATH."/panels/head/".$panel['panel_type'].".php"))
addHead($FSPATH."/panels/head/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/content/".$panel['panel_type'].".php"))
include($FSPATH."/panels/content/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/footjs/".$panel['panel_type'].".php"))
addFootJS($FSPATH."/panels/footjs/".$panel['panel_type'].".php");
}
include($FSPATH."/panels/include.php");
?>
</div> <!-- row -->
......@@ -48,13 +48,6 @@ if(!is_array($panels) or count($panels)<1) {
DB::query($q);
}
}
foreach($panels as $panel) {
if(file_exists($FSPATH."/panels/head/".$panel['panel_type'].".php"))
addHead($FSPATH."/panels/head/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/content/".$panel['panel_type'].".php"))
include($FSPATH."/panels/content/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/footjs/".$panel['panel_type'].".php"))
addFootJS($FSPATH."/panels/footjs/".$panel['panel_type'].".php");
}
include($FSPATH."/panels/include.php");
?>
</div> <!-- row -->
<? @include_once("../../includes/common.php"); ?>
<?
if($panel && is_array($panel)) {
$buttonar=getPanelButtons($_DOMOTIKA['username'],$panel['panel_content'],$panel['panel_sections'],$panel['panel_websections'],$panel['panel_selector'],true);
//$buttonar=getPanelButtons($_DOMOTIKA['username'],$panel['panel_content'],$panel['panel_sections'],$panel['panel_websections'],$panel['panel_selector'],true);
//print_r($buttonar);
if(is_numeric($panel['panel_height'])) $panel['panel_height'].="px";
$visible="";
......
<? @include_once("../../includes/common.php"); ?>
<?
foreach($panels as $panel)
{
$paneldo=TRUE;
$buttonar=FALSE;
if(file_exists($FSPATH."/panels/panelcheck/".$panel['panel_type'].".php"))
{
$paneldo=FALSE;
include($FSPATH."/panels/panelcheck/".$panel['panel_type'].".php");
}
if($paneldo || $SHOW_EMPTY_PANELS)
{
$showpanels[] = array('panel' => $panel, 'buttons' => $buttonar);
}
}
$totpans=count($showpanels);
foreach($showpanels as $panelar)
{
$buttonar = $panelar['buttons'];
$panel = $panelar['panel'];
if(array_key_exists('dimensions', $panel))
{
if(array_key_exists($totpans, $panel['dimensions']))
{
$panel['panel_height'] = $panel['dimensions'][$totpans];
}
}
if(file_exists($FSPATH."/panels/head/".$panel['panel_type'].".php"))
addHead($FSPATH."/panels/head/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/content/".$panel['panel_type'].".php"))
include($FSPATH."/panels/content/".$panel['panel_type'].".php");
if(file_exists($FSPATH."/panels/footjs/".$panel['panel_type'].".php"))
addFootJS($FSPATH."/panels/footjs/".$panel['panel_type'].".php");
}
?>
<? @include_once("../../includes/common.php"); ?>
<?
if($panel && is_array($panel)) {
$buttonar=getPanelButtons($_DOMOTIKA['username'],$panel['panel_content'],$panel['panel_sections'],$panel['panel_websections'],$panel['panel_selector'],true);
if(count($buttonar) > 0)
$paneldo=TRUE;
}
?>
......@@ -9,7 +9,8 @@ $PANELDEFAULTS=array(
'panel_websections'=>'*',
'panel_selector'=>'dmdomain',
'panel_content'=>'',
'panel_visible'=>'all'
'panel_visible'=>'all',
'panel_position'=>0
);
require_once("session.php");
......
......@@ -10,6 +10,13 @@ from dmlib.daemonizer import Daemonizer
from dmlib.utils.genutils import configFile
import logging, time, sys, os
from logging import handlers as loghandlers
from corepost import Response, NotFoundException, AlreadyExistsException
from corepost.web import RESTResource, route, Http
from corepost.convert import convertForSerialization, generateXml, convertToJson
from corepost.enums import MediaType, HttpHeader
import yaml
try:
......@@ -24,6 +31,8 @@ log = logging.getLogger( 'ZWaved' )
CURDIR=os.path.abspath(os.path.dirname(sys.argv[0]))
sys.path.append(os.path.abspath(CURDIR+"/../../"))
from domotika.web import sse
"""
{'homeId': 23191651L, 'event': 0, 'valueId': {'index': 0, 'units': '', 'type': 'Bool', 'nodeId': 2, 'value': None, 'commandClass': 'COMMAND_CLASS_NO_OPERATION', 'instance': 1, 'readOnly': False, 'homeId': 23191651L, 'label': '', 'genre': 'Basic', 'id': 72057594071482368L}, 'notificationType': 'NodeEvent', 'nodeId': 2}
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment