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.

530 lines
13 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. ob_start();
  4. $UID = intval( $CUser->Data['id'] );
  5. $ACCESS = intval( $CUser->Data['access'] );
  6. if( $UID > 1 ){
  7. $Data['status']='na';
  8. $TY = intval( $_POST['TYP'] );
  9. $QS="SELECT * FROM system_props LIMIT 1";
  10. $RV = $DATABASE->Query( $QS );
  11. if( count( $RV ) ){
  12. $AP_DATA = $RV[0];
  13. if( $AP_DATA['hw_info'] == '' ) $AP_DATA['hw_info'] = 'MUST_DO_DETECTION';
  14. if( $AP_DATA['os_info'] == '' ) $AP_DATA['os_info'] = 'MUST_RESTART_SERVER';
  15. } else {
  16. $AP_DATA = array(
  17. 'anchor_lat'=>0,
  18. 'anchor_lon'=>0,
  19. 'anchor_alt'=>0,
  20. 'type'=>0,
  21. 'name'=>'INITIAL_SETUP_MODE',
  22. 'os_info'=>'MUST_RESTART_SERVER',
  23. 'hw_info'=>'MUST_DO_DETECTION'
  24. );
  25. };
  26. $QS="SELECT `site_id`, `version_string` FROM `servers` LIMIT 1";
  27. $RR = $DATABASE->Query( $QS );
  28. if( count( $RR ) ){
  29. $AP_DATA['site_id'] = intval( $RR[0]['site_id']);
  30. $AP_DATA['build'] = $RR[0]['version_string'];
  31. } else {
  32. $AP_DATA['site_id'] = 1;
  33. $AP_DATA['build'] = 'undefined-build';
  34. };
  35. switch( $TY ){
  36. case 0:{
  37. $Data['status']='ok';
  38. $QS = "SELECT `identity` FROM `servers` LIMIT 1";
  39. $TT = $DATABASE->Query( $QS );
  40. if( count( $TT ) ){
  41. $IDT = $TT[0]['identity'];
  42. } else {
  43. $IDT = "----No-Identity-Set---";
  44. };
  45. $AP_TYPE = isset( $AP_DATA['type'] ) ? intval( $AP_DATA['type'] ) : 0;
  46. $AP_LAYOUT = isset( $AP_DATA['app_layout'] ) ? intval( $AP_DATA['app_layout'] ) : 3;
  47. $Data['content']=<<<DATA_BOUNDARY
  48. [{
  49. xtype: 'spacer',
  50. height: 10
  51. },{
  52. xtype: 'panel',
  53. frame: false,
  54. border: true,
  55. bodyStyle: 'background-color: white;',
  56. html: '<center><img height=\"120px\" src=\"/style/assets/{$AP_DATA['oem_logo']}.png\"></center>',
  57. height: 130
  58. },{
  59. xtype: 'spacer',
  60. height: 10
  61. },{
  62. xtype: 'textfield',
  63. fieldLabel: "{$Labels->GetLabel( '_INSTANCE_ID_' )}",
  64. width: 300,
  65. value: '{$IDT}'
  66. },{
  67. xtype: 'spacer',
  68. height: 10
  69. },{
  70. xtype: 'button',
  71. text: "{$Labels->GetLabel( '_GEN_INSTANCE_ID_' )}",
  72. width: 550,
  73. handler: function(){
  74. doApplicationOperation( 3, 0 );
  75. }
  76. },{
  77. xtype: 'spacer',
  78. height: 10
  79. },{
  80. xtype: 'combo',
  81. fieldLabel: "{$Labels->GetLabel('_DEBUGGING_MODE_')}",
  82. editable: false,
  83. typeAhead: true,
  84. width: 300,
  85. triggerAction: 'all',
  86. lazyRender:true,
  87. mode: 'local',
  88. store: new Ext.data.ArrayStore({
  89. fields: ['sid', 'snam'],
  90. data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]]
  91. }),
  92. value: '{$AP_DATA['work_mode']}',
  93. valueField: 'sid',
  94. displayField: 'snam',
  95. listeners:{
  96. select: function( t, r, i ){
  97. doApplicationOperation( 1, i );
  98. }
  99. }
  100. },{
  101. xtype: 'spacer',
  102. height: 10
  103. },{
  104. xtype: 'combo',
  105. fieldLabel: "{$Labels->GetLabel('_USE_REMOTE_SERVER_')}",
  106. editable: false,
  107. typeAhead: true,
  108. width: 300,
  109. triggerAction: 'all',
  110. lazyRender:true,
  111. mode: 'local',
  112. store: new Ext.data.ArrayStore({
  113. fields: ['sid', 'snam'],
  114. data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]]
  115. }),
  116. value: '{$AP_DATA['use_remote_server']}',
  117. valueField: 'sid',
  118. displayField: 'snam',
  119. listeners:{
  120. select: function( t, r, i ){
  121. doApplicationOperation( 10, i );
  122. }
  123. }
  124. },{
  125. xtype: 'spacer',
  126. height: 10
  127. },{
  128. xtype: 'textfield',
  129. fieldLabel: "{$Labels->GetLabel('_REMOTE_SERVER_ADDRESS_')}",
  130. width: 300,
  131. value: '{$AP_DATA['remote_ip']}',
  132. listeners:{
  133. change: function( a, c, b ){
  134. doApplicationOperation( 8, c );
  135. }
  136. }
  137. },{
  138. xtype: 'spacer',
  139. height: 10
  140. },{
  141. xtype: 'numberfield',
  142. fieldLabel: "{$Labels->GetLabel('_REMOTE_SERVER_PORT_')}",
  143. width: 300,
  144. value: '{$AP_DATA['remote_port']}',
  145. listeners:{
  146. change: function( a, c, b ){
  147. doApplicationOperation( 9, c );
  148. }
  149. }
  150. },{
  151. xtype: 'spacer',
  152. height: 10
  153. },{
  154. xtype: 'textfield',
  155. fieldLabel: "{$Labels->GetLabel('_BACKUP_SERVER_ADDRESS_')}",
  156. width: 300,
  157. value: '{$AP_DATA['remote_backup_ip']}',
  158. listeners:{
  159. change: function( a, c, b ){
  160. doApplicationOperation( 12, c );
  161. }
  162. }
  163. },{
  164. xtype: 'spacer',
  165. height: 10
  166. },{
  167. xtype: 'numberfield',
  168. fieldLabel: "{$Labels->GetLabel('_BACKUP_SERVER_PORT_')}",
  169. width: 300,
  170. value: '{$AP_DATA['remote_backup_port']}',
  171. listeners:{
  172. change: function( a, c, b ){
  173. doApplicationOperation( 13, c );
  174. }
  175. }
  176. },{
  177. xtype: 'spacer',
  178. height: 10
  179. },{
  180. xtype: 'combo',
  181. fieldLabel: "{$Labels->GetLabel('_SKIP_LOCAL_REPORTS_')}",
  182. editable: false,
  183. typeAhead: true,
  184. width: 300,
  185. triggerAction: 'all',
  186. lazyRender:true,
  187. mode: 'local',
  188. store: new Ext.data.ArrayStore({
  189. fields: ['sid', 'snam'],
  190. data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]]
  191. }),
  192. value: '{$AP_DATA['skip_local_report']}',
  193. valueField: 'sid',
  194. displayField: 'snam',
  195. listeners:{
  196. select: function( t, r, i ){
  197. doApplicationOperation( 11, i );
  198. }
  199. }
  200. },{
  201. xtype: 'spacer',
  202. height: 10
  203. },{
  204. xtype: 'numberfield',
  205. fieldLabel: "{$Labels->GetLabel('_APP_TYPE_')}",
  206. width: 300,
  207. allowDecimals: false,
  208. allowNegative: false,
  209. value: '{$AP_TYPE}',
  210. listeners:{
  211. change: function( a, c, b ){
  212. if( c !== null ) doApplicationOperation( 14, c );
  213. }
  214. }
  215. },{
  216. xtype: 'spacer',
  217. height: 10
  218. },{
  219. xtype: 'numberfield',
  220. fieldLabel: "{$Labels->GetLabel('_APP_LAYOUT_')}",
  221. width: 300,
  222. allowDecimals: false,
  223. allowNegative: false,
  224. value: '{$AP_LAYOUT}',
  225. listeners:{
  226. change: function( a, c, b ){
  227. if( c !== null ) doApplicationOperation( 2, c );
  228. }
  229. }
  230. }]
  231. DATA_BOUNDARY;
  232. break;
  233. };
  234. case 1:{
  235. $Data['status']='ok';
  236. $Data['content']=<<<DATA_BOUNDARY
  237. [{
  238. columnWidth: 0.83,
  239. frame: false,
  240. border: false,
  241. title: false,
  242. items: [{
  243. xtype: 'panel',
  244. border: false,
  245. title: false,
  246. frame: false,
  247. id: 'sys_location_map',
  248. height: PanelH-170,
  249. html: '&nbsp;',
  250. listeners:{
  251. afterrender: function( t, state ){
  252. loadLocationEditor('sys_location_map');
  253. }
  254. }
  255. },{
  256. layout: 'table',
  257. title: "{$Labels->GetLabel('_SITE_PROP_LBL_')}",
  258. flex: 1,
  259. defaults: {
  260. bodyStyle:'padding:20px'
  261. },
  262. layoutConfig: {
  263. columns: 8,
  264. textAlign: 'center'
  265. },
  266. items:[{
  267. border: false,
  268. id: 'lab_123',
  269. html: "{$Labels->GetLabel('_SYS_ANCHORT_LBL_')} "+((MAP_IS_LOCAL)?'Pos X':"{$Labels->GetLabel('_LON_SHORT_LBL_')}")+':'
  270. },{
  271. xtype: 'numberfield',
  272. width: 100,
  273. decimalPrecision: 8,
  274. id: 'siteLon',
  275. value: SiteLon
  276. },{
  277. border: false,
  278. id: 'lab_124',
  279. html: ((MAP_IS_LOCAL)?'Pos Y':"{$Labels->GetLabel('_LAT_SHORT_LBL_')}")+':'
  280. },{
  281. xtype: 'numberfield',
  282. id: 'siteLat',
  283. decimalPrecision: 8,
  284. width: 100,
  285. value: SiteLat
  286. },{
  287. border: false,
  288. html: "{$Labels->GetLabel('_ALT_SHORT_LBL_')}:"
  289. },{
  290. xtype: 'numberfield',
  291. decimalPrecision: 2,
  292. width: 100,
  293. id: 'siteAlt',
  294. value: SiteAlt
  295. },{
  296. xtype: 'button',
  297. text: "{$Labels->GetLabel('_UPDATE_LBL_')}",
  298. handler: updateSiteAnchor
  299. },{
  300. xtype: 'panel',
  301. frame: false,
  302. border: false,
  303. rowspan: 2,
  304. html: ((MAP_IS_LOCAL)?'<img id="lab_125" height="64px" src="/style/assets/map_mode_decart.png">':'<img id="lab_125" height="64px" src="/style/assets/map_mode_wgs84.png">')
  305. },{
  306. border: false,
  307. html: "{$Labels->GetLabel('_MAP_TYP_LBL_')}:"
  308. },{
  309. xtype: 'combo',
  310. disabled: false,
  311. typeAhead: true,
  312. triggerAction: 'all',
  313. id: 'siteMap',
  314. lazyRender:true,
  315. colspan: 3,
  316. mode: 'local',
  317. store: mapListStore,
  318. value: MAP_ID,
  319. valueField: 'map_id',
  320. displayField: 'map_name',
  321. listeners:{
  322. select: function(){
  323. updateSiteMap();
  324. LoadNodesList();
  325. }
  326. }
  327. },{
  328. xtype: 'button',
  329. disabled: false,
  330. text: "{$Labels->GetLabel('_DELETE_')}",
  331. handler: function(){
  332. deleteCurrentMap();
  333. }
  334. },{
  335. xtype: 'button',
  336. id: 'add-c_map-btn',
  337. disabled: false,
  338. text: "{$Labels->GetLabel('_CREATE_NEW_LBL_')}",
  339. handler: function(){
  340. createNewMap();
  341. }
  342. }]
  343. }]
  344. },{
  345. frame: true,
  346. border: false,
  347. xtype: 'panel',
  348. flex: 1,
  349. height: PanelH,
  350. columnWidth: 0.17,
  351. layout: 'fit',
  352. id: 'prop_content',
  353. items:[{
  354. html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>"
  355. }]
  356. }]
  357. DATA_BOUNDARY;
  358. break;
  359. };
  360. case 4:{
  361. $Data['status']='ok';
  362. $Data['content']=<<<DATA_BOUNDARY
  363. [{
  364. xtype: 'spacer',
  365. height: 10
  366. },{
  367. xtype: 'combo',
  368. fieldLabel: "{$Labels->GetLabel('_MULTYDIS_ENA_')}",
  369. editable: false,
  370. typeAhead: true,
  371. width: 300,
  372. triggerAction: 'all',
  373. lazyRender:true,
  374. mode: 'local',
  375. disabled: true,
  376. store: new Ext.data.ArrayStore({
  377. fields: ['sid', 'snam'],
  378. data: [[0,"{$Labels->GetLabel('__DISABLED__')}"], [1,"{$Labels->GetLabel('___ENABLED__')}"]]
  379. }),
  380. value: '{$AP_DATA['skip_local_report']}',
  381. valueField: 'sid',
  382. displayField: 'snam',
  383. listeners:{
  384. select: function( t, r, i ){
  385. if( i ){
  386. showMultyLayoutEditor();
  387. };
  388. //doApplicationOperation( 11, i );
  389. }
  390. }
  391. },{
  392. xtype: 'spacer',
  393. height: 10
  394. },{
  395. xtype: 'panel',
  396. layout: 'fit',
  397. height: PanelH - 190,
  398. id: 'mui_editor',
  399. border: true,
  400. frame: false,
  401. disabled: true,
  402. items:[{
  403. xtype:'portal',
  404. region:'center',
  405. margins:'35 5 5 0',
  406. items:[{
  407. columnWidth:.33,
  408. style:'padding:10px 0 10px 10px',
  409. items:[/*{
  410. title: 'Grid in a Portlet',
  411. layout:'fit',
  412. rowspan: 2,
  413. tools: [{
  414. id:'gear',
  415. handler: function(){
  416. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  417. }
  418. },{
  419. id:'close',
  420. handler: function(e, target, panel){
  421. panel.ownerCt.remove(panel, true);
  422. }
  423. }],
  424. html: 'chucha'
  425. },{
  426. title: 'Another Panel 1',
  427. tools: [{
  428. id:'gear',
  429. handler: function(){
  430. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  431. }
  432. },{
  433. id:'close',
  434. handler: function(e, target, panel){
  435. panel.ownerCt.remove(panel, true);
  436. }
  437. }],
  438. html: 'chucha'
  439. }]
  440. },{
  441. columnWidth:.33,
  442. style:'padding:10px 0 10px 10px',
  443. items:[{
  444. title: 'Panel 2',
  445. tools: [{
  446. id:'gear',
  447. handler: function(){
  448. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  449. }
  450. },{
  451. id:'close',
  452. handler: function(e, target, panel){
  453. panel.ownerCt.remove(panel, true);
  454. }
  455. }],
  456. html: 'chucha'
  457. },{
  458. title: 'Another Panel 2',
  459. tools: [{
  460. id:'gear',
  461. handler: function(){
  462. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  463. }
  464. },{
  465. id:'close',
  466. handler: function(e, target, panel){
  467. panel.ownerCt.remove(panel, true);
  468. }
  469. }],
  470. html: 'chucha'
  471. }]
  472. },{
  473. columnWidth:.33,
  474. style:'padding:10px',
  475. items:[{
  476. title: 'Panel 3',
  477. tools: [{
  478. id:'gear',
  479. handler: function(){
  480. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  481. }
  482. },{
  483. id:'close',
  484. handler: function(e, target, panel){
  485. panel.ownerCt.remove(panel, true);
  486. }
  487. }],
  488. html: 'chucha'
  489. },{
  490. title: 'Another Panel 3',
  491. colspan: 2,
  492. tools: [{
  493. id:'gear',
  494. handler: function(){
  495. Ext.Msg.alert('Message', 'The Settings tool was clicked.');
  496. }
  497. },{
  498. id:'close',
  499. handler: function(e, target, panel){
  500. panel.ownerCt.remove(panel, true);
  501. }
  502. }],
  503. html: 'chucha'
  504. }*/]
  505. }]
  506. /*
  507. * Uncomment this block to test handling of the drop event. You could use this
  508. * to save portlet position state for example. The event arg e is the custom
  509. * event defined in Ext.ux.Portal.DropZone.
  510. */
  511. // ,listeners: {
  512. // 'drop': function(e){
  513. // Ext.Msg.alert('Portlet Dropped', e.panel.title + '<br />Column: ' +
  514. // e.columnIndex + '<br />Position: ' + e.position);
  515. // }
  516. // }
  517. }]
  518. }]
  519. DATA_BOUNDARY;
  520. break;
  521. };
  522. };
  523. $Data['messages'] = ob_get_clean();
  524. echo json_encode( $Data );
  525. } else {
  526. header('location: /');
  527. };
  528. ?>