Commit 2d56e6da authored by nextime's avatar nextime

Moved gauge js to domotika.js

parent 1a66fb50
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -436,6 +436,60 @@
}
});
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')]);
}
);
var es = new EventSource("/sse");
var syncReceived = function(event) {
......
......@@ -13,7 +13,7 @@
foreach($links as $k => $v)
{
?>
<a href="<?=$BASEGUIPATH."/cameras/".$v?>" data-guisubsection='<?=$v?>' class="btn btn-block btn-default"><?=str_replace(".", " ", $k)?></a>
<a href="<?=$BASEGUIPATH."/clima/".$k?>" data-guisubsection='<?=$v?>' class="btn btn-block btn-default"><?=str_replace(".", " ", $k)?></a>
<?
}
?>
......
......@@ -9,6 +9,7 @@ CSS="../../resources/bootstrap/css/bootstrap.min.css
../../resources/full-glyphicons/css/glyphicons.css
../../resources/bootstrap-switch/static/stylesheets/bootstrap-switch.css
../../resources/js/jqplot/jquery.jqplot.min.css
../../resources/noUiSlider/jquery.nouislider.css
css/style.css
"
......@@ -27,6 +28,7 @@ js/starthammer.js
../../resources/EventSource/eventsource.js
../../resources/js/jquery.easing.1.3.min.js
../../resources/js/jquery.alterclass.js
../../resources/noUiSlider/jquery.nouislider.js
../../resources/js/jqplot/jquery.jqplot.min.js
../../resources/js/jqplot/plugins/jqplot.dateAxisRenderer.min.js
../../resources/js/jqplot/plugins/jqplot.highlighter.min.js
......
......@@ -11,7 +11,7 @@ $panels=FALSE;
if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
{
$pos=1;
$v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM mediasources WHERE websection='camera' AND active=1 AND id='".$GUISUBSECTION."'");
$v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM mediasources WHERE websection='camera' AND active=1 AND id=%i", intval($GUISUBSECTION));
if(is_array($v) && count($v)>0) {
$panels=array();
foreach($v as $cam) {
......@@ -27,7 +27,7 @@ if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
}
if(!$panels)
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user='$_DOMOTIKA[username]' AND page='cameras' ORDER by panel_position,id");
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user=%s AND page='cameras' ORDER by panel_position,id", $_DOMOTIKA['username']);
if(!is_array($panels) or count($panels)<1) {
......
......@@ -5,9 +5,10 @@
$paneldimensions=array('dimensions' => array(4 => '50%'));
$SHOW_EMPTY_PANELS=FALSE;
$panels = array();
if($GUISUBSECTION=="")
{
$panels = array();
$panels[]=array('panel_title'=>$tr->Get('clima')." - ".$tr->Get("Actions"),'panel_sections'=>'actions',
'panel_websections'=>'clima','panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS;
......@@ -22,6 +23,15 @@ if($GUISUBSECTION=="")
'panel_websections'=>'clima','panel_cols'=>4, 'panel_height'=>'100%')+$PANELDEFAULTS+$paneldimensions;
} else {
$thermostats=DB::query("SELECT * from thermostats WHERE name=%s", $GUISUBSECTION);
foreach($thermostats as $t)
{
$ptype='standard';
$pname=str_replace(".", " ", $t['name']);
if($t['sensor_type']=='analog') $ptype='gauge';
$panels[]=array('panel_title'=>$pname,'panel_sections'=>$t['sensor_type'], 'panel_websections'=>'clima',
'panel_type'=>$ptype, 'panel_content'=>$t['sensor_domain'],'panel_cols'=>4, 'panel_height'=>'50%')+$PANELDEFAULTS;
}
}
include($FSPATH."/panels/include.php");
?>
......
......@@ -5,7 +5,7 @@
$panels=FALSE;
if($GUISUBSECTION!="")
{
$v=DB::query("SELECT * FROM stats_charts WHERE websection='$GUISUBSECTION' AND active=1 order by webposition,id");
$v=DB::query("SELECT * FROM stats_charts WHERE websection=%s AND active=1 order by webposition,id", $GUISUBSECTION);
if(is_array($v) && count($v)>0) {
$panels=array();
$pos=1;
......@@ -21,7 +21,7 @@ $DEFPANELS = array();
$DEFPANELS[]=array('panel_title'=>'Default stats','panel_type'=>'graph','panel_content'=>'*','panel_websections'=>'home','panel_cols'=>'12','panel_height'=>'100%')+$PANELDEFAULTS;
if(!$panels)
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user='$_DOMOTIKA[username]' AND page='stats' ORDER by panel_position,id");
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user=%s AND page='stats' ORDER by panel_position,id", $_DOMOTIKA[username]);
if(!$panels or count($panels)<1) {
......
......@@ -10,7 +10,7 @@ $DEFPANELS = array();
$panels=FALSE;
if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
{
$v=DB::query("SELECT id,button_name,position,videostream FROM mediasources WHERE websection='video' AND active=1 AND id='".$GUISUBSECTION."'");
$v=DB::query("SELECT id,button_name,position,videostream FROM mediasources WHERE websection='video' AND active=1 AND id=%i", intval($GUISUBSECTION));
if(is_array($v) && count($v)>0) {
$panels=array();
$pos=1;
......@@ -24,7 +24,7 @@ if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
}
if(!$panels)
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user='$_DOMOTIKA[username]' AND page='video' ORDER by panel_position,id");
$panels=DB::query("SELECT * FROM user_gui_panels WHERE user=%s AND page='video' ORDER by panel_position,id", $_DOMOTIKA[username]);
if(!is_array($panels) or count($panels)<1) {
......
<? @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>
......@@ -33,7 +33,7 @@
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
<script type="text/javascript" src="/resources/js/raphael.min.js"></script>
<script type="text/javascript" src="/resources/js/justgage.js"></script>
<script type="text/javascript" src="/resources/noUiSlider/jquery.nouislider.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/fastclick.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/speech.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/domotika.js"></script>
......
......@@ -19,6 +19,7 @@
<link href="/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/resources/glyphicons/css/bootstrap-glyphicons.css" rel="stylesheet" media="screen">
<link href="/resources/full-glyphicons/css/glyphicons.css" rel="stylesheet" media="screen">
<link href="/resources/noUiSlider/jquery.nouislider.css" rel="stylesheet" media="screen">
<link href="/resources/bootstrap-switch/static/stylesheets/bootstrap-switch.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="/resources/js/jqplot/jquery.jqplot.min.css" media="screen" />
<link href="<?=$BASEGUIPATH;?>/css/style.css" rel="stylesheet" media="screen" />
......
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