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.

2251 lines
61 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
4 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var UartListStore = new Ext.data.JsonStore({
  3. root: 'ports',
  4. totalProperty: 'totalCount',
  5. idProperty: 'uart_id',
  6. remoteSort: false,
  7. baseParams: {
  8. UID: '<?=$CUser->Data['id'];?>',
  9. SID: '<?=$Session;?>',
  10. SITE: <?=$SiteID;?>
  11. },
  12. fields: [{
  13. name: 'uart_id',
  14. type: 'int'
  15. },{
  16. name: 'uart_name',
  17. type: 'string'
  18. }],
  19. proxy : new Ext.data.HttpProxy({
  20. method: 'POST',
  21. prettyUrls: false,
  22. url: '/lib/controller/listUarts.php'
  23. })
  24. });
  25. var ServersListStore = new Ext.data.JsonStore({
  26. root: 'servers',
  27. totalProperty: 'totalCount',
  28. idProperty: 'server_id',
  29. remoteSort: false,
  30. baseParams: {
  31. UID: '<?=$CUser->Data['id'];?>',
  32. SID: '<?=$Session;?>',
  33. SITE: <?=$SiteID;?>
  34. },
  35. fields: [{
  36. name: 'server_id',
  37. type: 'int'
  38. },{
  39. name: 'server_name',
  40. type: 'string'
  41. }],
  42. proxy : new Ext.data.HttpProxy({
  43. method: 'POST',
  44. prettyUrls: false,
  45. url: '/lib/controller/listServers.php'
  46. })
  47. });
  48. var ServerListStore = new Ext.data.JsonStore({
  49. root: 'servers',
  50. totalProperty: 'totalCount',
  51. idProperty: 'server_id',
  52. remoteSort: false,
  53. baseParams: {
  54. UID: '<?=$CUser->Data['id'];?>',
  55. SID: '<?=$Session;?>',
  56. SITE: <?=$SiteID;?>
  57. },
  58. fields: [{
  59. name: 'server_id',
  60. type: 'int'
  61. },{
  62. name: 'server_name',
  63. type: 'string'
  64. }],
  65. proxy : new Ext.data.HttpProxy({
  66. method: 'POST',
  67. prettyUrls: false,
  68. url: '/lib/controller/listServers.php'
  69. })
  70. });
  71. function loadSettingsLidar3D( NodeID, Master ){
  72. SelectedNodeID = NodeID;
  73. Ext.Ajax.request({
  74. url: '/lib/controller/getSettingsLidsr3D.php',
  75. params: {
  76. NID: NodeID,
  77. MST: ((Master)?1:0),
  78. UID: <?=$UserID;?>,
  79. SID: '<?=$Session;?>',
  80. },
  81. success: function( response, opts ){
  82. // If the response is JSON, you have to decode it
  83. var data = Ext.decode(response.responseText);
  84. Ext.getCmp('setting_master_ip').setValue( data.ip_address );
  85. Ext.getCmp('setting_master_port').setValue( data.port );
  86. Ext.getCmp('setting_slave_ip').setValue( data.aux_ip_address );
  87. Ext.getCmp('setting_slave_port').setValue( data.aux_port );
  88. Ext.getCmp('setting_lat').setValue( data.lat );
  89. Ext.getCmp('setting_lon').setValue( data.lon );
  90. Ext.getCmp('setting_alt').setValue( data.alt );
  91. Ext.getCmp('setting_roll').setValue( data.roll );
  92. Ext.getCmp('setting_pitch').setValue( data.pitch );
  93. Ext.getCmp('setting_yaw').setValue( data.yaw );
  94. },
  95. failure: failureAJAXFunction
  96. });
  97. };
  98. function saveSettingsLidar3D( ){
  99. if( SelectedNodeID == 0 ) return;
  100. t1 = Ext.getCmp('setting_master_ip').getValue();
  101. t2 = Ext.getCmp('setting_master_port').getValue();
  102. t3 = Ext.getCmp('setting_slave_ip').getValue();
  103. t4 = Ext.getCmp('setting_slave_port').getValue();
  104. t5 = Ext.getCmp('setting_lat').getValue();
  105. t6 = Ext.getCmp('setting_lon').getValue();
  106. t7 = Ext.getCmp('setting_alt').getValue();
  107. t8 = Ext.getCmp('setting_roll').getValue();
  108. t9 = Ext.getCmp('setting_pitch').getValue();
  109. t10 = Ext.getCmp('setting_yaw').getValue();
  110. Ext.Ajax.request({
  111. url: '/lib/controller/setSettingsLidsr3D.php',
  112. params: {
  113. NID: SelectedNodeID,
  114. UID: <?=$UserID;?>,
  115. SID: '<?=$Session;?>',
  116. MIP: t1,
  117. MPP: t2,
  118. SIP: t3,
  119. SPP: t4,
  120. LAT: t5,
  121. LON: t6,
  122. ALT: t7,
  123. ROL: t8,
  124. PCH: t9,
  125. YAW: t10
  126. },
  127. success: function( response, opts ){
  128. // If the response is JSON, you have to decode it
  129. var data = Ext.decode(response.responseText);
  130. if( data.success == true ) {
  131. Ext.Msg.show({
  132. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  133. msg: '<?=$Labels->GetLabel("_SETTING_SAVE_OK_");?>',
  134. buttons: Ext.Msg.OK,//YESNOCANCEL,
  135. fn: function(){
  136. SettingsLidar3D.hide();
  137. },
  138. //animEl: 'elId',
  139. icon: Ext.MessageBox.INFO //QUESTION
  140. });
  141. } else {
  142. Ext.Msg.show({
  143. title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
  144. msg: data['error'],
  145. buttons: Ext.Msg.OK,//YESNOCANCEL,
  146. fn: function(){
  147. SettingsLidar3D.hide();
  148. },
  149. //animEl: 'elId',
  150. icon: Ext.MessageBox.ERROR //QUESTION
  151. });
  152. };
  153. },
  154. failure: failureAJAXFunction
  155. });
  156. };
  157. function editSettingsLidar3D( NodeID, Master ){
  158. if( SettingsLidar3D == null ){
  159. SettingsLidar3D = new Ext.Window({
  160. modal: true,
  161. title: '<?=$Labels->GetLabel("_EDIT_LRF3D_SETTINGS_");?>',
  162. width: 773,
  163. height: 600,
  164. layout: 'fit',
  165. closeAction: 'hide',
  166. listeners:{
  167. beforehide : function(){
  168. Ext.getCmp('connectstarterbutton').toggle( false, false );
  169. }
  170. },
  171. items:[{
  172. layout: 'table',
  173. border: false,
  174. defaults: {
  175. // applied to each contained panel
  176. bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;'
  177. },
  178. layoutConfig: {
  179. // The total column count must be specified here
  180. columns: 4
  181. },
  182. items: [{
  183. border: false,
  184. html: 'Master IP Address:'
  185. },{
  186. xtype: 'textfield',
  187. id: 'setting_master_ip',
  188. width: '70%'
  189. },{
  190. border: false,
  191. html: 'Port:'
  192. },{
  193. xtype: 'textfield',
  194. id: 'setting_master_port',
  195. width: '30%'
  196. },{
  197. border: false,
  198. html: 'Slave IP Address:'
  199. },{
  200. xtype: 'textfield',
  201. id: 'setting_slave_ip',
  202. width: '70%'
  203. },{
  204. border: false,
  205. html: 'Port:'
  206. },{
  207. xtype: 'textfield',
  208. id: 'setting_slave_port',
  209. width: '30%'
  210. },{
  211. border: false,
  212. html: 'Position Lat/Lon/Alt:'
  213. },{
  214. xtype: 'textfield',
  215. id: 'setting_lat',
  216. width: '30%'
  217. },{
  218. xtype: 'textfield',
  219. id: 'setting_lon',
  220. width: '30%'
  221. },{
  222. xtype: 'textfield',
  223. id: 'setting_alt',
  224. width: '30%'
  225. },{
  226. border: false,
  227. html: 'Orientation Roll/Pitch/Yaw:'
  228. },{
  229. xtype: 'textfield',
  230. id: 'setting_roll',
  231. width: '30%'
  232. },{
  233. xtype: 'textfield',
  234. id: 'setting_pitch',
  235. width: '30%'
  236. },{
  237. xtype: 'textfield',
  238. id: 'setting_yaw',
  239. width: '30%'
  240. }]
  241. }],
  242. bbar: [{
  243. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  244. handler: function(){
  245. SettingsLidar3D.hide();
  246. }
  247. },{
  248. text: '<?=$Labels->GetLabel("_SAVE_");?>',
  249. handler: SaveSettingsLidar3D
  250. }]
  251. });
  252. };
  253. SettingsLidar3D.show();
  254. loadSettingsLidar3D( NodeID, Master );
  255. };
  256. var devicesStore = new Ext.data.JsonStore({
  257. root: 'nodes',
  258. totalProperty: 'totalCount',
  259. idProperty: 'id',
  260. remoteSort: true,
  261. fields: [{
  262. name: 'id',
  263. type: 'int'
  264. },{
  265. name: 'name',
  266. type: 'string'
  267. },{
  268. name: 'hardware',
  269. type: 'string'
  270. },{
  271. name: 'caps',
  272. type: 'int'
  273. },{
  274. name: 'ip',
  275. type: 'string'
  276. },{
  277. name: 'mac',
  278. type: 'string'
  279. }],
  280. proxy : new Ext.data.HttpProxy({
  281. method: 'POST',
  282. prettyUrls: false,
  283. url: '/lib/controller/listDiscoveredCameraSources.php',
  284. headers: {
  285. 'UID': '<?=$CUser->Data['id'];?>',
  286. 'SID': '<?=$Session;?>'
  287. }
  288. })
  289. });
  290. var LRF1D2_st_win = null;
  291. var LRF2D2_st_win = null;
  292. var LRF16D3_st_win = null;
  293. var currentDeviceOperatioId = 0;
  294. var currentOperationTO = 0;
  295. var currentOperationTimer = null;
  296. var lastOperationCode = 0;
  297. function checkDeviceOperationStatus(){
  298. if( currentOperationTO ){
  299. currentOperationTO--;
  300. Ext.Ajax.request({
  301. url: '/lib/controller/checkDeviceOperation.php',
  302. params: {
  303. OID: currentDeviceOperatioId,
  304. UID: '<?=$CUser->Data['id'];?>',
  305. SID: '<?=$Session;?>'
  306. },
  307. success: function( response, opts ){
  308. var data = Ext.decode(response.responseText);
  309. if( !data.success ){
  310. Ext.MessageBox.hide();
  311. Ext.Msg.show({
  312. title:'Node Command Status',
  313. msg: data.msg,
  314. buttons: Ext.Msg.OK,
  315. icon: Ext.MessageBox.ERROR
  316. });
  317. } else {
  318. if( lastOperationCode != data.code || data.code == 0 ){
  319. lastOperationCode = data.code;
  320. currentOperationTO = 20;
  321. };
  322. if( data.code < 100 ){
  323. currentOperationTimer = window.setTimeout( checkDeviceOperationStatus, 100 );
  324. } else {
  325. Ext.MessageBox.hide();
  326. switch( data.code ){
  327. case 120:
  328. case 100:
  329. default:
  330. Ext.Msg.show({
  331. title:'Node Command Status',
  332. msg: 'Operation Complete',
  333. buttons: Ext.Msg.OK,
  334. icon: Ext.MessageBox.INFO
  335. });
  336. };
  337. };
  338. };
  339. },
  340. failure: failureAJAXFunction
  341. });
  342. } else {
  343. Ext.MessageBox.hide();
  344. Ext.Msg.show({
  345. title:'Node Command Status',
  346. msg: 'Operation Status - Time Out!',
  347. buttons: Ext.Msg.OK,
  348. icon: Ext.MessageBox.ERROR
  349. });
  350. };
  351. };
  352. function doDeviceOperation( NodeID, OpCode, Param='', nowait=false ){
  353. if( !nowait ){
  354. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  355. width: '100%',
  356. hidden: true,
  357. progress: true,
  358. closable: false
  359. });
  360. };
  361. Ext.Ajax.request({
  362. url: '/lib/controller/doDeviceOperation.php',
  363. params: {
  364. NID: NodeID,
  365. UID: '<?=$CUser->Data['id'];?>',
  366. CMD: OpCode,
  367. SID: '<?=$Session;?>',
  368. PARAM: Param
  369. },
  370. success: function( response, opts ){
  371. var data = Ext.decode(response.responseText);
  372. if( !data.success ){
  373. if( !nowait ) Ext.MessageBox.hide();
  374. Ext.Msg.show({
  375. title:'Node Command Status',
  376. msg: data.msg,
  377. buttons: Ext.Msg.OK,
  378. icon: Ext.MessageBox.ERROR
  379. });
  380. } else {
  381. if( !nowait ){
  382. currentDeviceOperatioId = data.operation_id;
  383. currentOperationTO = 20;
  384. lastOperationCode = 0;
  385. currentOperationTimer = window.setTimeout( checkDeviceOperationStatus, 100 );
  386. };
  387. };
  388. },
  389. failure: failureAJAXFunction
  390. });
  391. };
  392. function clearDeviceEvents( NodeID ){
  393. Ext.Ajax.request({
  394. url: '/lib/controller/clearEventCloud.php',
  395. params: {
  396. NID: NodeID,
  397. UID: '<?=$CUser->Data['id'];?>',
  398. SID: '<?=$Session;?>'
  399. },
  400. success: function( response, opts ){
  401. },
  402. failure: failureAJAXFunction
  403. });
  404. };
  405. function loadFullLRF1D2Data( NodeID ){
  406. if( LRF1D2_st_win == null ) return;
  407. Ext.Ajax.request({
  408. url: '/lib/controller/getSettingsLRF.php',
  409. params: {
  410. NID: NodeID,
  411. UID: '<?=$CUser->Data['id'];?>',
  412. SID: '<?=$Session;?>',
  413. },
  414. success: function( response, opts ){
  415. if( LRF1D2_st_win!= null ){
  416. var data = Ext.decode(response.responseText);
  417. if( data.online ){
  418. switch( data.data_status ){
  419. case 0: Ext.getCmp('dev_online').update('<p class="green_status">ONLINE/Data Incomplete</p>'); break;
  420. case 1: Ext.getCmp('dev_online').update('<p class="green_status">ONLINE/Synced</p>'); break;
  421. case 2: Ext.getCmp('dev_online').update('<p class="green_status">ONLINE/Data Not Applyed</p>'); break;
  422. };
  423. } else {
  424. switch( data.data_status ){
  425. case 0: Ext.getCmp('dev_online').update('<p class="blue_status">OFFLINE/Data Incomplete</p>'); break;
  426. case 1: Ext.getCmp('dev_online').update('<p class="blue_status">OFFLINE/Synced</p>'); break;
  427. case 2: Ext.getCmp('dev_online').update('<p class="blue_status">OFFLINE/Data Not Applyed</p>'); break;
  428. };
  429. };
  430. Ext.getCmp('dev_name').setValue( data.name );
  431. Ext.getCmp('serial_num').setValue( data.serial );
  432. Ext.getCmp('version_id').setValue( data.version );
  433. Ext.getCmp('device_id').setValue( data.device_id );
  434. Ext.getCmp('com_spd').setValue( data.com_spd );
  435. Ext.getCmp('max_range').setValue( data.max_range );
  436. Ext.getCmp('base_shift').setValue( data.base_shift );
  437. Ext.getCmp('com_spd').setValue( data.uart_speed );
  438. Ext.getCmp('mlrf_offset').setValue( data.m_offset );
  439. Ext.getCmp('slrf_offset').setValue( data.s_offset );
  440. Ext.getCmp('mlrf_delta').setValue( data.m_delta );
  441. Ext.getCmp('slrf_delta').setValue( data.s_delta );
  442. Ext.getCmp('mlrf_width').setValue( data.m_width );
  443. Ext.getCmp('slrf_width').setValue( data.s_width );
  444. Ext.getCmp('mlrf_order').setValue( data.m_order );
  445. Ext.getCmp('slrf_order').setValue( data.s_order );
  446. Ext.getCmp('mlrf_sst').setValue( data.m_sst );
  447. Ext.getCmp('slrf_sst').setValue( data.s_sst );
  448. Ext.getCmp('mlrf_flip').setValue( data.m_flip );
  449. Ext.getCmp('slrf_flip').setValue( data.s_flip );
  450. Ext.getCmp('mlrf_sun').setValue( data.m_sun );
  451. Ext.getCmp('slrf_sun').setValue( data.s_sun );
  452. };
  453. },
  454. failure: failureAJAXFunction
  455. });
  456. };
  457. function loadFullLRF2D2Data( NodeID ){
  458. if( LRF2D2_st_win == null ) return;
  459. Ext.Ajax.request({
  460. url: '/lib/controller/getSettingsLRF.php',
  461. params: {
  462. NID: NodeID,
  463. UID: '<?=$CUser->Data['id'];?>',
  464. SID: '<?=$Session;?>',
  465. },
  466. success: function( response, opts ){
  467. if( LRF2D2_st_win!= null ){
  468. var data = Ext.decode(response.responseText);
  469. if( data.online ){
  470. switch( data.data_status ){
  471. case 0: Ext.getCmp('LRF2D2_dev_status').update('<p class="green_status">ONLINE/Data Incomplete</p>'); break;
  472. case 1: Ext.getCmp('LRF2D2_dev_status').update('<p class="green_status">ONLINE/Synced</p>'); break;
  473. case 2: Ext.getCmp('LRF2D2_dev_status').update('<p class="green_status">ONLINE/Data Not Applyed</p>'); break;
  474. };
  475. } else {
  476. switch( data.data_status ){
  477. case 0: Ext.getCmp('LRF2D2_dev_status').update('<p class="blue_status">OFFLINE/Data Incomplete</p>'); break;
  478. case 1: Ext.getCmp('LRF2D2_dev_status').update('<p class="blue_status">OFFLINE/Synced</p>'); break;
  479. case 2: Ext.getCmp('LRF2D2_dev_status').update('<p class="blue_status">OFFLINE/Data Not Applyed</p>'); break;
  480. };
  481. };
  482. Ext.getCmp('LRF2D2_name').setValue( data.name );
  483. Ext.getCmp('LRF2D2_serial_num').setValue( data.serial );
  484. Ext.getCmp('LRF2D2_version_id').setValue( data.version );
  485. Ext.getCmp('LRF2D2_device_id').setValue( data.device_id );
  486. Ext.getCmp('LRF2D2_com_spd').setValue( data.com_spd );
  487. Ext.getCmp('LRF2D2_max_range').setValue( data.max_range );
  488. Ext.getCmp('LRF2D2_base_shift').setValue( data.base_shift );
  489. Ext.getCmp('LRF2D2_com_spd').setValue( data.uart_speed );
  490. Ext.getCmp('mlrf_offset').setValue( data.master_profile.offset );
  491. Ext.getCmp('slrf_offset').setValue( data.slave_profile.offset );
  492. Ext.getCmp('mlrf_delta').setValue( data.master_profile.delta );
  493. Ext.getCmp('slrf_delta').setValue( data.slave_profile.delta );
  494. Ext.getCmp('mlrf_width').setValue( data.master_profile.width );
  495. Ext.getCmp('slrf_width').setValue( data.slave_profile.width );
  496. Ext.getCmp('mlrf_order').setValue( data.master_profile.order );
  497. Ext.getCmp('slrf_order').setValue( data.slave_profile.order );
  498. Ext.getCmp('mlrf_sst').setValue( data.master_profile.sst );
  499. Ext.getCmp('slrf_sst').setValue( data.slave_profile.sst );
  500. Ext.getCmp('mlrf_flip').setValue( data.master_profile.flip );
  501. Ext.getCmp('slrf_flip').setValue( data.slave_profile.flip );
  502. Ext.getCmp('mlrf_sun').setValue( data.master_profile.sun );
  503. Ext.getCmp('slrf_sun').setValue( data.slave_profile.sun );
  504. };
  505. },
  506. failure: failureAJAXFunction
  507. });
  508. };
  509. function LRF1D2_settings(){
  510. if( LRF1D2_st_win == null ){
  511. LRF1D2_st_win = new Ext.Window({
  512. title: 'Sensor Settings',
  513. modal: true,
  514. width: 800,
  515. height: 600,
  516. closeAction: 'hide',
  517. items:{
  518. xtype: 'tabpanel',
  519. activeTab: 0,
  520. items:[{
  521. title: 'General Settings',
  522. xtype: 'form',
  523. layout: 'table',
  524. defaults: {
  525. bodyStyle:'padding:20px'
  526. },
  527. layoutConfig: {
  528. columns: 3
  529. },
  530. items:[{
  531. html: 'Status',
  532. frame: false,
  533. border: false
  534. },{
  535. html: '<p class="green_status">ONLINE</p>',
  536. id: 'dev_online',
  537. frame: false,
  538. border: false
  539. },{},{
  540. html: 'Device Title',
  541. frame: false,
  542. border: false
  543. },{
  544. xtype: 'field',
  545. id: 'dev_name',
  546. readOnly: false,
  547. value: 'KOKO'
  548. },{},{
  549. html: 'Serial Number',
  550. frame: false,
  551. border: false
  552. },{
  553. xtype: 'field',
  554. id: 'serial_num',
  555. readOnly: true,
  556. value: '1212'
  557. },{},{
  558. html: 'Version ID',
  559. frame: false,
  560. border: false
  561. },{
  562. xtype: 'field',
  563. id: 'version_id',
  564. readOnly: true,
  565. value: 'LiberManDA122'
  566. },{},{
  567. html: 'Device Adress',
  568. frame: false,
  569. border: false
  570. },{
  571. xtype: 'numberfield',
  572. id: 'device_id'
  573. },{
  574. xtype: 'button',
  575. id: 'upddiBTN',
  576. text: 'Update Device Address',
  577. handler: function(){
  578. Ext.Msg.show({
  579. title:'Update Device Address?',
  580. msg: 'Are you sure to do so?',
  581. buttons: Ext.Msg.YESNOCANCEL,
  582. //fn: processResult,
  583. animEl: 'upddiBTN',
  584. icon: Ext.MessageBox.QUESTION
  585. });
  586. }
  587. },{
  588. html: 'Device COM Speed',
  589. frame: false,
  590. border: false
  591. },{
  592. xtype: 'combo',
  593. id: 'com_spd',
  594. editable: false,
  595. typeAhead: true,
  596. triggerAction: 'all',
  597. width: '100%',
  598. lazyRender:true,
  599. mode: 'local',
  600. store: new Ext.data.ArrayStore({
  601. id: 0,
  602. fields: ['mySPD', 'displayText' ],
  603. data: [[4800,'4800'],[9600,'9600'],[14400,'14400'],[19200,'19200'],[38400, '38400'],[56000,'56000'],[57600,'57600'],[115200,'115200']]
  604. }),
  605. valueField: 'mySPD',
  606. displayField: 'displayText'
  607. },{
  608. xtype: 'button',
  609. id: 'updspBTN',
  610. text: 'Set Device Speed',
  611. handler: function(){
  612. Ext.Msg.show({
  613. title:'Update Device Speed?',
  614. msg: 'Are you sure to do so?',
  615. buttons: Ext.Msg.YESNOCANCEL,
  616. //fn: processResult,
  617. animEl: 'upddiBTN',
  618. icon: Ext.MessageBox.QUESTION
  619. });
  620. }
  621. },{
  622. html: 'Detection Maximal Range',
  623. frame: false,
  624. border: false
  625. },{
  626. xtype: 'numberfield',
  627. id: 'max_range',
  628. readOnly: true,
  629. value: '1212'
  630. },{},{
  631. html: 'Base Shift',
  632. frame: false,
  633. border: false
  634. },{
  635. xtype: 'numberfield',
  636. id: 'base_shift',
  637. readOnly: true,
  638. value: '1212'
  639. },{}]
  640. },{
  641. title: 'Mantenence',
  642. xtype: 'form',
  643. layout: 'table',
  644. defaults: {
  645. bodyStyle:'padding:20px'
  646. },
  647. layoutConfig: {
  648. columns: 2
  649. },
  650. items:[{
  651. html: 'Restart Device',
  652. frame: false,
  653. border: false
  654. },{
  655. xtype: 'button',
  656. id: 'rstBTN',
  657. text: 'Full Reset',
  658. handler: function(){
  659. Ext.Msg.show({
  660. title:'Reset Device?',
  661. msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
  662. buttons: Ext.Msg.YESNOCANCEL,
  663. //fn: processResult,
  664. animEl: 'rstBTN',
  665. icon: Ext.MessageBox.QUESTION
  666. });
  667. }
  668. }]
  669. },{
  670. title: 'Detection Settings',
  671. xtype: 'form',
  672. layout: 'table',
  673. defaults: {
  674. bodyStyle:'padding:20px'
  675. },
  676. layoutConfig: {
  677. columns: 4
  678. },
  679. items:[{
  680. html: 'Master Offset',
  681. frame: false,
  682. border: false
  683. },{
  684. xtype: 'numberfield',
  685. id: 'mlrf_offset',
  686. name: 'mlrf_offset',
  687. allowBlank: false,
  688. allowDecimals: false,
  689. maxText: 'The Range is: 0 - 60',
  690. maxValue: 60,
  691. minText: 'No Negative Values Allowed',
  692. minValue: 0,
  693. },{
  694. html: 'Slave Offset',
  695. frame: false,
  696. border: false
  697. },{
  698. xtype: 'numberfield',
  699. id: 'slrf_offset',
  700. name: 'slrf_offset',
  701. allowBlank: false,
  702. allowDecimals: false,
  703. maxText: 'The Range is: 0 - 60',
  704. maxValue: 60,
  705. minText: 'No Negative Values Allowed',
  706. minValue: 0,
  707. },{
  708. html: 'Master Delta',
  709. frame: false,
  710. border: false
  711. },{
  712. xtype: 'numberfield',
  713. id: 'mlrf_delta',
  714. name: 'mlrf_delta',
  715. allowBlank: false,
  716. allowDecimals: false,
  717. maxText: 'The Range is: 0 - 320',
  718. maxValue: 320,
  719. minText: 'No Negative Values Allowed',
  720. minValue: 0
  721. },{
  722. html: 'Slave Delta',
  723. frame: false,
  724. border: false
  725. },{
  726. xtype: 'numberfield',
  727. id: 'slrf_delta',
  728. name: 'slrf_delta',
  729. allowBlank: false,
  730. allowDecimals: false,
  731. maxText: 'The Range is: 0 - 320',
  732. maxValue: 320,
  733. minText: 'No Negative Values Allowed',
  734. minValue: 0
  735. },{
  736. html: 'Master Width',
  737. frame: false,
  738. border: false
  739. },{
  740. xtype: 'numberfield',
  741. id: 'mlrf_width',
  742. name: 'mlrf_width',
  743. allowBlank: false,
  744. allowDecimals: false,
  745. maxText: 'The Range is: 1800 - 16000',
  746. maxValue: 16000,
  747. minText: 'The Range is: 1800 - 16000',
  748. minValue: 1800
  749. },{
  750. html: 'Slave Width',
  751. frame: false,
  752. border: false
  753. },{
  754. xtype: 'numberfield',
  755. id: 'slrf_width',
  756. name: 'slrf_width',
  757. allowBlank: false,
  758. allowDecimals: false,
  759. maxText: 'The Range is: 1800 - 16000',
  760. maxValue: 16000,
  761. minText: 'The Range is: 1800 - 16000',
  762. minValue: 1800
  763. },{
  764. html: 'Master Order',
  765. frame: false,
  766. border: false
  767. },{
  768. xtype: 'numberfield',
  769. id: 'mlrf_order',
  770. name: 'mlrf_order',
  771. allowBlank: false,
  772. allowDecimals: false,
  773. maxText: 'The Range is: 0 - 10',
  774. maxValue: 10,
  775. minText: 'No Negative Values Allowed',
  776. minValue: 0
  777. },{
  778. html: 'Slave Order',
  779. frame: false,
  780. border: false
  781. },{
  782. xtype: 'numberfield',
  783. id: 'slrf_order',
  784. name: 'slrf_order',
  785. allowBlank: false,
  786. allowDecimals: false,
  787. maxText: 'The Range is: 0 - 10',
  788. maxValue: 10,
  789. minText: 'No Negative Values Allowed',
  790. minValue: 0
  791. },{
  792. html: 'Master SST',
  793. frame: false,
  794. border: false
  795. },{
  796. xtype: 'numberfield',
  797. id: 'mlrf_sst',
  798. name: 'mlrf_sst',
  799. allowBlank: false,
  800. allowDecimals: false,
  801. maxText: 'The Range is: 0 - 100',
  802. maxValue: 100,
  803. minText: 'No Negative Values Allowed',
  804. minValue: 0
  805. },{
  806. html: 'Slave SST',
  807. frame: false,
  808. border: false
  809. },{
  810. xtype: 'numberfield',
  811. id: 'slrf_sst',
  812. name: 'slrf_sst',
  813. allowBlank: false,
  814. allowDecimals: false,
  815. maxText: 'The Range is: 0 - 100',
  816. maxValue: 100,
  817. minText: 'No Negative Values Allowed',
  818. minValue: 0
  819. },{
  820. html: 'Mastr Flip',
  821. frame: false,
  822. border: false
  823. },{
  824. xtype: 'numberfield',
  825. id: 'mlrf_flip',
  826. name: 'mlrf_flip',
  827. allowBlank: false,
  828. allowDecimals: false,
  829. maxText: 'The Range is: 8 - 128',
  830. maxValue: 128,
  831. minText: 'The Range is: 8 - 128',
  832. minValue: 8
  833. },{
  834. html: 'Slave Flip',
  835. frame: false,
  836. border: false
  837. },{
  838. xtype: 'numberfield',
  839. id: 'slrf_flip',
  840. name: 'slrf_flip',
  841. allowBlank: false,
  842. allowDecimals: false,
  843. maxText: 'The Range is: 8 - 128',
  844. maxValue: 128,
  845. minText: 'The Range is: 8 - 128',
  846. minValue: 8
  847. },{
  848. html: 'Master Sun',
  849. frame: false,
  850. border: false
  851. },{
  852. xtype: 'numberfield',
  853. id: 'mlrf_sun',
  854. name: 'mlrf_sun',
  855. allowBlank: false,
  856. allowDecimals: false,
  857. maxText: 'The Range is: 0 - 100',
  858. maxValue: 100,
  859. minText: 'No Negative Values Allowed',
  860. minValue: 0
  861. },{
  862. html: 'Slave Sun',
  863. frame: false,
  864. border: false
  865. },{
  866. xtype: 'numberfield',
  867. id: 'slrf_sun',
  868. name: 'slrf_sun',
  869. allowBlank: false,
  870. allowDecimals: false,
  871. maxText: 'The Range is: 0 - 100',
  872. maxValue: 100,
  873. minText: 'No Negative Values Allowed',
  874. minValue: 0
  875. }]
  876. },{
  877. title: 'Embed Options'
  878. },{
  879. title: 'Target Width Table'
  880. }]
  881. }
  882. });
  883. };
  884. LRF1D2_st_win.show();
  885. loadFullLRF1D2Data( SelectedNodeID );
  886. };
  887. function LRF2D2_settings(){
  888. if( LRF2D2_st_win == null ){
  889. LRF2D2_st_win = new Ext.Window({
  890. title: 'Sensor Settings',
  891. modal: true,
  892. width: 800,
  893. height: 600,
  894. closeAction: 'hide',
  895. items:{
  896. xtype: 'tabpanel',
  897. activeTab: 0,
  898. items:[{
  899. title: 'General Settings',
  900. xtype: 'form',
  901. layout: 'table',
  902. defaults: {
  903. bodyStyle:'padding:20px'
  904. },
  905. layoutConfig: {
  906. columns: 3
  907. },
  908. items:[{
  909. html: 'Status',
  910. frame: false,
  911. border: false
  912. },{
  913. html: '<p class="green_status">ONLINE</p>',
  914. id: 'LRF2D2_dev_status',
  915. frame: false,
  916. border: false
  917. },{},{
  918. html: 'Device Title',
  919. frame: false,
  920. border: false
  921. },{
  922. xtype: 'field',
  923. id: 'LRF2D2_name',
  924. readOnly: false,
  925. value: ''
  926. },{},{
  927. html: 'Serial Number',
  928. frame: false,
  929. border: false
  930. },{
  931. xtype: 'field',
  932. id: 'LRF2D2_serial_num',
  933. readOnly: true,
  934. value: '1212'
  935. },{},{
  936. html: 'Version ID',
  937. frame: false,
  938. border: false
  939. },{
  940. xtype: 'field',
  941. id: 'LRF2D2_version_id',
  942. readOnly: true,
  943. value: 'LiberManDA122'
  944. },{},{
  945. html: 'Device Adress',
  946. frame: false,
  947. border: false
  948. },{
  949. xtype: 'numberfield',
  950. id: 'LRF2D2_device_id'
  951. },{
  952. xtype: 'button',
  953. text: 'Update Device Address',
  954. handler: function(){
  955. Ext.Msg.show({
  956. title:'Update Device Address?',
  957. msg: 'Are you sure to do so?',
  958. buttons: Ext.Msg.YESNOCANCEL,
  959. //fn: processResult,
  960. animEl: 'upddiBTN',
  961. icon: Ext.MessageBox.QUESTION
  962. });
  963. }
  964. },{
  965. html: 'Device COM Speed',
  966. frame: false,
  967. border: false
  968. },{
  969. xtype: 'combo',
  970. id: 'LRF2D2_com_spd',
  971. editable: false,
  972. typeAhead: true,
  973. triggerAction: 'all',
  974. width: '100%',
  975. lazyRender:true,
  976. mode: 'local',
  977. store: new Ext.data.ArrayStore({
  978. id: 0,
  979. fields: ['mySPD', 'displayText' ],
  980. data: [[4800,'4800'],[9600,'9600'],[14400,'14400'],[19200,'19200'],[38400, '38400'],[56000,'56000'],[57600,'57600'],[115200,'115200']]
  981. }),
  982. valueField: 'mySPD',
  983. displayField: 'displayText'
  984. },{
  985. xtype: 'button',
  986. text: 'Set Device Speed',
  987. handler: function(){
  988. Ext.Msg.show({
  989. title:'Update Device Speed?',
  990. msg: 'Are you sure to do so?',
  991. buttons: Ext.Msg.YESNOCANCEL,
  992. //fn: processResult,
  993. animEl: 'upddiBTN',
  994. icon: Ext.MessageBox.QUESTION
  995. });
  996. }
  997. },{
  998. html: 'Detection Maximal Range',
  999. frame: false,
  1000. border: false
  1001. },{
  1002. xtype: 'numberfield',
  1003. id: 'LRF2D2_max_range',
  1004. readOnly: false,
  1005. value: '1212'
  1006. },{},{
  1007. html: 'Base Shift',
  1008. frame: false,
  1009. border: false
  1010. },{
  1011. xtype: 'numberfield',
  1012. id: 'LRF2D2_base_shift',
  1013. readOnly: false,
  1014. value: '1212'
  1015. },{
  1016. xtype: 'button',
  1017. text: 'Update Base Shift',
  1018. handler: function(){
  1019. var bash = Ext.getCmp('LRF2D2_base_shift').getValue();
  1020. Ext.Ajax.request({
  1021. url: '/lib/controller/updateLrfSettings_baseshift.php',
  1022. params: {
  1023. NID: SelectedNodeID,
  1024. UID: '<?=$CUser->Data['id'];?>',
  1025. SID: '<?=$Session;?>',
  1026. PID: 0,
  1027. BASH: bash
  1028. },
  1029. success: function( response, opts ){
  1030. loadFullLRF2D2Data( SelectedNodeID );
  1031. },
  1032. failure: failureAJAXFunction
  1033. });
  1034. }
  1035. }]
  1036. },{
  1037. title: 'Detection Settings',
  1038. xtype: 'form',
  1039. layout: 'table',
  1040. defaults: {
  1041. bodyStyle:'padding:20px'
  1042. },
  1043. layoutConfig: {
  1044. columns: 4
  1045. },
  1046. items:[{
  1047. html: 'Master Offset',
  1048. frame: false,
  1049. border: false
  1050. },{
  1051. xtype: 'numberfield',
  1052. id: 'mlrf_offset',
  1053. name: 'mlrf_offset',
  1054. allowBlank: false,
  1055. allowDecimals: false,
  1056. maxText: 'The Range is: 0 - 60',
  1057. maxValue: 60,
  1058. minText: 'No Negative Values Allowed',
  1059. minValue: 0,
  1060. },{
  1061. html: 'Slave Offset',
  1062. frame: false,
  1063. border: false
  1064. },{
  1065. xtype: 'numberfield',
  1066. id: 'slrf_offset',
  1067. name: 'slrf_offset',
  1068. allowBlank: false,
  1069. allowDecimals: false,
  1070. maxText: 'The Range is: 0 - 60',
  1071. maxValue: 60,
  1072. minText: 'No Negative Values Allowed',
  1073. minValue: 0,
  1074. },{
  1075. html: 'Master Delta',
  1076. frame: false,
  1077. border: false
  1078. },{
  1079. xtype: 'numberfield',
  1080. id: 'mlrf_delta',
  1081. name: 'mlrf_delta',
  1082. allowBlank: false,
  1083. allowDecimals: false,
  1084. maxText: 'The Range is: 0 - 320',
  1085. maxValue: 320,
  1086. minText: 'No Negative Values Allowed',
  1087. minValue: 0
  1088. },{
  1089. html: 'Slave Delta',
  1090. frame: false,
  1091. border: false
  1092. },{
  1093. xtype: 'numberfield',
  1094. id: 'slrf_delta',
  1095. name: 'slrf_delta',
  1096. allowBlank: false,
  1097. allowDecimals: false,
  1098. maxText: 'The Range is: 0 - 320',
  1099. maxValue: 320,
  1100. minText: 'No Negative Values Allowed',
  1101. minValue: 0
  1102. },{
  1103. html: 'Master Width',
  1104. frame: false,
  1105. border: false
  1106. },{
  1107. xtype: 'numberfield',
  1108. id: 'mlrf_width',
  1109. name: 'mlrf_width',
  1110. allowBlank: false,
  1111. allowDecimals: false,
  1112. maxText: 'The Range is: 1800 - 16000',
  1113. maxValue: 16000,
  1114. minText: 'The Range is: 1800 - 16000',
  1115. minValue: 1800
  1116. },{
  1117. html: 'Slave Width',
  1118. frame: false,
  1119. border: false
  1120. },{
  1121. xtype: 'numberfield',
  1122. id: 'slrf_width',
  1123. name: 'slrf_width',
  1124. allowBlank: false,
  1125. allowDecimals: false,
  1126. maxText: 'The Range is: 1800 - 16000',
  1127. maxValue: 16000,
  1128. minText: 'The Range is: 1800 - 16000',
  1129. minValue: 1800
  1130. },{
  1131. html: 'Master Order',
  1132. frame: false,
  1133. border: false
  1134. },{
  1135. xtype: 'numberfield',
  1136. id: 'mlrf_order',
  1137. name: 'mlrf_order',
  1138. allowBlank: false,
  1139. allowDecimals: false,
  1140. maxText: 'The Range is: 0 - 10',
  1141. maxValue: 10,
  1142. minText: 'No Negative Values Allowed',
  1143. minValue: 0
  1144. },{
  1145. html: 'Slave Order',
  1146. frame: false,
  1147. border: false
  1148. },{
  1149. xtype: 'numberfield',
  1150. id: 'slrf_order',
  1151. name: 'slrf_order',
  1152. allowBlank: false,
  1153. allowDecimals: false,
  1154. maxText: 'The Range is: 0 - 10',
  1155. maxValue: 10,
  1156. minText: 'No Negative Values Allowed',
  1157. minValue: 0
  1158. },{
  1159. html: 'Master SST',
  1160. frame: false,
  1161. border: false
  1162. },{
  1163. xtype: 'numberfield',
  1164. id: 'mlrf_sst',
  1165. name: 'mlrf_sst',
  1166. allowBlank: false,
  1167. allowDecimals: false,
  1168. maxText: 'The Range is: 0 - 100',
  1169. maxValue: 100,
  1170. minText: 'No Negative Values Allowed',
  1171. minValue: 0
  1172. },{
  1173. html: 'Slave SST',
  1174. frame: false,
  1175. border: false
  1176. },{
  1177. xtype: 'numberfield',
  1178. id: 'slrf_sst',
  1179. name: 'slrf_sst',
  1180. allowBlank: false,
  1181. allowDecimals: false,
  1182. maxText: 'The Range is: 0 - 100',
  1183. maxValue: 100,
  1184. minText: 'No Negative Values Allowed',
  1185. minValue: 0
  1186. },{
  1187. html: 'Mastr Flip',
  1188. frame: false,
  1189. border: false
  1190. },{
  1191. xtype: 'numberfield',
  1192. id: 'mlrf_flip',
  1193. name: 'mlrf_flip',
  1194. allowBlank: false,
  1195. allowDecimals: false,
  1196. maxText: 'The Range is: 8 - 128',
  1197. maxValue: 128,
  1198. minText: 'The Range is: 8 - 128',
  1199. minValue: 8
  1200. },{
  1201. html: 'Slave Flip',
  1202. frame: false,
  1203. border: false
  1204. },{
  1205. xtype: 'numberfield',
  1206. id: 'slrf_flip',
  1207. name: 'slrf_flip',
  1208. allowBlank: false,
  1209. allowDecimals: false,
  1210. maxText: 'The Range is: 8 - 128',
  1211. maxValue: 128,
  1212. minText: 'The Range is: 8 - 128',
  1213. minValue: 8
  1214. },{
  1215. html: 'Master Sun',
  1216. frame: false,
  1217. border: false
  1218. },{
  1219. xtype: 'numberfield',
  1220. id: 'mlrf_sun',
  1221. name: 'mlrf_sun',
  1222. allowBlank: false,
  1223. allowDecimals: false,
  1224. maxText: 'The Range is: 0 - 100',
  1225. maxValue: 100,
  1226. minText: 'No Negative Values Allowed',
  1227. minValue: 0
  1228. },{
  1229. html: 'Slave Sun',
  1230. frame: false,
  1231. border: false
  1232. },{
  1233. xtype: 'numberfield',
  1234. id: 'slrf_sun',
  1235. name: 'slrf_sun',
  1236. allowBlank: false,
  1237. allowDecimals: false,
  1238. maxText: 'The Range is: 0 - 100',
  1239. maxValue: 100,
  1240. minText: 'No Negative Values Allowed',
  1241. minValue: 0
  1242. },{
  1243. xtype: 'button',
  1244. text: 'Update Detection Settings',
  1245. width: '100%',
  1246. colspan: 4,
  1247. handler: function(){
  1248. var MOFS=Ext.getCmp('mlrf_offset').getValue();
  1249. var MDEL=Ext.getCmp('mlrf_delta').getValue();
  1250. var MWIT=Ext.getCmp('mlrf_width').getValue();
  1251. var MORD=Ext.getCmp('mlrf_order').getValue();
  1252. var MSST=Ext.getCmp('mlrf_sst').getValue();
  1253. var MFLP=Ext.getCmp('mlrf_flip').getValue();
  1254. var MSUN=Ext.getCmp('mlrf_sun').getValue();
  1255. var SOFS=Ext.getCmp('slrf_offset').getValue();
  1256. var SDEL=Ext.getCmp('slrf_delta').getValue();
  1257. var SWIT=Ext.getCmp('slrf_width').getValue();
  1258. var SORD=Ext.getCmp('slrf_order').getValue();
  1259. var SSST=Ext.getCmp('slrf_sst').getValue();
  1260. var SFLP=Ext.getCmp('slrf_flip').getValue();
  1261. var SSUN=Ext.getCmp('slrf_sun').getValue();
  1262. Ext.Ajax.request({
  1263. url: '/lib/controller/updateDetecttionProfile.php',
  1264. params: {
  1265. NID: SelectedNodeID,
  1266. UID: '<?=$CUser->Data['id'];?>',
  1267. SID: '<?=$Session;?>',
  1268. PID: 0,
  1269. MOFS: MOFS,
  1270. MDEL: MDEL,
  1271. MWIT: MWIT,
  1272. MORD: MORD,
  1273. MSST: MSST,
  1274. MFLP: MFLP,
  1275. MSUN: MSUN,
  1276. SOFS: SOFS,
  1277. SDEL: SDEL,
  1278. SWIT: SWIT,
  1279. SORD: SORD,
  1280. SSST: SSST,
  1281. SFLP: SFLP,
  1282. SSUN: SSUN
  1283. },
  1284. success: function( response, opts ){
  1285. loadFullLRF2D2Data( SelectedNodeID );
  1286. },
  1287. failure: failureAJAXFunction
  1288. });
  1289. }
  1290. }]
  1291. },{
  1292. title: 'Embed Options'
  1293. },{
  1294. title: 'Target Width Table'
  1295. },{
  1296. title: 'Mantenence',
  1297. xtype: 'form',
  1298. layout: 'table',
  1299. defaults: {
  1300. bodyStyle:'padding:20px'
  1301. },
  1302. layoutConfig: {
  1303. columns: 2
  1304. },
  1305. items:[{
  1306. html: 'Restart Device',
  1307. frame: false,
  1308. border: false
  1309. },{
  1310. xtype: 'button',
  1311. id: 'rstBTN',
  1312. text: 'Full Reset',
  1313. handler: function(){
  1314. Ext.Msg.show({
  1315. title:'Reset Device?',
  1316. msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
  1317. buttons: Ext.Msg.YESNOCANCEL,
  1318. //fn: processResult,
  1319. animEl: 'rstBTN',
  1320. icon: Ext.MessageBox.QUESTION
  1321. });
  1322. }
  1323. }]
  1324. }]
  1325. }
  1326. });
  1327. };
  1328. LRF2D2_st_win.show();
  1329. loadFullLRF2D2Data( SelectedNodeID );
  1330. };
  1331. function LRF16D3_settings(){
  1332. };
  1333. var currentResolveDeviceNode = 0;
  1334. var ResolveDeviceNodeWin = null;
  1335. function resolveDeviceMistmatch( NodeID ){
  1336. currentResolveDeviceNode = NodeID;
  1337. if( ResolveDeviceNodeWin == null ){
  1338. ResolveDeviceNodeWin = new Ext.Window({
  1339. title: '<?=$Labels->GetLabel('_WDEV_MISTMATCH_');?>',
  1340. modal: true,
  1341. width: 500,
  1342. height: 200,
  1343. closeAction: 'hide',
  1344. items:[{
  1345. xtype: 'spacer',
  1346. style: {
  1347. marginTop: '13px'
  1348. },
  1349. html: '<center><?=$Labels->GetLabel('_DEV_MISTMATT1_');?></center>',
  1350. height: 30
  1351. },{
  1352. xtype: 'button',
  1353. width: '100%',
  1354. text: 'It is Newly Connected Device',
  1355. handler: function(){
  1356. Ext.Ajax.request({
  1357. url: '/lib/controller/validateNode.php',
  1358. params: {
  1359. NID: currentResolveDeviceNode,
  1360. UID: '<?=$CUser->Data['id'];?>',
  1361. SID: '<?=$Session;?>',
  1362. MET: 1
  1363. },
  1364. success: function( response, opts ){
  1365. ResolveDeviceNodeWin.hide();
  1366. },
  1367. failure: failureAJAXFunction
  1368. });
  1369. }
  1370. },{
  1371. xtype: 'button',
  1372. width: '100%',
  1373. text: 'Apply Existing Detection Profiles to Newly Connected Device',
  1374. handler: function(){
  1375. Ext.Ajax.request({
  1376. url: '/lib/controller/validateNode.php',
  1377. params: {
  1378. NID: currentResolveDeviceNode,
  1379. UID: '<?=$CUser->Data['id'];?>',
  1380. SID: '<?=$Session;?>',
  1381. MET: 1
  1382. },
  1383. success: function( response, opts ){
  1384. ResolveDeviceNodeWin.hide();
  1385. },
  1386. failure: failureAJAXFunction
  1387. });
  1388. }
  1389. },{
  1390. xtype: 'button',
  1391. width: '100%',
  1392. text: 'Discard old Detection Profiles and Start Device Setup Wizard',
  1393. handler: function(){
  1394. ResolveDeviceNodeWin.hide();
  1395. startDeviceDetectionWizard( currentResolveDeviceNode );
  1396. }
  1397. },{
  1398. xtype: 'button',
  1399. width: '100%',
  1400. text: 'Discard old Detection Profiles and Load Factory Settings from Device'
  1401. },{
  1402. xtype: 'button',
  1403. width: '100%',
  1404. text: 'Discard this Connection for NOW'
  1405. }]
  1406. });
  1407. };
  1408. ResolveDeviceNodeWin.show();
  1409. };
  1410. var DeviceDetectionWizardWnd = null;
  1411. var DDWizardActiveDevice = '';
  1412. var RangeSetBlocker = false;
  1413. function startDeviceDetectionWizard( NodeID ){
  1414. DDWizardActiveDevice = NodeID
  1415. if( DeviceDetectionWizardWnd == null ){
  1416. DeviceDetectionWizardWnd = new Ext.Window({
  1417. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZT_');?>',
  1418. modal: true,
  1419. width: 500,
  1420. height: 208,
  1421. closeAction: 'hide',
  1422. items:[{
  1423. xtype: 'tabpanel',
  1424. activeTab: 1,
  1425. items: [{
  1426. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZ0_');?>',
  1427. frame: false,
  1428. xtype: 'form',
  1429. items:[{
  1430. xtype: 'spacer',
  1431. height: 20
  1432. },{
  1433. xtype: 'combo',
  1434. id: 'DDWizST',
  1435. fieldLabel: '<?=$Labels->GetLabel('_DEV_TYPE_FLD_');?>',
  1436. typeAhead: true,
  1437. triggerAction: 'all',
  1438. lazyRender:true,
  1439. mode: 'local',
  1440. store: new Ext.data.ArrayStore({
  1441. id: 0,
  1442. fields: [
  1443. 'dtId',
  1444. 'dtText'
  1445. ],
  1446. data: [
  1447. [1, '<?=$Labels->GetLabel('_DEV_TYPE_ALS_');?>'],
  1448. [2, '<?=$Labels->GetLabel('_DEV_TYPE_LFS_');?>'],
  1449. [3, '<?=$Labels->GetLabel('_DEV_TYPE_PLS200_');?>'],
  1450. [4, '<?=$Labels->GetLabel('_DEV_TYPE_PLS360_');?>'],
  1451. [5, '<?=$Labels->GetLabel('_DEV_TYPE_3D_');?>'],
  1452. [6, '<?=$Labels->GetLabel('_DEV_TYPE_NPLS200_');?>']
  1453. ]
  1454. }),
  1455. valueField: 'dtId',
  1456. displayField: 'dtText'
  1457. },{
  1458. xtype: 'numberfield',
  1459. id: 'DDWizSR',
  1460. fieldLabel: '<?=$Labels->GetLabel('_DEV_RANGE_FLD_');?>',
  1461. minValue: 15.0,
  1462. maxValue: 300.0,
  1463. listeners:{
  1464. change: function( m, nv, ov ){
  1465. if( RangeSetBlocker ) return;
  1466. RangeSetBlocker = true;
  1467. Ext.getCmp('DDWizSRS').setValue( nv );
  1468. RangeSetBlocker = false;
  1469. }
  1470. }
  1471. },{
  1472. xtype: 'slider',
  1473. id: 'DDWizSRS',
  1474. fieldLabel: '<?=$Labels->GetLabel('_DEV_RANGE_FLD_');?>',
  1475. minValue: 15.0,
  1476. maxValue: 300.0,
  1477. listeners:{
  1478. change: function( m, nv, ov ){
  1479. if( RangeSetBlocker ) return;
  1480. RangeSetBlocker = true;
  1481. Ext.getCmp('DDWizSR').setValue( nv );
  1482. RangeSetBlocker = false;
  1483. }
  1484. }
  1485. },{
  1486. xtype: 'spacer',
  1487. height: 10
  1488. }]
  1489. },{
  1490. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZ1_');?>',
  1491. frame: false,
  1492. xtype: 'form',
  1493. labelWidth: 120,
  1494. items:[{
  1495. xtype: 'spacer',
  1496. height: 20
  1497. },{
  1498. xtype: 'combo',
  1499. id: 'DDWizIT',
  1500. fieldLabel: '<?=$Labels->GetLabel('_DEV_ITYPE_FLD_');?>',
  1501. typeAhead: true,
  1502. triggerAction: 'all',
  1503. lazyRender:true,
  1504. mode: 'local',
  1505. value: 1,
  1506. store: new Ext.data.ArrayStore({
  1507. id: 0,
  1508. fields: [
  1509. 'dpId',
  1510. 'dpText'
  1511. ],
  1512. data: [
  1513. [1, '<?=$Labels->GetLabel('_DEV_PL_HORI_');?>'],
  1514. [2, '<?=$Labels->GetLabel('_DEV_PL_VERT_');?>'],
  1515. [3, '<?=$Labels->GetLabel('_DEV_PL_ANG_');?>']
  1516. ]
  1517. }),
  1518. valueField: 'dpId',
  1519. displayField: 'dpText'
  1520. }]
  1521. },{
  1522. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZ2_');?>',
  1523. html: 'Another one'
  1524. },{
  1525. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZ3_');?>',
  1526. html: 'Another one'
  1527. }]
  1528. }],
  1529. bbar:[{
  1530. text: 'Create Profiles And Finish',
  1531. handler: function(){
  1532. DeviceDetectionWizardWnd.hide();
  1533. }
  1534. },{
  1535. text: 'Advanced Config',
  1536. handler: function(){
  1537. DeviceDetectionWizardWnd.hide();
  1538. startAdvancedDeviceDetection( DDWizardActiveDevice );
  1539. }
  1540. }]
  1541. });
  1542. };
  1543. Ext.Ajax.request({
  1544. url: '/lib/controller/getNodeBasicNfo.php',
  1545. params: {
  1546. NID: DDWizardActiveDevice,
  1547. UID: '<?=$CUser->Data['id'];?>',
  1548. SID: '<?=$Session;?>'
  1549. },
  1550. success: function( response, opts ){
  1551. var data = Ext.decode(response.responseText);
  1552. DeviceDetectionWizardWnd.setTitle( '<?=$Labels->GetLabel('_WDEV_DET_WIZT_');?> [' + data.name+']' );
  1553. Ext.getCmp('DDWizST').setValue( data.type );
  1554. RangeSetBlocker = true;
  1555. Ext.getCmp('DDWizSR').setValue( data.range );
  1556. Ext.getCmp('DDWizSRS').setValue( data.range );
  1557. RangeSetBlocker = false;
  1558. DeviceDetectionWizardWnd.show();
  1559. },
  1560. failure: failureAJAXFunction
  1561. });
  1562. };
  1563. var DeviceDetectionAdvancedWnd = null;
  1564. var DeviceDetectionProfileNames = ['factory default', 'low sens', 'medium sens', 'high sens'];
  1565. function loadAdvancedDeviceDetectionSettings(){
  1566. Ext.getCmp('ADD_TP').removeAll( false );
  1567. Ext.Ajax.request({
  1568. url: '/lib/controller/getNodeAdvancedNfo.php',
  1569. params: {
  1570. NID: DDWizardActiveDevice,
  1571. UID: '<?=$CUser->Data['id'];?>',
  1572. SID: '<?=$Session;?>'
  1573. },
  1574. success: function( response, opts ){
  1575. var data = Ext.decode(response.responseText);
  1576. DeviceDetectionAdvancedWnd.setTitle( '<?=$Labels->GetLabel('_WDEV_DET_WIZT_');?> [' + data.name+']' );
  1577. if( data.profiles.length > 0 ){
  1578. if( data.profiles.length > 3 ) Ext.getCmp('ADD_PADD_BTN').disable();
  1579. switch( data.type ){
  1580. case 1:
  1581. case 5:{
  1582. for( i = 0; i < data.profiles.length / 2; i++){
  1583. };
  1584. break;
  1585. };
  1586. case 2:
  1587. case 3:
  1588. case 4:
  1589. case 6:{
  1590. for( i = 0; i < data.profiles.length; i++){
  1591. Ext.getCmp('ADD_TP').add({
  1592. title: DeviceDetectionProfileNames[ data.profiles[i].id ],
  1593. xtype: 'form',
  1594. frame: false,
  1595. items:[{xtype: 'spacer', height: 10 },{
  1596. xtype: 'numberfield',
  1597. id: 'OFFSET_P'+data.profiles[i].id,
  1598. fieldLabel: 'OFFSET',
  1599. minValue: 15.0,
  1600. maxValue: 300.0,
  1601. value: data.profiles[i].offset
  1602. },{
  1603. xtype: 'numberfield',
  1604. id: 'DELTA_P'+data.profiles[i].id,
  1605. fieldLabel: 'DELTA',
  1606. minValue: 15.0,
  1607. maxValue: 300.0,
  1608. value: data.profiles[i].delta
  1609. },{
  1610. xtype: 'numberfield',
  1611. id: 'WIDTH_P'+data.profiles[i].id,
  1612. fieldLabel: 'WIDTH',
  1613. minValue: 15.0,
  1614. maxValue: 300.0,
  1615. value: data.profiles[i].width
  1616. },{
  1617. xtype: 'numberfield',
  1618. id: 'SST_P'+data.profiles[i].id,
  1619. fieldLabel: 'SST',
  1620. minValue: 15.0,
  1621. maxValue: 300.0,
  1622. value: data.profiles[i].sst
  1623. },{
  1624. xtype: 'numberfield',
  1625. id: 'FLIP_P'+data.profiles[i].id,
  1626. fieldLabel: 'FLIP',
  1627. minValue: 15.0,
  1628. maxValue: 300.0,
  1629. value: data.profiles[i].flip
  1630. },{
  1631. xtype: 'numberfield',
  1632. id: 'SUN_P'+data.profiles[i].id,
  1633. fieldLabel: 'SUN',
  1634. minValue: 15.0,
  1635. maxValue: 300.0,
  1636. value: data.profiles[i].sun
  1637. }]
  1638. });
  1639. };
  1640. break;
  1641. };
  1642. };
  1643. //
  1644. } else {
  1645. Ext.getCmp('ADD_TP').add({
  1646. title: 'Error!',
  1647. html: 'No Profiles Defined'
  1648. });
  1649. };
  1650. DeviceDetectionAdvancedWnd.show();
  1651. },
  1652. failure: failureAJAXFunction
  1653. });
  1654. };
  1655. function startAdvancedDeviceDetection( NodeID ){
  1656. DDWizardActiveDevice = NodeID;
  1657. if( DeviceDetectionAdvancedWnd == null ){
  1658. DeviceDetectionAdvancedWnd = new Ext.Window({
  1659. title: '<?=$Labels->GetLabel('_WDEV_DET_WIZT_');?>',
  1660. modal: true,
  1661. width: 500,
  1662. height: 300,
  1663. closeAction: 'hide',
  1664. items:[{
  1665. xtype: 'tabpanel',
  1666. id: 'ADD_TP',
  1667. frame: false,
  1668. border: false,
  1669. activeTab: 0,
  1670. items: []
  1671. }],
  1672. bbar:[{
  1673. id: 'ADD_PADD_BTN',
  1674. text: 'Add Detection Profile',
  1675. handler: function(){
  1676. Ext.Ajax.request({
  1677. url: '/lib/controller/addDetectionProfile.php',
  1678. params: {
  1679. NID: DDWizardActiveDevice,
  1680. UID: '<?=$CUser->Data['id'];?>',
  1681. SID: '<?=$Session;?>'
  1682. },
  1683. success: function( response, opts ){
  1684. loadAdvancedDeviceDetectionSettings();
  1685. },
  1686. failure: failureAJAXFunction
  1687. });
  1688. }
  1689. },{
  1690. text: 'Apply And Finish'
  1691. },{
  1692. text: 'Use Wizard'
  1693. }]
  1694. });
  1695. };
  1696. loadAdvancedDeviceDetectionSettings();
  1697. };
  1698. var maskEditorDiv = null;
  1699. var MEPanel = null;
  1700. function handleFSMaskEditorClose( event ){
  1701. if ( document.fullscreenElement ||
  1702. document.webkitFullscreenElement ||
  1703. document.mozFullScreenElement ||
  1704. document.msFullscreenElement ){
  1705. } else {
  1706. MEPanel.destroy();
  1707. maskEditorDiv.remove();
  1708. maskEditorDiv = null;
  1709. MEPanel = null;
  1710. document.removeEventListener( 'fullscreenchange', handleFSMaskEditorClose );
  1711. };
  1712. };
  1713. function hideMaskEditor(){
  1714. if(
  1715. document.fullscreenElement ||
  1716. document.webkitFullscreenElement ||
  1717. document.mozFullScreenElement ||
  1718. document.msFullscreenElement
  1719. ){
  1720. if( document.exitFullscreen ){
  1721. document.exitFullscreen();
  1722. }else if( document.mozCancelFullScreen ){
  1723. document.mozCancelFullScreen();
  1724. }else if( document.webkitExitFullscreen ){
  1725. document.webkitExitFullscreen();
  1726. }else if( document.msExitFullscreen ){
  1727. document.msExitFullscreen();
  1728. };
  1729. // Removal Done by event!
  1730. //maskEditorDiv.remove();
  1731. //maskEditorDiv = null;
  1732. //document.removeEventListener( 'fullscreenchange', handleFSMaskEditorClose );
  1733. };
  1734. };
  1735. var values = {
  1736. paths: 50,
  1737. minPoints: 5,
  1738. maxPoints: 15,
  1739. minRadius: 30,
  1740. maxRadius: 90
  1741. };
  1742. var hitOptions = {
  1743. segments: true,
  1744. stroke: true,
  1745. fill: true,
  1746. tolerance: 10
  1747. };
  1748. var polycolors = new Array();
  1749. var polyindex = 0;
  1750. var poligones = new Array();
  1751. var segment = null;
  1752. var path = null;
  1753. var MaskProject = null;
  1754. var MaskEditorMode = 0;
  1755. function onMouseDown(event) {
  1756. segment = path = null;
  1757. var hitResult = MaskProject.hitTest( event.point, hitOptions );
  1758. if (!hitResult) return;
  1759. if( event.modifiers.shift ){
  1760. if (hitResult.type == 'segment') {
  1761. hitResult.segment.remove();
  1762. };
  1763. return;
  1764. };
  1765. if( hitResult ){
  1766. path = hitResult.item;
  1767. if( hitResult.type == 'segment' ){
  1768. segment = hitResult.segment;
  1769. path.fullySelected = false;
  1770. segment.selected = true;
  1771. } else if( hitResult.type == 'stroke' ){
  1772. var location = hitResult.location;
  1773. segment = path.insert(location.index + 1, event.point);
  1774. //path.smooth();
  1775. path.fullySelected = false;
  1776. segment.selected = true;
  1777. } else if ( hitResult.type == 'fill' ){
  1778. path.fullySelected = true;
  1779. };
  1780. }
  1781. //movePath = ;
  1782. //if( movePath ) MaskProject.activeLayer.addChild(hitResult.item);
  1783. }
  1784. function onMouseMove(event) {
  1785. MaskProject.activeLayer.selected = false;
  1786. if( event.item ) {
  1787. //event.item.selected = true;
  1788. event.item.fullySelected = true;
  1789. };
  1790. }
  1791. function onMouseDrag(event) {
  1792. if( segment ){
  1793. //segment.point += event.delta;
  1794. segment.point = event.point;
  1795. //path.smooth();
  1796. };
  1797. //else if (path) {
  1798. // path.position += event.delta;
  1799. //}
  1800. }
  1801. var absDrawMapSizes = [[4096,4096],[2304,288]];
  1802. var deviceMapScaling = 1.0;
  1803. var deviceMapTopShift = 100;
  1804. var deviceMapLeftShift = 100;
  1805. var cMapImageWidth = 0;
  1806. var cMapImageHeight = 0;
  1807. var cMapCanvasWidth = 0;
  1808. var cMapCanvasHeight = 0;
  1809. var cMapType = 0;
  1810. var cMaskLRF = 0;
  1811. var cMaskID = 0;
  1812. function SaveCurrentMask( NodeID, MaskID = 0, LRFID = 0 ){
  1813. var serial = MaskProject.exportJSON();
  1814. Ext.Ajax.request({
  1815. url: '/lib/controller/uploadDeviceMask.php',
  1816. params: {
  1817. NID: NodeID,
  1818. UID: '<?=$CUser->Data['id'];?>',
  1819. SID: '<?=$Session;?>',
  1820. MID: MaskID,
  1821. LID: LRFID,
  1822. MDTA: serial,
  1823. MIH: cMapImageHeight,
  1824. MIW: cMapImageWidth,
  1825. MSHX: deviceMapLeftShift,
  1826. MSHY: deviceMapTopShift,
  1827. DSTD: 1
  1828. },
  1829. success: function( response, opts ){
  1830. //var data = Ext.decode(response.responseText);
  1831. //hideMaskEditor();
  1832. },
  1833. failure: failureAJAXFunction
  1834. });
  1835. }
  1836. function showMaskEditor( fromDevTool, DevType, NodeID ){
  1837. //alert( "DevType: "+DevType + " Dev Map size: "+ absDrawMapSizes[DevType][0]+"x"+absDrawMapSizes[DevType][1] );
  1838. cMapType = DevType;
  1839. if( DevType == 1 ){
  1840. deviceMapScaling = ( window.screen.height * window.devicePixelRatio - 130 - ( deviceMapTopShift * 2 )) / absDrawMapSizes[DevType][1];
  1841. } else {
  1842. deviceMapScaling = ( window.screen.width * window.devicePixelRatio - 30 - ( deviceMapLeftShift * 2 )) / absDrawMapSizes[DevType][0];
  1843. };
  1844. cMapImageHeight = deviceMapScaling * absDrawMapSizes[DevType][1];
  1845. cMapImageWidth = deviceMapScaling * absDrawMapSizes[DevType][0];
  1846. cMapCanvasWidth = cMapImageWidth + (deviceMapLeftShift * 2);
  1847. cMapCanvasHeight = cMapImageHeight + (deviceMapTopShift * 2);
  1848. if( fromDevTool ){
  1849. detectionProfileWindow.hide();
  1850. };
  1851. if(
  1852. document.fullscreenElement ||
  1853. document.webkitFullscreenElement ||
  1854. document.mozFullScreenElement ||
  1855. document.msFullscreenElement
  1856. ){
  1857. //fs mode allready
  1858. hideMaskEditor();
  1859. }else{
  1860. if( maskEditorDiv == null ){
  1861. maskEditorDiv = document.createElement("div");
  1862. maskEditorDiv.style.height="200px";
  1863. maskEditorDiv.style.width="200px";
  1864. //maskEditorDiv.style.backgroundImage = "url('your_image.png')";
  1865. //append div as a child to body
  1866. document.body.appendChild( maskEditorDiv );
  1867. //var elem = document.createElement("img"); 'getDeviceMap.php?NID='+NodeID
  1868. //elem.setAttribute("src", "/lib/controller/data/device_draws/75c85fec4be204fc0bc0452f53b5a3df_map.png");
  1869. //elem.setAttribute("height", "80%");
  1870. //elem.setAttribute("width", "130");
  1871. //maskEditorDiv.appendChild( elem );
  1872. //alert( window.screen.width * window.devicePixelRatio + "x" + window.screen.height * window.devicePixelRatio);
  1873. if( MEPanel == null ){
  1874. var ww = window.screen.width * window.devicePixelRatio;
  1875. var hh = window.screen.height * window.devicePixelRatio;
  1876. MEPanel = new Ext.Panel( {
  1877. title: 'Mask Editor',
  1878. renderTo: maskEditorDiv,
  1879. width: ww,
  1880. height: hh,
  1881. frame: true,
  1882. autoScroll: true,
  1883. items:[{
  1884. xtype: 'panel',
  1885. width: cMapCanvasWidth,
  1886. html: '<div id=\'popomas\' style="display: block; width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; background: orange; background-position-x: '+deviceMapLeftShift+'px; background-position-y: '+deviceMapTopShift+'px; background-size: '+cMapImageWidth+'px '+cMapImageHeight+'px; background-image: url(\'/lib/controller/getDeviceDraw.php?MAP=1&NID='+NodeID+'\'); background-repeat: no-repeat;"><canvas id="mask_canvas" width="'+cMapCanvasWidth+'px" height="'+cMapCanvasHeight+'px"></canvas></dvi>'
  1887. }],
  1888. tbar:[{
  1889. text:'New Polygone',
  1890. id: 'me_b_newp',
  1891. enableToggle: true,
  1892. toggleGroup: 'me_topbar_grp',
  1893. pressed: false,
  1894. handler: function( btn ){
  1895. //alert("koko");
  1896. if( btn.pressed ) setMaskEditorMode( 0 );
  1897. }
  1898. },{
  1899. text:'Delete Polygone',
  1900. id: 'me_b_delp',
  1901. enableToggle: true,
  1902. toggleGroup: 'me_topbar_grp'
  1903. },{
  1904. text:'Delete Point',
  1905. id: 'me_b_delpo',
  1906. enableToggle: true,
  1907. toggleGroup: 'me_topbar_grp'
  1908. },{
  1909. text:'Clear Mask',
  1910. id: 'me_b_delm',
  1911. handler: function(){
  1912. if( MaskProject!= null ){
  1913. //alert( 'ClearMask' );
  1914. };
  1915. }
  1916. },{
  1917. text:'1',
  1918. enableToggle: true,
  1919. toggleGroup: 'me_maskbar_grp',
  1920. handler: function(){
  1921. if( cMaskID != 0 ){
  1922. SaveCurrentMask( NodeID, cMaskID );
  1923. };
  1924. MaskProject = new paper.Project( canvas );
  1925. paper.view.draw();
  1926. cMaskID = 0;
  1927. loadDeviceMask( NodeID, cMaskID );
  1928. }
  1929. },{
  1930. text:'2',
  1931. enableToggle: true,
  1932. toggleGroup: 'me_maskbar_grp',
  1933. handler: function(){
  1934. if( cMaskID != 1 ){
  1935. SaveCurrentMask( NodeID, cMaskID );
  1936. };
  1937. MaskProject = new paper.Project( canvas );
  1938. paper.view.draw();
  1939. cMaskID = 1;
  1940. loadDeviceMask( NodeID, cMaskID );
  1941. }
  1942. },{
  1943. text:'3',
  1944. enableToggle: true,
  1945. toggleGroup: 'me_maskbar_grp',
  1946. handler: function(){
  1947. if( cMaskID != 2 ){
  1948. SaveCurrentMask( NodeID, cMaskID );
  1949. };
  1950. MaskProject = new paper.Project( canvas );
  1951. paper.view.draw();
  1952. cMaskID = 2;
  1953. loadDeviceMask( NodeID, cMaskID );
  1954. }
  1955. },{
  1956. text:'4',
  1957. enableToggle: true,
  1958. toggleGroup: 'me_maskbar_grp',
  1959. handler: function(){
  1960. if( cMaskID != 3 ){
  1961. SaveCurrentMask( NodeID, cMaskID );
  1962. };
  1963. MaskProject = new paper.Project( canvas );
  1964. paper.view.draw();
  1965. cMaskID = 3;
  1966. loadDeviceMask( NodeID, cMaskID );
  1967. }
  1968. },{
  1969. text:'5',
  1970. enableToggle: true,
  1971. toggleGroup: 'me_maskbar_grp',
  1972. handler: function(){
  1973. if( cMaskID != 4 ){
  1974. SaveCurrentMask( NodeID, cMaskID );
  1975. };
  1976. MaskProject = new paper.Project( canvas );
  1977. paper.view.draw();
  1978. cMaskID = 4;
  1979. loadDeviceMask( NodeID, cMaskID );
  1980. }
  1981. }],
  1982. buttons:[{
  1983. text: 'Cancel',
  1984. handler: function(){
  1985. hideMaskEditor();
  1986. }
  1987. },{
  1988. text:'Save Mask and Close',
  1989. handler: function(){
  1990. var serial = MaskProject.exportJSON();
  1991. Ext.Ajax.request({
  1992. url: '/lib/controller/uploadDeviceMask.php',
  1993. params: {
  1994. NID: NodeID,
  1995. UID: '<?=$CUser->Data['id'];?>',
  1996. SID: '<?=$Session;?>',
  1997. MID: 0,
  1998. LID: 0,
  1999. MDTA: serial,
  2000. MIH: cMapImageHeight,
  2001. MIW: cMapImageWidth,
  2002. //MSF: deviceMapScaling,
  2003. MSHX: deviceMapLeftShift,
  2004. MSHY: deviceMapTopShift
  2005. },
  2006. success: function( response, opts ){
  2007. var data = Ext.decode(response.responseText);
  2008. hideMaskEditor();
  2009. },
  2010. failure: failureAJAXFunction
  2011. });
  2012. }
  2013. }]
  2014. });
  2015. };
  2016. MEPanel.doLayout();
  2017. //if( MaskProject == null ){
  2018. var canvas = document.getElementById('mask_canvas');
  2019. paper.settings.handleSize = 10;
  2020. MaskProject = new paper.Project( canvas );
  2021. //canvas.addEventListener( 'mousemove', onMaskMouseMove );
  2022. canvas.addEventListener( 'mousedown', onMaskMouseDown );
  2023. //canvas.addEventListener( 'mouseup', onMaskMouseUp );
  2024. //canvas.addEventListener( 'mousedrag', onMaskMouseMove );
  2025. //};
  2026. cMaskID = 0;
  2027. loadDeviceMask( NodeID, cMaskID );
  2028. };
  2029. //maskEditorDiv = $('#container').get(0);
  2030. //var maskEditorDiv = document.getElementById( id ); //Ext.getCmp( id );
  2031. if( maskEditorDiv.requestFullscreen ){
  2032. maskEditorDiv.requestFullscreen();
  2033. }else if( maskEditorDiv.mozRequestFullScreen ){
  2034. maskEditorDiv.mozRequestFullScreen();
  2035. }else if( maskEditorDiv.webkitRequestFullscreen ){
  2036. maskEditorDiv.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
  2037. }else if( maskEditorDiv.msRequestFullscreen ){
  2038. maskEditorDiv.msRequestFullscreen();
  2039. };
  2040. document.addEventListener( 'fullscreenchange', handleFSMaskEditorClose );
  2041. };
  2042. };
  2043. function setMaskEditorMode( nM ){
  2044. switch( nM ){
  2045. case 0:{
  2046. var MEP = Ext.getCmp('me_b_newp');
  2047. if( !MEP.pressed ) MEP.toggle( true );
  2048. var caca = document.getElementById('mask_canvas');
  2049. caca.style.cursor = 'crosshair';
  2050. break;
  2051. };
  2052. case 1:{
  2053. var MEP = Ext.getCmp('me_b_newp');
  2054. if( !MEP.pressed ) MEP.toggle( false );
  2055. MEP = Ext.getCmp('me_b_delp');
  2056. if( !MEP.pressed ) MEP.toggle( false );
  2057. MEP = Ext.getCmp('me_b_delpo');
  2058. if( !MEP.pressed ) MEP.toggle( false );
  2059. if( MaskProject!= null ){
  2060. if( MaskProject.isEmpty() ){
  2061. MEP = Ext.getCmp('me_b_delp');
  2062. MEP.disable();
  2063. MEP = Ext.getCmp('me_b_delpo');
  2064. MEP.disable();
  2065. MEP = Ext.getCmp('me_b_delm');
  2066. MEP.disable();
  2067. setMaskEditorMode( 0 );
  2068. } else {
  2069. MEP = Ext.getCmp('me_b_delp');
  2070. MEP.enable();
  2071. MEP = Ext.getCmp('me_b_delpo');
  2072. MEP.enable();
  2073. MEP = Ext.getCmp('me_b_delm');
  2074. MEP.enable();
  2075. };
  2076. };
  2077. var caca = document.getElementById('mask_canvas');
  2078. caca.style.cursor = 'default';
  2079. break;
  2080. };
  2081. case 2:{
  2082. var MEP = Ext.getCmp('me_b_delp');
  2083. if( !MEP.pressed ) MEP.toggle( true );
  2084. break;
  2085. };
  2086. case 3:{
  2087. var MEP = Ext.getCmp('me_b_delpo');
  2088. if( !MEP.pressed ) MEP.toggle( true );
  2089. break;
  2090. };
  2091. case 4:{
  2092. };
  2093. };
  2094. MaskEditorMode = nM;
  2095. };
  2096. function loadDeviceMask( NodeID, LayerID = 0, LrfID = 0 ){
  2097. Ext.Ajax.request({
  2098. url: '/lib/controller/getDeviceMask.php',
  2099. params: {
  2100. NID: NodeID,
  2101. UID: '<?=$CUser->Data['id'];?>',
  2102. SID: '<?=$Session;?>',
  2103. MID: LayerID,
  2104. LID: LrfID
  2105. },
  2106. success: function( response, opts ){
  2107. var data = Ext.decode(response.responseText);
  2108. if( data.length > 0 ){
  2109. for( i = 0; i < data.length; i++ ){
  2110. //var
  2111. path = new paper.Path();
  2112. path.strokeColor = 'black';
  2113. //var lightness = (Math.random() - 0.5) * 0.4 + 0.4;
  2114. //var hue = Math.random() * 360;
  2115. //path.fillColor = { hue: hue, saturation: 1, lightness: lightness };
  2116. path.fillColor = data[i].colour;
  2117. path.closed = true;
  2118. path.opacity = 0.5;
  2119. //path.onMouseMove = onMouseMove;
  2120. path.onMouseDown = onMouseDown;
  2121. path.onMouseDrag = onMouseDrag;
  2122. //path.onMouseUp = function( event ){
  2123. // path.add(event.point);
  2124. //}
  2125. if( data[i].points.length > 2 ){
  2126. if( cMapType == 1 ){
  2127. var tX = data[i].points[0][0] * deviceMapScaling + deviceMapLeftShift;
  2128. var tY = data[i].points[0][1] * deviceMapScaling + deviceMapTopShift;
  2129. path.moveTo( [tX,tY] );
  2130. for(k = 1; k < data[i].points.length; k++ ){
  2131. tX = data[i].points[k][0] * deviceMapScaling + deviceMapLeftShift;
  2132. tY = data[i].points[k][1] * deviceMapScaling + deviceMapTopShift;
  2133. path.lineTo( [tX,tY] );
  2134. };
  2135. } else {
  2136. var tX = ( 2047 + parseInt( data[i].points[0][0]) ) * deviceMapScaling + deviceMapLeftShift;
  2137. var tY = ( 2047 + parseInt( data[i].points[0][1]) ) * deviceMapScaling + deviceMapTopShift;
  2138. path.moveTo( [tX,tY] );
  2139. for(k = 1; k < data[i].points.length; k++ ){
  2140. tX = ( 2047 + parseInt(data[i].points[k][0]) ) * deviceMapScaling + deviceMapLeftShift;
  2141. tY = ( 2047 + parseInt(data[i].points[k][1]) ) * deviceMapScaling + deviceMapTopShift;
  2142. path.lineTo( [tX,tY] );
  2143. };
  2144. };
  2145. path.fullySelected = true;
  2146. paper.view.draw();
  2147. };
  2148. poligones.push(path);
  2149. setMaskEditorMode( 4 );
  2150. };
  2151. } else {
  2152. setMaskEditorMode( 0 );
  2153. };
  2154. },
  2155. failure: failureAJAXFunction
  2156. });
  2157. };
  2158. function onMaskMouseDown( evt ){
  2159. switch( MaskEditorMode ){
  2160. case 0:{
  2161. path = new paper.Path();
  2162. path.strokeColor = 'black';
  2163. path.fillColor = '#ff8020';
  2164. path.onMouseDown = onMouseDown;
  2165. path.onMouseDrag = onMouseDrag;
  2166. //path.onMouseMove = onMouseMove;
  2167. path.fullySelected = true;
  2168. path.closed = true;
  2169. path.opacity = 0.5;
  2170. path.moveTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
  2171. setMaskEditorMode( 1 );
  2172. break;
  2173. };
  2174. case 1:{
  2175. path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
  2176. if( path.segments.length == 3 ){
  2177. setMaskEditorMode( 4 );
  2178. };
  2179. };
  2180. };
  2181. //if( MaskEditorMode == 0 ){
  2182. //
  2183. //} else {
  2184. // path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
  2185. //};
  2186. };
  2187. function onMaskMouseUp( evt ){
  2188. if( MaskEditorMode == 4 ){
  2189. //path.lineTo( [ evt.pageX - $(document).scrollLeft() - $('#mask_canvas').offset().left, evt.pageY - $(document).scrollTop() - $('#mask_canvas').offset().top ] );
  2190. path.fullySelected = true;
  2191. path.onMouseDown = onMouseDown;
  2192. path.onMouseDrag = onMouseDrag;
  2193. paper.view.draw();
  2194. //poligones.push( path );
  2195. setMaskEditorMode( 1 );
  2196. };
  2197. };
  2198. function onMaskMouseMove( event ){
  2199. if( MaskEditorMode == 4 ){
  2200. //paper.view.draw();
  2201. };
  2202. };