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.

1191 lines
36 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var serverToolBox = null;
  3. var currentNodeID = 0;
  4. //import * as THREE from 'three';
  5. //let camera, scene, renderer;
  6. var l3dMapOverlayTexture = new THREE.TextureLoader().load( '/lib/controller/data/assets/images/mask_3d.png' );
  7. var l3dMapOverlayMaterial = new THREE.MeshBasicMaterial( { map: l3dMapOverlayTexture, alphaTest: 0.7 } );
  8. var l3dMapOverlayGeometry = new THREE.SphereGeometry( 490, 60, 40 );
  9. // invert the geometry on the x-axis so that all of the faces point inward
  10. l3dMapOverlayGeometry.scale( -1, 1, 1 );
  11. var l3dMapOverlayMesh = new THREE.Mesh( l3dMapOverlayGeometry, l3dMapOverlayMaterial );
  12. function addl3dTarget( id, radius, az, el, color = 0xff0000 ){
  13. if( id > 0 ){
  14. var target = {};
  15. target.geometry = new THREE.BoxGeometry( 10, 10, 10 );
  16. //target.geometry = new THREE.OctahedronGeometry({ radius : 20 });
  17. //target.geometry.translate( x, y, z );
  18. // Turn back into Cartesian coordinates
  19. var fi = (Math.PI/2) - el;
  20. var x = radius * Math.sin( fi) * Math.cos( az );
  21. var y = radius * Math.sin( fi ) * Math.sin( az );
  22. var z = radius * Math.cos( fi );
  23. //alert( "Cords: "+x+" "+y+" "+z+" An:"+az+" "+el);
  24. //target.geometry.position.set( x, y, z ); //translate( x, y, z );
  25. target.material = new THREE.MeshBasicMaterial( {color: color} );
  26. target.mesh = new THREE.Mesh( target.geometry, target.material );
  27. nodeTHREEviewers[id].scene.add( target.mesh );
  28. target.mesh.position.set( x, z, y );
  29. nodeTHREEviewers[id].targets.push( target );
  30. };
  31. };
  32. function cleanup3DDraw( id ){
  33. if( typeof nodeTHREEviewers[id] !== 'undefined' ){
  34. if( typeof nodeTHREEviewers[id].targets !== 'undefined' ){
  35. for( var z=0; z < nodeTHREEviewers[id].targets.length; z++ ){
  36. nodeTHREEviewers[id].scene.remove( nodeTHREEviewers[id].targets[z].mesh );
  37. delete nodeTHREEviewers[id].targets[z].mesh;
  38. delete nodeTHREEviewers[id].targets[z].material;
  39. delete nodeTHREEviewers[id].targets[z].geometry;
  40. delete nodeTHREEviewers[id].targets[z];
  41. };
  42. nodeTHREEviewers[id].targets = [];
  43. //nodeTHREEviewers[id].renderer.render( nodeTHREEviewers[id].scene, nodeTHREEviewers[id].camera );
  44. };
  45. };
  46. };
  47. function DrawClicker( id, event ){
  48. var x = event.offsetX-100;
  49. var y = event.offsetY-100;
  50. switch( drawZoomLevels[ id ] ){
  51. case 100:{
  52. var r = Math.round( 1024.0 / 98 * Math.sqrt( x*x + y*y ) );
  53. if( r > 1024 ) r = 1024;
  54. break;
  55. };
  56. case 50:{
  57. var r = Math.round( 512.0 / 98 * Math.sqrt( x*x + y*y ) );
  58. if( r > 512 ) r = 512;
  59. break;
  60. };
  61. case 25:{
  62. var r = Math.round( 256.0 / 98 * Math.sqrt( x*x + y*y ) );
  63. if( r > 256 ) r = 256;
  64. break;
  65. };
  66. case 12:{
  67. var r = Math.round( 128.0 / 98 * Math.sqrt( x*x + y*y ) );
  68. if( r > 128 ) r = 128;
  69. break;
  70. };
  71. default:{
  72. var r = -1;
  73. break;
  74. };
  75. };
  76. if( r > -1 ){
  77. var z = Math.round( -1.0 * Math.atan2(y, x) * 3000 / Math.PI );
  78. if( z < 0 ) z += 6000 ;
  79. doDeviceOperation( id, 42, r+':'+z, true );
  80. };
  81. };
  82. function Draw3DTargets( k, b ){
  83. cleanup3DDraw( k );
  84. for( var z = 0; z < b.length; z++ ){
  85. var az = b[z].az * ( Math.PI/180.0 );
  86. var el = b[z].el * ( Math.PI/180.0 );
  87. //addl3dTarget( k, b[z].range, az, el, b[z].color );
  88. addl3dTarget( k, 280, az, el, b[z].color );
  89. };
  90. };
  91. let isUserInteracting = false, onPointerDownMouseX = 0, onPointerDownMouseY = 0,
  92. lon = 0, onPointerDownLon = 0,
  93. lat = 0, onPointerDownLat = 0,
  94. phi = 0, theta = 0;
  95. function onWindowResize() {
  96. camera.aspect = window.innerWidth / window.innerHeight;
  97. camera.updateProjectionMatrix();
  98. renderer.setSize( window.innerWidth, window.innerHeight );
  99. };
  100. function onPointerDown( event ) {
  101. if ( event.isPrimary === false ) return;
  102. isUserInteracting = true;
  103. onPointerDownMouseX = event.clientX;
  104. onPointerDownMouseY = event.clientY;
  105. onPointerDownLon = lon;
  106. onPointerDownLat = lat;
  107. document.addEventListener( 'pointermove', onPointerMove );
  108. document.addEventListener( 'pointerup', onPointerUp );
  109. };
  110. function onPointerMove( event ) {
  111. if ( event.isPrimary === false ) return;
  112. lon = ( onPointerDownMouseX - event.clientX ) * 0.1 + onPointerDownLon;
  113. lat = ( event.clientY - onPointerDownMouseY ) * 0.1 + onPointerDownLat;
  114. };
  115. function onPointerUp() {
  116. if ( event.isPrimary === false ) return;
  117. isUserInteracting = false;
  118. document.removeEventListener( 'pointermove', onPointerMove );
  119. document.removeEventListener( 'pointerup', onPointerUp );
  120. };
  121. function onDocumentMouseWheel( event ) {
  122. var id = event.currentTarget.myVID;
  123. if( id > 0 ){
  124. const fov = nodeTHREEviewers[id].camera.fov + event.deltaY * 0.05;
  125. nodeTHREEviewers[id].camera.fov = THREE.MathUtils.clamp( fov, 10, 75 );
  126. nodeTHREEviewers[id].camera.updateProjectionMatrix();
  127. };
  128. };
  129. function reload3dTexture( id ){
  130. if( typeof nodeTHREEviewers[id] !== 'undefined' ){
  131. stopAnimation();
  132. //while( nodeTHREEviewers[id].scene.children.length > 0){
  133. // nodeTHREEviewers[id].scene.remove(nodeTHREEviewers[id].scene.children[0]);
  134. //};
  135. nodeTHREEviewers[id].scene.remove( nodeTHREEviewers[id].mesh );
  136. //nodeTHREEviewers[id].mesh.geometry.dispose();
  137. //nodeTHREEviewers[id].mesh.material.dispose();
  138. delete nodeTHREEviewers[id].mesh;
  139. delete nodeTHREEviewers[id].material;
  140. delete nodeTHREEviewers[id].texture;
  141. delete nodeTHREEviewers[id].geometry;
  142. nodeTHREEviewers[id].geometry = new THREE.SphereGeometry( 500, 60, 40 );
  143. nodeTHREEviewers[id].geometry.scale( -1, 1, 1 );
  144. nodeTHREEviewers[id].texture = new THREE.TextureLoader().load( '/lib/controller/getDeviceDraw.php?NID='+id );
  145. nodeTHREEviewers[id].material = new THREE.MeshBasicMaterial( { map: nodeTHREEviewers[id].texture } );
  146. nodeTHREEviewers[id].mesh = new THREE.Mesh( nodeTHREEviewers[id].geometry, nodeTHREEviewers[id].material );
  147. nodeTHREEviewers[id].scene.add( nodeTHREEviewers[id].mesh );
  148. animate();
  149. //nodeTHREEviewers[id].material.map.needsUpdate = true;
  150. //nodeTHREEviewers[id].material.needsUpdate = true
  151. //alert( ' reloadded ' );
  152. };
  153. };
  154. function stopAnimation(){
  155. if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId );
  156. };
  157. function animate( ) {
  158. if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId );
  159. nodeTHREEanimationId = requestAnimationFrame( animate );
  160. nodeTHREEviewers.forEach( function(element, index, array){
  161. if ( isUserInteracting === false ) {
  162. lon += 0.5;
  163. }
  164. lat = Math.max( - 85, Math.min( 85, lat ) );
  165. phi = THREE.MathUtils.degToRad( 90 - lat );
  166. theta = THREE.MathUtils.degToRad( lon );
  167. const x = 500 * Math.sin( phi ) * Math.cos( theta );
  168. const y = 500 * Math.cos( phi );
  169. const z = 500 * Math.sin( phi ) * Math.sin( theta );
  170. element.camera.lookAt( x, y, z );
  171. element.renderer.render( element.scene, element.camera );
  172. });
  173. //update( id );
  174. };
  175. function animateTargets(){
  176. if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId );
  177. nodeTHREEanimationId = requestAnimationFrame( animateTargets );
  178. nodeTHREEviewers.forEach( function(element, index, array){
  179. if ( isUserInteracting === false ) {
  180. if( element.targetShowCopunter ){
  181. element.targetShowCopunter--;
  182. } else {
  183. element.camera.lookAt( element.targets[element.targetIndex].mesh.position );
  184. element.targetShowCopunter = 100;
  185. element.renderer.render( element.scene, element.camera );
  186. element.targetIndex++;
  187. if( element.targetIndex == element.targets.length ) element.targetIndex = 0;
  188. };
  189. };
  190. });
  191. };
  192. function update() {
  193. if ( isUserInteracting === false ) {
  194. lon += 0.5;
  195. }
  196. lat = Math.max( - 85, Math.min( 85, lat ) );
  197. phi = THREE.MathUtils.degToRad( 90 - lat );
  198. theta = THREE.MathUtils.degToRad( lon );
  199. const x = 500 * Math.sin( phi ) * Math.cos( theta );
  200. const y = 500 * Math.cos( phi );
  201. const z = 500 * Math.sin( phi ) * Math.sin( theta );
  202. camera.lookAt( x, y, z );
  203. renderer.render( scene, camera );
  204. };
  205. function Pie(cx, cy, radius, data) {
  206. var decimals = 4;
  207. var total = 0;
  208. var offset = 0;
  209. var offset2;
  210. var arr = [];
  211. var x;
  212. var y;
  213. var la;
  214. var radians;
  215. for (var i = 0; i < data.length; i++)
  216. total += data[i].value;
  217. for (var i = 0; i < data.length; i++) {
  218. var item = data[i];
  219. var tmp = {};
  220. tmp.index = i;
  221. tmp.value = item.value;
  222. radians = ((((item.value / total) * 360) * Math.PI) / 180).floor(decimals);
  223. offset2 = ((offset / total) * 360).floor(decimals);
  224. tmp.data = item;
  225. x = (cx + Math.sin(radians) * radius).floor(decimals);
  226. y = (cy - Math.cos(radians) * radius).floor(decimals);
  227. la = radians > Math.PI ? 1 : 0;
  228. // Arc
  229. tmp.d = 'M{0} {1},L{0} {2},A{3} {3},0 {4} 1,{5} {6}Z'.format(cx, cy, cy - radius, radius, la, x, y);
  230. tmp.transform = 'rotate({0}, {1}, {2})'.format(offset2, cx, cy);
  231. // Text
  232. x = (cx + Math.sin(radians / 2) * radius / 2).floor(decimals);
  233. y = (cy - Math.cos(radians / 2) * radius / 2).floor(decimals);
  234. tmp.text = 'x="{0}" y="{1}" transform="rotate({2},{0},{1})"'.format(x, y, -offset2);
  235. offset += item.value;
  236. arr.push(tmp);
  237. }
  238. return arr;
  239. }
  240. function Donut(cx, cy, radius, data) {
  241. function arcradius(cx, cy, radius, degrees) {
  242. var radians = (degrees - 90) * Math.PI / 180.0;
  243. return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) };
  244. }
  245. var decimals = 4;
  246. var total = 0;
  247. var arr = [];
  248. var beg = 0;
  249. var end = 0;
  250. var count = 0;
  251. var half = radius / 2;
  252. var midpoint = radius / 2.4;
  253. for (var i = 0; i < data.length; i++)
  254. total += data[i].value;
  255. for (var i = 0; i < data.length; i++) {
  256. var item = data[i];
  257. var tmp = {};
  258. //var p = (((item.value + 1) / total) * 100).floor( 2 );
  259. var p = Math.floor(((item.value + 1) / total) * 100);
  260. count += p;
  261. if (i === length - 1 && count < 100)
  262. p = p + (100 - count);
  263. end = beg + ((360 / 100) * p);
  264. tmp.index = i;
  265. tmp.value = item.value;
  266. tmp.data = item;
  267. var b = arcradius(cx, cy, radius, end);
  268. var e = arcradius(cx, cy, radius, beg);
  269. var la = (end - beg) <= 180 ? 0 : 1;
  270. tmp.d = ['M', Math.floor( b.x ), Math.floor( b.y ), 'A', radius, radius, 0, la, 0, Math.floor( e.x ), Math.floor( e.y ) ].join(' ');
  271. arr.push(tmp);
  272. beg = end;
  273. }
  274. return arr;
  275. }
  276. //Pie Chart Usage
  277. /*
  278. var svg = $('#yoursvgelement');
  279. var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }];
  280. var centerX = 300;
  281. var centerY = 300;
  282. var radius = 250;
  283. var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453'];
  284. var arr = Pie(centerX, centerY, radius, data);
  285. for (var i = 0; i < arr.length; i++) {
  286. var item = arr[i];
  287. svg.asvg('<g transform="{0}"><path d="{1}" fill="{4}" /><text fill="white" font-size="25" {2}>{3}</text></g>'.format(item.transform, item.d, item.text, item.value, color[i]));
  288. }
  289. */
  290. // Donut Chart Usage
  291. /*
  292. var svg = $('#yoursvgelement');
  293. var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }];
  294. var centerX = 300;
  295. var centerY = 300;
  296. var radius = 250;
  297. var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453'];
  298. var arr = Donut(centerX, centerY, radius, data);
  299. for (var i = 0; i < arr.length; i++) {
  300. var item = arr[i];
  301. svg.asvg('<g><path d="{0}" stroke="{1}" fill="none" stroke-width="50" /></g>'.format(item.d, color[i]));
  302. }
  303. */
  304. function makePtzMove( me ){
  305. var name = me.target.id;
  306. Ext.Ajax.request({
  307. url: '/lib/controller/camMakeMove.php',
  308. params: {
  309. SITE: <?=$SiteID;?>,
  310. UID: <?=$UserID;?>,
  311. SID: '<?=$Session;?>',
  312. CMD: name
  313. },
  314. //success: function( response, opts ){
  315. //},
  316. failure: failureAJAXFunction
  317. });
  318. };
  319. function ptzCtrl( a ){
  320. };
  321. function makePtzStop( me ){
  322. var name = me.target.id;
  323. Ext.Ajax.request({
  324. url: '/lib/controller/camStop.php',
  325. params: {
  326. SITE: <?=$SiteID;?>,
  327. UID: <?=$UserID;?>,
  328. SID: '<?=$Session;?>',
  329. CMD: name
  330. },
  331. //success: function( response, opts ){
  332. //},
  333. failure: failureAJAXFunction
  334. });
  335. };
  336. function fullScreen( id ){
  337. // if already full screen; exit
  338. // else go fullscreen
  339. if(
  340. document.fullscreenElement ||
  341. document.webkitFullscreenElement ||
  342. document.mozFullScreenElement ||
  343. document.msFullscreenElement
  344. ){
  345. if( document.exitFullscreen ){
  346. document.exitFullscreen();
  347. }else if( document.mozCancelFullScreen ){
  348. document.mozCancelFullScreen();
  349. }else if( document.webkitExitFullscreen ){
  350. document.webkitExitFullscreen();
  351. }else if( document.msExitFullscreen ){
  352. document.msExitFullscreen();
  353. };
  354. }else{
  355. //element = $('#container').get(0);
  356. var element = document.getElementById( id ); //Ext.getCmp( id );
  357. if( element.requestFullscreen ){
  358. element.requestFullscreen();
  359. }else if( element.mozRequestFullScreen ){
  360. element.mozRequestFullScreen();
  361. }else if( element.webkitRequestFullscreen ){
  362. element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
  363. }else if( element.msRequestFullscreen ){
  364. element.msRequestFullscreen();
  365. };
  366. };
  367. };
  368. function updateDashBoardItemLayout( id, x, y ){
  369. Ext.Ajax.request({
  370. url: '/lib/controller/updateDashBoardItems.php',
  371. params: {
  372. SITE: <?=$SiteID;?>,
  373. UID: <?=$UserID;?>,
  374. SID: '<?=$Session;?>',
  375. PANEL: id,
  376. X: x,
  377. Y: y
  378. },
  379. success: function( response, opts ){
  380. //var data = Ext.decode(response.responseText);
  381. //var tPanel = Ext.getCmp('main_portal');
  382. //tPanel.removeAll(true);
  383. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  384. //tPanel.doLayout();
  385. },
  386. failure: failureAJAXFunction
  387. });
  388. };
  389. var drawZoomLevels = Array();
  390. function cleanup2DDraw( a ){
  391. var canvas = document.getElementById('targ_canvas_'+a );
  392. var img = document.getElementById('draw_img_'+a );
  393. if( canvas != 'undefined' ){
  394. canvas.style='display: block; cursor: crosshair;'; //cursor: auto;
  395. img.style='display: none;';
  396. var ctx = canvas.getContext('2d');
  397. ctx.drawImage( img, 0, 0 );
  398. };
  399. };
  400. function Draw2DTargets( k, b ){
  401. var canvas = document.getElementById('targ_canvas_'+k );
  402. var ctx = canvas.getContext('2d');
  403. var img = document.getElementById('draw_img_'+k );
  404. ctx.drawImage( img, 0, 0 );
  405. canvas.style='display: block;';
  406. img.style='display: none;';
  407. for( var i=0; i< b.length; i++ ){
  408. switch( drawZoomLevels[k] ){
  409. case 12:{
  410. if( b[i].digital < 256 ){
  411. var cc = 255 - i ;//* ( 255 / 33 );
  412. //ctx.fillStyle = "#" + cc.toString(16) + "0000";
  413. ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")";
  414. //ctx.strokeStyle = "#FF0000";
  415. var r = (196 * b[i].digital)/ 512;
  416. var a = -1.0 * b[i].az * ( Math.PI / 180 );
  417. var x = 100 + Math.cos( a ) * r;
  418. var y = 100 + Math.sin( a ) * r;
  419. ctx.fillRect( x, y, 24, 24 );
  420. };
  421. break;
  422. };
  423. case 25:{
  424. if( b[i].digital < 512 ){
  425. var cc = 255 - i ;//* ( 255 / 33 );
  426. //ctx.fillStyle = "#" + cc.toString(16) + "0000";
  427. ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")";
  428. //ctx.strokeStyle = "#FF0000";
  429. var r = (196 * b[i].digital)/ 1024;
  430. var a = -1.0 * b[i].az * ( Math.PI / 180 );
  431. var x = 100 + Math.cos( a ) * r;
  432. var y = 100 + Math.sin( a ) * r;
  433. ctx.fillRect( x, y, 12, 12 );
  434. };
  435. break;
  436. };
  437. case 50:{
  438. if( b[i].digital < 1024 ){
  439. var cc = 255 - i ;//* ( 255 / 33 );
  440. //ctx.fillStyle = "#" + cc.toString(16) + "0000";
  441. ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")";
  442. //ctx.strokeStyle = "#FF0000";
  443. var r = (196 * b[i].digital) / 2048;
  444. var a = -1.0 * b[i].az * ( Math.PI / 180 );
  445. var x = 100 + Math.cos( a ) * r;
  446. var y = 100 + Math.sin( a ) * r;
  447. ctx.fillRect( x, y, 6, 6 );
  448. };
  449. break;
  450. };
  451. case 100:{
  452. var cc = 255 - i ;//* ( 255 / 33 );
  453. //ctx.fillStyle = "#" + cc.toString(16) + "0000";
  454. ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")";
  455. //ctx.strokeStyle = "#FF0000";
  456. var r = (196 * b[i].digital)/ 4096;
  457. var a = -1.0 * b[i].az * ( Math.PI / 180 );
  458. var x = 100 + Math.cos( a ) * r;
  459. var y = 100 + Math.sin( a ) * r;
  460. ctx.fillRect( x, y, 3, 3 );
  461. break;
  462. };
  463. };
  464. };
  465. };
  466. var lastNotificationID = 0;
  467. function setDonatStatus( node_id, param_id, value ){
  468. var val1D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment1');
  469. var val2D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment2');
  470. var val3D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment3');
  471. var val1 = (value>-1)?value:0;
  472. var val2 = (value>-1)?100 - val1:0;//data.nodes[i].cpu5 * 100;
  473. var val3 = (value>-1)?0:100;//data.nodes[i].cpu15 * 100;
  474. var totalValue = document.getElementById('status_'+node_id+'_totalValue'+param_id);
  475. var total = val1+val2+val3;
  476. var per1 = val1/total*100;
  477. var per2 = val2/total*100;
  478. var per3 = val3/total*100;
  479. var offset = 25;
  480. if( ( val1 != undefined ) && ( value > -1 ) ){
  481. totalValue.textContent = val1+'%';
  482. } else {
  483. totalValue.textContent = 'No Data';
  484. };
  485. val1D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out";
  486. val1D.style.strokeDasharray = per1+" "+(100-per1);
  487. val1D.style.strokeDashoffset = offset;
  488. val2D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out";
  489. val2D.style.strokeDasharray = per2+" "+(100-per2);
  490. val2D.style.strokeDashoffset = 100-per1+offset;
  491. val3D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out";
  492. val3D.style.strokeDasharray = per3+" "+(100-per3);
  493. val3D.style.strokeDashoffset = 100-(per1+per2)+offset;
  494. };
  495. function fetchSiteStatus(){
  496. Ext.Ajax.request({
  497. url: '/lib/controller/getStatus.php',
  498. params: {
  499. SITE: <?=$SiteID;?>,
  500. LNID: lastNotificationID,
  501. SPID: StatusTS,
  502. LOAT: LoadTS,
  503. UID: <?=$UserID;?>,
  504. SID: '<?=$Session;?>'
  505. },
  506. success: function( response, opts ){
  507. var data = Ext.decode(response.responseText);
  508. StatusTS = data.CTS;
  509. if( data.nodes.length > 0 ){
  510. for( i=0; i < data.nodes.length; i++ ){
  511. if( data.nodes[i].type == 0 ){
  512. //Handle Server Status
  513. if ( data.nodes[i].status ){
  514. setDonatStatus( data.nodes[i].id, 0, data.nodes[i].cpu5 );
  515. setDonatStatus( data.nodes[i].id, 1, data.nodes[i].mem );
  516. setDonatStatus( data.nodes[i].id, 2, data.nodes[i].disk );
  517. } else {
  518. setDonatStatus( data.nodes[i].id, 0, -1 );
  519. setDonatStatus( data.nodes[i].id, 1, -1 );
  520. setDonatStatus( data.nodes[i].id, 2, -1 );
  521. };
  522. };
  523. // Sesors
  524. if( data.nodes[i].type > 0 && data.nodes[i].type < 7 ){
  525. if( data.nodes[i].reload_draw ){
  526. reload3dTexture( data.nodes[i].id );
  527. LoadTS = StatusTS;
  528. };
  529. };
  530. // Cameras
  531. if( data.nodes[i].type > 9 && data.nodes[i].type < 14 ){
  532. var iel = document.getElementById('img-'+data.nodes[i].id );
  533. if( iel != null ){
  534. if( !data.nodes[i].valid ){
  535. if( iel.src != "/style/assets/no-signal.png" ) iel.src = "/style/assets/no-signal.png";
  536. } else {
  537. if( data.nodes[i].src != iel.src ) iel.src = data.nodes[i].src;
  538. };
  539. };
  540. };
  541. var tt = Ext.getCmp('status_'+data.nodes[i].id );
  542. if( tt != undefined ){
  543. if( data.nodes[i].type < 5 && data.nodes[i].type > 0 ){
  544. if( data.nodes[i].status == 4 ){
  545. Draw2DTargets( data.nodes[i].id, data.nodes[i].targets );
  546. } else {
  547. cleanup2DDraw( data.nodes[i].id );
  548. };
  549. };
  550. if( data.nodes[i].type == 5 ){//addl3dTarget( id, radius, az, el, color = 0xff0000 )
  551. if( data.nodes[i].status == 4 ){
  552. //DrawTargets( data.nodes[i].id, data.nodes[i].targets );
  553. //addl3dTarget( data.nodes[i].id, data.nodes[i].targets[0].digital, data.nodes[i].targets[0].az, data.nodes[i].targets[0].el );
  554. //addl3dTarget( data.nodes[i].id, 150, data.nodes[i].targets[0].az, data.nodes[i].targets[0].el );
  555. Draw3DTargets( data.nodes[i].id, data.nodes[i].targets );
  556. animateTargets();
  557. } else {
  558. cleanup3DDraw( data.nodes[i].id );
  559. animate();
  560. };
  561. var ca = document.getElementById( 'status_canvas_' + data.nodes[i].id );
  562. var ctx = ca.getContext('2d');
  563. //if( stat_present );
  564. ca.style='display: block;';
  565. ctx.font = "10px Arial";
  566. ctx.fillStyle = "rgba(255, 255, 255, 255)";
  567. ctx.fillText( "Master:", 5, 8 );
  568. ctx.fillText( "Slave:", 5, 24 );
  569. //var cc = 255 - i ;//* ( 255 / 33 );
  570. //ctx.fillStyle = "#" + cc.toString(16) + "0000";
  571. //ctx.fillStyle = "rgba(255, 0, 0, 100)";//+((b.length - i)/ b.length )+")";
  572. if( data.nodes[i].master_present ){
  573. ctx.fillStyle = "rgba(0, 255, 0, 255)";
  574. } else {
  575. ctx.fillStyle = "rgba(128, 0, 0, 255)";
  576. };
  577. ctx.fillRect( 43, 1, 8, 8 );
  578. if( data.nodes[i].stat_present ){
  579. ctx.strokeStyle = "#FFFF00";
  580. ctx.strokeRect( 43, 1, 8, 8 );
  581. ctx.beginPath();
  582. ctx.moveTo( 51, 5 );
  583. ctx.lineTo( 56, 5 );
  584. ctx.lineTo( 56, 2 );
  585. ctx.lineTo( 103, 2 );
  586. ctx.lineTo( 103, 5 );
  587. ctx.moveTo( 63, 5 );
  588. ctx.lineTo( 143, 5 );
  589. ctx.stroke();
  590. for( z=0; z < 8; z++ ){
  591. //ctx.strokeStyle = "#FFFF00";
  592. //ctx.fillStyle = "rgba(0, 255, 0, 255)";
  593. ctx.fillStyle = "rgba(20, 20, 20, 255)";
  594. h = 19 - ( 19 * data.nodes[i].runtime.mp[z] );
  595. ha = 19 - h;
  596. ctx.fillRect( 64 + z*10, 7, 2, h );
  597. if( ha > 0 ) {
  598. if( data.nodes[i].runtime.mp[z] > 0.8 ){
  599. ctx.fillStyle = "rgba(0, 255, 0, 255)";
  600. } else if ( data.nodes[i].runtime.mp[z] > 0.5 ){
  601. ctx.fillStyle = "rgba( 255, 255, 0, 255)";
  602. } else if ( data.nodes[i].runtime.mp[z] > 0.3 ){
  603. ctx.fillStyle = "rgba( 255, 128, 0, 255)";
  604. } else {
  605. ctx.fillStyle = "rgba( 255, 0, 0, 255)";
  606. };
  607. ctx.fillRect( 64 + z*10, 7+h, 2, ha );
  608. };
  609. ctx.fillStyle = "rgba(20, 20, 20, 255)";
  610. h = 19 - ( 19 * data.nodes[i].runtime.gp[z] );
  611. ha = 19 - h;
  612. ctx.fillRect( 67 + z*10, 7, 2, h );
  613. if( ha > 0 ) {
  614. if( data.nodes[i].runtime.gp[z] > 0.8 ){
  615. ctx.fillStyle = "rgba(0, 255, 0, 255)";
  616. } else if ( data.nodes[i].runtime.gp[z] > 0.5 ){
  617. ctx.fillStyle = "rgba( 255, 255, 0, 255)";
  618. } else if ( data.nodes[i].runtime.gp[z] > 0.3 ){
  619. ctx.fillStyle = "rgba( 255, 128, 0, 255)";
  620. } else {
  621. ctx.fillStyle = "rgba( 255, 0, 0, 255)";
  622. };
  623. ctx.fillRect( 67 + z*10, 7+h, 2, ha );
  624. };
  625. ctx.fillStyle = "rgba(20, 20, 20, 255)";
  626. h = 19 - ( 19 * data.nodes[i].runtime.wp[z] );
  627. ha = 19 - h;
  628. ctx.fillRect( 70 + z*10, 7, 2, h );
  629. if( ha > 0 ){
  630. if( data.nodes[i].runtime.wp[z] > 0.8 ){
  631. ctx.fillStyle = "rgba(0, 255, 0, 255)";
  632. } else if ( data.nodes[i].runtime.wp[z] > 0.5 ){
  633. ctx.fillStyle = "rgba( 255, 255, 0, 255)";
  634. } else if ( data.nodes[i].runtime.wp[z] > 0.3 ){
  635. ctx.fillStyle = "rgba( 255, 128, 0, 255)";
  636. } else {
  637. ctx.fillStyle = "rgba( 255, 0, 0, 255)";
  638. };
  639. ctx.fillRect( 70 + z*10, 7+h, 2, ha );
  640. };
  641. };
  642. //ffmpeg -f v4l2 -framerate <framerate> -thread_queue_size 512 -i <input device> -f alsa -thread_queue_size 512 -i <input device> -t <duration of video> -c:v h264 -c:a aac -pix_fmt yuv420p <output filename>
  643. } else {
  644. ctx.strokeStyle = "#808080";
  645. ctx.strokeRect( 43, 1, 8, 8 );
  646. ctx.beginPath();
  647. ctx.moveTo( 51, 5 );
  648. ctx.lineTo( 56, 5 );
  649. ctx.lineTo( 56, 2 );
  650. ctx.lineTo( 103, 2 );
  651. ctx.lineTo( 103, 5 );
  652. ctx.moveTo( 63, 5 );
  653. ctx.lineTo( 143, 5 );
  654. ctx.stroke();
  655. ctx.fillStyle = "rgba( 128, 0, 0, 255)";
  656. for( z=0; z < 8; z++ ){
  657. ctx.fillRect( 64 + z*10, 7, 2, 19 );
  658. ctx.fillRect( 67 + z*10, 7, 2, 19 );
  659. ctx.fillRect( 70 + z*10, 7, 2, 19 );
  660. //https://www.ebay.com/itm/304440983138
  661. };
  662. };
  663. if( data.nodes[i].slave_present ){
  664. ctx.strokeStyle = "#FFFF00";
  665. ctx.fillStyle = "rgba(0, 255, 0, 255)";
  666. } else {
  667. ctx.strokeStyle = "#808080";
  668. ctx.fillStyle = "rgba(128, 0, 0, 255)";
  669. };
  670. ctx.fillRect( 43, 17, 8, 8 );
  671. ctx.strokeRect( 43, 17, 8, 8 );
  672. ctx.beginPath();
  673. ctx.moveTo( 51, 21 );
  674. ctx.lineTo( 56, 21 );
  675. ctx.lineTo( 56, 31 );
  676. ctx.lineTo( 187, 31 );
  677. ctx.lineTo( 187, 28 );
  678. ctx.moveTo( 147, 28 );
  679. ctx.lineTo( 227, 28 );
  680. ctx.stroke();
  681. for( z=8; z < 16; z++ ){
  682. //ctx.strokeStyle = "#FFFF00";
  683. //ctx.fillStyle = "rgba(0, 255, 0, 255)";
  684. ctx.fillRect( 68 + z*10, 7, 2, 19 );
  685. ctx.fillRect( 71 + z*10, 7, 2, 19 );
  686. ctx.fillRect( 74 + z*10, 7, 2, 19 );
  687. //ctx.strokeRect( 43, 1, 8, 8 );
  688. };
  689. };
  690. if( typeof nodeDashboardStatuses[i] === 'undefined' || nodeDashboardStatuses[i] != data.nodes[i].status ){
  691. nodeDashboardStatuses[i] = data.nodes[i].status;
  692. switch( data.nodes[i].status ){
  693. case 0:{
  694. if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id );
  695. tt.update('<table style="background-color:#808080; color:#ffff00;" border="0" width="100%"><tr><td>Offline</td><td width="16"><img width="16px" src="/style/assets/offline.png"></td></tr></table>');
  696. break;
  697. };
  698. case 1:{
  699. if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id );
  700. tt.update('<table style="background-color:#008000; color:#ffff00;" border="0" width="100%"><tr><td>Online</td><td width="16"><img width="16px" src="/style/assets/green_2.gif"></td></tr></table>');
  701. break;
  702. };
  703. case 2:{
  704. if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id );
  705. tt.update('<table style="background-color:#008000; color:#ffff00;" border="0" width="100%"><tr><td>Initializing</td><td width="16"><img width="16px" src="/style/assets/green_1.gif"></td></tr></table>');
  706. break;
  707. };
  708. case 3:{
  709. if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id );
  710. tt.update('<table style="background-color:#800000; color:#ffff00;" border="0" width="100%"><tr><td>Trouble</td><td width="16"><img width="16px" src="/style/assets/red_1.gif"></td></tr></table>');
  711. break;
  712. };
  713. case 4:{
  714. if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id, data.nodes[i].targets );
  715. tt.update('<table style="background-color:#ff0000; color:#ffff00;" border="0" width="100%"><tr><td>Alarm</td><td width="16"><img width="16px" src="/style/assets/red_2.gif"></td></tr></table>');
  716. break;
  717. };
  718. };
  719. };
  720. };
  721. };
  722. };
  723. if( data.notifications.length > 0 ){
  724. sndExcl.play();
  725. for( i=0; i < data.notifications.length; i++ ){
  726. /*const not = PNotify.alert({
  727. title: 'You Will Receive a Side',
  728. text: 'You have no choice.',
  729. icon: 'fas fa-info-circle',
  730. hide: false,
  731. closer: false,
  732. sticker: false,
  733. destroy: true,
  734. modules: new Map([
  735. ...PNotify.defaultModules,
  736. [PNotifyConfirm, {
  737. confirm: true,
  738. buttons: [{
  739. text: 'Ok',
  740. primary: true,
  741. click: notice => notice.close()
  742. }]
  743. }]
  744. ])
  745. });
  746. */
  747. const l = PNotify.alert({
  748. type: data.notifications[i].type,
  749. text: data.notifications[i].msg,
  750. textTrusted: true,
  751. stack: NotificationStack,
  752. title: data.notifications[i].action,
  753. hide: data.notifications[i].hide,
  754. closer: data.notifications[i].hide,
  755. sticker: data.notifications[i].hide,
  756. destroy: true,
  757. modules: (data.notifications[i].react )? new Map([
  758. ...PNotify.defaultModules,
  759. [PNotifyConfirm, {
  760. confirm: true,
  761. buttons: [{
  762. text: 'Ok',
  763. primary: true,
  764. click: ( notice, value, evt ) => {
  765. notice.close();
  766. if( notice.title!='' ){
  767. resolveDeviceMistmatch( notice.title );
  768. };
  769. }
  770. }]
  771. }]
  772. ]): null
  773. });
  774. /*
  775. if( data.notifications[i].react ){
  776. l.on('click', (notice, value) => {
  777. notice.close();
  778. resolveDeviceMistmatch( notice.title );
  779. });
  780. };
  781. */
  782. lastNotificationID = data.notifications[i].id;
  783. };
  784. };
  785. },
  786. failure: failureAJAXFunction
  787. });
  788. };
  789. function loadDashBoard(){
  790. if( tlInterval!= null ){
  791. window.clearInterval( tlInterval );
  792. tlInterval = null;
  793. timelineObj = null;
  794. };
  795. setUserContent( 0 );
  796. Ext.Ajax.request({
  797. url: '/lib/controller/getDashBoardItems.php',
  798. params: {
  799. SITE: <?=$SiteID;?>,
  800. UID: <?=$UserID;?>,
  801. SID: '<?=$Session;?>'
  802. },
  803. success: function( response, opts ){
  804. var data = Ext.decode(response.responseText);
  805. Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel('_SYS_DASHBOARD_');?>' );
  806. var tPanel = Ext.getCmp('main_portal');
  807. tPanel.removeAll(true);
  808. nodeDashboardStatuses = new Array();
  809. for( i=0; i < data.length; i++) tPanel.add( data[i] );
  810. tPanel.doLayout();
  811. $('img[data-enlargeable]').addClass('img-enlargeable').click(function() {
  812. var src = $(this).attr('src');
  813. var modal;
  814. function removeModal() {
  815. modal.remove();
  816. $('body').off('keyup.modal-close');
  817. }
  818. modal = $('<div>').css({
  819. background: 'RGBA(0,0,0,.5) url(' + src + ') no-repeat center',
  820. backgroundSize: 'contain',
  821. width: '100%',
  822. height: '100%',
  823. position: 'fixed',
  824. zIndex: '10000',
  825. top: '0',
  826. left: '0',
  827. cursor: 'zoom-out'
  828. }).click(function() {
  829. removeModal();
  830. }).appendTo('body');
  831. //handling ESC
  832. $('body').on('keyup.modal-close', function(e) {
  833. if (e.key === 'Escape') {
  834. removeModal();
  835. }
  836. });
  837. });
  838. tlInterval = window.setInterval( fetchSiteStatus, 333, selectedSite );
  839. },
  840. failure: failureAJAXFunction
  841. });
  842. };
  843. function showServerToolBox( ServerNodeId ){
  844. currentNodeID = ServerNodeId;
  845. if( serverToolBox == null ){
  846. serverToolBox = new Ext.Window({
  847. title: '<?=$Labels->GetLabel('_SERV_CTLPANEL_SHRT_');?>',
  848. modal: true,
  849. width: 400,
  850. height: 328,
  851. closeAction: 'hide',
  852. items:[{
  853. xtype: 'button',
  854. text: 'Restart',
  855. width: '100%',
  856. textAlign: 'left',
  857. iconCls: 'server_btn_restart',
  858. scale: 'large',
  859. iconAlign: 'left',
  860. handler: function(){
  861. doDeviceOperation( currentNodeID, 250 );
  862. }
  863. },{
  864. xtype: 'button',
  865. text: 'Initialize Hardware',
  866. width: '100%',
  867. textAlign: 'left',
  868. iconCls: 'server_btn_hwinit',
  869. scale: 'large',
  870. iconAlign: 'left',
  871. handler: function(){
  872. doDeviceOperation( currentNodeID, 251 );
  873. }
  874. },{
  875. xtype: 'button',
  876. text: 'Clear Site',
  877. width: '100%',
  878. textAlign: 'left',
  879. iconCls: 'server_btn_restart',
  880. scale: 'large',
  881. iconAlign: 'left'
  882. }]
  883. });
  884. };
  885. serverToolBox.show();
  886. };
  887. var detectionProfileWindow = null;
  888. var deviceCtrlNode = '';
  889. function showSensorToolBox( NodeID ){
  890. currentNodeID = NodeID;
  891. deviceCtrlNode = NodeID + ':0';
  892. <?php if( $CUser->Data['access']>4 ) $ColSpan = 4; else $ColSpan = 3; ?>
  893. if( detectionProfileWindow == null ){
  894. detectionProfileWindow = new Ext.Window({
  895. title: '<?=$Labels->GetLabel('_DEV_CTLPANEL_SHRT_');?>',
  896. modal: true,
  897. width: <?=$ColSpan*80+16;?>,
  898. height: 328,
  899. closeAction: 'hide',
  900. items:[]
  901. });
  902. };
  903. detectionProfileWindow.show();
  904. var myMask = new Ext.LoadMask( detectionProfileWindow.getEl(), {msg:"Please wait..."});
  905. myMask.show();
  906. Ext.Ajax.request({
  907. url: '/lib/controller/getDetectionProfile.php',
  908. params: {
  909. SITE: SelectedSite,
  910. UID: <?=$UserID;?>,
  911. SID: '<?=$Session;?>',
  912. NID: NodeID
  913. },
  914. success: function( response, opts ){
  915. var data = Ext.decode( response.responseText );
  916. myMask.hide();
  917. detectionProfileWindow.setTitle( '['+data.name + '] <?=$Labels->GetLabel('_DEV_CTLPANEL_SHRT_');?>');
  918. detectionProfileWindow.removeAll( true );
  919. //detectionProfileWindow.setSize( data.width, data.height );
  920. if( data.additional !== 'undefined' ){
  921. var addi = Ext.decode( data.additional );
  922. detectionProfileWindow.add( addi );
  923. };
  924. if( data.data_status == 3 ){
  925. detectionProfileWindow.add({
  926. xtype: 'panel',
  927. layout: 'table',
  928. layoutConfig: {
  929. columns: <?=$ColSpan;?>
  930. },
  931. items:[{
  932. xtype: 'spacer',
  933. height: 30,
  934. style: {
  935. marginTop: '13px'
  936. },
  937. html: '<center><?=$Labels->GetLabel('_DET_SENSITIVITY_');?></center>',
  938. colspan: <?=$ColSpan;?>
  939. },<?php
  940. if( $CUser->Data['access']>4 ){
  941. ?>{
  942. xtype: 'button',
  943. text: 'Factory',
  944. id: 'DDSPBTN0',
  945. width: 80,
  946. iconCls: 'detection_btn_factory',
  947. enableToggle: true,
  948. toggleGroup: 'det_sens_btn_grp',
  949. disabled: true,
  950. scale: 'large',
  951. iconAlign: 'top'
  952. },<?php
  953. };
  954. ?>{
  955. xtype: 'button',
  956. text: 'Low',
  957. id: 'DDSPBTN1',
  958. width: 80,
  959. iconCls: 'detection_btn_low',
  960. enableToggle: true,
  961. toggleGroup: 'det_sens_btn_grp',
  962. disabled: true,
  963. scale: 'large',
  964. iconAlign: 'top'
  965. },{
  966. xtype: 'button',
  967. text: 'Meduim',
  968. id: 'DDSPBTN2',
  969. width: 80,
  970. iconCls: 'detection_btn_medium',
  971. enableToggle: true,
  972. toggleGroup: 'det_sens_btn_grp',
  973. disabled: true,
  974. scale: 'large',
  975. iconAlign: 'top'
  976. },{
  977. xtype: 'button',
  978. text: 'High',
  979. id: 'DDSPBTN3',
  980. width: 80,
  981. iconCls: 'detection_btn_high',
  982. enableToggle: true,
  983. toggleGroup: 'det_sens_btn_grp',
  984. disabled: true,
  985. scale: 'large',
  986. iconAlign: 'top'
  987. }]
  988. });
  989. for( i=0; i < data.profiles.length; i++ ){
  990. Ext.getCmp('DDSPBTN'+data.profiles[i] ).enable();
  991. if( i == data.profile_id ) Ext.getCmp('DDSPBTN'+data.profiles[i] ).toggle();
  992. };
  993. } else if( data.data_status == 4 ){
  994. detectionProfileWindow.add({
  995. xtype: 'panel',
  996. //layout: 'fit',
  997. //layoutConfig: {
  998. // columns: 3
  999. //},
  1000. items:[{
  1001. xtype: 'spacer',
  1002. height: 40,
  1003. //colspan: 3,
  1004. style: {
  1005. marginTop: '20px'
  1006. },
  1007. html: '<center><?=$Labels->GetLabel('_DET_SENSITIVITY_');?></center>',
  1008. }<?php
  1009. if( $CUser->Data['access']>4 ){
  1010. ?>,{
  1011. xtype: 'button',
  1012. text: 'Resolve Trouble',
  1013. width: '100%',
  1014. //colspan: 3,
  1015. iconCls: 'ctrl_panel_cog',
  1016. scale: 'large',
  1017. iconAlign: 'left',
  1018. handler: function(){
  1019. detectionProfileWindow.hide();
  1020. resolveDeviceMistmatch( deviceCtrlNode );
  1021. }
  1022. }<?php
  1023. };
  1024. ?>]
  1025. });
  1026. };
  1027. detectionProfileWindow.add({
  1028. xtype: 'spacer',
  1029. height: 30,
  1030. style: {
  1031. marginTop: '13px'
  1032. },
  1033. html: '<center><?=$Labels->GetLabel('_DET_GENWORKS_');?></center>',
  1034. });
  1035. detectionProfileWindow.add({
  1036. xtype: 'button',
  1037. width: '100%',
  1038. text: 'Clear Alarm',
  1039. scale: 'large',
  1040. iconCls: 'ctrl_panel_clean',
  1041. iconAlign: 'left'
  1042. });
  1043. detectionProfileWindow.add({
  1044. xtype: 'button',
  1045. width: '100%',
  1046. text: 'Draw Background',
  1047. scale: 'large',
  1048. iconCls: 'ctrl_panel_drawscan',
  1049. iconAlign: 'left',
  1050. handler: function(){
  1051. doDeviceOperation( deviceCtrlNode, 3 );
  1052. }
  1053. });
  1054. detectionProfileWindow.add({
  1055. xtype: 'button',
  1056. width: '100%',
  1057. text: 'Force Study Background',
  1058. scale: 'large',
  1059. iconCls: 'ctrl_panel_study',
  1060. iconAlign: 'left',
  1061. handler: function(){
  1062. doDeviceOperation( deviceCtrlNode, 2 );
  1063. }
  1064. });
  1065. detectionProfileWindow.add({
  1066. xtype: 'button',
  1067. width: '100%',
  1068. buttonAlign: 'left',
  1069. //text: '<table width="100%" border=1><tr><td style="text-align:left">Button 1</td></tr></table>',
  1070. text: 'Force Reset Sensor',
  1071. scale: 'large',
  1072. iconCls: 'ctrl_panel_reset',
  1073. iconAlign: 'left',
  1074. handler: function(){
  1075. doDeviceOperation( deviceCtrlNode, 1 );
  1076. }
  1077. });
  1078. detectionProfileWindow.doLayout();
  1079. //detectionProfileWindow.show();
  1080. },
  1081. failure: failureAJAXFunction
  1082. });
  1083. };