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.
 
 
 
 

1444 lines
46 KiB

//<?php require_once('../../jscript_asm.php'); ?>
function SecRenderer(value){
if(value>0){
return '<img src="/style/img/ext/icon_padlock.png" title="Secure ['+value+']">';
} else {
return '<img src="/style/img/ext/accept.png" title="Not Secure">';
};
};
var WiFiListColModel = new Ext.grid.ColumnModel([
{header: "<?=$Labels->GetLabel('_SECURITY_NET_');?>", width: 80, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: SecRenderer, dataIndex: 'wifi_sec'},
{header: "<?=$Labels->GetLabel('_WIFI_NETNAME_');?>",width: 252, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_name'},
{header: "<?=$Labels->GetLabel('_WIFI_CAPS_');?>", width: 100, sortable: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_cap'}
]);
var WiFiListRecord = Ext.data.Record.create([
'id',
'wifi_name',
'wifi_cap',
'wifi_sec'
]);
var WiFiListDataStore = new Ext.data.Store({
reader: new Ext.data.JsonReader({
root: "rows", // the property which contains an Array of row objects
idProperty: "id" // the property within each row object that provides an ID for the record (optional)
}, WiFiListRecord // Ext.data.Record constructor that provides mapping for JSON object
)
});
function GetWiFiList(){
Ext.Ajax.request({
url: 'lib/connector/json/device_wlans.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
success: function( response, opts ){
var obj = Ext.decode( response.responseText );
WiFiListDataStore.loadData( obj );
Ext.getCmp('wifi_grid').doLayout();
},
failure: function( response, opts ){
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
},
headers: {
'my-header': 'foo'
},
params: { foo: 'bar' }
});
}
var AddCategoryWindow;
var SelectedNode=null; // root
function ShowAddWindow(){
if( !AddCategoryWindow ){
AddCategoryWindow = new Ext.Window({
title : 'Add New Group',
layout : 'fit',
width : 300,
height : 120,
closeAction :'hide',
plain : false,
animateTarget: 'create_group',
resizable : false,
items : [ new Ext.FormPanel({
id: 'add_catpan',
labelWidth: 100, // label settings here cascade unless overridden
//url:'/connector/json/add_devices_group.php',
frame: true,
//bodyBorder: false,
//border: false,
//title : 'The Geofencing Service',
bodyStyle:'padding:0px 0px 0',
width: '100%',
//layout : 'fit',
defaultType: 'textfield',
items: [{
name : 'grp_name',
labelStyle : 'color: black;',
fieldLabel : 'New Group'
},{
hidden : true,
value : SelectedNode.id,
name : 'grp_parent'//,
//fieldLabel : 'New Category'
}]
})],
buttons:[{
text: 'Add',
listeners: {
click: function(){
Ext.getCmp('add_catpan').getForm().submit({
url: 'lib/connector/json/add_devices_group.php?UID='+UserID+'&SID='+SessionID+'',
waitMsg:'Creating New Group...',
params: {
parent: SelectedNode.id
},
success: function ( aa, rr ){
Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root);
AddCategoryWindow.hide();
},
failure: function( aa, rr ){
switch( rr.result.err_status ){
case 'NEX': // Not Existed Key
Ext.Msg.show({
title:'Activation Failed',
msg: '<center><br/>You are entered activation code that<br/>does not registered in',
buttons: Ext.Msg.OK,
width: 400,
icon: Ext.MessageBox.ERROR
});
break;
}
}
});
}
}
},{
text: 'Cancel',
listeners: {
click: function(){
AddCategoryWindow.hide();
}
}
}]
});
};
AddCategoryWindow.show();
};
function SetIRStatus(a) {
if( a == 0 ){
Ext.getCmp('ir_retrieve').setText('Request Sent');
Ext.getCmp('ir_retrieve').disable();
document.getElementById('ir_status_text').innerHTML='<span class="red"><b>Queued</b></span>';
document.getElementById('ir_status_img').innerHTML='<img src="/style/img/wait.gif">';
} else {
Ext.getCmp('ir_retrieve').setText('Send Request');
Ext.getCmp('ir_retrieve').enable();
document.getElementById('ir_status_text').innerHTML='<span class="green"><b>Idle</b></span>';
document.getElementById('ir_status_img').innerHTML='';
};
};
var HTTPO_IR = null;
var IR_TIMER = null;
function StartIRSession(){
var QURL='';
if ( HTTPO_IR == null ){
HTTPO_IR = getHTTPObject();
};
if ( HTTPO_IR != null ) {
QURL="/lib/connector/json/iridium_ping.php?UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&OP=CHLS";
HTTPO_IR.open("GET", QURL , true);
HTTPO_IR.send('');
HTTPO_IR.onreadystatechange = HGDT_IR;
} else {
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CSXL00221');
};
};
function HGDT_IR(){
switch(HTTPO_IR.readyState){
case 0: window.status = 'IR:Communication is Uninitialized';
break;
case 1: window.status = 'IR:Loading Data';
break;
case 2: window.status = 'IR:Data is Loaded';
break;
case 3: window.status = 'IR:Communication is Interactive';
break;
case 4: window.status = 'IR:Data Load Complete';
break;
};
if( HTTPO_IR.readyState == 4 ){
var T_Arr;
//alert( HTTPO_IR.responseText);
T_Arr = JSON_parse( HTTPO_IR.responseText,'' );
httpRequestType=T_Arr.type/1;
//alert(httpRequestType);
if( T_Arr.status == 0 ){
SetIRStatus(0);
if( IR_TIMER == null ){
IR_TIMER = window.setInterval( 'StartIRSession();',20000);
};
} else {
SetIRStatus(1);
if( IR_TIMER != null ){
window.clearInterval( IR_TIMER );
IR_TIMER = null;
};
};
};
};
function ShowWiFiNetworks(){
if( !WiFiNetworksWindow ){
WiFiNetworksWindow = new Ext.Window({
title : "<?=$Labels->GetLabel('_WIFI_NETS_RANGE');?>",
layout : 'fit',
width : 450,
height : 300,
closeAction :'hide',
plain : false,
resizable : false,
items : [
{
xtype : 'grid',
id : 'wifi_grid',
height : 189,
frame: false,
forceFit: true,
//title: 'Geofencing Zones List',
ds: WiFiListDataStore,
cm: WiFiListColModel,
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
SelectedZone=rec.data;
PreviewZone(SelectedZone.id);
}
}
}),
//autoExpandColumn: 'login',
width: '100%',
border: false
}
],
buttons: [
{
text: "<?=$Labels->GetLabel('_CLOSE_');?>",
handler: function(){
WiFiNetworksWindow.hide();
}
}
]});
};
WiFiNetworksWindow.show();
GetWiFiList();
};
Ext.onReady( function(){
var gct_p = Ext.get('gmap_control_placeholder');
var gct_t = Ext.get('gmap_control_toolbox');
var gct_m = Ext.get('gmap_control_map');
var GMapToolbox = new Ext.Panel({
title: "<?=$Labels->GetLabel('_Tools_');?>",
//renderTo: gct_t,
region:'west',
margins: '5 0 0 5',
width: 200,
height: PanelH,
collapsible: true, // make collapsible
//collapsed: true,
//collapseFirst: true,
cmargins: '5 5 0 5', // adjust top margin when collapsed
id: 'GMAP-Toolbox',
style: 'background: white; border: 1px solid black;',
hideCollapseTool: false,
layoutConfig: {
titleCollapse: true,
//animate: false,
activeOnTop: true
},
items: [
new Ext.Panel({
id: 'acc_module',
//title: 'Tools',
//margins: '5 0 0 5',
width: 200,
height: PanelH - 160,
bodyBorder: true,
layout:'accordion',
unstyled: true,
defaults: {
// applied to each contained panel
bodyStyle: 'padding:5px',
frame: false
},
layoutConfig: {
// layout-specific configs go here
//titleCollapse: false,
//animate: false
//activeOnTop: true
},
items: [
new Ext.tree.TreePanel({
id:'dev-tree',
title: "<?=$Labels->GetLabel('_TRACK_DEVICES_');?>",
frame: false,
enableDD:true,
animate: true,
autoScroll:true,
dropConfig: {appendOnly:true},
//containerScroll: true,
border: false,
loader: new Ext.tree.TreeLoader({
dataUrl: 'lib/connector/json/tracking_device_tree.php?UID='+UserID+'&SID='+SessionID,
baseAttrs:{
expanded: true
},
listeners:{
load: function( tre, tnode, response ){
//alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID);
//GMapToolbox.doLayout();
//GMapToolbox.expand();
if ( tnode.getPath() == InitTreeNodePath ){
tnode.select();
};
}
}
}),
listeners:{
movenode: function( tt, nn, op, np, idx ){
if( nn.attributes.device_db_id == 0 ){
AURL = 'lib/connector/json/move_group_node.php?node='+nn.id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID;
} else {
AURL = 'lib/connector/json/move_tracker_node.php?node='+nn.attributes.device_db_id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID;
};
Ext.Ajax.request({
url: AURL,
success: function( response, opts ){
},
failure: function( response, opts ){
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
},
headers: { 'my-header': 'foo' },
params: { foo: 'bar' }
});
},
click : function( tnode, evt ){
SelectedNode= tnode;
//alert( tnode.getPath() );
if ( PopUpShown ){
if ( map.getExtInfoWindow() != null) {
map.closeExtInfoWindow();
}
//Markers[ PopUpMarkerID ].closeExtInfoWindow();
};
if ( tnode.attributes.device_db_id == 0 ){ // Group Selected
Ext.getCmp('t_settings').disable();
CDevID=tnode.id;
SaveSetting(2, CDevID );
CQStyle = 2
RetriveData();
} else { // Device Selected
Ext.getCmp('t_settings').enable();
if ( tnode.attributes.link_type == 'G' ){
NumberOfPoints=OLD_NumberOfPoints;
Ext.getCmp('trh_simple').enable();
Ext.getCmp('trh_sms').disable();
Ext.getCmp('history-settings').setActiveTab('trh_simple');
if ( SMS_timer != null ) window.clearInterval( SMS_timer );
} else {
if ( tnode.attributes.link_type == 'I' ){ // Combined Mode = GPRS+SMS
NumberOfPoints=OLD_NumberOfPoints;
Ext.getCmp('trh_simple').enable();
Ext.getCmp('trh_sms').enable();
Ext.getCmp('history-settings').setActiveTab('trh_simple');
SMS_timer=window.setInterval('StartSmsSession(9);',5000);
} else {
OLD_NumberOfPoints=NumberOfPoints;
NumberOfPoints=1;
Ext.getCmp('trh_simple').disable();
Ext.getCmp('trh_sms').enable();
Ext.getCmp('history-settings').setActiveTab('trh_sms');
SMS_timer=window.setInterval('StartSmsSession(9);',5000);
};
};
CDevID=tnode.attributes.device_db_id;
SaveSetting(2, 'dev_'+CDevID );
Ext.getCmp('ctrack_name').removeAll();
Ext.getCmp('ctrack_name').add({
html: "<?=$Labels->GetLabel('_TRACKER_DEV_');?>"+': <span style="font-weight: bold;"><img width="16px" style="position: relative; top: 4px;" src="/resources/vehicles/icons/'+ SiteIcon[ tnode.attributes.icon_id ].file + '">&nbsp;'+ tnode.text +'</span>'
});
Ext.getCmp('ctrack_name').doLayout();
if( ( tnode.attributes.caps & 8 ) == 8 ){
Ext.getCmp('ird_retrive').enable();
StartIRSession();
ChatModuleEnabled = true;
CurrentCDate = Math.round((new Date())/1000);
if ( !ChatModule ){
ChatModule = Ext.getCmp('acc_module').insert( 1, new Ext.Panel({
id: 'chat_module',
title: 'Online Chat',
listeners:{
expand: function( pA ){
GetMesseges();
}
},
tbar: [ {xtype: 'tbspacer'}, { xtype: 'tbtext', id: 'c_dev', text: '', style: 'color: white; font-weight: bold;' }, '->',{
id: 'dis_sound',
text: '',
iconCls: 'chat_mute_on_icon',
tooltip: 'Mute Sound Notification',
handler: function(){
if ( SoundEnabled ){
Ext.Msg.show({
title:'Disable Sound Notification',
width: 500,
msg: '<center>Are You Certain You Want To Do This ?<br/>The Emergency Event and New Messages will appear Silently.</center>',
buttons: Ext.Msg.YESNOCANCEL,
fn: function(btn, text){
if (btn == 'yes'){
SoundEnabled = false;
Ext.getCmp('dis_sound').setIconClass('chat_mute_off_icon');
} else {
SoundEnabled = true;
};
},
//animEl: 'elId',
icon: Ext.MessageBox.QUESTION
});
if ( SoundEnabled ){
niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/que.mp3');
};
} else {
SoundEnabled = true;
Ext.getCmp('dis_sound').setIconClass('chat_mute_on_icon');
};
}
}, '-', {
id: 'chat_popup_btn',
text: '',
iconCls: 'chat_popup_icon',
tooltip: 'Popup Chat Window',
handler: function(){
PopUpChat();
}
} ],
items: [{
html: '<table width="100%" border=0 height="' + ( PanelH - 390 ) + 'px"><tr><td><div id="chat_div" class="chat_chat_class" style="height: ' + ( PanelH - 400 ) + 'px;"><div style="text-align: center; height: ' + ( PanelH - 390 ) + 'px; width: 100%; font-size: 12px; font-weight: bold; vertical-align: middle;">Loading Data ... <img src="/style/img/wait.gif"></div></div></td></tr></table>'
}, new Ext.form.TextField({
id: 'chat_input',
width: '100%',
height: 25,
listeners: {
specialkey: function( field, e ){
// e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,
// e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN
if ( e.getKey() == e.ENTER ) {
CMSG='';
CMSG=Ext.getCmp('chat_input').getValue();
Ext.getCmp('chat_input').reset();
Ext.getCmp('chat_send_btn').disable();
if ( CMSG != ''){
Ext.Ajax.request({
url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
success: function( response, opts ){
Ext.getCmp('chat_send_btn').enable();
GetMesseges();
},
failure: function( response, opts ){
Ext.getCmp('chat_send_btn').enable();
//Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
},
headers: {
'my-header': 'foo'
},
params: { MSG: CMSG }
});
};
};
}
}
})
],
buttonAlign: 'right',
buttons: [ {
id: 'chat_send_btn',
text: 'SEND',
handler: function(){
CMSG='';
CMSG=Ext.getCmp('chat_input').getValue();
Ext.getCmp('chat_input').reset();
Ext.getCmp('chat_send_btn').disable();
if ( CMSG != ''){
Ext.Ajax.request({
url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
success: function( response, opts ){
Ext.getCmp('chat_send_btn').enable();
GetMesseges();
},
failure: function( response, opts ){
Ext.getCmp('chat_send_btn').enable();
//Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
},
headers: {
'my-header': 'foo'
},
params: { MSG: CMSG }
});
};
}
} ]
}) );
};
Ext.getCmp('acc_module').doLayout();
Ext.getCmp('c_dev').setText( tnode.text );
} else {
SetIRStatus(1);
Ext.getCmp('ird_retrive').disable();
if( IR_TIMER ){
window.clearInterval( IR_TIMER );
IR_TIMER = null;
};
if( ChatModuleEnabled ){
window.clearTimeout( MessegesIntervalHandler );
ChatModuleEnabled = false;
Ext.getCmp('acc_module').remove( ChatModule, true );
ChatModule = null;
Ext.getCmp('acc_module').doLayout();
};
};
CQStyle=0;
RetriveData();
};
}
},
tbar:[ '->',{
id: 'create_group',
iconCls: 'add_group_icon',
text: '',
tooltip: 'Add New Group',
handler: function(){
ShowAddWindow();
}
},{
id: 'delete_group',
iconCls: 'del_group_icon',
tooltip: 'Remove Group',
text: '',
handler: function(){
if( SelectedNode != null ){
if( SelectedNode.attributes.device_db_id == 0 ){
if( SelectedNode.isExpanded() ){
if( SelectedNode.hasChildNodes() ){
Ext.Msg.show({
title:'Error',
msg: '<center><br/>You can not delete not empty group</center>',
buttons: Ext.Msg.OK,
width: 400,
icon: Ext.MessageBox.ERROR
});
} else {
Ext.Ajax.request({
url: 'lib/connector/json/delete_devices_group.php?UID='+UserID+'&SID='+SessionID+'&GID='+SelectedNode.id,
success: function( response, opts ){
Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root);
},
failure: function( response, opts ){
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
}
});
};
} else {
Ext.Msg.show({
title:'Error',
msg: '<center><br/>You can not delete collapsed group</center>',
buttons: Ext.Msg.OK,
width: 400,
icon: Ext.MessageBox.ERROR
});
};
};
};
}
}],
rootVisible:false,
lines: true,
autoScroll:true,
root: new Ext.tree.AsyncTreeNode({
text: "<?=$Labels->GetLabel('_ALL_DEVICES_');?>",
expanded: true
})
}), new Ext.Panel({
id: 't_settings',
title: "<?=$Labels->GetLabel('_TRACK_SETTINGS_');?>",
frame: true,
//style: 'background: white;',
align: 'center',
items: [{
id: 'ctrack_name',
width: 190,
height: 30
},{
xtype: 'tabpanel',
id: 'history-settings',
resizeTabs: true,
minTabWidth: 70,
activeTab: 0,
width: 190,
//height: 240, // Why do I have to specify the height here?
// Shouldn't its container's 'fit' layout take
// care of that?
//width: PanelH,
//hidden: true,
border: false,
deferredRender: true, // This works
//defaults: {autoScroll: true},
listeners:{
'tabchange': function( tab , tab_p ){
if(tab_p.id=='trh_dts'){
window.clearInterval(MapUpdateInterval);
trackingMode = 2;
CQStyle=5;
StartCalendarSession(5);
//Ext.getCmp('history-settings').setVisible( true );
try{
Ext.getCmp('history-settings').doLayout();
} catch(e){};
} else {
map.checkResize();
StartTrackingSession(0);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
trackingMode = 1;
CQStyle=0;
//Ext.getCmp('history-settings').setVisible( false );
try{
Ext.getCmp('history-settings').doLayout();
} catch (e){};
};
//alert(trackingMode);
}
},
items: [
{
layout: 'form',
title: "<?=$Labels->GetLabel('_REAL_TIME_');?>",
frame: true,
id:'trh_simple',
tabWidth: 100,
//height: 180,
//labelWidth: 50,
//defaults: { width: 80},
items: [new Ext.form.Radio({
width: 180,
hideLabel: true,
boxLabel: "<?=$Labels->GetLabel('_50_LAST_POINT_');?>",
listeners: {
'check': function( ch, checked ){
if(checked){
NumberOfPoints=50;
OLD_NumberOfPoints=50;
SaveSetting(18,50);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
RetriveData();
};
}
},
id: 'track_type_50',
name: 'track_type'
}), new Ext.form.Radio({
width: 180,
hideLabel: true,
boxLabel: "<?=$Labels->GetLabel('_25_LAST_POINT_');?>",
listeners: {
'check': function( ch, checked ){
if(checked){
NumberOfPoints=25;
OLD_NumberOfPoints=25;
SaveSetting(18,25);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
RetriveData();
};
}
},
id: 'track_type_25',
name: 'track_type'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
boxLabel: "<?=$Labels->GetLabel('_15_LAST_POINT_');?>",
listeners: {
'check': function( ch, checked ){
if(checked){
NumberOfPoints=15;
OLD_NumberOfPoints=15;
SaveSetting(18,15);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
RetriveData();
};
}
},
id: 'track_type_15',
name: 'track_type'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
boxLabel: "<?=$Labels->GetLabel('_5_LAST_POINT_');?>",
listeners: {
'check': function( ch, checked ){
if(checked){
NumberOfPoints=5;
OLD_NumberOfPoints=5;
SaveSetting(18,5);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
RetriveData();
};
}
},
id: 'track_type_5',
name: 'track_type'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
boxLabel: "<?=$Labels->GetLabel('_1_LAST_POINT_');?>",
listeners: {
'check': function( ch, checked ){
if(checked){
NumberOfPoints=1;
OLD_NumberOfPoints=1;
SaveSetting(18,1);
window.clearInterval(MapUpdateInterval);
MapUpdateInterval=window.setInterval("RetriveData();",10000);
RetriveData();
};
}
},
id: 'track_type_1',
name: 'track_type'
}), {
xtype: 'spacer',
height: 10
}, {
xtype: 'panel',
id: 'ird_retrive',
frame: true,
disabled: true,
title: 'Retrieve Current Position',
items:[{
html: '<table width="100%"><tr><td align="center" id="ir_status_text" style="font-size: 12px; height: 20px;"><span class="green"><b>Idle</b></span></td><td id="ir_status_img"></td></tr></table>'
}, {
xtype: 'button',
id: 'ir_retrieve',
width: '100%',
text: 'Send Request',
handler: function(){
SetIRStatus( 0 );
Ext.Ajax.request({
url: 'lib/connector/json/iridium_ping.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID+'&OP=REQP',
success: function( response, opts ){
StartIRSession();
},
failure: function( response, opts ){
SetIRStatus( 0 );
}
});
}
}
]
}
]
},{
layout: 'form',
title: "<?=$Labels->GetLabel('_HISTORY_');?>",
id:'trh_dts',
frame: true,
height: 255,
labelAlign: 'right',
labelWidth: 50,
defaults: { width: 80},
items: [
new Ext.form.ComboBox({
id: 'STimeFROM',
typeAhead: true,
width: 120,
triggerAction: 'all',
fieldLabel: "<?=$Labels->GetLabel('_FROM_TIME_');?>",
forceSelection: true,
allowBlank: false,
hiddenName: 'type',
//labelStyle: 'width: 150px;',
lazyRender: true,
mode: 'local',
value: '00:00',
listeners: {
select: function( me, mrec, idx ){
SH=Math.floor( me.getValue()/60 );
SM=me.getValue() - 60 * SH;
}
},
store: new Ext.data.ArrayStore({
id: 0,
fields: [
'val',
'displayText'
],
data: [
['0000', '00:00'],
['0030', '00:30'],
['0060', '01:00'],
['0090', '01:30'],
['0120', '02:00'],
['0150', '02:30'],
['0180', '03:00'],
['0210', '03:30'],
['0240', '04:00'],
['0270', '04:30'],
['0300', '05:00'],
['0330', '05:30'],
['0360', '06:00'],
['0390', '06:30'],
['0420', '07:00'],
['0450', '07:30'],
['0480', '08:00'],
['0510', '08:30'],
['0540', '09:00'],
['0570', '09:30'],
['0600', '10:00'],
['0630', '10:30'],
['0660', '11:00'],
['0690', '11:30'],
['0720', '12:00'],
['0750', '12:30'],
['0780', '13:00'],
['0810', '13:30'],
['0840', '14:00'],
['0870', '14:30'],
['0900', '15:00'],
['0930', '15:30'],
['0960', '16:00'],
['0990', '16:30'],
['1020', '17:00'],
['1050', '17:30'],
['1080', '18:00'],
['1110', '18:30'],
['1140', '19:00'],
['1170', '19:30'],
['1200', '20:00'],
['1230', '20:30'],
['1260', '21:00'],
['1290', '21:30'],
['1320', '22:00'],
['1350', '22:30'],
['1380', '23:00'],
['1410', '23:30'],
['1439', '24:00']
]
}),
valueField: 'val',
displayField: 'displayText'
}),new Ext.form.ComboBox({
id: 'STimeTO',
typeAhead: true,
width: 50,
triggerAction: 'all',
fieldLabel: "<?=$Labels->GetLabel('_TILL_TIME_');?>",
forceSelection: true,
allowBlank: false,
hiddenName: 'type',
//labelStyle: 'width: 150px;',
lazyRender: true,
mode: 'local',
value: '00:00',
listeners: {
select: function( me, mrec, idx ){
EH=Math.floor( me.getValue()/60 );
EM=me.getValue() - 60 * EH;
}
},
store: new Ext.data.ArrayStore({
id: 0,
fields: [
'val',
'displayText'
],
data: [
['0000', '00:00'],
['0030', '00:30'],
['0060', '01:00'],
['0090', '01:30'],
['0120', '02:00'],
['0150', '02:30'],
['0180', '03:00'],
['0210', '03:30'],
['0240', '04:00'],
['0270', '04:30'],
['0300', '05:00'],
['0330', '05:30'],
['0360', '06:00'],
['0390', '06:30'],
['0420', '07:00'],
['0450', '07:30'],
['0480', '08:00'],
['0510', '08:30'],
['0540', '09:00'],
['0570', '09:30'],
['0600', '10:00'],
['0630', '10:30'],
['0660', '11:00'],
['0690', '11:30'],
['0720', '12:00'],
['0750', '12:30'],
['0780', '13:00'],
['0810', '13:30'],
['0840', '14:00'],
['0870', '14:30'],
['0900', '15:00'],
['0930', '15:30'],
['0960', '16:00'],
['0990', '16:30'],
['1020', '17:00'],
['1050', '17:30'],
['1080', '18:00'],
['1110', '18:30'],
['1140', '19:00'],
['1170', '19:30'],
['1200', '20:00'],
['1230', '20:30'],
['1260', '21:00'],
['1290', '21:30'],
['1320', '22:00'],
['1350', '22:30'],
['1380', '23:00'],
['1410', '23:30'],
['1439', '24:00']
]
}),
valueField: 'val',
displayField: 'displayText'
}),{
width: '100%',
html: '<table width="100%"><tr><td id="calendar_TD" valign="top" align="center"></td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
width: '100%',
text: "<?=$Labels->GetLabel('_DISP_HISTORY_');?>",
listeners:{
click: function( me, e){
//alert(SMO+' '+SD);
CQStyle=3;
RetriveData();
}
}
}]
},{
title: 'SMS',
frame: true,
id:'trh_sms',
disabled: true,
//height: 200,
items: [ new Ext.Panel({
title: "<?=$Labels->GetLabel('_TRACK_POINTS_');?>",
frame: true,
//height: 100,
html: '<table width=100%><tr><td align="center"><span id="sms_ammount">'+ACC_sms_ammount+"</span> <?=$Labels->GetLabel('_POINTS_');?>.</td></tr></table>",
buttons: [{
xtype: 'button',
text: "<?=$Labels->GetLabel('_PURCH_MORE_');?>",
listeners: {
click: function(){
window.location='http://www.gplogger.com/Services.php?PCID=4';
}
}
}]
}),new Ext.Spacer({
height: 5,
style: 'background: white'
}),new Ext.Panel({
title: "<?=$Labels->GetLabel('_TRACKING_');?>",
frame: true,
align: 'center',
items: [{
layout: 'form',
items: [{
xtype: 'button',
id: 'sms_button',
text: "<?=$Labels->GetLabel('_GET_POSITION_');?>",
width: '100%',
disabled: true,
style: 'padding-top: 3px;',
handler: function( tb, e ){
if ( SMS_timer != null ) window.clearInterval( SMS_timer );
Ext.getCmp('sms_button').disable();
StartSmsSession(10);
}
}]
},new Ext.Spacer({
height: 5,
style: 'background: white'
}),{
layout: 'form',
height: 20,
html: '<table class="small" width="100%"><tr><td height="15px" width="40px"><b>'+"<?=$Labels->GetLabel('_STATUS_');?>"+':</b></td><td><span class="orange" id="sms_status_text" style="font-weight: bold;">'+"<?=$Labels->GetLabel('_WAIT_UPDATE_');?>"+'</span></td><td id="sms_status_img" width="20px"></td></tr></table>'
}]
})]
}]
}
]
}),new Ext.Panel({
title: "<?=$Labels->GetLabel('_MAP_SETTINGS_');?>",
frame: true,
//style: 'background: white;',
align: 'center',
items: [{
layout: 'form',
//title: 'Address Info',
frame: true,
//labelAlign: 'center',
//style: 'text-align: center;',
//defaults: {width: 75},
items: [ new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "<?=$Labels->GetLabel('_REGULAR_MAP_');?>",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,1);
map.setMapType(G_NORMAL_MAP);
};
}
},
id: 'map_type_1',
name: 'map_type'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'sat',
boxLabel: "<?=$Labels->GetLabel('_SATELITE_MAP_');?>",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,2);
map.setMapType(G_SATELLITE_MAP);
};
}
},
id: 'map_type_2',
name: 'map_type'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'comb',
boxLabel: "<?=$Labels->GetLabel('_HYBRID_MAP_');?>",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,3);
map.setMapType(G_HYBRID_MAP);
};
}
},
id: 'map_type_3',
name: 'map_type'
}),new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "<?=$Labels->GetLabel('_MAPNIK_MAP_');?>",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,4);
map.setMapType( mapMapnik );
};
}
},
id: 'map_type_4',
name: 'map_type'
}),new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "<?=$Labels->GetLabel('_OSMARE_MAP_');?>",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,5);
map.setMapType( mapOsmarender );
};
}
},
id: 'map_type_5',
name: 'map_type'
}),new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "Google Terrain",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,6);
map.setMapType( mapTerrainA );
};
}
},
id: 'map_type_6',
name: 'map_type'
}),new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "Open Cycle Map",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,7);
map.setMapType( mapTerrainB );
};
}
},
id: 'map_type_7',
name: 'map_type'
})/*,new Ext.form.Radio({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "Yandex Map",
listeners: {
'check': function( me, checked ){
if( checked ){
if ( InitSetupParameters ) SaveSetting(3,8);
map.setMapType( mapYandex );
};
}
},
id: 'map_type_7',
name: 'map_type'
})*/
]
}
]
}),new Ext.Panel({
title: "<?=$Labels->GetLabel('_ADVANCED_SET_');?>",
frame: true,
//style: 'background: white;',
align: 'center',
items: [{
layout: 'form',
frame: true,
items: [ new Ext.form.Checkbox({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "<?=$Labels->GetLabel('_SHOW_TRAFFIC_');?>",
listeners: {
'check': function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(12,1);
mapTrafficOverlay=new GTrafficOverlay();
map.addOverlay( mapTrafficOverlay );
mapShowTraffic = true;
};
} else {
if ( InitSetupParameters ){
SaveSetting(12,0);
if (mapTrafficOverlay!=null){
map.removeOverlay( mapTrafficOverlay );
mapTrafficOverlay = null;
};
mapShowTraffic = false;
};
};
}
},
id: 'map_show_traffic',
name: 'map_show_traffic'
}), new Ext.form.Checkbox({
width: 180,
hideLabel: true,
value: 'reg',
boxLabel: "<?=$Labels->GetLabel('_SHOW_GEOFENCE_');?>",
listeners: {
'check': function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(19,1);
mapShowFence = true;
};
} else {
if ( InitSetupParameters ){
SaveSetting(19,0);
mapShowFence = false;
for (index=0;index<GZPoly.length;index++){
GZPoly[index].clear();
GZPoly[index]=null;
};
GZPoly = new Array();
};
};
}
},
id: 'map_show_geofence',
name: 'map_show_geofence'
}),
new Ext.form.Checkbox({
width: 180,
hideLabel: true,
value: 'sat',
boxLabel: "<?=$Labels->GetLabel('_SHOW_PTZ_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ) SaveSetting(11,1);
mapPZControlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
mapPZControl = new GLargeMapControl3D();
map.addControl( mapPZControl, mapPZControlPosition );
} else {
if ( InitSetupParameters ) SaveSetting(11,0);
map.removeControl( mapPZControl );
mapPZControlPosition = null;
mapPZControl = null;
};
}
},
id: 'map_show_ptz',
name: 'map_show_ptz'
}),
new Ext.form.Checkbox({
width: 180,
hideLabel: true,
value: 'red',
boxLabel: "<?=$Labels->GetLabel('_CONNECT_WP_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(13,1);
polyline_r = new GPolyline(CPoints, "#ff0000", 5);
map.addOverlay( polyline_r );
mapShowRedLine = true;
};
} else {
if ( InitSetupParameters ){
SaveSetting(13,0);
mapShowRedLine = false;
map.removeOverlay( polyline_r );
polyline_r = null;
};
};
}
},
id: 'map_show_red',
name: 'map_show_red'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
value: '0',
boxLabel: "<?=$Labels->GetLabel('_NFOLOW_VC_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(8,0);
mapVehicleCentered = false;
mapAreaCentered = false;
};
};
}
},
id: 'map_no_centered',
name: 'map_centered'
}),new Ext.form.Radio({
width: 180,
hideLabel: true,
value: '1',
boxLabel: "<?=$Labels->GetLabel('_CENTER_TO_VC_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(8,1);
mapAreaCentered = false;
mapVehicleCentered = true;
map.panTo( CPoints[CPoints.length-1] );
};
};
}
},
id: 'map_vehicle_centered',
name: 'map_centered'
}),
new Ext.form.Radio({
width: 180,
hideLabel: true,
value: '2',
boxLabel: "<?=$Labels->GetLabel('_CENTER_TO_WA_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
if ( polygon_r == null ){
polygon_r = new GPolygon(CPoints, "#808080", 5);
};
SaveSetting(8,2);
map.panTo( polygon_r.getBounds().getCenter() );
mapAreaCentered = true;
mapVehicleCentered = false;
};
};
}
},
id: 'map_area_centered',
name: 'map_centered'
}),
new Ext.form.Checkbox({
width: 180,
hideLabel: true,
value: '',
boxLabel: "<?=$Labels->GetLabel('_ZOOM_TO_WA_');?>",
listeners: {
'check':function( me, checked ){
if ( checked ){
if ( InitSetupParameters ){
SaveSetting(7,1);
if ( polygon_r == null ){
polygon_r = new GPolygon(CPoints, "#808080", 5);
}
map.setCenter( map.getCenter(), map.getBoundsZoomLevel( polygon_r.getBounds()) );
mapShowZoomed = true;
};
} else {
if ( InitSetupParameters ){
SaveSetting(7,0);
mapShowZoomed = false;
};
};
}
},
id: 'map_show_zoomed',
name: 'map_show_zoomed'
})
]
}
]
})
]
}),
new Ext.Panel({
title: "<?=$Labels->GetLabel('_LAST_POS_NFO_');?>",
frame: true,
height: 90,
html: '<table width=100%><tr><td class="small" id="INFO_TD"></td></tr></table>'
})
]
});
var ts = new Ext.tree.TreeSorter( Ext.getCmp('dev-tree'), { folderSort:true });
var te = new Ext.tree.TreeEditor( Ext.getCmp('dev-tree'),{},{
//completeOnEnter: true,
autosize: true,
//ignoreNoChange: true,
listeners: {
complete: function(te,val,sval){
if (sval!=val){
//alert('Edited node'+te.editNode.id+" New Val:"+val);
if( te.editNode.attributes.device_db_id == 0 ){
AURL = 'lib/connector/json/rename_group_node.php?node='+te.editNode.id+'&name='+val+'&UID='+UserID+'&SID='+SessionID;
} else {
AURL = 'lib/connector/json/rename_tracker_node.php?node='+te.editNode.attributes.device_db_id+'&name='+val+'&UID='+UserID+'&SID='+SessionID;
};
Ext.Ajax.request({
url: AURL,
success: function( response, opts ){
},
failure: function( response, opts ){
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
},
headers: {
'my-header': 'foo'
},
params: { foo: 'bar' }
});
};
}
}
});
var GMapPanel = new Ext.Panel({
title: "<?=$Labels->GetLabel('_MAP_');?>",
width: '100%',
//renderTo: gct_m,
height: PanelH,
frame: true,
//margins: '0 0 0 0',
region: 'center', // center region is required, no width/height specified
//xtype: 'container',
layoutConfig: {
// layout-specific configs go here
//titleCollapse: true,
//animate: true
//renderHidden: true,
//activeOnTop: true
},
layout: 'fit',
margins: '5 5 0 0',
html: '<div style="width: 100%; height: '+(PanelH-70)+'px; background: white;" id="tracking_map"></div>'
//handlers
});
var GMapWindow = new Ext.Panel({
width: '100%',
//renderTo: gct_p,
frame: true,
height: PanelH,
title: "<?=$Labels->GetLabel('_ONLINE_TRACK_');?>",
layout: 'border',
items: [ GMapPanel, GMapToolbox ]
});
GMapWindow.doLayout();
try {
GMapWindow.render('gmap_control_placeholder');
} catch (e){
};
Ext.MessageBox.wait("<?=$Labels->GetLabel('_Load_Items_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
progressText: 'Initializing...',
width: '100%',
hidden: true,
progress: true,
closable: false
});
window.setTimeout(function(){
GMapToolbox.expand();
//GMapWindow.doLayout();
}, 1000 );
window.setTimeout(function(){
Tracking_Init();
}, 2000 );
//Ext.QuickTips.init();
// turn on validation errors beside the field globally
//Ext.form.Field.prototype.msgTarget = 'side';
});