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.

537 lines
22 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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
​
​
​
​
​
​
​
​
​
​
​
  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: 'log_grid',
  60. border: false,
  61. frame: false,
  62. autoScroll: true,
  63. //width: '100%',
  64. lazyRender: true,
  65. height: 210,
  66. ds: log_store,
  67. cm: new Ext.grid.ColumnModel( log_ColModel_ops ),
  68. sm: new Ext.grid.RowSelectionModel( log_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('main_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: 'Event Log', frame: true, /*height: 200,*/ 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. switch( $SP['app_layout'] ){
  105. case 0:{
  106. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  107. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  108. $STA[2]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  109. $STA[3]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  110. $STA[4]="{ columnWidth: .5, stylde:'padding:10px 0 10px 10px', items:[";
  111. $STA[5]="{ columnWidth: .5, stylde:'padding:10px 0 10px 10px', items:[";
  112. $STA[6]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  113. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  114. $R = $DATABASE->Query( $QS );
  115. $idx = 0;
  116. if( count( $R ) ){
  117. foreach( $R as $DD ){
  118. if( $idx < 4 ){
  119. $TFN = 'dash/node_' . $DD['type'] . '.js';
  120. if(!file_exists( $TFN )) continue;
  121. $TPL = file_get_contents( $TFN );
  122. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  123. $TPL = str_replace('%%%NODENAME%%%', ''. urldecode( $DD['name'] ), $TPL );
  124. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  125. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  126. $OUT[]= $STA[$idx] . $TPL . $END;
  127. } else break;
  128. $idx++;
  129. };
  130. if( $idx < 4 ){
  131. for( ;$idx<4;$idx++ ){
  132. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  133. };
  134. };
  135. } else {
  136. for( ;$idx<4;$idx++ ){
  137. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  138. };
  139. };
  140. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  141. $R = $DATABASE->Query( $QS );
  142. $idx = 0;
  143. if( count( $R ) ){
  144. foreach( $R as $DD ){
  145. if( $idx < 2 ){
  146. $TFN = 'dash/node_' . $DD['type'] . '.js';
  147. if(!file_exists( $TFN )) continue;
  148. $TPL = file_get_contents( $TFN );
  149. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  150. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode( $DD['name'] ) , $TPL );
  151. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  152. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  153. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  154. $Z=$DATABASE->Query( $QS );
  155. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  156. $S=$DATABASE->Query( $QS );
  157. $MODULE_DATA = $S[0];
  158. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  159. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  160. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  161. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  162. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  163. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  164. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  165. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  166. if( $DD['type'] == 13 || $DD['type'] == 11 ){
  167. $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
  168. $JUA = $DATABASE->Query( $QS );
  169. $CAMDATA = $JUA[0];
  170. if( $CAMDATA['homing_enable'] ){
  171. if( $CUser->Data['access'] > 5 ){
  172. $TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
  173. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
  174. } else {
  175. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  176. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  177. };
  178. } else {
  179. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  180. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  181. };
  182. };
  183. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  184. $W = 244;
  185. $H = $W * $FK;
  186. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  187. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  188. $OUT[]= $STA[4+$idx] . $TPL . $END;
  189. } else break;
  190. $idx++;
  191. };
  192. if( $idx < 2 ){
  193. for( ;$idx<2;$idx++ ){
  194. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  195. $OUT[]= $STA[4+$idx] . $T . $END;
  196. };
  197. };
  198. } else {
  199. for( ;$idx<2;$idx++ ){
  200. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  201. $OUT[]= $STA[4+$idx] . $T . $END;
  202. };
  203. };
  204. switch( $SP['type'] ){
  205. case 1:{
  206. // LA Metro
  207. $OUT[]= $STA[6] . $DUMMY['log'] . $END;
  208. break;
  209. };
  210. case 2:{
  211. //Togo
  212. $OUT[]= $STA[6] . $DUMMY['map'] . $END;
  213. break;
  214. };
  215. }
  216. break;
  217. };
  218. case 1:{
  219. $STA[0]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  220. $STA[1]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  221. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  222. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  223. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  224. $R = $DATABASE->Query( $QS );
  225. $idx = 0;
  226. if( count( $R ) ){
  227. foreach( $R as $DD ){
  228. if( $idx < 2 ){
  229. $TFN = 'dash/node_' . $DD['type'] . '.js';
  230. if(!file_exists( $TFN )) continue;
  231. $TPL = file_get_contents( $TFN );
  232. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  233. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  234. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  235. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  236. $OUT[]= $STA[$idx] . $TPL . $END;
  237. } else break;
  238. $idx++;
  239. };
  240. if( $idx < 2 ){
  241. for( ;$idx<2;$idx++ ){
  242. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  243. };
  244. };
  245. } else {
  246. for( ;$idx<2;$idx++ ){
  247. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  248. };
  249. };
  250. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  251. $R = $DATABASE->Query( $QS );
  252. $idx = 0;
  253. if( count( $R ) ){
  254. foreach( $R as $DD ){
  255. if( $idx < 1 ){
  256. $TFN = 'dash/node_' . $DD['type'] . '.js';
  257. if(!file_exists( $TFN )) continue;
  258. $TPL = file_get_contents( $TFN );
  259. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  260. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  261. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  262. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  263. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  264. $Z=$DATABASE->Query( $QS );
  265. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  266. $S=$DATABASE->Query( $QS );
  267. $MODULE_DATA = $S[0];
  268. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  269. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  270. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  271. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  272. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  273. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  274. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  275. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  276. if( $DD['type'] == 13 || $DD['type'] == 11 ){
  277. $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
  278. $JUA = $DATABASE->Query( $QS );
  279. $CAMDATA = $JUA[0];
  280. if( $CAMDATA['homing_enable'] ){
  281. if( $CUser->Data['access'] > 5 ){
  282. $TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
  283. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
  284. } else {
  285. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  286. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  287. };
  288. } else {
  289. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  290. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  291. };
  292. };
  293. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  294. $W = 244;
  295. $H = $W * $FK;
  296. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  297. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  298. $OUT[]= $STA[2+$idx] . $TPL . $END;
  299. } else break;
  300. $idx++;
  301. };
  302. if( $idx < 1 ){
  303. for( ;$idx<1;$idx++ ){
  304. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  305. $OUT[]= $STA[2+$idx] . $T . $END;
  306. };
  307. };
  308. } else {
  309. for( ;$idx<1;$idx++ ){
  310. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  311. $OUT[]= $STA[2+$idx] . $T . $END;
  312. };
  313. };
  314. switch( $SP['type'] ){
  315. case 1:{
  316. // LA Metro
  317. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  318. break;
  319. };
  320. case 2:{
  321. //Togo
  322. $OUT[]= $STA[3] . $DUMMY['map'] . $END;
  323. break;
  324. };
  325. }
  326. break;
  327. };
  328. case 2:{
  329. $STA[0]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  330. $STA[1]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  331. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  332. $STA[3]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  333. $STA[4]="{ columnWidth: .5, stylde:'padding:10px 0 10px 10px', items:[";
  334. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  335. $R = $DATABASE->Query( $QS );
  336. $idx = 0;
  337. if( count( $R ) ){
  338. foreach( $R as $DD ){
  339. if( $idx < 3 ){
  340. $TFN = 'dash/node_' . $DD['type'] . '.js';
  341. if(!file_exists( $TFN )) continue;
  342. $TPL = file_get_contents( $TFN );
  343. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  344. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  345. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  346. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  347. $OUT[]= $STA[$idx] . $TPL . $END;
  348. } else break;
  349. $idx++;
  350. };
  351. if( $idx < 3 ){
  352. for( ;$idx<3;$idx++ ){
  353. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  354. };
  355. };
  356. } else {
  357. for( ;$idx<3;$idx++ ){
  358. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  359. };
  360. };
  361. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  362. $R = $DATABASE->Query( $QS );
  363. $idx = 0;
  364. if( count( $R ) ){
  365. foreach( $R as $DD ){
  366. if( $idx < 2 ){
  367. $TFN = 'dash/node_' . $DD['type'] . '.js';
  368. if(!file_exists( $TFN )) continue;
  369. $TPL = file_get_contents( $TFN );
  370. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  371. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  372. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  373. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  374. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  375. $Z=$DATABASE->Query( $QS );
  376. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  377. $S=$DATABASE->Query( $QS );
  378. $MODULE_DATA = $S[0];
  379. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  380. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  381. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  382. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  383. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  384. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  385. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  386. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  387. if( $DD['type'] == 13 || $DD['type'] == 11 ){
  388. $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
  389. $JUA = $DATABASE->Query( $QS );
  390. $CAMDATA = $JUA[0];
  391. if( $CAMDATA['homing_enable'] ){
  392. if( $CUser->Data['access'] > 5 ){
  393. $TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
  394. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
  395. } else {
  396. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  397. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  398. };
  399. } else {
  400. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  401. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  402. };
  403. };
  404. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  405. $W = 244;
  406. $H = $W * $FK;
  407. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  408. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  409. $OUT[]= $STA[3+$idx] . $TPL . $END;
  410. } else break;
  411. $idx++;
  412. };
  413. if( $idx < 2 ){
  414. for( ;$idx<2;$idx++ ){
  415. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  416. $OUT[]= $STA[3+$idx] . $T . $END;
  417. };
  418. };
  419. } else {
  420. for( ;$idx<2;$idx++ ){
  421. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  422. $OUT[]= $STA[3+$idx] . $T . $END;
  423. };
  424. };
  425. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  426. $OUT[]= $STA[4] . $DUMMY['map'] . $END;
  427. break;
  428. };
  429. case 3:{
  430. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  431. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  432. $STA[2]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  433. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  434. $R = $DATABASE->Query( $QS );
  435. $idx = 0;
  436. if( count( $R ) ){
  437. foreach( $R as $DD ){
  438. if( $idx < 1 ){
  439. $TFN = 'dash/node_' . $DD['type'] . '.js';
  440. if(!file_exists( $TFN )) continue;
  441. $TPL = file_get_contents( $TFN );
  442. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  443. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  444. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  445. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  446. $OUT[]= $STA[$idx] . $TPL . $END;
  447. } else break;
  448. $idx++;
  449. };
  450. } else {
  451. for( ;$idx<1;$idx++ ){
  452. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  453. };
  454. };
  455. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  456. $R = $DATABASE->Query( $QS );
  457. $idx = 0;
  458. if( count( $R ) ){
  459. foreach( $R as $DD ){
  460. if( $idx < 1 ){
  461. $TFN = 'dash/node_' . $DD['type'] . '.js';
  462. if(!file_exists( $TFN )) continue;
  463. $TPL = file_get_contents( $TFN );
  464. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  465. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  466. $TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
  467. $TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
  468. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  469. $Z=$DATABASE->Query( $QS );
  470. $QS="SELECT * FROM `module_eve` WHERE `id`=1";
  471. $S=$DATABASE->Query( $QS );
  472. $MODULE_DATA = $S[0];
  473. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  474. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  475. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  476. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  477. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  478. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  479. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  480. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  481. if( $DD['type'] == 13 || $DD['type'] == 11 ){
  482. $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
  483. $JUA = $DATABASE->Query( $QS );
  484. $CAMDATA = $JUA[0];
  485. if( $CAMDATA['homing_enable'] ){
  486. if( $CUser->Data['access'] > 5 ){
  487. $TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
  488. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
  489. } else {
  490. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  491. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  492. };
  493. } else {
  494. $TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
  495. $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
  496. };
  497. };
  498. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  499. $W = 244;
  500. $H = $W * $FK;
  501. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  502. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  503. $OUT[]= $STA[1+$idx] . $TPL . $END;
  504. } else break;
  505. $idx++;
  506. };
  507. } else {
  508. for( ;$idx<1;$idx++ ){
  509. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  510. $OUT[]= $STA[1+$idx] . $T . $END;
  511. };
  512. };
  513. $OUT[]= $STA[2] . $DUMMY['log'] . /*','. $DUMMY['map'].*/ $END;
  514. break;
  515. };
  516. case 4:
  517. case 5:
  518. default:
  519. };
  520. $Data = '[' . implode( ',' , $OUT ) . ']';
  521. } else {
  522. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  523. };
  524. };
  525. if( $Data != '' ) {
  526. echo $Data;
  527. } else {
  528. echo '[]';
  529. };
  530. ?>