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.

205 lines
7.1 KiB

4 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 =<<<jodjhowierewt
  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. jodjhowierewt;
  56. $LOGIO=<<<kahkjahskfgkgkh
  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( 0 ).getHeight();
  86. t.setHeight( PanelH - jj - 20 );
  87. }
  88. }
  89. }
  90. kahkjahskfgkgkh;
  91. $DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
  92. $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( 32+(W/16)*9);}}}";
  93. $DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  94. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  95. } else {
  96. $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);}}}";
  97. $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);}}}";
  98. $DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  99. $DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  100. };
  101. $STA = array();
  102. $END="]}";
  103. $OUT = array();
  104. {
  105. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  106. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  107. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  108. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  109. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  110. $R = $DATABASE->Query( $QS );
  111. $idx = 0;
  112. if( count( $R ) ){
  113. foreach( $R as $DD ){
  114. if( $idx < 2 ){
  115. $TFN = 'report/node_' . $DD['type'] . '.js';
  116. if(!file_exists( $TFN )) continue;
  117. $TPL = file_get_contents( $TFN );
  118. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  119. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  120. $OUT[]= $STA[$idx] . $TPL . $END;
  121. } else break;
  122. $idx++;
  123. };
  124. if( $idx < 2 ){
  125. for( ;$idx<2;$idx++ ){
  126. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  127. };
  128. };
  129. } else {
  130. for( ;$idx<2;$idx++ ){
  131. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  132. };
  133. };
  134. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  135. $R = $DATABASE->Query( $QS );
  136. $idx = 0;
  137. if( count( $R ) ){
  138. foreach( $R as $DD ){
  139. if( $idx < 1 ){
  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%%%', ''.urldecode($DD['name']) , $TPL );
  145. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  146. $Z=$DATABASE->Query( $QS );
  147. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  148. $S=$DATABASE->Query( $QS );
  149. $MODULE_DATA = $S[0];
  150. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  151. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  152. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  153. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  154. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  155. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  156. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  157. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  158. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  159. $W = 244;
  160. $H = $W * $FK;
  161. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  162. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  163. $OUT[]= $STA[2+$idx] . $TPL . $END;
  164. } else break;
  165. $idx++;
  166. };
  167. if( $idx < 1 ){
  168. for( ;$idx<1;$idx++ ){
  169. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  170. $OUT[]= $STA[2+$idx] . $T . $END;
  171. };
  172. };
  173. } else {
  174. for( ;$idx<1;$idx++ ){
  175. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  176. $OUT[]= $STA[2+$idx] . $T . $END;
  177. };
  178. };
  179. switch( 1 ){
  180. case 1:{
  181. // LA Metro
  182. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  183. break;
  184. };
  185. case 2:{
  186. //Togo
  187. $OUT[]= $STA[3] . $DUMMY['map'] . $END;
  188. break;
  189. };
  190. }
  191. };
  192. $Data = '[' . implode( ',' , $OUT ) . ']';
  193. } else {
  194. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  195. };
  196. };
  197. if( $Data != '' ) {
  198. echo $Data;
  199. } else {
  200. echo '[]';
  201. };
  202. ?>