Commit 52891c3c authored by nextime's avatar nextime

Add needed files for clima

parent 3326ca8c
ALTER TABLE `user_gui_panels` CHANGE `page` `page` ENUM( 'actuations', 'video', 'cameras', 'stats', 'gmi' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'actuations';
DELETE FROM user_gui_panels where page='';
ALTER TABLE `actions` DROP `select_domain` ;
ALTER TABLE `actions` ADD `action_name` VARCHAR( 32 ) NOT NULL AFTER `id` ,
ADD INDEX ( `action_name` ) ;
ALTER TABLE `timers` CHANGE `timer_name` `description` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ;
ALTER TABLE `timers` ADD `timer_name` VARCHAR( 32 ) NOT NULL AFTER `id` ,
ADD INDEX ( `timer_name` ) ;
ALTER TABLE `speech_actions` CHANGE `speechaction_name` `speechaction_name` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ;
ALTER TABLE `statuses` CHANGE `status_name` `status_name` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ;
ALTER TABLE `statuses` CHANGE `trigger` `status_trigger` VARCHAR( 1024 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ;
ALTER TABLE `statusrealtime` CHANGE `status_name` `status_name` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ;
ALTER TABLE `status_actions` CHANGE `status_name` `status_name` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ;
ALTER TABLE `user_gui_panels` CHANGE `panel_type` `panel_type` ENUM( 'standard', 'gauge', 'graph', 'macrobuttons', 'bookmarks', 'cameras', 'video', 'gxv3175_left', 'gxv3175_center', 'gxv3175_right' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'standard';
<? @include_once("../includes/common.php"); ?>
<div class="row insider">
<?
$DEFPANELS = array();
$DEFPANELS[]=array('panel_title'=>'clima','panel_type'=>'clima','panel_sections'=>'','panel_websections'=>'home','panel_cols'=>6,'panel_height'=>'100%')+$PANELDEFAULTS;
//$DEFPANELS[]=array('panel_title'=>'Uscite Home','panel_sections'=>'relay','panel_websections'=>'home','panel_height'=>'100%')+$PANELDEFAULTS;
//$DEFPANELS[]=array('panel_title'=>'Ingressi Home','panel_sections'=>'input','panel_websections'=>'window','panel_height'=>'100%')+$PANELDEFAULTS;
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user='$_DOMOTIKA[username]' AND page='clima' ORDER by panel_position,id");
if(!$panels or count($panels)<1) {
$panels=$DEFPANELS;
/*
foreach($panels as $p) {
$q="INSERT INTO user_gui_panels
(user,page,panel_title,panel_type,panel_cols,panel_height,panel_visible,panel_position,panel_sections,panel_websections,panel_selector,panel_content)
VALUES
('".$_DOMOTIKA['username']."','clima','".$p['panel_title']."','".$p['panel_type']."',
'".$p['panel_cols']."','".$p['panel_height']."','".$p['panel_visible']."','".$p['panel_position']."',
'".$p['panel_sections']."','".$p['panel_websections']."','".$p['panel_selector']."','".$p['panel_content']."')";
//DB::query($q);
}
*/
}
include($FSPATH."/panels/include.php");
?>
</div> <!-- row -->
<? @include_once("../../includes/common.php"); ?>
<?
if($panel && is_array($panel)) {
if(is_numeric($panel['panel_height'])) $panel['panel_height'].="px";
$visible="";
if($panel['panel_visible']!="all") $visible=$panel['panel_visible'];
if(count($buttonar)<=0) {
$visible.=" hidden-xs hidden-sm";
}
?>
<div class="panel panel-theme-<?=$_DOMOTIKA['gui_theme']?> col-lg-<?=$panel['panel_cols']?> panel-media-low <?=$visible?>" style="height:<?=$panel['panel_height'];?>;">
<?
if($panel['panel_title']!="") {
?>
<div class="panel-heading panel-head-theme-<?=$_DOMOTIKA['gui_theme']?>"><h2 class="panel-title"><?=$panel['panel_title']?></h2></div>
<?
}
$height="";
$dmfull="";
if($panel['panel_height']!="" && intval($panel['panel_height'])>0) {
$height="style=\"height:".$panel['panel_height']."\"";
$dmheight="style=\"height:".strval(intval($panel['panel_height'])-70)."px\"";
if(endsWith($panel['panel_height'], '%')) {
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
}
elseif($panel['panel_height']!="" && intval($panel['panel_height'])==0) {
$height="style=\"height:100%;\"";
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
?>
<div class="domotika-panel <?=$dmfull;?>" <?=$dmheight;?>>
<div class="home-panel" <?=$dmheight;?>>
<div class="list-group theme-<?=$_DOMOTIKA['gui_theme']?>">
</div>
</div>
</div>
</div>
<?}?>
<? @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);
//print_r($buttonar);
if(is_numeric($panel['panel_height'])) $panel['panel_height'].="px";
$visible="";
if($panel['panel_visible']!="all") $visible=$panel['panel_visible'];
if(count($buttonar)<=0) {
$visible.=" hidden-xs hidden-sm";
}
?>
<div class="panel panel-theme-<?=$_DOMOTIKA['gui_theme']?> col-lg-<?=$panel['panel_cols']?> panel-media-low <?=$visible?>" style="height:<?=$panel['panel_height'];?>;">
<?
if($panel['panel_title']!="") {
?>
<div class="panel-heading panel-head-theme-<?=$_DOMOTIKA['gui_theme']?>"><h2 class="panel-title"><?=$panel['panel_title']?></h2></div>
<?
}
$height="";
$dmfull="";
if($panel['panel_height']!="" && intval($panel['panel_height'])>0) {
$height="style=\"height:".$panel['panel_height']."\"";
$dmheight="style=\"height:".strval(intval($panel['panel_height'])-70)."px\"";
if(endsWith($panel['panel_height'], '%')) {
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
}
elseif($panel['panel_height']!="" && intval($panel['panel_height'])==0) {
$height="style=\"height:100%;\"";
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
?>
<div class="domotika-panel <?=$dmfull;?>" <?=$dmheight;?>>
<div class="home-panel" <?=$dmheight;?>>
<div class="list-group theme-<?=$_DOMOTIKA['gui_theme']?>">
<?
foreach($buttonar as $button) {
if($button['devtype']=='analog') {
//$_SESSION['PANELS_CHARTS'][$chart['name']."-".$panel['id']]=$chart;
?>
<div id="gauge-<?=$button['id']."-".$panel['id']?>" data-domotika-type="gauge"
data-dmval-min="<?=floatval($button['minval'])?>"
data-dmval-max="<?=floatval($button['maxval'])?>"
data-dmval-low="<?=floatval($button['lowval'])?>"
data-dmval-high="<?=floatval($button['highval'])?>"
data-dmval-divider="<?=floatval($button['divider'])?>"
data-dmcolor-min="<?=$button['color_min']?>"
data-dmcolor-low="<?=$button['color_low']?>"
data-dmcolor-medium="<?=$button['color_medium']?>"
data-dmcolor-high="<?=$button['color_high']?>"
data-domotika-name="<?=$button['button_name']?>"
data-dmval="<?=floatval($button['status'])?>"
data-domotika-label="<?=$button['unit']?>"
data-domotika-gaugeid="<?=$button['id']?>" style="height:200px;width:550px"></div>
<?
}
}?>
</div>
</div>
</div>
</div>
<?}?>
<? @include_once("../../includes/common.php"); ?>
<script>
function gaugeFloat(fval)
{
return fval;
}
var gaugeArray = new Array();
$("[data-domotika-type=gauge]").each(
function (){
if($(this).attr('data-dmval-min')!=$(this).attr('data-dmval-low') && $(this).attr('data-dmval-min')!=$(this).attr('data-dmval-high'))
{
var customS=[
{color: stringColors[$(this).attr('data-dmcolor-min')],
lo: $(this).attr('data-dmval-min')/$(this).attr('data-dmval-divider'),
hi: $(this).attr('data-dmval-low')/$(this).attr('data-dmval-divider')},
{color: stringColors[$(this).attr('data-dmcolor-low')],
lo: $(this).attr('data-dmval-low')/$(this).attr('data-dmval-divider'),
hi: (($(this).attr('data-dmval-low')/$(this).attr('data-dmval-divider'))
+((($(this).attr('data-dmval-high')-$(this).attr('data-dmval-low'))/2)/$(this).attr('data-dmval-divider')))},
{color: stringColors[$(this).attr('data-dmcolor-medium')],
lo: (($(this).attr('data-dmval-low')/$(this).attr('data-dmval-divider'))
+((($(this).attr('data-dmval-high')-$(this).attr('data-dmval-low'))/2)/$(this).attr('data-dmval-divider'))),
hi: $(this).attr('data-dmval-high')/$(this).attr('data-dmval-divider')},
{color: stringColors[$(this).attr('data-dmcolor-high')],
lo: $(this).attr('data-dmval-high')/$(this).attr('data-dmval-divider'),
hi: $(this).attr('data-dmval-max')/$(this).attr('data-dmval-divider')}
];
console.debug(customS);
} else {
var customS=false;
var levelC=new Array(
stringColors[$(this).attr('data-dmcolor-min')],
stringColors[$(this).attr('data-dmcolor-low')],
stringColors[$(this).attr('data-dmcolor-medium')],
stringColors[$(this).attr('data-dmcolor-high')]
);
}
gaugeArray[$(this).attr('id')]=new JustGage({
id:$(this).attr('id'),
value: 0,
textRenderer: gaugeFloat,
min: $(this).attr('data-dmval-min')/$(this).attr('data-dmval-divider'),
max: $(this).attr('data-dmval-max')/$(this).attr('data-dmval-divider'),
valueFontColor: "#999999",
title: $(this).attr('data-domotika-name'),
labelFontColor: "#999999",
label: $(this).attr('data-domotika-label'),
customSectors: customS,
});
gaugeArray[$(this).attr('id')].refresh($(this).attr('data-dmval')/$(this).attr('data-dmval-divider'));
$(this).data('gauge', gaugeArray[$(this).attr('id')]);
}
);
</script>
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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