Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

193 lines
5.4 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['CID'] );
$QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
$TTPL=<<<JOJOKA
{
xtype: 'panel',
border: false,
frame: false,
items:[%%%ITEMS%%%]
}
JOJOKA;
$ITEMS = array();
switch( $CR['type'] ){
case 1: $NAME = '<b>'.$CR['name'].'</b><br/>ALS ' . $Labels->getLabel('SENSOR'); break;
case 2: $NAME = '<b>'.$CR['name'].'</b><br/>LGS ' . $Labels->getLabel('SENSOR'); break;
case 3: $NAME = '<b>'.$CR['name'].'</b><br/>PLS200 ' . $Labels->getLabel('SENSOR'); break;
case 4: $NAME = '<b>'.$CR['name'].'</b><br/>PLS360 ' . $Labels->getLabel('SENSOR'); break;
default: $NAME = '<b>'.$CR['name'].'</b><br/>Unknown Sensor';
};
$INFO = '<table width="100%" border=0 style="font-weight: bold;"><tr><td width="130px" align="right">Serial:</td><td>'.(($CR['serial']!='')?$CR['serial']:'No Serial Defined').'</td></tr><tr><td align="right">Version:</td><td>'.(($CR['version']!='')?$CR['version']:'No Version Info').'</td></tr></table>';
$ITEMS[0]="{ xtype:'panel', border: false, frame: false, html: '<table width=\"100%\" border=0 class=\"setEd_infoPanel\" id=\"SENSOR_".(($CR['enable']==1)?'A':'N')."\"><tr><td width=\"200px\"><div class=\"node_".$CR['type']."_img_sset\"></div></td><td valign=\"middle\">{$NAME}</td></tr><tr><td colspan=2>{$INFO}</td></tr></table><br/>'}";
$QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )";
$RR=$DATABASE->Query( $QS );
if( count( $RR ) ){
$RE=array();
foreach( $RR as $R ){
$RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
};
$UARTS = implode( ',', $RE );
} else {
$UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
};
$ED =<<<kokakskhkajhskr
{
xtype: 'form',
labelWidth: 160,
border: false,
frame: false,
labelAlign: 'right',
items:[{
xtype: 'combo',
id: 'sens_se',
fieldLabel: "{$Labels->GetLabel('_SENS_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: {$CR['enable']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 1, b, true );
}
}
},{
xtype: 'combo',
id: 'sens_range',
fieldLabel: "{$Labels->GetLabel('SENS_RANGE')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['range','range_txt'],
data: [
[15,'15 Meters'],
[35,'35 Meters'],
[45,'45 Meters'],
[65,'65 Meters'],
[75,'75 Meters'],
[150,'150 Meters'],
[200,'200 Meters'],
[300,'300 Meters']
]
}),
valueField: 'range',
displayField: 'range_txt',
value: {$CR['max_range']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 2, b, true );
}
}
},{
xtype: 'numberfield',
id: 'sens_id',
fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}',
width: 200,
value: {$CR['device_id']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 3, c, true );
}
}
},{
xtype: 'combo',
fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}',
lazyRender: true,
id: 'uart_id',
mode: 'local',
disabled: false,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [{$UARTS}]
}),
valueField: 'uart',
displayField: 'uart_txt',
value: {$CR['uart_id']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 4, c.data.uart, true );
}
}
},{
xtype: 'combo',
id: 'ad_se',
fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['ad','ad_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[10,'Each 10 Flips'],
[20,'Each 20 Flips'],
[30,'Each 30 Flips'],
[40,'Each 40 Flips'],
[50,'Each 50 Flips'],
[100,'Each 100 Flips'],
[200,'Each 200 Flips']
]
}),
valueField: 'ad',
displayField: 'ad_txt',
value: {$CR['auto_draw']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 5, b, true );
}
}
},{
xtype: 'numberfield',
id: 'basesh_id',
fieldLabel: '{$Labels->GetLabel('__ZERO_SHIFT__')}',
width: 200,
value: {$CR['base_shift']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 6, c, true );
}
}
}]
}
kokakskhkajhskr;
$ITEMS[1] = $ED;
$CONTENT = implode(',',$ITEMS);
$TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
echo $TTPL;
} else {
echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
};
} else {
header('location: /');
};
?>