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.

1471 lines
42 KiB

5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. function GetUserList(){
  2. Ext.Ajax.request({
  3. url: 'lib/connector/json/user_list.php?UID='+UserID+'&SID='+SessionID,
  4. success: function( response, opts ){
  5. var obj = Ext.decode( response.responseText );
  6. UserListDataStore.loadData( obj );
  7. Ext.getCmp('user-list-grid').doLayout();
  8. },
  9. failure: function( response, opts ){
  10. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CEUL00227');
  11. },
  12. headers: {
  13. 'my-header': 'foo'
  14. },
  15. params: { foo: 'bar' }
  16. });
  17. };
  18. function SetUserAddDescription(){
  19. CVal=Ext.getCmp('add_user_access_select').getValue();
  20. var DTX=Ext.getCmp('add_user_access_description');
  21. DTX.removeAll();
  22. switch( CVal ){
  23. case 1:{
  24. DTX.add({html:'Tracking Reviewer Access Level Will Grant:<br><ul><li>Review Online Tracking</li></ul>'});
  25. break;
  26. };
  27. case 2:{
  28. DTX.add({html:'Report Reviewer Access Level Will Grant:<br><ul><li>Review Online Tracking</li><li>Review and Print Reports</li></ul>'});
  29. break;
  30. };
  31. case 3:{
  32. DTX.add({html:'Report Manager Access Level Will Grant:<br><ol><li>Review Online Tracking</li><li>Review and Print Reports</li><li>Manage Report Events</li></ol>'});
  33. break;
  34. };
  35. case 4:{
  36. DTX.add({html:'Administrator Access Level Will Grant:<br><ul><li>Review Online Tracking</li><li>Review and Print Reports</li><li>Manage Report Events</li><li>Manage Account Settings</li><li>Manage Account Users</li></ul>'});
  37. break;
  38. };
  39. };
  40. DTX.doLayout();
  41. };
  42. function SetUserEditorDescription(){
  43. CVal=Ext.getCmp('edit_user_access_select').getValue();
  44. var DTX=Ext.getCmp('edit_user_access_description');
  45. DTX.removeAll();
  46. switch( CVal ){
  47. case 1:{
  48. DTX.add({html:'Tracking Reviewer Access Level Will Grant:<br><ul><li>Review Online Tracking</li></ul>'});
  49. break;
  50. };
  51. case 2:{
  52. DTX.add({html:'Report Reviewer Access Level Will Grant:<br><ul><li>Review Online Tracking</li><li>Review and Print Reports</li></ul>'});
  53. break;
  54. };
  55. case 3:{
  56. DTX.add({html:'Report Manager Access Level Will Grant:<br><ol><li>Review Online Tracking</li><li>Review and Print Reports</li><li>Manage Report Events</li></ol>'});
  57. break;
  58. };
  59. case 4:{
  60. DTX.add({html:'Administrator Access Level Will Grant:<br><ul><li>Review Online Tracking</li><li>Review and Print Reports</li><li>Manage Report Events</li><li>Manage Account Settings</li><li>Manage Account Users</li></ul>'});
  61. break;
  62. };
  63. };
  64. DTX.doLayout();
  65. };
  66. var UserListRecord = Ext.data.Record.create([
  67. 'id',
  68. 'login',
  69. 'status',
  70. 'type',
  71. 'created',
  72. 'last_access'
  73. ]);
  74. var UserListDataStore = new Ext.data.Store({
  75. reader: new Ext.data.JsonReader({
  76. // The metadata property, with configuration options:
  77. //totalProperty: "results", // the property which contains the total dataset size (optional)
  78. root: "rows", // the property which contains an Array of row objects
  79. idProperty: "id" // the property within each row object that provides an ID for the record (optional)
  80. }, UserListRecord // Ext.data.Record constructor that provides mapping for JSON object
  81. )
  82. });
  83. // DEEVICE LIST
  84. var DeviceListRecord = Ext.data.Record.create([
  85. 'id',
  86. 'device_id',
  87. 'status',
  88. 'icon',
  89. 'name',
  90. 'created',
  91. 'last_access',
  92. 'sms'
  93. ]);
  94. var DeviceListDataStore = new Ext.data.Store({
  95. reader: new Ext.data.JsonReader({
  96. root: "rows", // the property which contains an Array of row objects
  97. idProperty: "id" // the property within each row object that provides an ID for the record (optional)
  98. }, DeviceListRecord // Ext.data.Record constructor that provides mapping for JSON object
  99. )
  100. });
  101. function GetDeviceList(){
  102. Ext.Ajax.request({
  103. url: 'lib/connector/json/device_list.php?UID='+UserID+'&SID='+SessionID,
  104. success: function( response, opts ){
  105. var obj = Ext.decode( response.responseText );
  106. DeviceListDataStore.loadData( obj );
  107. },
  108. failure: function( response, opts ){
  109. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CEDL00226');
  110. },
  111. headers: {
  112. 'my-header': 'foo'
  113. },
  114. params: { foo: 'bar' }
  115. });
  116. };
  117. // New Device List
  118. var NDeviceListRecord = Ext.data.Record.create([
  119. 'id',
  120. 'device_id'
  121. ]);
  122. var NDeviceListDataStore = new Ext.data.Store({
  123. reader: new Ext.data.JsonReader({
  124. // The metadata property, with configuration options:
  125. //totalProperty: "results", // the property which contains the total dataset size (optional)
  126. root: "rows", // the property which contains an Array of row objects
  127. idProperty: "id" // the property within each row object that provides an ID for the record (optional)
  128. }, NDeviceListRecord // Ext.data.Record constructor that provides mapping for JSON object
  129. )
  130. });
  131. function GetNewDeviceList(){
  132. Ext.Ajax.request({
  133. url: 'lib/connector/json/new_device_list.php?UID='+UserID+'&SID='+SessionID,
  134. success: function( response, opts ){
  135. var obj = Ext.decode( response.responseText );
  136. NDeviceListDataStore.loadData( obj );
  137. },
  138. failure: function( response, opts ){
  139. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CENDL00225');
  140. },
  141. headers: {
  142. 'my-header': 'foo'
  143. },
  144. params: { foo: 'bar' }
  145. });
  146. };
  147. // Reports
  148. var SelectedRDevice;
  149. var RepportDeviceButtonList = new Ext.Panel({
  150. id: 'New-Device-List',
  151. //renderTo: RDeviceListDiv,
  152. frame: true,
  153. title: 'Report Manager',
  154. bodyStyle:'padding: 5px;'
  155. });
  156. var RepportPlaceholderPanel = new Ext.Panel({
  157. id: 'New-Device-List',
  158. //renderTo: RDeviceListDiv,
  159. frame: true,
  160. height: PanelH,
  161. title: 'Reports',
  162. bodyStyle:'padding: 5px;'
  163. });
  164. function GetRepDevicesButtons(){
  165. Ext.Ajax.request({
  166. url: 'lib/connector/json/device_list.php?UID='+UserID+'&SID='+SessionID,
  167. success: function( response, opts ){
  168. var obj = Ext.decode( response.responseText );
  169. for( index=0; index < obj.rows.length; index++ ){
  170. RepportDeviceButtonList.add({
  171. xtype: 'button',
  172. param: obj.rows[index].device_id,
  173. text: obj.rows[index].name,
  174. width: '100%',
  175. style: 'padding-top: 3px;',
  176. handler: function( tb, e ){
  177. alert( tb.param );
  178. }
  179. });
  180. };
  181. RepportDeviceButtonList.doLayout();
  182. },
  183. failure: function( response, opts ){
  184. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CEDL00224');
  185. },
  186. headers: {
  187. 'my-header': 'foo'
  188. },
  189. params: { foo: 'bar' }
  190. });
  191. };
  192. Ext.onReady( function(){
  193. Ext.QuickTips.init();
  194. // turn on validation errors beside the field globally
  195. Ext.form.Field.prototype.msgTarget = 'side';
  196. var UserListDiv = Ext.get('user_list');
  197. var DeviceListDiv = Ext.get('device_list');
  198. var NDeviceListDiv = Ext.get('ndevice_list');
  199. var RDeviceListDiv = Ext.get('rep_dev_list');
  200. var AddNewUserWindow;
  201. var EditUserWindow;
  202. // MAP
  203. var gct_p = Ext.get('gmap_control_placeholder');
  204. var gct_t = Ext.get('gmap_control_toolbox');
  205. var gct_m = Ext.get('gmap_control_map');
  206. var GMapToolbox = new Ext.Panel({
  207. title: 'Tools',
  208. //renderTo: gct_t,
  209. region:'west',
  210. margins: '5 0 0 5',
  211. width: 200,
  212. height: PanelH,
  213. collapsible: true, // make collapsible
  214. //collapsed: true,
  215. //collapseFirst: true,
  216. cmargins: '5 5 0 5', // adjust top margin when collapsed
  217. id: 'GMAP-Toolbox',
  218. style: 'background: white; border: 1px solid black;',
  219. hideCollapseTool: false,
  220. layoutConfig: {
  221. titleCollapse: true,
  222. //animate: false,
  223. activeOnTop: true
  224. },
  225. items: [
  226. new Ext.Panel({
  227. //title: 'Tools',
  228. //margins: '5 0 0 5',
  229. width: 200,
  230. height: PanelH - 220,
  231. bodyBorder: true,
  232. layout:'accordion',
  233. unstyled: true,
  234. defaults: {
  235. // applied to each contained panel
  236. bodyStyle: 'padding:5px',
  237. frame: false
  238. },
  239. layoutConfig: {
  240. // layout-specific configs go here
  241. //titleCollapse: false,
  242. //animate: false
  243. //activeOnTop: true
  244. },
  245. items: [
  246. new Ext.tree.TreePanel({
  247. id:'im-tree',
  248. title: 'Vehicles',
  249. frame: true,
  250. loader: new Ext.tree.TreeLoader({
  251. dataUrl: 'lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID,
  252. baseAttrs:{
  253. expanded: true
  254. },
  255. listeners:{
  256. load: function( me, node, response ){
  257. //alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID);
  258. //GMapToolbox.doLayout();
  259. //GMapToolbox.expand();
  260. if ( node.getPath() == InitTreeNodePath ){
  261. node.select();
  262. };
  263. }
  264. }
  265. }),
  266. selModel: new Ext.tree.DefaultSelectionModel({
  267. listeners:{
  268. selectionchange: function ( me, node ){
  269. if (isNaN(node.id)){
  270. CDevID=node.id-1;
  271. CQStyle=2
  272. RetriveData();
  273. } else {
  274. CDevID=node.id-1;
  275. CQStyle=0
  276. RetriveData();
  277. };
  278. }
  279. }
  280. }),
  281. rootVisible:false,
  282. lines:false,
  283. autoScroll:true,
  284. root: new Ext.tree.AsyncTreeNode({
  285. text:'All Devices',
  286. expanded: true
  287. })
  288. }), new Ext.Panel({
  289. title: 'Tracking Settings',
  290. frame: true,
  291. //style: 'background: white;',
  292. align: 'center',
  293. items: [
  294. {
  295. layout: 'form',
  296. frame: true,
  297. items: [
  298. {
  299. xtype:'label',
  300. autoWidth: true,
  301. fieldLabel: 'Tracking Mode'
  302. },
  303. new Ext.form.Radio({
  304. width: 180,
  305. hideLabel: true,
  306. boxLabel: 'Real Time Tracking',
  307. listeners: {
  308. 'check': function( me, checked ){
  309. if(checked){
  310. map.checkResize();
  311. StartTrackingSession(0);
  312. window.clearInterval(MapUpdateInterval);
  313. MapUpdateInterval=window.setInterval("RetriveData();",10000);
  314. trackingMode = 1;
  315. Ext.getCmp('history-settings').setVisible( false );
  316. try{
  317. Ext.getCmp('history-settings').doLayout();
  318. } catch (e){};
  319. };
  320. }
  321. },
  322. id: 'track_type_r',
  323. name: 'track_type'
  324. }),
  325. new Ext.form.Radio({
  326. width: 180,
  327. hideLabel: true,
  328. boxLabel: 'Tracking History',
  329. listeners: {
  330. 'check': function( me, checked ){
  331. if(checked){
  332. window.clearInterval(MapUpdateInterval);
  333. trackingMode = 2;
  334. StartCalendarSession(5);
  335. Ext.getCmp('history-settings').setVisible( true );
  336. try{
  337. Ext.getCmp('history-settings').doLayout();
  338. } catch(e){};
  339. };
  340. }
  341. },
  342. id: 'track_type_h',
  343. name: 'track_type'
  344. })
  345. ]
  346. },
  347. new Ext.Spacer({
  348. height: 5,
  349. style: 'background: white'
  350. }),
  351. {
  352. xtype: 'tabpanel',
  353. id: 'history-settings',
  354. activeTab: 0,
  355. height: 280, // Why do I have to specify the height here?
  356. // Shouldn't its container's 'fit' layout take
  357. // care of that?
  358. //width: PanelH,
  359. hidden: true,
  360. border: false,
  361. deferredRender: true, // This works
  362. //defaults: {autoScroll: true},
  363. items: [
  364. {
  365. layout: 'form',
  366. title: 'Simple Param.',
  367. frame: true,
  368. //bodyStyle: 'padding 10px;',
  369. labelWidth: 50,
  370. defaults: { width: 80},
  371. items: [{
  372. html:'koko'
  373. }/*,
  374. new Ext.Slider({
  375. fieldLabel: 'Plot Number',
  376. width: 150,
  377. value: 50,
  378. increment: 10,
  379. minValue: 0,
  380. maxValue: 100
  381. })*/
  382. ],
  383. buttons: [{
  384. xtype: 'button',
  385. text: 'Display History'
  386. }]
  387. },{
  388. layout: 'form',
  389. title: 'Date/Time',
  390. frame: true,
  391. labelAlign: 'right',
  392. labelWidth: 50,
  393. defaults: { width: 80},
  394. items: [
  395. new Ext.form.TimeField({
  396. id: 'STimeFROM',
  397. width: 120,
  398. fieldLabel: 'From',
  399. minValue: '00:00',
  400. maxValue: '24:00',
  401. increment: 30
  402. }),
  403. new Ext.form.TimeField({
  404. id: 'STimeTO',
  405. width: 50,
  406. fieldLabel: 'Till',
  407. minValue: '00:00',
  408. maxValue: '24:00',
  409. increment: 30
  410. })
  411. ],
  412. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  413. buttons: [{
  414. xtype: 'button',
  415. text: 'Display History'
  416. }]
  417. }]
  418. }
  419. ]
  420. }),new Ext.Panel({
  421. title: 'Map Settings',
  422. frame: true,
  423. //style: 'background: white;',
  424. align: 'center',
  425. items: [{
  426. layout: 'form',
  427. //title: 'Address Info',
  428. frame: true,
  429. //labelAlign: 'center',
  430. //style: 'text-align: center;',
  431. //defaults: {width: 75},
  432. items: [
  433. {
  434. xtype:'label',
  435. autoWidth: true,
  436. fieldLabel: 'Map Type'
  437. },
  438. new Ext.form.Radio({
  439. width: 180,
  440. hideLabel: true,
  441. value: 'reg',
  442. boxLabel: 'Regular Map',
  443. listeners: {
  444. 'check': function( me, checked ){
  445. if( checked ){
  446. if ( InitSetupParameters ) SaveSetting(3,1);
  447. map.setMapType(G_NORMAL_MAP);
  448. };
  449. }
  450. },
  451. id: 'map_type_1',
  452. name: 'map_type'
  453. }),
  454. new Ext.form.Radio({
  455. width: 180,
  456. hideLabel: true,
  457. value: 'sat',
  458. boxLabel: 'Satelite Map',
  459. listeners: {
  460. 'check': function( me, checked ){
  461. if( checked ){
  462. if ( InitSetupParameters ) SaveSetting(3,2);
  463. map.setMapType(G_SATELLITE_MAP);
  464. };
  465. }
  466. },
  467. id: 'map_type_2',
  468. name: 'map_type'
  469. }),
  470. new Ext.form.Radio({
  471. width: 180,
  472. hideLabel: true,
  473. value: 'comb',
  474. boxLabel: 'Hybrid Map (Satelite/Regular)',
  475. listeners: {
  476. 'check': function( me, checked ){
  477. if( checked ){
  478. if ( InitSetupParameters ) SaveSetting(3,3);
  479. map.setMapType(G_HYBRID_MAP);
  480. };
  481. }
  482. },
  483. id: 'map_type_3',
  484. name: 'map_type'
  485. })
  486. ]
  487. },
  488. new Ext.Spacer({
  489. height: 5,
  490. style: 'background: white'
  491. }),
  492. {
  493. layout: 'form',
  494. frame: true,
  495. items: [
  496. {
  497. xtype:'label',
  498. autoWidth: true,
  499. fieldLabel: 'Advanced Options'
  500. },
  501. new Ext.form.Checkbox({
  502. width: 180,
  503. hideLabel: true,
  504. value: 'reg',
  505. boxLabel: 'Show Traffic (If Possible)',
  506. listeners: {
  507. 'check': function( me, checked ){
  508. if ( checked ){
  509. if ( InitSetupParameters ){
  510. SaveSetting(12,1);
  511. mapTrafficOverlay=new GTrafficOverlay();
  512. map.addOverlay( mapTrafficOverlay );
  513. };
  514. } else {
  515. if ( InitSetupParameters ){
  516. SaveSetting(12,0);
  517. map.removeOverlay( mapTrafficOverlay );
  518. mapTrafficOverlay = null;
  519. };
  520. };
  521. }
  522. },
  523. id: 'map_show_traffic',
  524. name: 'map_show_traffic'
  525. }),
  526. new Ext.form.Checkbox({
  527. width: 180,
  528. hideLabel: true,
  529. value: 'sat',
  530. boxLabel: 'Show Pan/Zoom Control',
  531. listeners: {
  532. 'check':function( me, checked ){
  533. if ( checked ){
  534. if ( InitSetupParameters ) SaveSetting(11,1);
  535. mapPZControlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
  536. mapPZControl = new GLargeMapControl3D();
  537. map.addControl( mapPZControl, mapPZControlPosition );
  538. } else {
  539. if ( InitSetupParameters ) SaveSetting(11,0);
  540. map.removeControl( mapPZControl );
  541. mapPZControlPosition = null;
  542. mapPZControl = null;
  543. };
  544. }
  545. },
  546. id: 'map_show_ptz',
  547. name: 'map_show_ptz'
  548. }),
  549. new Ext.form.Checkbox({
  550. width: 180,
  551. hideLabel: true,
  552. value: 'red',
  553. boxLabel: 'Connect WayPoints',
  554. listeners: {
  555. 'check':function( me, checked ){
  556. if ( checked ){
  557. if ( InitSetupParameters ){
  558. SaveSetting(13,1);
  559. polyline_r = new GPolyline(CPoints, "#ff0000", 5);
  560. map.addOverlay( polyline_r );
  561. mapShowRedLine = true;
  562. };
  563. } else {
  564. if ( InitSetupParameters ){
  565. SaveSetting(13,0);
  566. mapShowRedLine = false;
  567. map.removeOverlay( polyline_r );
  568. polyline_r = null;
  569. };
  570. };
  571. }
  572. },
  573. id: 'map_show_red',
  574. name: 'map_show_red'
  575. }),
  576. new Ext.form.Radio({
  577. width: 180,
  578. hideLabel: true,
  579. value: '0',
  580. boxLabel: 'Do Not Follow Vehicle',
  581. listeners: {
  582. 'check':function( me, checked ){
  583. if ( checked ){
  584. if ( InitSetupParameters ){
  585. SaveSetting(8,0);
  586. mapVehicleCentered = false;
  587. mapAreaCentered = false;
  588. };
  589. };
  590. }
  591. },
  592. id: 'map_no_centered',
  593. name: 'map_centered'
  594. }),new Ext.form.Radio({
  595. width: 180,
  596. hideLabel: true,
  597. value: '1',
  598. boxLabel: 'Center to Vehicle',
  599. listeners: {
  600. 'check':function( me, checked ){
  601. if ( checked ){
  602. if ( InitSetupParameters ){
  603. SaveSetting(8,1);
  604. mapAreaCentered = false;
  605. mapVehicleCentered = true;
  606. map.panTo( CPoints[CPoints.length-1] );
  607. };
  608. };
  609. }
  610. },
  611. id: 'map_vehicle_centered',
  612. name: 'map_centered'
  613. }),
  614. new Ext.form.Radio({
  615. width: 180,
  616. hideLabel: true,
  617. value: '2',
  618. boxLabel: 'Center to WayPoints Area',
  619. listeners: {
  620. 'check':function( me, checked ){
  621. if ( checked ){
  622. if ( InitSetupParameters ){
  623. if ( polygon_r == null ){
  624. polygon_r = new GPolygon(CPoints, "#808080", 5);
  625. };
  626. SaveSetting(8,2);
  627. map.panTo( polygon_r.getBounds().getCenter() );
  628. mapAreaCentered = true;
  629. mapVehicleCentered = false;
  630. };
  631. };
  632. }
  633. },
  634. id: 'map_area_centered',
  635. name: 'map_centered'
  636. }),
  637. new Ext.form.Checkbox({
  638. width: 180,
  639. hideLabel: true,
  640. value: '',
  641. boxLabel: 'Zoom to WayPoints Area',
  642. listeners: {
  643. 'check':function( me, checked ){
  644. if ( checked ){
  645. if ( InitSetupParameters ){
  646. SaveSetting(7,1);
  647. if ( polygon_r == null ){
  648. polygon_r = new GPolygon(CPoints, "#808080", 5);
  649. }
  650. map.setCenter( map.getCenter(), map.getBoundsZoomLevel( polygon_r.getBounds()) );
  651. mapShowZoomed = true;
  652. };
  653. } else {
  654. if ( InitSetupParameters ){
  655. SaveSetting(7,0);
  656. mapShowZoomed = false;
  657. };
  658. };
  659. }
  660. },
  661. id: 'map_show_zoomed',
  662. name: 'map_show_zoomed'
  663. })
  664. ]
  665. }
  666. ]
  667. })
  668. ]
  669. }),
  670. new Ext.Panel({
  671. title: 'Info',
  672. frame: true,
  673. height: 150,
  674. html: '<table width=100%><tr><td class="small" id="INFO_TD"></td></tr></table>'
  675. })
  676. ]
  677. });
  678. var GMapPanel = new Ext.Panel({
  679. title: 'Map',
  680. width: '100%',
  681. //renderTo: gct_m,
  682. height: PanelH,
  683. frame: true,
  684. //margins: '0 0 0 0',
  685. region: 'center', // center region is required, no width/height specified
  686. //xtype: 'container',
  687. layoutConfig: {
  688. // layout-specific configs go here
  689. //titleCollapse: true,
  690. //animate: true
  691. //renderHidden: true,
  692. //activeOnTop: true
  693. },
  694. layout: 'fit',
  695. margins: '5 5 0 0',
  696. html: '<div style="width: 100%; height: '+(PanelH-70)+'px; background: white;" id="tracking_map"></div>'
  697. //handlers
  698. });
  699. var GMapWindow = new Ext.Panel({
  700. width: '100%',
  701. //renderTo: gct_p,
  702. frame: true,
  703. height: PanelH,
  704. title: 'Online Tracking',
  705. layout: 'border',
  706. items: [ GMapPanel, GMapToolbox ]
  707. });
  708. function ShowAddNewUser(){
  709. // create the window on the first click and reuse on subsequent clicks
  710. if( !AddNewUserWindow ){
  711. AddNewUserWindow = new Ext.Window({
  712. title : 'Add New User Dialog',
  713. layout : 'fit',
  714. width : 500,
  715. height : 300,
  716. closeAction :'hide',
  717. plain : false,
  718. resizable : false,
  719. items : [ new Ext.FormPanel({
  720. id: 'add_user_form',
  721. labelWidth: 150, // label settings here cascade unless overridden
  722. //url:'lib/connector/add_user.php',
  723. frame: true,
  724. //bodyBorder: false,
  725. //border: false,
  726. //title: 'Simple Form',
  727. bodyStyle:'padding:5px 5px 0',
  728. width: '100%',
  729. defaultType: 'textfield',
  730. items: [{
  731. fieldLabel: 'User ID(Login)',
  732. name: 'nnl',
  733. width: 180,
  734. allowBlank: false
  735. },{
  736. fieldLabel: 'Password',
  737. width: 180,
  738. inputType: 'password',
  739. name: 'npasswd'
  740. },{
  741. fieldLabel: 'Retype Password',
  742. width: 180,
  743. inputType: 'password',
  744. name: 'repasswd'
  745. }, new Ext.form.ComboBox({
  746. id: 'add_user_access_select',
  747. typeAhead: true,
  748. width: 180,
  749. triggerAction: 'all',
  750. fieldLabel: 'User Access Level',
  751. forceSelection: true,
  752. hiddenName: 'type',
  753. lazyRender: true,
  754. mode: 'local',
  755. listeners: {
  756. select: SetUserAddDescription
  757. },
  758. store: new Ext.data.ArrayStore({
  759. id: 0,
  760. fields: [
  761. 'val',
  762. 'displayText'
  763. ],
  764. data: [[1, 'Tracking Reviewer'], [2, 'Report Reviewer'],[3, 'Report Manager'],[4, 'Administrator']]
  765. }),
  766. valueField: 'val',
  767. displayField: 'displayText'
  768. }), new Ext.Panel({
  769. id: 'add_user_access_description',
  770. frame: true,
  771. bodyBorder: true,
  772. border: true,
  773. collapsible: true,
  774. width: '100%',
  775. height: 100
  776. })]
  777. })],
  778. buttons: [{
  779. text : 'Add New User',
  780. disabled : false,
  781. handler : function(){
  782. Ext.getCmp('add_user_form').getForm().submit({
  783. url: 'lib/connector/json/add_user.php?UID='+UserID+'&SID='+SessionID,
  784. waitMsg:'Creating New User...',
  785. success : function(){
  786. AddNewUserWindow.hide();
  787. }
  788. });
  789. }
  790. },{
  791. text : 'Cancel',
  792. handler : function(){
  793. AddNewUserWindow.hide();
  794. }
  795. }]
  796. });
  797. }
  798. AddNewUserWindow.show(UserListDiv);
  799. };
  800. function ShowEditUser(){
  801. // create the window on the first click and reuse on subsequent clicks
  802. if( !EditUserWindow ){
  803. EditUserWindow = new Ext.Window({
  804. title : 'Edit User Dialog',
  805. layout : 'fit',
  806. width : 500,
  807. height : 300,
  808. closeAction :'hide',
  809. plain : false,
  810. resizable : false,
  811. items : new Ext.FormPanel({
  812. labelWidth: 150, // label settings here cascade unless overridden
  813. id: 'edit_user_form',
  814. url:'save-form.php',
  815. frame: true,
  816. bodyStyle:'padding:5px 5px 0',
  817. width: '100%',
  818. defaultType: 'textfield',
  819. items: [{
  820. fieldLabel: 'User ID(Login)',
  821. name: 'login',
  822. width: 180,
  823. //disabled: true,
  824. readOnly: true,
  825. allowBlank: false
  826. },{
  827. fieldLabel: 'New Password',
  828. inputType: 'password',
  829. width: 180,
  830. name: 'npasswd'
  831. },{
  832. fieldLabel: 'Retype New Password',
  833. inputType: 'password',
  834. width: 180,
  835. name: 'repasswd'
  836. }, new Ext.form.ComboBox({
  837. typeAhead: true,
  838. id: 'edit_user_access_select',
  839. triggerAction: 'all',
  840. width: 180,
  841. fieldLabel: 'User Access Level',
  842. forceSelection: true,
  843. //lazyRender:true,
  844. hiddenName: 'type',
  845. mode: 'local',
  846. listeners: {
  847. select: SetUserEditorDescription
  848. },
  849. store: new Ext.data.ArrayStore({
  850. id: 0,
  851. fields: [
  852. 'val',
  853. 'displayText'
  854. ],
  855. data: [[1, 'Tracking Reviewer'], [2, 'Report Reviewer'],[3, 'Report Manager'],[4, 'Administrator']]
  856. }),
  857. valueField: 'val',
  858. displayField: 'displayText'
  859. }), new Ext.Panel({
  860. id: 'edit_user_access_description',
  861. frame: true,
  862. bodyBorder: true,
  863. border: true,
  864. collapsible: true,
  865. width: '100%',
  866. height: 100
  867. })]
  868. }),
  869. buttons: [{
  870. text : 'Update',
  871. disabled : false,
  872. handler : function(){
  873. Ext.getCmp('edit_user_form').getForm().submit({
  874. url: 'lib/connector/json/update_user.php?UID='+UserID+'&SID='+SessionID,
  875. waitMsg:'Updating User Data...',
  876. success : function(){
  877. EditUserWindow.hide();
  878. GetUserList();
  879. }
  880. });
  881. }
  882. },{
  883. text : 'Cancel',
  884. handler : function(){
  885. EditUserWindow.hide();
  886. }
  887. }]
  888. });
  889. }
  890. EditUserWindow.show(UserListDiv);
  891. };
  892. function SuspendUser( UserLogin ){
  893. Ext.Ajax.request({
  894. url: 'lib/connector/json/suspend_user.php?UID='+UserID+'&SID='+SessionID+'&uln='+UserLogin,
  895. success: function( response, opts ){
  896. GetUserList();
  897. }
  898. });
  899. };
  900. function ActivateUser( UserLogin ){
  901. Ext.Ajax.request({
  902. url: 'lib/connector/json/activate_user.php?UID='+UserID+'&SID='+SessionID+'&uln='+UserLogin,
  903. success: function( response, opts ){
  904. GetUserList();
  905. }
  906. });
  907. };
  908. GetUserList();
  909. function StatusRenderer(val){
  910. switch(val){
  911. case 0: return '<span style="color: blue; font-weight: bold;">Suspended</span>';
  912. case 1: return '<span style="color: green; font-weight: bold;">Active</span>';
  913. };
  914. return '';
  915. };
  916. function AccessLevelRenderer(val){
  917. switch(val){
  918. case 1: return 'Tracking Reviewer';
  919. case 2: return 'Report Reviewer';
  920. case 3: return 'Report Manager';
  921. case 4: return 'Administrator';
  922. case 5: return 'Account Holder';
  923. };
  924. return '';
  925. };
  926. var UserListColModel = new Ext.grid.ColumnModel([
  927. {header: "User Name (Login)", sortable: true, locked: true, dataIndex: 'login'},
  928. {header: "Status", width: 85, sortable: true, renderer: StatusRenderer, dataIndex: 'status'},
  929. {header: "Access Level", width: 95, sortable: true, renderer: AccessLevelRenderer , dataIndex: 'type'},
  930. {header: "Active Since", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'created'},
  931. {header: "Last Activity", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'last_access'}
  932. ]);
  933. var SelectedUser;
  934. var UserListGridForm = new Ext.FormPanel({
  935. id: 'User-List',
  936. frame: true,
  937. labelAlign: 'left',
  938. title: 'List of Account Users',
  939. bodyStyle:'padding: 5px; align: center;',
  940. shim: false,
  941. //animCollapse: false,
  942. constrainHeader: true,
  943. layout: 'fit',
  944. items: {
  945. xtype: 'grid',
  946. ds: UserListDataStore,
  947. cm: UserListColModel,
  948. id: 'user-list-grid',
  949. sm: new Ext.grid.RowSelectionModel({
  950. singleSelect: true,
  951. listeners: {
  952. rowselect: function(sm, row, rec) {
  953. if (!SelectedUser){
  954. SelectedUser=rec;
  955. } else {
  956. SelectedUser=rec;
  957. if ( SelectedUser.data.type<5 ){
  958. Ext.getCmp('Suspend_AUB').enable();
  959. Ext.getCmp('Edit_AUB').enable();
  960. Ext.getCmp('Delete_AUB').enable();
  961. if ( SelectedUser.data.status>0 ){
  962. Ext.getCmp('Suspend_AUB').setText('Suspend');
  963. Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User');
  964. } else {
  965. Ext.getCmp('Suspend_AUB').setText('Activate');
  966. Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User');
  967. };
  968. } else {
  969. Ext.getCmp('Edit_AUB').disable();
  970. Ext.getCmp('Suspend_AUB').disable();
  971. Ext.getCmp('Delete_AUB').disable();
  972. };
  973. };
  974. }
  975. }
  976. }),
  977. //autoExpandColumn: 'login',
  978. height: 350,
  979. width: '100%',
  980. forceFit: true,
  981. border: false,
  982. listeners: {
  983. render: function(g) {
  984. g.getSelectionModel().selectRow(0);
  985. },
  986. delay: 20 // Allow rows to be rendered.
  987. },
  988. viewConfig: {
  989. forceFit:true
  990. },
  991. bbar: [{
  992. tooltip: 'Create New User and Set Privilegies',
  993. text: 'Add New',
  994. iconCls:'user-add',
  995. handler : function(){
  996. ShowAddNewUser();
  997. }
  998. },{
  999. tooltip:'Edit Access Level of Selected User',
  1000. id: 'Edit_AUB',
  1001. text: 'Edit',
  1002. iconCls:'user-edit',
  1003. handler: function(){
  1004. ShowEditUser();
  1005. Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser);
  1006. SetUserEditorDescription();
  1007. },
  1008. disabled: true
  1009. },{
  1010. tooltip:'Suspend Access of Selected User',
  1011. id: 'Suspend_AUB',
  1012. text: 'Suspend',
  1013. iconCls:'user-block',
  1014. handler: function(){
  1015. if ( SelectedUser.data.status>0 ){
  1016. SuspendUser( SelectedUser.data.login );
  1017. } else {
  1018. ActivateUser( SelectedUser.data.login );
  1019. };
  1020. },
  1021. disabled: true
  1022. },{
  1023. tooltip: 'Remove Selected User from Account',
  1024. id: 'Delete_AUB',
  1025. text:'Delete',
  1026. iconCls:'user-delete',
  1027. disabled: true,
  1028. handler: function(){
  1029. Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', function (){
  1030. });
  1031. }
  1032. }]
  1033. },
  1034. renderTo: UserListDiv
  1035. });
  1036. GetDeviceList();
  1037. function DevStatusRenderer(val){
  1038. switch(val){
  1039. case 0: return '<span style="color: red; font-weight: bold;">Off Line</span>';
  1040. case 1: return '<span style="color: green; font-weight: bold;">On Line</span>';
  1041. };
  1042. return '';
  1043. };
  1044. function IconRenderer( val ) {
  1045. if ( val > 0) {
  1046. return '<img src="/resources/vehicles/icons/' + val + '.png" >';
  1047. }
  1048. return val;
  1049. };
  1050. function SMSRenderer( val ) {
  1051. if ( val!='Disabled' ) {
  1052. return '<img src="/resources/site/smsgr.gif" alt="SMS Reports to '+val+' Enabled" title="SMS Reports to '+val+' Enabled">';
  1053. } else {
  1054. return '<img src="/resources/site/smsg.gif" alt="SMS Reports '+val+'" title="SMS Reports '+val+'">';
  1055. };
  1056. return '';
  1057. };
  1058. // the DefaultColumnModel expects this blob to define columns. It can be extended to provide
  1059. // custom or reusable ColumnModels
  1060. var DeviceListColModel = new Ext.grid.ColumnModel([
  1061. {header: "", width: 38, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: IconRenderer, dataIndex: 'icon'},
  1062. {header: "Device ID", width: 120, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'device_id'},
  1063. {header: "Vehicle ID", width: 120, sortable: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'name'},
  1064. {header: "Status", width: 95, sortable: true, align: 'center', css: 'vertical-align: middle;', renderer: DevStatusRenderer, dataIndex: 'status'},
  1065. {header: "SMS", width: 36, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', renderer: SMSRenderer, dataIndex: 'sms'},
  1066. {header: "Active Since", width: 85, sortable: true, css: 'vertical-align: middle;', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'created'},
  1067. {header: "Last Activity", width: 85, sortable: true, css: 'vertical-align: middle;', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'last_access'}
  1068. ]);
  1069. var SelectedDevice;
  1070. var DeviceListGridForm = new Ext.FormPanel({
  1071. id: 'Device-List',
  1072. frame: true,
  1073. labelAlign: 'left',
  1074. title: 'List of Devices',
  1075. bodyStyle:'padding: 5px; align: center;',
  1076. shim: false,
  1077. //animCollapse: false,
  1078. constrainHeader: true,
  1079. //layout: 'column', // Specifies that the items will now be arranged in columns
  1080. layout: 'fit',
  1081. items: {
  1082. xtype: 'grid',
  1083. frame: false,
  1084. forceFit: true,
  1085. ds: DeviceListDataStore,
  1086. cm: DeviceListColModel,
  1087. sm: new Ext.grid.RowSelectionModel({
  1088. singleSelect: true,
  1089. listeners: {
  1090. rowselect: function(sm, row, rec) {
  1091. if (!SelectedUser){
  1092. SelectedDevice=rec;
  1093. } else {
  1094. SelectedDevice=rec;
  1095. if ( SelectedDevice.data.type<5 ){
  1096. Ext.getCmp('Suspend_AUB').enable();
  1097. Ext.getCmp('Edit_AUB').enable();
  1098. Ext.getCmp('Delete_AUB').enable();
  1099. if ( SelectedDevice.data.status>0 ){
  1100. Ext.getCmp('Suspend_AUB').setText('Suspend');
  1101. Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User');
  1102. } else {
  1103. Ext.getCmp('Suspend_AUB').setText('Activate');
  1104. Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User');
  1105. };
  1106. } else {
  1107. Ext.getCmp('Edit_AUB').disable();
  1108. Ext.getCmp('Suspend_AUB').disable();
  1109. Ext.getCmp('Delete_AUB').disable();
  1110. };
  1111. };
  1112. }
  1113. }
  1114. }),
  1115. //autoExpandColumn: 'login',
  1116. height: 350,
  1117. width: '100%',
  1118. border: false,
  1119. listeners: {
  1120. render: function(g) {
  1121. g.getSelectionModel().selectRow(0);
  1122. },
  1123. delay: 10 // Allow rows to be rendered.
  1124. },
  1125. viewConfig: {
  1126. forceFit:true
  1127. },
  1128. bbar: [{
  1129. tooltip:'Edit Vehicle ID and Image',
  1130. id: 'Edit_DEV',
  1131. text: 'Edit',
  1132. iconCls:'user-edit',
  1133. handler: function(){
  1134. //ShowEditUser();
  1135. Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser);
  1136. SetUserEditorDescription();
  1137. },
  1138. disabled: false
  1139. },{
  1140. tooltip:'Setup Custom Events',
  1141. id: 'Events_DEV',
  1142. text: 'Events',
  1143. iconCls:'user-block',
  1144. handler: function(){
  1145. if ( SelectedDevice.data.status>0 ){
  1146. //SuspendUser( SelectedUser.data.login );
  1147. } else {
  1148. //ActivateUser( SelectedUser.data.login );
  1149. };
  1150. },
  1151. disabled: false
  1152. }]
  1153. },
  1154. renderTo: DeviceListDiv
  1155. });
  1156. GetNewDeviceList();
  1157. function NewIconRenderer( val ) {
  1158. if ( val > 0) {
  1159. return '<img src="/resources/site/ndev.gif" alt="'+val+'" title="'+val+'">';
  1160. }
  1161. return val;
  1162. };
  1163. // the DefaultColumnModel expects this blob to define columns. It can be extended to provide
  1164. // custom or reusable ColumnModels
  1165. var NDeviceListColModel = new Ext.grid.ColumnModel([
  1166. {header: "", width: 38, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: NewIconRenderer,dataIndex: 'id'},
  1167. {header: "Device ID", width: 120, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'device_id'}
  1168. ]);
  1169. var SelectedNDevice;
  1170. var NewDeviceListGridForm = new Ext.FormPanel({
  1171. id: 'New-Device-List',
  1172. frame: true,
  1173. labelAlign: 'left',
  1174. title: 'Newly Purchased Devices',
  1175. bodyStyle:'padding: 5px; align: center;',
  1176. shim: false,
  1177. //animCollapse: false,
  1178. constrainHeader: true,
  1179. //layout: 'column', // Specifies that the items will now be arranged in columns
  1180. layout: 'fit',
  1181. items: {
  1182. xtype: 'grid',
  1183. frame: false,
  1184. forceFit: true,
  1185. ds: NDeviceListDataStore,
  1186. cm: NDeviceListColModel,
  1187. sm: new Ext.grid.RowSelectionModel({
  1188. singleSelect: true,
  1189. listeners: {
  1190. rowselect: function(sm, row, rec) {
  1191. if (!SelectedUser){
  1192. SelectedNDevice=rec;
  1193. } else {
  1194. SelectedNDevice=rec;
  1195. if ( SelectedNDevice.data.type<5 ){
  1196. Ext.getCmp('Suspend_AUB').enable();
  1197. Ext.getCmp('Edit_AUB').enable();
  1198. Ext.getCmp('Delete_AUB').enable();
  1199. if ( SelectedDevice.data.status>0 ){
  1200. Ext.getCmp('Suspend_AUB').setText('Suspend');
  1201. Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User');
  1202. } else {
  1203. Ext.getCmp('Suspend_AUB').setText('Activate');
  1204. Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User');
  1205. };
  1206. } else {
  1207. Ext.getCmp('Edit_AUB').disable();
  1208. Ext.getCmp('Suspend_AUB').disable();
  1209. Ext.getCmp('Delete_AUB').disable();
  1210. };
  1211. };
  1212. }
  1213. }
  1214. }),
  1215. //autoExpandColumn: 'login',
  1216. height: 350,
  1217. width: '100%',
  1218. border: false,
  1219. listeners: {
  1220. render: function(g) {
  1221. g.getSelectionModel().selectRow(0);
  1222. },
  1223. delay: 10 // Allow rows to be rendered.
  1224. },
  1225. viewConfig: {
  1226. forceFit:true
  1227. },
  1228. bbar: [{
  1229. tooltip:'Add Purchased Elsewhere Device',
  1230. id: 'ANew_DEV',
  1231. text: 'Add',
  1232. iconCls:'user-block',
  1233. handler: function(){
  1234. if ( SelectedDevice.data.status>0 ){
  1235. //SuspendUser( SelectedUser.data.login );
  1236. } else {
  1237. //ActivateUser( SelectedUser.data.login );
  1238. };
  1239. },
  1240. disabled: false
  1241. },{
  1242. tooltip:'Activate Selected Device',
  1243. id: 'Act_DEV',
  1244. text: 'Activate',
  1245. iconCls:'user-edit',
  1246. handler: function(){
  1247. //ShowEditUser();
  1248. Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser);
  1249. SetUserEditorDescription();
  1250. },
  1251. disabled: true
  1252. },{
  1253. tooltip:'Purchase Additional',
  1254. id: 'Purc_DEV',
  1255. text: 'Purchase',
  1256. iconCls:'user-block',
  1257. handler: function(){
  1258. window.location='/Products.php';
  1259. },
  1260. disabled: false
  1261. }]
  1262. },
  1263. renderTo: NDeviceListDiv
  1264. });
  1265. var AccountInfo = new Ext.FormPanel({
  1266. //renderTo: document.body,
  1267. frame: true,
  1268. labelAlign: 'left',
  1269. title: 'Account Settings',
  1270. bodyStyle:'padding: 5px; align: center;',
  1271. //shim: false,
  1272. //animCollapse: false,
  1273. //constrainHeader: true,
  1274. //url: '/',
  1275. width: 500,
  1276. //height: 300,
  1277. layout: 'fit',
  1278. items: [
  1279. {
  1280. xtype: 'tabpanel',
  1281. activeTab: 0,
  1282. height: 324, // Why do I have to specify the height here?
  1283. // Shouldn't its container's 'fit' layout take
  1284. // care of that?
  1285. width: PanelH,
  1286. border: false,
  1287. deferredRender: true, // This works
  1288. //defaults: {autoScroll: true},
  1289. items: [
  1290. {
  1291. title: 'Account Info',
  1292. frame: true,
  1293. bodyStyle: 'padding 10px;',
  1294. html: "This is just some text..."
  1295. },
  1296. {
  1297. layout: 'form',
  1298. title: 'Address Info',
  1299. frame: true,
  1300. labelAlign: 'right',
  1301. defaults: {width: 175},
  1302. items: [
  1303. {
  1304. xtype: 'textfield',
  1305. name: 'address_1',
  1306. value: '',
  1307. fieldLabel: 'Street Adress'
  1308. },{
  1309. xtype: 'textfield',
  1310. name: 'address_2',
  1311. value: '',
  1312. fieldLabel: 'City'
  1313. },
  1314. {
  1315. xtype: 'combo',
  1316. hiddenName: 'state',
  1317. fieldLabel: 'State',
  1318. store: new Ext.data.SimpleStore({
  1319. fields: ['abbr', 'state', 'tooltip'],
  1320. data : Ext.exampledata.states // from states.js
  1321. }),
  1322. editable: false,
  1323. allowBlank: true,
  1324. valueField:'abbr',
  1325. displayField:'state',
  1326. typeAhead: true,
  1327. mode: 'local',
  1328. triggerAction: 'all',
  1329. selectOnFocus:true
  1330. },
  1331. {
  1332. xtype: 'combo',
  1333. hiddenName: 'country',
  1334. fieldLabel: 'Country',
  1335. store: new Ext.data.SimpleStore({
  1336. fields: ['abbr', 'country', 'tooltip'],
  1337. data : Ext.exampledata.countries // from states.js
  1338. }),
  1339. editable: false,
  1340. allowBlank: true,
  1341. valueField:'abbr',
  1342. displayField:'country',
  1343. typeAhead: true,
  1344. mode: 'local',
  1345. triggerAction: 'all',
  1346. selectOnFocus:true
  1347. }
  1348. ]
  1349. }
  1350. ]
  1351. }
  1352. ],
  1353. bbar: [{
  1354. tooltip: 'Save All Account Settings',
  1355. text: 'Save Changes',
  1356. iconCls:'account-save',
  1357. handler : function(){
  1358. //ShowAddNewUser();
  1359. }
  1360. }]
  1361. });
  1362. GetRepDevicesButtons();
  1363. RepportPlaceholderPanel.render('rep_placeholder');
  1364. RepportDeviceButtonList.render('rep_dev_list');
  1365. AccountInfo.render('account_info');
  1366. GMapWindow.doLayout();
  1367. //GMapWindow.render('gmap_control_placeholder');
  1368. //GMapToolbox.doLayout();
  1369. //alert('koko2');
  1370. //GMapPanel.doLayout();
  1371. //alert('koko3');
  1372. //GMapWindow.doLayout();
  1373. //alert('koko4');
  1374. //GMapToolbox.collapse();
  1375. //alert('koko5');
  1376. //GMapToolbox.doLayout();
  1377. //alert('koko6');
  1378. try {
  1379. GMapWindow.render('gmap_control_placeholder');
  1380. } catch (e){
  1381. };
  1382. Ext.MessageBox.wait('Loading items...','Please wait',{
  1383. progressText: 'Initializing...',
  1384. width:300,
  1385. progress:true,
  1386. closable:false
  1387. });
  1388. window.setTimeout(function(){
  1389. GMapToolbox.expand();
  1390. //GMapWindow.doLayout();
  1391. }, 1000 );
  1392. window.setTimeout(function(){
  1393. Tracking_Init();
  1394. }, 2000 );
  1395. });