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.

493 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. title: false,
  115. /* frame: true,*/
  116. frame: false,
  117. border: false,
  118. draggable: false,
  119. collapsible: false,
  120. html: '&nbsp;',
  121. listeners:{
  122. afterrender : function( t ){
  123. var papa = Ext.getCmp('segment_portal');
  124. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  125. //alert( jj );
  126. t.setHeight( jj + 30 );
  127. geoMapIsPresent = true;
  128. initMapReporting();
  129. }
  130. }
  131. }
  132. _DATA_BOUNDARY;
  133. //$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  134. $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);}} }";
  135. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  136. $STA = array();
  137. $END="]}";
  138. $OUT = array();
  139. //$OUT[] = "{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[{html:'App Type:{$SP['type']}'}]}";
  140. switch( $SP['type'] ){
  141. case 0:{
  142. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  143. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  144. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  145. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  146. $MH = 4;
  147. $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();}} }";
  148. $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);}} }";
  149. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  150. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  151. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  152. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  153. break;
  154. };
  155. case 1:{
  156. //Metro
  157. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  158. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  159. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  160. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  161. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10";// AND `enable`=1";
  162. $R = $DATABASE->Query( $QS );
  163. $idx = 0;
  164. if( count( $R ) ){
  165. foreach( $R as $DD ){
  166. if( $idx < 2 ){
  167. $TFN = 'report/node_' . $DD['type'] . '.js';
  168. if(!file_exists( $TFN )) continue;
  169. $TPL = file_get_contents( $TFN );
  170. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  171. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  172. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  173. $OUT[]= $STA[$idx] . $TPL . $END;
  174. } else break;
  175. $idx++;
  176. };
  177. if( $idx < 2 ){
  178. for( ;$idx<2;$idx++ ){
  179. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  180. };
  181. };
  182. } else {
  183. for( ;$idx<2;$idx++ ){
  184. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  185. };
  186. };
  187. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 ";// AND `enable`=1";
  188. $R = $DATABASE->Query( $QS );
  189. $idx = 0;
  190. if( count( $R ) ){
  191. foreach( $R as $DD ){
  192. if( $idx < 1 ){
  193. $TFN = 'report/node_' . $DD['type'] . '.js';
  194. if(!file_exists( $TFN )) continue;
  195. $TPL = file_get_contents( $TFN );
  196. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  197. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  198. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  199. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  200. $Z=$DATABASE->Query( $QS );
  201. $QS="SELECT * FROM `module_eve` LIMIT 1";
  202. $S=$DATABASE->Query( $QS );
  203. $MODULE_DATA = $S[0];
  204. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  205. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  206. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  207. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  208. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  209. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  210. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  211. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  212. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  213. $W = 244;
  214. $H = $W * $FK;
  215. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  216. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  217. $OUT[]= $STA[2+$idx] . $TPL . $END;
  218. } else break;
  219. $idx++;
  220. };
  221. if( $idx < 1 ){
  222. for( ;$idx<1;$idx++ ){
  223. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  224. $OUT[]= $STA[2+$idx] . $T . $END;
  225. };
  226. };
  227. } else {
  228. for( ;$idx<1;$idx++ ){
  229. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  230. $OUT[]= $STA[2+$idx] . $T . $END;
  231. };
  232. };
  233. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  234. break;
  235. };
  236. case 2:{
  237. //Muazot A
  238. $STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  239. $STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  240. $STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  241. $STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
  242. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 AND `enable`=1";
  243. $R = $DATABASE->Query( $QS );
  244. $idx = 0;
  245. if( count( $R ) ){
  246. foreach( $R as $DD ){
  247. if( $idx < 2 ){
  248. $TFN = 'report/node_' . $DD['type'] . '.js';
  249. if(!file_exists( $TFN )) continue;
  250. $TPL = file_get_contents( $TFN );
  251. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  252. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  253. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  254. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  255. $Z=$DATABASE->Query( $QS );
  256. $QS="SELECT * FROM `module_eve` LIMIT 1";
  257. $S=$DATABASE->Query( $QS );
  258. $MODULE_DATA = $S[0];
  259. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  260. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  261. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  262. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  263. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  264. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  265. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  266. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  267. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  268. $W = 244;
  269. $H = $W * $FK;
  270. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  271. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  272. $OUT[]= $STA[$idx] . $TPL . $END;
  273. } else break;
  274. $idx++;
  275. };
  276. if( $idx < 2 ){
  277. for( ;$idx<2;$idx++ ){
  278. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  279. $OUT[]= $STA[$idx] . $T . $END;
  280. };
  281. };
  282. } else {
  283. for( ;$idx<2;$idx++ ){
  284. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  285. $OUT[]= $STA[$idx] . $T . $END;
  286. };
  287. };
  288. $OUT[]= $STA[2] . $DUMMY['map'] . $END;
  289. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  290. break;
  291. };
  292. case 4:{
  293. //Mekorot
  294. $STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  295. $STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  296. $STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  297. $STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  298. $STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  299. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  300. $R = $DATABASE->Query( $QS );
  301. $idx = 0;
  302. if( count( $R ) ){
  303. foreach( $R as $DD ){
  304. if( $idx < 3 ){
  305. $TFN = 'report/node_' . $DD['type'] . '.js';
  306. if(!file_exists( $TFN )) continue;
  307. $TPL = file_get_contents( $TFN );
  308. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  309. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  310. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  311. $OUT[]= $STA[$idx] . $TPL . $END;
  312. } else break;
  313. $idx++;
  314. };
  315. if( $idx < 3 ){
  316. for( ;$idx<3;$idx++ ){
  317. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  318. };
  319. };
  320. } else {
  321. for( ;$idx<3;$idx++ ){
  322. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  323. };
  324. };
  325. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  326. $R = $DATABASE->Query( $QS );
  327. $idx = 0;
  328. if( count( $R ) ){
  329. foreach( $R as $DD ){
  330. if( $idx < 1 ){
  331. $TFN = 'report/node_' . $DD['type'] . '.js';
  332. if(!file_exists( $TFN )) continue;
  333. $TPL = file_get_contents( $TFN );
  334. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  335. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  336. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  337. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  338. $Z=$DATABASE->Query( $QS );
  339. $QS="SELECT * FROM `module_eve` LIMIT 1";
  340. $S=$DATABASE->Query( $QS );
  341. $MODULE_DATA = $S[0];
  342. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  343. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  344. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  345. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  346. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  347. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  348. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  349. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  350. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  351. $W = 244;
  352. $H = $W * $FK;
  353. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  354. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  355. $OUT[]= $STA[3+$idx] . $TPL . $END;
  356. } else break;
  357. $idx++;
  358. };
  359. if( $idx < 1 ){
  360. for( ;$idx<1;$idx++ ){
  361. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  362. $OUT[]= $STA[3+$idx] . $T . $END;
  363. };
  364. };
  365. } else {
  366. for( ;$idx<1;$idx++ ){
  367. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  368. $OUT[]= $STA[2+$idx] . $T . $END;
  369. };
  370. };
  371. $OUT[]= $STA[4] . $DUMMY['log'] . $END;
  372. break;
  373. };
  374. case 6:{
  375. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  376. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  377. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  378. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  379. $MH = 4;
  380. $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();}} }";
  381. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  382. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  383. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  384. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  385. break;
  386. };
  387. default:{
  388. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  389. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  390. if( $UP['width'] > 1.6* $UP['height'] ){
  391. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  392. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  393. } else {
  394. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  395. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  396. };
  397. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  398. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  399. $R = $DATABASE->Query( $QS );
  400. $idx = 0;
  401. if( count( $R ) ){
  402. foreach( $R as $DD ){
  403. if( $idx < 1 ){
  404. $TFN = 'report/node_' . $DD['type'] . '.js';
  405. if(!file_exists( $TFN )) continue;
  406. $TPL = file_get_contents( $TFN );
  407. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  408. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  409. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  410. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  411. $Z=$DATABASE->Query( $QS );
  412. $QS="SELECT * FROM `module_eve` LIMIT 1";
  413. $S=$DATABASE->Query( $QS );
  414. $MODULE_DATA = $S[0];
  415. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  416. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  417. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  418. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  419. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  420. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  421. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  422. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  423. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  424. $W = 244;
  425. $H = $W * $FK;
  426. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  427. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  428. $OUT[]= $STA[1+$idx] . $TPL . $END;
  429. } else break;
  430. $idx++;
  431. };
  432. if( $idx < 1 ){
  433. for( ;$idx<1;$idx++ ){
  434. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  435. $OUT[]= $STA[1+$idx] . $T . $END;
  436. };
  437. };
  438. } else {
  439. for( ;$idx<1;$idx++ ){
  440. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  441. $OUT[]= $STA[1+$idx] . $T . $END;
  442. };
  443. };
  444. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  445. $R = $DATABASE->Query( $QS );
  446. $idx = 0;
  447. if( count( $R ) ){
  448. foreach( $R as $DD ){
  449. if( $idx < 2 ){
  450. $TFN = 'report/node_' . $DD['type'] . '.js';
  451. if(!file_exists( $TFN )) continue;
  452. $TPL = file_get_contents( $TFN );
  453. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  454. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  455. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  456. $OUT[]= $STA[2+$idx] . $TPL . $END;
  457. } else break;
  458. $idx++;
  459. };
  460. } else {
  461. for( ;$idx<1;$idx++ ){
  462. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  463. };
  464. };
  465. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  466. break;
  467. };
  468. };
  469. $Data = '[' . implode( ',' , $OUT ) . ']';
  470. } else {
  471. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  472. };
  473. };
  474. if( $Data != '' ) {
  475. echo $Data;
  476. } else {
  477. echo '[]';
  478. };
  479. ?>