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.
 
 
 
 

229 lines
5.4 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['DID'] );
$TPL =<<<EFUFU
{
title: 'Width Table Editor',
frame: true,
border: false,
xtype: 'editorgrid',
id: 'tw_grid',
cm: new Ext.grid.ColumnModel({
columns: [
{header: "Width [%]", width: 100, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'width' },
{header: "Range [%]", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'range' },
{header: "Range [m]", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'range_m' },
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
}/*,
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}*/
}),
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec ) {
//loadEventProperties( rec.data );
//SelectedEvent = rec.data.id;
//SelectedRow = row;
//alert( SelectedEvent );
//var CB = Ext.getCmp('con_to_src');
//CB.enable();
}
}
}),
ds: new Ext.data.JsonStore({
root: 'rows',
totalProperty: 'totalCount',
idProperty: 'id',
autoLoad: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'width',
type: 'int'
},{
name: 'range',
type: 'string'
},{
name: 'range_m',
type: 'string'
}],
baseParams:{
UID: {$UserID},
SID: '{$Session}',
NID: {$EID}
},
proxy:
new Ext.data.HttpProxy({
method: 'POST',
noCache: false,
type: 'ajax',
prettyUrls: false,
url: '/lib/controller/getWidthTable.php',
headers: {
UIDZ: {$UserID},
SIDZ: '{$Session}',
NIDZ: {$EID}
}
})
}),
tbar:[{
text: 'Add Row',
handler: function(){
var wiwin = new Ext.Window({
title: 'Add Row',
width: 300,
height: 220,
modal: true,
layout: 'fit',
items:{
xtype: 'form',
id: 'm_a_w_f',
border: false,
frame: true,
labelWidth: 160,
hideLabel: false,
items:[{
xtype: 'radio',
fieldLabel: 'Range by Meters',
id: 'ra_ty_me',
name: 'ra_ra_ty',
checked: true,
listeners:{
check: function( t, n ){
if( n ){
Ext.getCmp('ra_ra_vam').enable();
Ext.getCmp('ra_ra_vap').disable();
} else {
Ext.getCmp('ra_ra_vap').enable();
Ext.getCmp('ra_ra_vam').disable();
};
}
}
},{
xtype: 'radio',
fieldLabel: 'Range by Percents',
id: 'ra_ty_pe',
name: 'ra_ra_ty',
checked: false
},{
xtype: 'numberfield',
id: 'ra_ra_vam',
fieldLabel: 'Range [m]',
hideLabel: false,
width: 60,
listeners:{
change: function( t, n, o ){
var cmm = Ext.getCmp('node_range').getValue() / 100;
if( cmm > 0 ){
Ext.getCmp('ra_ra_vap').setValue( n / cmm );
} else {
Ext.getCmp('ra_ra_vap').setValue( 0 );
};
}
}
},{
xtype: 'numberfield',
id: 'ra_ra_vap',
fieldLabel: 'Range [%]',
hideLabel: false,
disabled: true,
minValue: 1,
maxValue: 100,
width: 60,
listeners:{
change: function( t, n, o ){
var cmm = Ext.getCmp('node_range').getValue() / 100;
if( cmm > 0 ){
Ext.getCmp('ra_ra_vam').setValue( n * cmm );
} else {
Ext.getCmp('ra_ra_vam').setValue( 0 );
};
}
}
},{
xtype: 'numberfield',
id: 'wi_wi_va',
fieldLabel: 'Width [%]',
width: 60,
minValue: 1,
maxValue: 5000,
value: 100
}]
},
bbar:[{
text: 'Cancel',
handler: function(){
wiwin.close();
}
},{
text: 'Add',
handler: function(){
var CT = Ext.getCmp('ra_ty_me').getValue();
if( CT ){
var CV = Ext.getCmp('ra_ra_vam').getValue();
} else {
var CV = Ext.getCmp('ra_ra_vap').getValue();
};
var CW = Ext.getCmp('wi_wi_va').getValue();
Ext.Ajax.request({
url: '/lib/controller/addWidthTableRow.php',
params: {
UID: {$UserID},
SID: '{$Session}',
NID: {$EID},
SBM: CT,
RNG: CV,
WDZ: CW
},
success: function( response, opts ){
//get DS and reload!
},
failure: failureAJAXFunction
});
}
}]
});
wiwin.show();
var cmm = Ext.getCmp('node_range').getValue();
Ext.getCmp('ra_ra_vam').setRawValue( cmm );
Ext.getCmp('ra_ra_vap').setRawValue( 100 );
}
},{
text: 'Remove Row',
handler: function(){
}
},{
text: 'Clear Table',
handler: function(){
}
}]
}
EFUFU;
$TPL = str_ireplace( '%%%NAME%%%', $R_name, $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $R_dev, $TPL );
$TPL = str_ireplace( '%%%SPD%%%', $Labels->GetLabel('UART_COM_SPEED'), $TPL );
$TPL = str_ireplace( '%%%SPD_VAL%%%', $Z['speed'], $TPL );
$TPL = str_ireplace( '%%%BITS_VAL%%%',$Z['bit'], $TPL );
$TPL = str_ireplace( '%%%PARITY_VAL%%%',$Z['parity'], $TPL );
$TPL = str_ireplace( '%%%STOPS_VAL%%%',$Z['stop_bit'], $TPL );
$TPL = str_ireplace( '%%%%RES_ID%%%',$EID, $TPL );
$TPL = str_ireplace( '%%%USER_ID%%%',$UserID, $TPL );
$TPL = str_ireplace( '%%%SESSION%%%',$Session, $TPL );
echo $TPL;
} else {
header('location: /');
};
?>