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.

208 lines
7.2 KiB

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