Web Interface For Lite Argus Control modules
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.

490 lines
20 KiB

4 years ago
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
4 years ago
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. $UID = intval( $CUser->Data['id'] );
  4. $Data = '';
  5. if( $UID > 1 ){
  6. $QS = "SELECT * FROM `system_props` LIMIT 1";
  7. $SPD = $DATABASE->Query( $QS );
  8. $QS = "SELECT * FROM `users` WHERE `id`={$UID}";
  9. $EPD = $DATABASE->Query( $QS );
  10. if( count( $SPD ) ){
  11. $SP = $SPD[0];
  12. $UP = $EPD[0];
  13. $DUMMY = array();
  14. if( $CUser->Data['access'] > 5 ){
  15. $TABA =<<<_DATA_BOUNDARY
  16. {
  17. xtype: 'panel',
  18. html: '<table id="tbl_ph_ccc_%%ID%%" style="color: black; background-image: url(\'/style/assets/16-9-nocam.png\');" width="100%" border=0><tr><td colspan=3>&nbsp;</td></tr><tr><td>&nbsp;</td><td align="center"><div id="btn_ph_ccc_%%ID%%"></div></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>',
  19. listeners:{
  20. afterrender : function( ){
  21. var tb = document.getElementById('tbl_ph_ccc_%%ID%%');
  22. var W = tb.offsetWidth;
  23. var H = (W/16)*9;
  24. tb.setAttribute("height", H );
  25. tb.style.backgroundSize=W+"px "+H+"px";
  26. var p = Ext.getCmp('pan_ph_ccc_%%ID%%');
  27. p.setHeight( H+40 );
  28. var jaja = Ext.create({
  29. xtype: 'panel',
  30. title: 'Camera is Not Assigned to the System',
  31. frame: true,
  32. renderTo: 'btn_ph_ccc_%%ID%%',
  33. layout: 'vbox',
  34. width: 500,
  35. height: 120,
  36. items:[{
  37. xtype: 'spacer',
  38. height: 10
  39. },{
  40. width: '100%',
  41. html: '<center>Proceed to Cameras Settings to Assign One</center>'
  42. },{
  43. xtype: 'spacer',
  44. height: 20
  45. },{
  46. xtype: 'button',
  47. width: '100%',
  48. text: 'Open Camera Settings',
  49. handler: function(){
  50. showContent( 2020 );
  51. }
  52. }]
  53. });
  54. jaja.doLayout();
  55. }
  56. }
  57. }
  58. _DATA_BOUNDARY;
  59. $DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
  60. $DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 66+W );}}}";
  61. } else {
  62. $DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
  63. $DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
  64. $DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  65. $DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  66. };
  67. $LOGIO=<<<_DATA_BOUNDARY
  68. {
  69. xtype: 'grid',
  70. id: 'rep_grid',
  71. border: false,
  72. frame: false,
  73. autoScroll: true,
  74. //width: '100%',
  75. lazyRender: true,
  76. height: 210,
  77. ds: rep_store,
  78. tbar:[{
  79. text: 'Analyze Bubbles',
  80. handler: doBubbleAnalyze
  81. }],
  82. cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
  83. sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
  84. viewConfig: {
  85. forceFit: true,
  86. getRowClass: function( record, rowIndex, rowParams, store){
  87. switch( record.get('node_id')%5 ){
  88. case 0: return 'row-level01';
  89. case 1: return 'row-level02';
  90. case 2: return 'row-level03';
  91. case 3: return 'row-level04';
  92. case 4: return 'row-level05';
  93. };
  94. return '';
  95. }
  96. },
  97. listeners:{
  98. afterrender : function( t ){
  99. var papa = Ext.getCmp('segment_portal');
  100. var jj = papa.getComponent( 1 ).getHeight();
  101. var mama = Ext.getCmp('lg_panel');
  102. var R = PanelH - jj - 30;
  103. mama.setHeight( R+40 );
  104. t.setHeight( R );
  105. }
  106. }
  107. }
  108. _DATA_BOUNDARY;
  109. $MAPIO=<<<_DATA_BOUNDARY
  110. {
  111. id: 'report_map',
  112. height: 200,
  113. title: 'Map',
  114. frame: true,
  115. draggable: false,
  116. collapsible: false,
  117. html: '&nbsp;',
  118. listeners:{
  119. afterrender : function( t ){
  120. var papa = Ext.getCmp('segment_portal');
  121. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  122. //alert( jj );
  123. t.setHeight( jj + 30 );
  124. geoMapIsPresent = true;
  125. initMapReporting();
  126. }
  127. }
  128. }
  129. _DATA_BOUNDARY;
  130. //$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  131. $DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}} }";
  132. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  133. $STA = array();
  134. $END="]}";
  135. $OUT = array();
  136. //$OUT[] = "{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[{html:'App Type:{$SP['type']}'}]}";
  137. switch( $SP['type'] ){
  138. case 0:{
  139. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  140. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  141. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  142. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  143. $MH = 4;
  144. $DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
  145. $DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*4);}} }";
  146. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  147. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  148. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  149. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  150. break;
  151. };
  152. case 1:{
  153. //Metro
  154. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  155. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  156. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  157. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  158. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10";// AND `enable`=1";
  159. $R = $DATABASE->Query( $QS );
  160. $idx = 0;
  161. if( count( $R ) ){
  162. foreach( $R as $DD ){
  163. if( $idx < 2 ){
  164. $TFN = 'report/node_' . $DD['type'] . '.js';
  165. if(!file_exists( $TFN )) continue;
  166. $TPL = file_get_contents( $TFN );
  167. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  168. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  169. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  170. $OUT[]= $STA[$idx] . $TPL . $END;
  171. } else break;
  172. $idx++;
  173. };
  174. if( $idx < 2 ){
  175. for( ;$idx<2;$idx++ ){
  176. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  177. };
  178. };
  179. } else {
  180. for( ;$idx<2;$idx++ ){
  181. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  182. };
  183. };
  184. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 ";// AND `enable`=1";
  185. $R = $DATABASE->Query( $QS );
  186. $idx = 0;
  187. if( count( $R ) ){
  188. foreach( $R as $DD ){
  189. if( $idx < 1 ){
  190. $TFN = 'report/node_' . $DD['type'] . '.js';
  191. if(!file_exists( $TFN )) continue;
  192. $TPL = file_get_contents( $TFN );
  193. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  194. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  195. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  196. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  197. $Z=$DATABASE->Query( $QS );
  198. $QS="SELECT * FROM `module_eve` LIMIT 1";
  199. $S=$DATABASE->Query( $QS );
  200. $MODULE_DATA = $S[0];
  201. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  202. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  203. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  204. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  205. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  206. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  207. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  208. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  209. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  210. $W = 244;
  211. $H = $W * $FK;
  212. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  213. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  214. $OUT[]= $STA[2+$idx] . $TPL . $END;
  215. } else break;
  216. $idx++;
  217. };
  218. if( $idx < 1 ){
  219. for( ;$idx<1;$idx++ ){
  220. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  221. $OUT[]= $STA[2+$idx] . $T . $END;
  222. };
  223. };
  224. } else {
  225. for( ;$idx<1;$idx++ ){
  226. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  227. $OUT[]= $STA[2+$idx] . $T . $END;
  228. };
  229. };
  230. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  231. break;
  232. };
  233. case 2:{
  234. //Muazot A
  235. $STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  236. $STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  237. $STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  238. $STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
  239. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 AND `enable`=1";
  240. $R = $DATABASE->Query( $QS );
  241. $idx = 0;
  242. if( count( $R ) ){
  243. foreach( $R as $DD ){
  244. if( $idx < 2 ){
  245. $TFN = 'report/node_' . $DD['type'] . '.js';
  246. if(!file_exists( $TFN )) continue;
  247. $TPL = file_get_contents( $TFN );
  248. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  249. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  250. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  251. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  252. $Z=$DATABASE->Query( $QS );
  253. $QS="SELECT * FROM `module_eve` LIMIT 1";
  254. $S=$DATABASE->Query( $QS );
  255. $MODULE_DATA = $S[0];
  256. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  257. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  258. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  259. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  260. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  261. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  262. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  263. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  264. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  265. $W = 244;
  266. $H = $W * $FK;
  267. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  268. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  269. $OUT[]= $STA[$idx] . $TPL . $END;
  270. } else break;
  271. $idx++;
  272. };
  273. if( $idx < 2 ){
  274. for( ;$idx<2;$idx++ ){
  275. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  276. $OUT[]= $STA[$idx] . $T . $END;
  277. };
  278. };
  279. } else {
  280. for( ;$idx<2;$idx++ ){
  281. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  282. $OUT[]= $STA[$idx] . $T . $END;
  283. };
  284. };
  285. $OUT[]= $STA[2] . $DUMMY['map'] . $END;
  286. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  287. break;
  288. };
  289. case 4:{
  290. //Mekorot
  291. $STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  292. $STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  293. $STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  294. $STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  295. $STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  296. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  297. $R = $DATABASE->Query( $QS );
  298. $idx = 0;
  299. if( count( $R ) ){
  300. foreach( $R as $DD ){
  301. if( $idx < 3 ){
  302. $TFN = 'report/node_' . $DD['type'] . '.js';
  303. if(!file_exists( $TFN )) continue;
  304. $TPL = file_get_contents( $TFN );
  305. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  306. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  307. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  308. $OUT[]= $STA[$idx] . $TPL . $END;
  309. } else break;
  310. $idx++;
  311. };
  312. if( $idx < 3 ){
  313. for( ;$idx<3;$idx++ ){
  314. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  315. };
  316. };
  317. } else {
  318. for( ;$idx<3;$idx++ ){
  319. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  320. };
  321. };
  322. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  323. $R = $DATABASE->Query( $QS );
  324. $idx = 0;
  325. if( count( $R ) ){
  326. foreach( $R as $DD ){
  327. if( $idx < 1 ){
  328. $TFN = 'report/node_' . $DD['type'] . '.js';
  329. if(!file_exists( $TFN )) continue;
  330. $TPL = file_get_contents( $TFN );
  331. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  332. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  333. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  334. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  335. $Z=$DATABASE->Query( $QS );
  336. $QS="SELECT * FROM `module_eve` LIMIT 1";
  337. $S=$DATABASE->Query( $QS );
  338. $MODULE_DATA = $S[0];
  339. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  340. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  341. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  342. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  343. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  344. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  345. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  346. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  347. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  348. $W = 244;
  349. $H = $W * $FK;
  350. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  351. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  352. $OUT[]= $STA[3+$idx] . $TPL . $END;
  353. } else break;
  354. $idx++;
  355. };
  356. if( $idx < 1 ){
  357. for( ;$idx<1;$idx++ ){
  358. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  359. $OUT[]= $STA[3+$idx] . $T . $END;
  360. };
  361. };
  362. } else {
  363. for( ;$idx<1;$idx++ ){
  364. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  365. $OUT[]= $STA[2+$idx] . $T . $END;
  366. };
  367. };
  368. $OUT[]= $STA[4] . $DUMMY['log'] . $END;
  369. break;
  370. };
  371. case 6:{
  372. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  373. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  374. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  375. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  376. $MH = 4;
  377. $DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
  378. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  379. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  380. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  381. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  382. break;
  383. };
  384. default:{
  385. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  386. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  387. if( $UP['width'] > 1.6* $UP['height'] ){
  388. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  389. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  390. } else {
  391. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  392. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  393. };
  394. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  395. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  396. $R = $DATABASE->Query( $QS );
  397. $idx = 0;
  398. if( count( $R ) ){
  399. foreach( $R as $DD ){
  400. if( $idx < 1 ){
  401. $TFN = 'report/node_' . $DD['type'] . '.js';
  402. if(!file_exists( $TFN )) continue;
  403. $TPL = file_get_contents( $TFN );
  404. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  405. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  406. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  407. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  408. $Z=$DATABASE->Query( $QS );
  409. $QS="SELECT * FROM `module_eve` LIMIT 1";
  410. $S=$DATABASE->Query( $QS );
  411. $MODULE_DATA = $S[0];
  412. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  413. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  414. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  415. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  416. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  417. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  418. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  419. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  420. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  421. $W = 244;
  422. $H = $W * $FK;
  423. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  424. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  425. $OUT[]= $STA[1+$idx] . $TPL . $END;
  426. } else break;
  427. $idx++;
  428. };
  429. if( $idx < 1 ){
  430. for( ;$idx<1;$idx++ ){
  431. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  432. $OUT[]= $STA[1+$idx] . $T . $END;
  433. };
  434. };
  435. } else {
  436. for( ;$idx<1;$idx++ ){
  437. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  438. $OUT[]= $STA[1+$idx] . $T . $END;
  439. };
  440. };
  441. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  442. $R = $DATABASE->Query( $QS );
  443. $idx = 0;
  444. if( count( $R ) ){
  445. foreach( $R as $DD ){
  446. if( $idx < 2 ){
  447. $TFN = 'report/node_' . $DD['type'] . '.js';
  448. if(!file_exists( $TFN )) continue;
  449. $TPL = file_get_contents( $TFN );
  450. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  451. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  452. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  453. $OUT[]= $STA[2+$idx] . $TPL . $END;
  454. } else break;
  455. $idx++;
  456. };
  457. } else {
  458. for( ;$idx<1;$idx++ ){
  459. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  460. };
  461. };
  462. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  463. break;
  464. };
  465. };
  466. $Data = '[' . implode( ',' , $OUT ) . ']';
  467. } else {
  468. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  469. };
  470. };
  471. if( $Data != '' ) {
  472. echo $Data;
  473. } else {
  474. echo '[]';
  475. };
  476. ?>