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.

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