Web UI for ARGUS server
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

5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../jscript_asm.php'); ?>
  2. function SecRenderer(value){
  3. if(value>0){
  4. return '<img src="/style/img/ext/icon_padlock.png" title="Secure ['+value+']">';
  5. } else {
  6. return '<img src="/style/img/ext/accept.png" title="Not Secure">';
  7. };
  8. };
  9. var WiFiListColModel = new Ext.grid.ColumnModel([
  10. {header: "<?=$Labels->GetLabel('_SECURITY_NET_');?>", width: 80, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: SecRenderer, dataIndex: 'wifi_sec'},
  11. {header: "<?=$Labels->GetLabel('_WIFI_NETNAME_');?>",width: 252, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_name'},
  12. {header: "<?=$Labels->GetLabel('_WIFI_CAPS_');?>", width: 100, sortable: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_cap'}
  13. ]);
  14. var WiFiListRecord = Ext.data.Record.create([
  15. 'id',
  16. 'wifi_name',
  17. 'wifi_cap',
  18. 'wifi_sec'
  19. ]);
  20. var WiFiListDataStore = new Ext.data.Store({
  21. reader: new Ext.data.JsonReader({
  22. root: "rows", // the property which contains an Array of row objects
  23. idProperty: "id" // the property within each row object that provides an ID for the record (optional)
  24. }, WiFiListRecord // Ext.data.Record constructor that provides mapping for JSON object
  25. )
  26. });
  27. function GetWiFiList(){
  28. Ext.Ajax.request({
  29. url: 'lib/connector/json/device_wlans.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
  30. success: function( response, opts ){
  31. var obj = Ext.decode( response.responseText );
  32. WiFiListDataStore.loadData( obj );
  33. Ext.getCmp('wifi_grid').doLayout();
  34. },
  35. failure: function( response, opts ){
  36. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  37. },
  38. headers: {
  39. 'my-header': 'foo'
  40. },
  41. params: { foo: 'bar' }
  42. });
  43. }
  44. var AddCategoryWindow;
  45. var SelectedNode=null; // root
  46. function ShowAddWindow(){
  47. if( !AddCategoryWindow ){
  48. AddCategoryWindow = new Ext.Window({
  49. title : 'Add New Group',
  50. layout : 'fit',
  51. width : 300,
  52. height : 120,
  53. closeAction :'hide',
  54. plain : false,
  55. animateTarget: 'create_group',
  56. resizable : false,
  57. items : [ new Ext.FormPanel({
  58. id: 'add_catpan',
  59. labelWidth: 100, // label settings here cascade unless overridden
  60. //url:'/connector/json/add_devices_group.php',
  61. frame: true,
  62. //bodyBorder: false,
  63. //border: false,
  64. //title : 'The Geofencing Service',
  65. bodyStyle:'padding:0px 0px 0',
  66. width: '100%',
  67. //layout : 'fit',
  68. defaultType: 'textfield',
  69. items: [{
  70. name : 'grp_name',
  71. labelStyle : 'color: black;',
  72. fieldLabel : 'New Group'
  73. },{
  74. hidden : true,
  75. value : SelectedNode.id,
  76. name : 'grp_parent'//,
  77. //fieldLabel : 'New Category'
  78. }]
  79. })],
  80. buttons:[{
  81. text: 'Add',
  82. listeners: {
  83. click: function(){
  84. Ext.getCmp('add_catpan').getForm().submit({
  85. url: 'lib/connector/json/add_devices_group.php?UID='+UserID+'&SID='+SessionID+'',
  86. waitMsg:'Creating New Group...',
  87. params: {
  88. parent: SelectedNode.id
  89. },
  90. success: function ( aa, rr ){
  91. Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root);
  92. AddCategoryWindow.hide();
  93. },
  94. failure: function( aa, rr ){
  95. switch( rr.result.err_status ){
  96. case 'NEX': // Not Existed Key
  97. Ext.Msg.show({
  98. title:'Activation Failed',
  99. msg: '<center><br/>You are entered activation code that<br/>does not registered in',
  100. buttons: Ext.Msg.OK,
  101. width: 400,
  102. icon: Ext.MessageBox.ERROR
  103. });
  104. break;
  105. }
  106. }
  107. });
  108. }
  109. }
  110. },{
  111. text: 'Cancel',
  112. listeners: {
  113. click: function(){
  114. AddCategoryWindow.hide();
  115. }
  116. }
  117. }]
  118. });
  119. };
  120. AddCategoryWindow.show();
  121. };
  122. function SetIRStatus(a) {
  123. if( a == 0 ){
  124. Ext.getCmp('ir_retrieve').setText('Request Sent');
  125. Ext.getCmp('ir_retrieve').disable();
  126. document.getElementById('ir_status_text').innerHTML='<span class="red"><b>Queued</b></span>';
  127. document.getElementById('ir_status_img').innerHTML='<img src="/style/img/wait.gif">';
  128. } else {
  129. Ext.getCmp('ir_retrieve').setText('Send Request');
  130. Ext.getCmp('ir_retrieve').enable();
  131. document.getElementById('ir_status_text').innerHTML='<span class="green"><b>Idle</b></span>';
  132. document.getElementById('ir_status_img').innerHTML='';
  133. };
  134. };
  135. var HTTPO_IR = null;
  136. var IR_TIMER = null;
  137. function StartIRSession(){
  138. var QURL='';
  139. if ( HTTPO_IR == null ){
  140. HTTPO_IR = getHTTPObject();
  141. };
  142. if ( HTTPO_IR != null ) {
  143. QURL="/lib/connector/json/iridium_ping.php?UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&OP=CHLS";
  144. HTTPO_IR.open("GET", QURL , true);
  145. HTTPO_IR.send('');
  146. HTTPO_IR.onreadystatechange = HGDT_IR;
  147. } else {
  148. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CSXL00221');
  149. };
  150. };
  151. function HGDT_IR(){
  152. switch(HTTPO_IR.readyState){
  153. case 0: window.status = 'IR:Communication is Uninitialized';
  154. break;
  155. case 1: window.status = 'IR:Loading Data';
  156. break;
  157. case 2: window.status = 'IR:Data is Loaded';
  158. break;
  159. case 3: window.status = 'IR:Communication is Interactive';
  160. break;
  161. case 4: window.status = 'IR:Data Load Complete';
  162. break;
  163. };
  164. if( HTTPO_IR.readyState == 4 ){
  165. var T_Arr;
  166. //alert( HTTPO_IR.responseText);
  167. T_Arr = JSON_parse( HTTPO_IR.responseText,'' );
  168. httpRequestType=T_Arr.type/1;
  169. //alert(httpRequestType);
  170. if( T_Arr.status == 0 ){
  171. SetIRStatus(0);
  172. if( IR_TIMER == null ){
  173. IR_TIMER = window.setInterval( 'StartIRSession();',20000);
  174. };
  175. } else {
  176. SetIRStatus(1);
  177. if( IR_TIMER != null ){
  178. window.clearInterval( IR_TIMER );
  179. IR_TIMER = null;
  180. };
  181. };
  182. };
  183. };
  184. function ShowWiFiNetworks(){
  185. if( !WiFiNetworksWindow ){
  186. WiFiNetworksWindow = new Ext.Window({
  187. title : "<?=$Labels->GetLabel('_WIFI_NETS_RANGE');?>",
  188. layout : 'fit',
  189. width : 450,
  190. height : 300,
  191. closeAction :'hide',
  192. plain : false,
  193. resizable : false,
  194. items : [
  195. {
  196. xtype : 'grid',
  197. id : 'wifi_grid',
  198. height : 189,
  199. frame: false,
  200. forceFit: true,
  201. //title: 'Geofencing Zones List',
  202. ds: WiFiListDataStore,
  203. cm: WiFiListColModel,
  204. sm: new Ext.grid.RowSelectionModel({
  205. singleSelect: true,
  206. listeners: {
  207. rowselect: function(sm, row, rec) {
  208. SelectedZone=rec.data;
  209. PreviewZone(SelectedZone.id);
  210. }
  211. }
  212. }),
  213. //autoExpandColumn: 'login',
  214. width: '100%',
  215. border: false
  216. }
  217. ],
  218. buttons: [
  219. {
  220. text: "<?=$Labels->GetLabel('_CLOSE_');?>",
  221. handler: function(){
  222. WiFiNetworksWindow.hide();
  223. }
  224. }
  225. ]});
  226. };
  227. WiFiNetworksWindow.show();
  228. GetWiFiList();
  229. };
  230. Ext.onReady( function(){
  231. var gct_p = Ext.get('gmap_control_placeholder');
  232. var gct_t = Ext.get('gmap_control_toolbox');
  233. var gct_m = Ext.get('gmap_control_map');
  234. var GMapToolbox = new Ext.Panel({
  235. title: "<?=$Labels->GetLabel('_Tools_');?>",
  236. //renderTo: gct_t,
  237. region:'west',
  238. margins: '5 0 0 5',
  239. width: 200,
  240. height: PanelH,
  241. collapsible: true, // make collapsible
  242. //collapsed: true,
  243. //collapseFirst: true,
  244. cmargins: '5 5 0 5', // adjust top margin when collapsed
  245. id: 'GMAP-Toolbox',
  246. style: 'background: white; border: 1px solid black;',
  247. hideCollapseTool: false,
  248. layoutConfig: {
  249. titleCollapse: true,
  250. //animate: false,
  251. activeOnTop: true
  252. },
  253. items: [
  254. new Ext.Panel({
  255. id: 'acc_module',
  256. //title: 'Tools',
  257. //margins: '5 0 0 5',
  258. width: 200,
  259. height: PanelH - 160,
  260. bodyBorder: true,
  261. layout:'accordion',
  262. unstyled: true,
  263. defaults: {
  264. // applied to each contained panel
  265. bodyStyle: 'padding:5px',
  266. frame: false
  267. },
  268. layoutConfig: {
  269. // layout-specific configs go here
  270. //titleCollapse: false,
  271. //animate: false
  272. //activeOnTop: true
  273. },
  274. items: [
  275. new Ext.tree.TreePanel({
  276. id:'dev-tree',
  277. title: "<?=$Labels->GetLabel('_TRACK_DEVICES_');?>",
  278. frame: false,
  279. enableDD:true,
  280. animate: true,
  281. autoScroll:true,
  282. dropConfig: {appendOnly:true},
  283. //containerScroll: true,
  284. border: false,
  285. loader: new Ext.tree.TreeLoader({
  286. dataUrl: 'lib/connector/json/tracking_device_tree.php?UID='+UserID+'&SID='+SessionID,
  287. baseAttrs:{
  288. expanded: true
  289. },
  290. listeners:{
  291. load: function( tre, tnode, response ){
  292. //alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID);
  293. //GMapToolbox.doLayout();
  294. //GMapToolbox.expand();
  295. if ( tnode.getPath() == InitTreeNodePath ){
  296. tnode.select();
  297. };
  298. }
  299. }
  300. }),
  301. listeners:{
  302. movenode: function( tt, nn, op, np, idx ){
  303. if( nn.attributes.device_db_id == 0 ){
  304. AURL = 'lib/connector/json/move_group_node.php?node='+nn.id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID;
  305. } else {
  306. AURL = 'lib/connector/json/move_tracker_node.php?node='+nn.attributes.device_db_id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID;
  307. };
  308. Ext.Ajax.request({
  309. url: AURL,
  310. success: function( response, opts ){
  311. },
  312. failure: function( response, opts ){
  313. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  314. },
  315. headers: { 'my-header': 'foo' },
  316. params: { foo: 'bar' }
  317. });
  318. },
  319. click : function( tnode, evt ){
  320. SelectedNode= tnode;
  321. //alert( tnode.getPath() );
  322. if ( PopUpShown ){
  323. if ( map.getExtInfoWindow() != null) {
  324. map.closeExtInfoWindow();
  325. }
  326. //Markers[ PopUpMarkerID ].closeExtInfoWindow();
  327. };
  328. if ( tnode.attributes.device_db_id == 0 ){ // Group Selected
  329. Ext.getCmp('t_settings').disable();
  330. CDevID=tnode.id;
  331. SaveSetting(2, CDevID );
  332. CQStyle = 2
  333. RetriveData();
  334. } else { // Device Selected
  335. Ext.getCmp('t_settings').enable();
  336. if ( tnode.attributes.link_type == 'G' ){
  337. NumberOfPoints=OLD_NumberOfPoints;
  338. Ext.getCmp('trh_simple').enable();
  339. Ext.getCmp('trh_sms').disable();
  340. Ext.getCmp('history-settings').setActiveTab('trh_simple');
  341. if ( SMS_timer != null ) window.clearInterval( SMS_timer );
  342. } else {
  343. if ( tnode.attributes.link_type == 'I' ){ // Combined Mode = GPRS+SMS
  344. NumberOfPoints=OLD_NumberOfPoints;
  345. Ext.getCmp('trh_simple').enable();
  346. Ext.getCmp('trh_sms').enable();
  347. Ext.getCmp('history-settings').setActiveTab('trh_simple');
  348. SMS_timer=window.setInterval('StartSmsSession(9);',5000);
  349. } else {
  350. OLD_NumberOfPoints=NumberOfPoints;
  351. NumberOfPoints=1;
  352. Ext.getCmp('trh_simple').disable();
  353. Ext.getCmp('trh_sms').enable();
  354. Ext.getCmp('history-settings').setActiveTab('trh_sms');
  355. SMS_timer=window.setInterval('StartSmsSession(9);',5000);
  356. };
  357. };
  358. CDevID=tnode.attributes.device_db_id;
  359. SaveSetting(2, 'dev_'+CDevID );
  360. Ext.getCmp('ctrack_name').removeAll();
  361. Ext.getCmp('ctrack_name').add({
  362. 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>'
  363. });
  364. Ext.getCmp('ctrack_name').doLayout();
  365. if( ( tnode.attributes.caps & 8 ) == 8 ){
  366. Ext.getCmp('ird_retrive').enable();
  367. StartIRSession();
  368. ChatModuleEnabled = true;
  369. CurrentCDate = Math.round((new Date())/1000);
  370. if ( !ChatModule ){
  371. ChatModule = Ext.getCmp('acc_module').insert( 1, new Ext.Panel({
  372. id: 'chat_module',
  373. title: 'Online Chat',
  374. listeners:{
  375. expand: function( pA ){
  376. GetMesseges();
  377. }
  378. },
  379. tbar: [ {xtype: 'tbspacer'}, { xtype: 'tbtext', id: 'c_dev', text: '', style: 'color: white; font-weight: bold;' }, '->',{
  380. id: 'dis_sound',
  381. text: '',
  382. iconCls: 'chat_mute_on_icon',
  383. tooltip: 'Mute Sound Notification',
  384. handler: function(){
  385. if ( SoundEnabled ){
  386. Ext.Msg.show({
  387. title:'Disable Sound Notification',
  388. width: 500,
  389. msg: '<center>Are You Certain You Want To Do This ?<br/>The Emergency Event and New Messages will appear Silently.</center>',
  390. buttons: Ext.Msg.YESNOCANCEL,
  391. fn: function(btn, text){
  392. if (btn == 'yes'){
  393. SoundEnabled = false;
  394. Ext.getCmp('dis_sound').setIconClass('chat_mute_off_icon');
  395. } else {
  396. SoundEnabled = true;
  397. };
  398. },
  399. //animEl: 'elId',
  400. icon: Ext.MessageBox.QUESTION
  401. });
  402. if ( SoundEnabled ){
  403. niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/que.mp3');
  404. };
  405. } else {
  406. SoundEnabled = true;
  407. Ext.getCmp('dis_sound').setIconClass('chat_mute_on_icon');
  408. };
  409. }
  410. }, '-', {
  411. id: 'chat_popup_btn',
  412. text: '',
  413. iconCls: 'chat_popup_icon',
  414. tooltip: 'Popup Chat Window',
  415. handler: function(){
  416. PopUpChat();
  417. }
  418. } ],
  419. items: [{
  420. 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>'
  421. }, new Ext.form.TextField({
  422. id: 'chat_input',
  423. width: '100%',
  424. height: 25,
  425. listeners: {
  426. specialkey: function( field, e ){
  427. // e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,
  428. // e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN
  429. if ( e.getKey() == e.ENTER ) {
  430. CMSG='';
  431. CMSG=Ext.getCmp('chat_input').getValue();
  432. Ext.getCmp('chat_input').reset();
  433. Ext.getCmp('chat_send_btn').disable();
  434. if ( CMSG != ''){
  435. Ext.Ajax.request({
  436. url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
  437. success: function( response, opts ){
  438. Ext.getCmp('chat_send_btn').enable();
  439. GetMesseges();
  440. },
  441. failure: function( response, opts ){
  442. Ext.getCmp('chat_send_btn').enable();
  443. //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  444. },
  445. headers: {
  446. 'my-header': 'foo'
  447. },
  448. params: { MSG: CMSG }
  449. });
  450. };
  451. };
  452. }
  453. }
  454. })
  455. ],
  456. buttonAlign: 'right',
  457. buttons: [ {
  458. id: 'chat_send_btn',
  459. text: 'SEND',
  460. handler: function(){
  461. CMSG='';
  462. CMSG=Ext.getCmp('chat_input').getValue();
  463. Ext.getCmp('chat_input').reset();
  464. Ext.getCmp('chat_send_btn').disable();
  465. if ( CMSG != ''){
  466. Ext.Ajax.request({
  467. url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID,
  468. success: function( response, opts ){
  469. Ext.getCmp('chat_send_btn').enable();
  470. GetMesseges();
  471. },
  472. failure: function( response, opts ){
  473. Ext.getCmp('chat_send_btn').enable();
  474. //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  475. },
  476. headers: {
  477. 'my-header': 'foo'
  478. },
  479. params: { MSG: CMSG }
  480. });
  481. };
  482. }
  483. } ]
  484. }) );
  485. };
  486. Ext.getCmp('acc_module').doLayout();
  487. Ext.getCmp('c_dev').setText( tnode.text );
  488. } else {
  489. SetIRStatus(1);
  490. Ext.getCmp('ird_retrive').disable();
  491. if( IR_TIMER ){
  492. window.clearInterval( IR_TIMER );
  493. IR_TIMER = null;
  494. };
  495. if( ChatModuleEnabled ){
  496. window.clearTimeout( MessegesIntervalHandler );
  497. ChatModuleEnabled = false;
  498. Ext.getCmp('acc_module').remove( ChatModule, true );
  499. ChatModule = null;
  500. Ext.getCmp('acc_module').doLayout();
  501. };
  502. };
  503. CQStyle=0;
  504. RetriveData();
  505. };
  506. }
  507. },
  508. tbar:[ '->',{
  509. id: 'create_group',
  510. iconCls: 'add_group_icon',
  511. text: '',
  512. tooltip: 'Add New Group',
  513. handler: function(){
  514. ShowAddWindow();
  515. }
  516. },{
  517. id: 'delete_group',
  518. iconCls: 'del_group_icon',
  519. tooltip: 'Remove Group',
  520. text: '',
  521. handler: function(){
  522. if( SelectedNode != null ){
  523. if( SelectedNode.attributes.device_db_id == 0 ){
  524. if( SelectedNode.isExpanded() ){
  525. if( SelectedNode.hasChildNodes() ){
  526. Ext.Msg.show({
  527. title:'Error',
  528. msg: '<center><br/>You can not delete not empty group</center>',
  529. buttons: Ext.Msg.OK,
  530. width: 400,
  531. icon: Ext.MessageBox.ERROR
  532. });
  533. } else {
  534. Ext.Ajax.request({
  535. url: 'lib/connector/json/delete_devices_group.php?UID='+UserID+'&SID='+SessionID+'&GID='+SelectedNode.id,
  536. success: function( response, opts ){
  537. Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root);
  538. },
  539. failure: function( response, opts ){
  540. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  541. }
  542. });
  543. };
  544. } else {
  545. Ext.Msg.show({
  546. title:'Error',
  547. msg: '<center><br/>You can not delete collapsed group</center>',
  548. buttons: Ext.Msg.OK,
  549. width: 400,
  550. icon: Ext.MessageBox.ERROR
  551. });
  552. };
  553. };
  554. };
  555. }
  556. }],
  557. rootVisible:false,
  558. lines: true,
  559. autoScroll:true,
  560. root: new Ext.tree.AsyncTreeNode({
  561. text: "<?=$Labels->GetLabel('_ALL_DEVICES_');?>",
  562. expanded: true
  563. })
  564. }), new Ext.Panel({
  565. id: 't_settings',
  566. title: "<?=$Labels->GetLabel('_TRACK_SETTINGS_');?>",
  567. frame: true,
  568. //style: 'background: white;',
  569. align: 'center',
  570. items: [{
  571. id: 'ctrack_name',
  572. width: 190,
  573. height: 30
  574. },{
  575. xtype: 'tabpanel',
  576. id: 'history-settings',
  577. resizeTabs: true,
  578. minTabWidth: 70,
  579. activeTab: 0,
  580. width: 190,
  581. //height: 240, // Why do I have to specify the height here?
  582. // Shouldn't its container's 'fit' layout take
  583. // care of that?
  584. //width: PanelH,
  585. //hidden: true,
  586. border: false,
  587. deferredRender: true, // This works
  588. //defaults: {autoScroll: true},
  589. listeners:{
  590. 'tabchange': function( tab , tab_p ){
  591. if(tab_p.id=='trh_dts'){
  592. window.clearInterval(MapUpdateInterval);
  593. trackingMode = 2;
  594. CQStyle=5;
  595. StartCalendarSession(5);
  596. //Ext.getCmp('history-settings').setVisible( true );
  597. try{
  598. Ext.getCmp('history-settings').doLayout();
  599. } catch(e){};
  600. } else {
  601. map.checkResize();
  602. StartTrackingSession(0);
  603. window.clearInterval(MapUpdateInterval);
  604. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  605. trackingMode = 1;
  606. CQStyle=0;
  607. //Ext.getCmp('history-settings').setVisible( false );
  608. try{
  609. Ext.getCmp('history-settings').doLayout();
  610. } catch (e){};
  611. };
  612. //alert(trackingMode);
  613. }
  614. },
  615. items: [
  616. {
  617. layout: 'form',
  618. title: "<?=$Labels->GetLabel('_REAL_TIME_');?>",
  619. frame: true,
  620. id:'trh_simple',
  621. tabWidth: 100,
  622. //height: 180,
  623. //labelWidth: 50,
  624. //defaults: { width: 80},
  625. items: [new Ext.form.Radio({
  626. width: 180,
  627. hideLabel: true,
  628. boxLabel: "<?=$Labels->GetLabel('_50_LAST_POINT_');?>",
  629. listeners: {
  630. 'check': function( ch, checked ){
  631. if(checked){
  632. NumberOfPoints=50;
  633. OLD_NumberOfPoints=50;
  634. SaveSetting(18,50);
  635. window.clearInterval(MapUpdateInterval);
  636. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  637. RetriveData();
  638. };
  639. }
  640. },
  641. id: 'track_type_50',
  642. name: 'track_type'
  643. }), new Ext.form.Radio({
  644. width: 180,
  645. hideLabel: true,
  646. boxLabel: "<?=$Labels->GetLabel('_25_LAST_POINT_');?>",
  647. listeners: {
  648. 'check': function( ch, checked ){
  649. if(checked){
  650. NumberOfPoints=25;
  651. OLD_NumberOfPoints=25;
  652. SaveSetting(18,25);
  653. window.clearInterval(MapUpdateInterval);
  654. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  655. RetriveData();
  656. };
  657. }
  658. },
  659. id: 'track_type_25',
  660. name: 'track_type'
  661. }),
  662. new Ext.form.Radio({
  663. width: 180,
  664. hideLabel: true,
  665. boxLabel: "<?=$Labels->GetLabel('_15_LAST_POINT_');?>",
  666. listeners: {
  667. 'check': function( ch, checked ){
  668. if(checked){
  669. NumberOfPoints=15;
  670. OLD_NumberOfPoints=15;
  671. SaveSetting(18,15);
  672. window.clearInterval(MapUpdateInterval);
  673. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  674. RetriveData();
  675. };
  676. }
  677. },
  678. id: 'track_type_15',
  679. name: 'track_type'
  680. }),
  681. new Ext.form.Radio({
  682. width: 180,
  683. hideLabel: true,
  684. boxLabel: "<?=$Labels->GetLabel('_5_LAST_POINT_');?>",
  685. listeners: {
  686. 'check': function( ch, checked ){
  687. if(checked){
  688. NumberOfPoints=5;
  689. OLD_NumberOfPoints=5;
  690. SaveSetting(18,5);
  691. window.clearInterval(MapUpdateInterval);
  692. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  693. RetriveData();
  694. };
  695. }
  696. },
  697. id: 'track_type_5',
  698. name: 'track_type'
  699. }),
  700. new Ext.form.Radio({
  701. width: 180,
  702. hideLabel: true,
  703. boxLabel: "<?=$Labels->GetLabel('_1_LAST_POINT_');?>",
  704. listeners: {
  705. 'check': function( ch, checked ){
  706. if(checked){
  707. NumberOfPoints=1;
  708. OLD_NumberOfPoints=1;
  709. SaveSetting(18,1);
  710. window.clearInterval(MapUpdateInterval);
  711. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  712. RetriveData();
  713. };
  714. }
  715. },
  716. id: 'track_type_1',
  717. name: 'track_type'
  718. }), {
  719. xtype: 'spacer',
  720. height: 10
  721. }, {
  722. xtype: 'panel',
  723. id: 'ird_retrive',
  724. frame: true,
  725. disabled: true,
  726. title: 'Retrieve Current Position',
  727. items:[{
  728. 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>'
  729. }, {
  730. xtype: 'button',
  731. id: 'ir_retrieve',
  732. width: '100%',
  733. text: 'Send Request',
  734. handler: function(){
  735. SetIRStatus( 0 );
  736. Ext.Ajax.request({
  737. url: 'lib/connector/json/iridium_ping.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID+'&OP=REQP',
  738. success: function( response, opts ){
  739. StartIRSession();
  740. },
  741. failure: function( response, opts ){
  742. SetIRStatus( 0 );
  743. }
  744. });
  745. }
  746. }
  747. ]
  748. }
  749. ]
  750. },{
  751. layout: 'form',
  752. title: "<?=$Labels->GetLabel('_HISTORY_');?>",
  753. id:'trh_dts',
  754. frame: true,
  755. height: 255,
  756. labelAlign: 'right',
  757. labelWidth: 50,
  758. defaults: { width: 80},
  759. items: [
  760. new Ext.form.ComboBox({
  761. id: 'STimeFROM',
  762. typeAhead: true,
  763. width: 120,
  764. triggerAction: 'all',
  765. fieldLabel: "<?=$Labels->GetLabel('_FROM_TIME_');?>",
  766. forceSelection: true,
  767. allowBlank: false,
  768. hiddenName: 'type',
  769. //labelStyle: 'width: 150px;',
  770. lazyRender: true,
  771. mode: 'local',
  772. value: '00:00',
  773. listeners: {
  774. select: function( me, mrec, idx ){
  775. SH=Math.floor( me.getValue()/60 );
  776. SM=me.getValue() - 60 * SH;
  777. }
  778. },
  779. store: new Ext.data.ArrayStore({
  780. id: 0,
  781. fields: [
  782. 'val',
  783. 'displayText'
  784. ],
  785. data: [
  786. ['0000', '00:00'],
  787. ['0030', '00:30'],
  788. ['0060', '01:00'],
  789. ['0090', '01:30'],
  790. ['0120', '02:00'],
  791. ['0150', '02:30'],
  792. ['0180', '03:00'],
  793. ['0210', '03:30'],
  794. ['0240', '04:00'],
  795. ['0270', '04:30'],
  796. ['0300', '05:00'],
  797. ['0330', '05:30'],
  798. ['0360', '06:00'],
  799. ['0390', '06:30'],
  800. ['0420', '07:00'],
  801. ['0450', '07:30'],
  802. ['0480', '08:00'],
  803. ['0510', '08:30'],
  804. ['0540', '09:00'],
  805. ['0570', '09:30'],
  806. ['0600', '10:00'],
  807. ['0630', '10:30'],
  808. ['0660', '11:00'],
  809. ['0690', '11:30'],
  810. ['0720', '12:00'],
  811. ['0750', '12:30'],
  812. ['0780', '13:00'],
  813. ['0810', '13:30'],
  814. ['0840', '14:00'],
  815. ['0870', '14:30'],
  816. ['0900', '15:00'],
  817. ['0930', '15:30'],
  818. ['0960', '16:00'],
  819. ['0990', '16:30'],
  820. ['1020', '17:00'],
  821. ['1050', '17:30'],
  822. ['1080', '18:00'],
  823. ['1110', '18:30'],
  824. ['1140', '19:00'],
  825. ['1170', '19:30'],
  826. ['1200', '20:00'],
  827. ['1230', '20:30'],
  828. ['1260', '21:00'],
  829. ['1290', '21:30'],
  830. ['1320', '22:00'],
  831. ['1350', '22:30'],
  832. ['1380', '23:00'],
  833. ['1410', '23:30'],
  834. ['1439', '24:00']
  835. ]
  836. }),
  837. valueField: 'val',
  838. displayField: 'displayText'
  839. }),new Ext.form.ComboBox({
  840. id: 'STimeTO',
  841. typeAhead: true,
  842. width: 50,
  843. triggerAction: 'all',
  844. fieldLabel: "<?=$Labels->GetLabel('_TILL_TIME_');?>",
  845. forceSelection: true,
  846. allowBlank: false,
  847. hiddenName: 'type',
  848. //labelStyle: 'width: 150px;',
  849. lazyRender: true,
  850. mode: 'local',
  851. value: '00:00',
  852. listeners: {
  853. select: function( me, mrec, idx ){
  854. EH=Math.floor( me.getValue()/60 );
  855. EM=me.getValue() - 60 * EH;
  856. }
  857. },
  858. store: new Ext.data.ArrayStore({
  859. id: 0,
  860. fields: [
  861. 'val',
  862. 'displayText'
  863. ],
  864. data: [
  865. ['0000', '00:00'],
  866. ['0030', '00:30'],
  867. ['0060', '01:00'],
  868. ['0090', '01:30'],
  869. ['0120', '02:00'],
  870. ['0150', '02:30'],
  871. ['0180', '03:00'],
  872. ['0210', '03:30'],
  873. ['0240', '04:00'],
  874. ['0270', '04:30'],
  875. ['0300', '05:00'],
  876. ['0330', '05:30'],
  877. ['0360', '06:00'],
  878. ['0390', '06:30'],
  879. ['0420', '07:00'],
  880. ['0450', '07:30'],
  881. ['0480', '08:00'],
  882. ['0510', '08:30'],
  883. ['0540', '09:00'],
  884. ['0570', '09:30'],
  885. ['0600', '10:00'],
  886. ['0630', '10:30'],
  887. ['0660', '11:00'],
  888. ['0690', '11:30'],
  889. ['0720', '12:00'],
  890. ['0750', '12:30'],
  891. ['0780', '13:00'],
  892. ['0810', '13:30'],
  893. ['0840', '14:00'],
  894. ['0870', '14:30'],
  895. ['0900', '15:00'],
  896. ['0930', '15:30'],
  897. ['0960', '16:00'],
  898. ['0990', '16:30'],
  899. ['1020', '17:00'],
  900. ['1050', '17:30'],
  901. ['1080', '18:00'],
  902. ['1110', '18:30'],
  903. ['1140', '19:00'],
  904. ['1170', '19:30'],
  905. ['1200', '20:00'],
  906. ['1230', '20:30'],
  907. ['1260', '21:00'],
  908. ['1290', '21:30'],
  909. ['1320', '22:00'],
  910. ['1350', '22:30'],
  911. ['1380', '23:00'],
  912. ['1410', '23:30'],
  913. ['1439', '24:00']
  914. ]
  915. }),
  916. valueField: 'val',
  917. displayField: 'displayText'
  918. }),{
  919. width: '100%',
  920. html: '<table width="100%"><tr><td id="calendar_TD" valign="top" align="center"></td></tr></table>'
  921. },{
  922. xtype: 'spacer',
  923. height: 5
  924. },{
  925. xtype: 'button',
  926. width: '100%',
  927. text: "<?=$Labels->GetLabel('_DISP_HISTORY_');?>",
  928. listeners:{
  929. click: function( me, e){
  930. //alert(SMO+' '+SD);
  931. CQStyle=3;
  932. RetriveData();
  933. }
  934. }
  935. }]
  936. },{
  937. title: 'SMS',
  938. frame: true,
  939. id:'trh_sms',
  940. disabled: true,
  941. //height: 200,
  942. items: [ new Ext.Panel({
  943. title: "<?=$Labels->GetLabel('_TRACK_POINTS_');?>",
  944. frame: true,
  945. //height: 100,
  946. html: '<table width=100%><tr><td align="center"><span id="sms_ammount">'+ACC_sms_ammount+"</span> <?=$Labels->GetLabel('_POINTS_');?>.</td></tr></table>",
  947. buttons: [{
  948. xtype: 'button',
  949. text: "<?=$Labels->GetLabel('_PURCH_MORE_');?>",
  950. listeners: {
  951. click: function(){
  952. window.location='http://www.gplogger.com/Services.php?PCID=4';
  953. }
  954. }
  955. }]
  956. }),new Ext.Spacer({
  957. height: 5,
  958. style: 'background: white'
  959. }),new Ext.Panel({
  960. title: "<?=$Labels->GetLabel('_TRACKING_');?>",
  961. frame: true,
  962. align: 'center',
  963. items: [{
  964. layout: 'form',
  965. items: [{
  966. xtype: 'button',
  967. id: 'sms_button',
  968. text: "<?=$Labels->GetLabel('_GET_POSITION_');?>",
  969. width: '100%',
  970. disabled: true,
  971. style: 'padding-top: 3px;',
  972. handler: function( tb, e ){
  973. if ( SMS_timer != null ) window.clearInterval( SMS_timer );
  974. Ext.getCmp('sms_button').disable();
  975. StartSmsSession(10);
  976. }
  977. }]
  978. },new Ext.Spacer({
  979. height: 5,
  980. style: 'background: white'
  981. }),{
  982. layout: 'form',
  983. height: 20,
  984. 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>'
  985. }]
  986. })]
  987. }]
  988. }
  989. ]
  990. }),new Ext.Panel({
  991. title: "<?=$Labels->GetLabel('_MAP_SETTINGS_');?>",
  992. frame: true,
  993. //style: 'background: white;',
  994. align: 'center',
  995. items: [{
  996. layout: 'form',
  997. //title: 'Address Info',
  998. frame: true,
  999. //labelAlign: 'center',
  1000. //style: 'text-align: center;',
  1001. //defaults: {width: 75},
  1002. items: [ new Ext.form.Radio({
  1003. width: 180,
  1004. hideLabel: true,
  1005. value: 'reg',
  1006. boxLabel: "<?=$Labels->GetLabel('_REGULAR_MAP_');?>",
  1007. listeners: {
  1008. 'check': function( me, checked ){
  1009. if( checked ){
  1010. if ( InitSetupParameters ) SaveSetting(3,1);
  1011. map.setMapType(G_NORMAL_MAP);
  1012. };
  1013. }
  1014. },
  1015. id: 'map_type_1',
  1016. name: 'map_type'
  1017. }),
  1018. new Ext.form.Radio({
  1019. width: 180,
  1020. hideLabel: true,
  1021. value: 'sat',
  1022. boxLabel: "<?=$Labels->GetLabel('_SATELITE_MAP_');?>",
  1023. listeners: {
  1024. 'check': function( me, checked ){
  1025. if( checked ){
  1026. if ( InitSetupParameters ) SaveSetting(3,2);
  1027. map.setMapType(G_SATELLITE_MAP);
  1028. };
  1029. }
  1030. },
  1031. id: 'map_type_2',
  1032. name: 'map_type'
  1033. }),
  1034. new Ext.form.Radio({
  1035. width: 180,
  1036. hideLabel: true,
  1037. value: 'comb',
  1038. boxLabel: "<?=$Labels->GetLabel('_HYBRID_MAP_');?>",
  1039. listeners: {
  1040. 'check': function( me, checked ){
  1041. if( checked ){
  1042. if ( InitSetupParameters ) SaveSetting(3,3);
  1043. map.setMapType(G_HYBRID_MAP);
  1044. };
  1045. }
  1046. },
  1047. id: 'map_type_3',
  1048. name: 'map_type'
  1049. }),new Ext.form.Radio({
  1050. width: 180,
  1051. hideLabel: true,
  1052. value: 'reg',
  1053. boxLabel: "<?=$Labels->GetLabel('_MAPNIK_MAP_');?>",
  1054. listeners: {
  1055. 'check': function( me, checked ){
  1056. if( checked ){
  1057. if ( InitSetupParameters ) SaveSetting(3,4);
  1058. map.setMapType( mapMapnik );
  1059. };
  1060. }
  1061. },
  1062. id: 'map_type_4',
  1063. name: 'map_type'
  1064. }),new Ext.form.Radio({
  1065. width: 180,
  1066. hideLabel: true,
  1067. value: 'reg',
  1068. boxLabel: "<?=$Labels->GetLabel('_OSMARE_MAP_');?>",
  1069. listeners: {
  1070. 'check': function( me, checked ){
  1071. if( checked ){
  1072. if ( InitSetupParameters ) SaveSetting(3,5);
  1073. map.setMapType( mapOsmarender );
  1074. };
  1075. }
  1076. },
  1077. id: 'map_type_5',
  1078. name: 'map_type'
  1079. }),new Ext.form.Radio({
  1080. width: 180,
  1081. hideLabel: true,
  1082. value: 'reg',
  1083. boxLabel: "Google Terrain",
  1084. listeners: {
  1085. 'check': function( me, checked ){
  1086. if( checked ){
  1087. if ( InitSetupParameters ) SaveSetting(3,6);
  1088. map.setMapType( mapTerrainA );
  1089. };
  1090. }
  1091. },
  1092. id: 'map_type_6',
  1093. name: 'map_type'
  1094. }),new Ext.form.Radio({
  1095. width: 180,
  1096. hideLabel: true,
  1097. value: 'reg',
  1098. boxLabel: "Open Cycle Map",
  1099. listeners: {
  1100. 'check': function( me, checked ){
  1101. if( checked ){
  1102. if ( InitSetupParameters ) SaveSetting(3,7);
  1103. map.setMapType( mapTerrainB );
  1104. };
  1105. }
  1106. },
  1107. id: 'map_type_7',
  1108. name: 'map_type'
  1109. })/*,new Ext.form.Radio({
  1110. width: 180,
  1111. hideLabel: true,
  1112. value: 'reg',
  1113. boxLabel: "Yandex Map",
  1114. listeners: {
  1115. 'check': function( me, checked ){
  1116. if( checked ){
  1117. if ( InitSetupParameters ) SaveSetting(3,8);
  1118. map.setMapType( mapYandex );
  1119. };
  1120. }
  1121. },
  1122. id: 'map_type_7',
  1123. name: 'map_type'
  1124. })*/
  1125. ]
  1126. }
  1127. ]
  1128. }),new Ext.Panel({
  1129. title: "<?=$Labels->GetLabel('_ADVANCED_SET_');?>",
  1130. frame: true,
  1131. //style: 'background: white;',
  1132. align: 'center',
  1133. items: [{
  1134. layout: 'form',
  1135. frame: true,
  1136. items: [ new Ext.form.Checkbox({
  1137. width: 180,
  1138. hideLabel: true,
  1139. value: 'reg',
  1140. boxLabel: "<?=$Labels->GetLabel('_SHOW_TRAFFIC_');?>",
  1141. listeners: {
  1142. 'check': function( me, checked ){
  1143. if ( checked ){
  1144. if ( InitSetupParameters ){
  1145. SaveSetting(12,1);
  1146. mapTrafficOverlay=new GTrafficOverlay();
  1147. map.addOverlay( mapTrafficOverlay );
  1148. mapShowTraffic = true;
  1149. };
  1150. } else {
  1151. if ( InitSetupParameters ){
  1152. SaveSetting(12,0);
  1153. if (mapTrafficOverlay!=null){
  1154. map.removeOverlay( mapTrafficOverlay );
  1155. mapTrafficOverlay = null;
  1156. };
  1157. mapShowTraffic = false;
  1158. };
  1159. };
  1160. }
  1161. },
  1162. id: 'map_show_traffic',
  1163. name: 'map_show_traffic'
  1164. }), new Ext.form.Checkbox({
  1165. width: 180,
  1166. hideLabel: true,
  1167. value: 'reg',
  1168. boxLabel: "<?=$Labels->GetLabel('_SHOW_GEOFENCE_');?>",
  1169. listeners: {
  1170. 'check': function( me, checked ){
  1171. if ( checked ){
  1172. if ( InitSetupParameters ){
  1173. SaveSetting(19,1);
  1174. mapShowFence = true;
  1175. };
  1176. } else {
  1177. if ( InitSetupParameters ){
  1178. SaveSetting(19,0);
  1179. mapShowFence = false;
  1180. for (index=0;index<GZPoly.length;index++){
  1181. GZPoly[index].clear();
  1182. GZPoly[index]=null;
  1183. };
  1184. GZPoly = new Array();
  1185. };
  1186. };
  1187. }
  1188. },
  1189. id: 'map_show_geofence',
  1190. name: 'map_show_geofence'
  1191. }),
  1192. new Ext.form.Checkbox({
  1193. width: 180,
  1194. hideLabel: true,
  1195. value: 'sat',
  1196. boxLabel: "<?=$Labels->GetLabel('_SHOW_PTZ_');?>",
  1197. listeners: {
  1198. 'check':function( me, checked ){
  1199. if ( checked ){
  1200. if ( InitSetupParameters ) SaveSetting(11,1);
  1201. mapPZControlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
  1202. mapPZControl = new GLargeMapControl3D();
  1203. map.addControl( mapPZControl, mapPZControlPosition );
  1204. } else {
  1205. if ( InitSetupParameters ) SaveSetting(11,0);
  1206. map.removeControl( mapPZControl );
  1207. mapPZControlPosition = null;
  1208. mapPZControl = null;
  1209. };
  1210. }
  1211. },
  1212. id: 'map_show_ptz',
  1213. name: 'map_show_ptz'
  1214. }),
  1215. new Ext.form.Checkbox({
  1216. width: 180,
  1217. hideLabel: true,
  1218. value: 'red',
  1219. boxLabel: "<?=$Labels->GetLabel('_CONNECT_WP_');?>",
  1220. listeners: {
  1221. 'check':function( me, checked ){
  1222. if ( checked ){
  1223. if ( InitSetupParameters ){
  1224. SaveSetting(13,1);
  1225. polyline_r = new GPolyline(CPoints, "#ff0000", 5);
  1226. map.addOverlay( polyline_r );
  1227. mapShowRedLine = true;
  1228. };
  1229. } else {
  1230. if ( InitSetupParameters ){
  1231. SaveSetting(13,0);
  1232. mapShowRedLine = false;
  1233. map.removeOverlay( polyline_r );
  1234. polyline_r = null;
  1235. };
  1236. };
  1237. }
  1238. },
  1239. id: 'map_show_red',
  1240. name: 'map_show_red'
  1241. }),
  1242. new Ext.form.Radio({
  1243. width: 180,
  1244. hideLabel: true,
  1245. value: '0',
  1246. boxLabel: "<?=$Labels->GetLabel('_NFOLOW_VC_');?>",
  1247. listeners: {
  1248. 'check':function( me, checked ){
  1249. if ( checked ){
  1250. if ( InitSetupParameters ){
  1251. SaveSetting(8,0);
  1252. mapVehicleCentered = false;
  1253. mapAreaCentered = false;
  1254. };
  1255. };
  1256. }
  1257. },
  1258. id: 'map_no_centered',
  1259. name: 'map_centered'
  1260. }),new Ext.form.Radio({
  1261. width: 180,
  1262. hideLabel: true,
  1263. value: '1',
  1264. boxLabel: "<?=$Labels->GetLabel('_CENTER_TO_VC_');?>",
  1265. listeners: {
  1266. 'check':function( me, checked ){
  1267. if ( checked ){
  1268. if ( InitSetupParameters ){
  1269. SaveSetting(8,1);
  1270. mapAreaCentered = false;
  1271. mapVehicleCentered = true;
  1272. map.panTo( CPoints[CPoints.length-1] );
  1273. };
  1274. };
  1275. }
  1276. },
  1277. id: 'map_vehicle_centered',
  1278. name: 'map_centered'
  1279. }),
  1280. new Ext.form.Radio({
  1281. width: 180,
  1282. hideLabel: true,
  1283. value: '2',
  1284. boxLabel: "<?=$Labels->GetLabel('_CENTER_TO_WA_');?>",
  1285. listeners: {
  1286. 'check':function( me, checked ){
  1287. if ( checked ){
  1288. if ( InitSetupParameters ){
  1289. if ( polygon_r == null ){
  1290. polygon_r = new GPolygon(CPoints, "#808080", 5);
  1291. };
  1292. SaveSetting(8,2);
  1293. map.panTo( polygon_r.getBounds().getCenter() );
  1294. mapAreaCentered = true;
  1295. mapVehicleCentered = false;
  1296. };
  1297. };
  1298. }
  1299. },
  1300. id: 'map_area_centered',
  1301. name: 'map_centered'
  1302. }),
  1303. new Ext.form.Checkbox({
  1304. width: 180,
  1305. hideLabel: true,
  1306. value: '',
  1307. boxLabel: "<?=$Labels->GetLabel('_ZOOM_TO_WA_');?>",
  1308. listeners: {
  1309. 'check':function( me, checked ){
  1310. if ( checked ){
  1311. if ( InitSetupParameters ){
  1312. SaveSetting(7,1);
  1313. if ( polygon_r == null ){
  1314. polygon_r = new GPolygon(CPoints, "#808080", 5);
  1315. }
  1316. map.setCenter( map.getCenter(), map.getBoundsZoomLevel( polygon_r.getBounds()) );
  1317. mapShowZoomed = true;
  1318. };
  1319. } else {
  1320. if ( InitSetupParameters ){
  1321. SaveSetting(7,0);
  1322. mapShowZoomed = false;
  1323. };
  1324. };
  1325. }
  1326. },
  1327. id: 'map_show_zoomed',
  1328. name: 'map_show_zoomed'
  1329. })
  1330. ]
  1331. }
  1332. ]
  1333. })
  1334. ]
  1335. }),
  1336. new Ext.Panel({
  1337. title: "<?=$Labels->GetLabel('_LAST_POS_NFO_');?>",
  1338. frame: true,
  1339. height: 90,
  1340. html: '<table width=100%><tr><td class="small" id="INFO_TD"></td></tr></table>'
  1341. })
  1342. ]
  1343. });
  1344. var ts = new Ext.tree.TreeSorter( Ext.getCmp('dev-tree'), { folderSort:true });
  1345. var te = new Ext.tree.TreeEditor( Ext.getCmp('dev-tree'),{},{
  1346. //completeOnEnter: true,
  1347. autosize: true,
  1348. //ignoreNoChange: true,
  1349. listeners: {
  1350. complete: function(te,val,sval){
  1351. if (sval!=val){
  1352. //alert('Edited node'+te.editNode.id+" New Val:"+val);
  1353. if( te.editNode.attributes.device_db_id == 0 ){
  1354. AURL = 'lib/connector/json/rename_group_node.php?node='+te.editNode.id+'&name='+val+'&UID='+UserID+'&SID='+SessionID;
  1355. } else {
  1356. AURL = 'lib/connector/json/rename_tracker_node.php?node='+te.editNode.attributes.device_db_id+'&name='+val+'&UID='+UserID+'&SID='+SessionID;
  1357. };
  1358. Ext.Ajax.request({
  1359. url: AURL,
  1360. success: function( response, opts ){
  1361. },
  1362. failure: function( response, opts ){
  1363. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  1364. },
  1365. headers: {
  1366. 'my-header': 'foo'
  1367. },
  1368. params: { foo: 'bar' }
  1369. });
  1370. };
  1371. }
  1372. }
  1373. });
  1374. var GMapPanel = new Ext.Panel({
  1375. title: "<?=$Labels->GetLabel('_MAP_');?>",
  1376. width: '100%',
  1377. //renderTo: gct_m,
  1378. height: PanelH,
  1379. frame: true,
  1380. //margins: '0 0 0 0',
  1381. region: 'center', // center region is required, no width/height specified
  1382. //xtype: 'container',
  1383. layoutConfig: {
  1384. // layout-specific configs go here
  1385. //titleCollapse: true,
  1386. //animate: true
  1387. //renderHidden: true,
  1388. //activeOnTop: true
  1389. },
  1390. layout: 'fit',
  1391. margins: '5 5 0 0',
  1392. html: '<div style="width: 100%; height: '+(PanelH-70)+'px; background: white;" id="tracking_map"></div>'
  1393. //handlers
  1394. });
  1395. var GMapWindow = new Ext.Panel({
  1396. width: '100%',
  1397. //renderTo: gct_p,
  1398. frame: true,
  1399. height: PanelH,
  1400. title: "<?=$Labels->GetLabel('_ONLINE_TRACK_');?>",
  1401. layout: 'border',
  1402. items: [ GMapPanel, GMapToolbox ]
  1403. });
  1404. GMapWindow.doLayout();
  1405. try {
  1406. GMapWindow.render('gmap_control_placeholder');
  1407. } catch (e){
  1408. };
  1409. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Load_Items_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  1410. progressText: 'Initializing...',
  1411. width: '100%',
  1412. hidden: true,
  1413. progress: true,
  1414. closable: false
  1415. });
  1416. window.setTimeout(function(){
  1417. GMapToolbox.expand();
  1418. //GMapWindow.doLayout();
  1419. }, 1000 );
  1420. window.setTimeout(function(){
  1421. Tracking_Init();
  1422. }, 2000 );
  1423. //Ext.QuickTips.init();
  1424. // turn on validation errors beside the field globally
  1425. //Ext.form.Field.prototype.msgTarget = 'side';
  1426. });