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.

297 lines
11 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
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years 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. if( count( $SPD ) ){
  9. $SP = $SPD[0];
  10. $DUMMY = array();
  11. if( $CUser->Data['access'] > 5 ){
  12. $TABA =<<<_DATA_BOUNDARY
  13. {
  14. xtype: 'panel',
  15. 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>',
  16. listeners:{
  17. afterrender : function( ){
  18. var tb = document.getElementById('tbl_ph_ccc_%%ID%%');
  19. var W = tb.offsetWidth;
  20. var H = (W/16)*9;
  21. tb.setAttribute("height", H );
  22. tb.style.backgroundSize=W+"px "+H+"px";
  23. var p = Ext.getCmp('pan_ph_ccc_%%ID%%');
  24. p.setHeight( H+40 );
  25. var jaja = Ext.create({
  26. xtype: 'panel',
  27. title: 'Camera is Not Assigned to the System',
  28. frame: true,
  29. renderTo: 'btn_ph_ccc_%%ID%%',
  30. layout: 'vbox',
  31. width: 500,
  32. height: 120,
  33. items:[{
  34. xtype: 'spacer',
  35. height: 10
  36. },{
  37. width: '100%',
  38. html: '<center>Proceed to Cameras Settings to Assign One</center>'
  39. },{
  40. xtype: 'spacer',
  41. height: 20
  42. },{
  43. xtype: 'button',
  44. width: '100%',
  45. text: 'Open Camera Settings',
  46. handler: function(){
  47. showContent( 2020 );
  48. }
  49. }]
  50. });
  51. jaja.doLayout();
  52. }
  53. }
  54. }
  55. _DATA_BOUNDARY;
  56. $LOGIO=<<<_DATA_BOUNDARY
  57. {
  58. xtype: 'grid',
  59. id: 'rep_grid',
  60. border: false,
  61. frame: false,
  62. autoScroll: true,
  63. //width: '100%',
  64. lazyRender: true,
  65. height: 210,
  66. ds: rep_store,
  67. cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
  68. sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
  69. viewConfig: {
  70. forceFit: true,
  71. getRowClass: function( record, rowIndex, rowParams, store){
  72. switch( record.get('node_id')%5 ){
  73. case 0: return 'row-level01';
  74. case 1: return 'row-level02';
  75. case 2: return 'row-level03';
  76. case 3: return 'row-level04';
  77. case 4: return 'row-level05';
  78. };
  79. return '';
  80. }
  81. },
  82. listeners:{
  83. afterrender : function( t ){
  84. var papa = Ext.getCmp('segment_portal');
  85. var jj = papa.getComponent( 1 ).getHeight();
  86. var mama = Ext.getCmp('lg_panel');
  87. var R = PanelH - jj - 30;
  88. mama.setHeight( R+40 );
  89. t.setHeight( R );
  90. }
  91. }
  92. }
  93. _DATA_BOUNDARY;
  94. $MAPIO=<<<_DATA_BOUNDARY
  95. {
  96. id: 'report_map',
  97. height: 200,
  98. title: 'Map',
  99. frame: true,
  100. draggable: false,
  101. collapsible: false,
  102. html: '&nbsp;',
  103. listeners:{
  104. afterrender : function( t ){
  105. var papa = Ext.getCmp('segment_portal');
  106. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  107. //alert( jj );
  108. t.setHeight( jj + 30 );
  109. geoMapIsPresent = true;
  110. initMapReporting();
  111. }
  112. }
  113. }
  114. _DATA_BOUNDARY;
  115. $DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
  116. $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 );}}}";
  117. $DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  118. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  119. } else {
  120. $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);}}}";
  121. $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);}}}";
  122. $DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  123. $DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  124. };
  125. $STA = array();
  126. $END="]}";
  127. $OUT = array();
  128. if( $SP['type'] == 1 ) {
  129. //Metro
  130. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  131. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  132. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  133. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  134. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  135. $R = $DATABASE->Query( $QS );
  136. $idx = 0;
  137. if( count( $R ) ){
  138. foreach( $R as $DD ){
  139. if( $idx < 2 ){
  140. $TFN = 'report/node_' . $DD['type'] . '.js';
  141. if(!file_exists( $TFN )) continue;
  142. $TPL = file_get_contents( $TFN );
  143. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  144. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  145. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  146. $OUT[]= $STA[$idx] . $TPL . $END;
  147. } else break;
  148. $idx++;
  149. };
  150. if( $idx < 2 ){
  151. for( ;$idx<2;$idx++ ){
  152. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  153. };
  154. };
  155. } else {
  156. for( ;$idx<2;$idx++ ){
  157. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  158. };
  159. };
  160. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  161. $R = $DATABASE->Query( $QS );
  162. $idx = 0;
  163. if( count( $R ) ){
  164. foreach( $R as $DD ){
  165. if( $idx < 1 ){
  166. $TFN = 'report/node_' . $DD['type'] . '.js';
  167. if(!file_exists( $TFN )) continue;
  168. $TPL = file_get_contents( $TFN );
  169. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  170. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  171. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  172. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  173. $Z=$DATABASE->Query( $QS );
  174. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  175. $S=$DATABASE->Query( $QS );
  176. $MODULE_DATA = $S[0];
  177. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  178. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  179. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  180. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  181. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  182. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  183. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  184. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  185. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  186. $W = 244;
  187. $H = $W * $FK;
  188. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  189. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  190. $OUT[]= $STA[2+$idx] . $TPL . $END;
  191. } else break;
  192. $idx++;
  193. };
  194. if( $idx < 1 ){
  195. for( ;$idx<1;$idx++ ){
  196. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  197. $OUT[]= $STA[2+$idx] . $T . $END;
  198. };
  199. };
  200. } else {
  201. for( ;$idx<1;$idx++ ){
  202. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  203. $OUT[]= $STA[2+$idx] . $T . $END;
  204. };
  205. };
  206. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  207. } else {
  208. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  209. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  210. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  211. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  212. $OUT[]= $STA[0] . $MAPIO . $END;
  213. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  214. $R = $DATABASE->Query( $QS );
  215. $idx = 0;
  216. if( count( $R ) ){
  217. foreach( $R as $DD ){
  218. if( $idx < 1 ){
  219. $TFN = 'report/node_' . $DD['type'] . '.js';
  220. if(!file_exists( $TFN )) continue;
  221. $TPL = file_get_contents( $TFN );
  222. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  223. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  224. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  225. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  226. $Z=$DATABASE->Query( $QS );
  227. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  228. $S=$DATABASE->Query( $QS );
  229. $MODULE_DATA = $S[0];
  230. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  231. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  232. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  233. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  234. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  235. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  236. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  237. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  238. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  239. $W = 244;
  240. $H = $W * $FK;
  241. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  242. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  243. $OUT[]= $STA[1+$idx] . $TPL . $END;
  244. } else break;
  245. $idx++;
  246. };
  247. if( $idx < 1 ){
  248. for( ;$idx<1;$idx++ ){
  249. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  250. $OUT[]= $STA[1+$idx] . $T . $END;
  251. };
  252. };
  253. } else {
  254. for( ;$idx<1;$idx++ ){
  255. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  256. $OUT[]= $STA[1+$idx] . $T . $END;
  257. };
  258. };
  259. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  260. $R = $DATABASE->Query( $QS );
  261. $idx = 0;
  262. if( count( $R ) ){
  263. foreach( $R as $DD ){
  264. if( $idx < 2 ){
  265. $TFN = 'report/node_' . $DD['type'] . '.js';
  266. if(!file_exists( $TFN )) continue;
  267. $TPL = file_get_contents( $TFN );
  268. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  269. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  270. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  271. $OUT[]= $STA[2+$idx] . $TPL . $END;
  272. } else break;
  273. $idx++;
  274. };
  275. } else {
  276. for( ;$idx<1;$idx++ ){
  277. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  278. };
  279. };
  280. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  281. };
  282. $Data = '[' . implode( ',' , $OUT ) . ']';
  283. } else {
  284. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  285. };
  286. };
  287. if( $Data != '' ) {
  288. echo $Data;
  289. } else {
  290. echo '[]';
  291. };
  292. ?>