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.

2370 lines
66 KiB

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