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.

2704 lines
74 KiB

​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
2 months ago
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
2 years ago
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
2 years ago
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
12 months ago
12 months ago
​
​
​
​
​
​
​
​
2 years ago
12 months ago
12 months ago
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
12 months ago
12 months ago
12 months ago
​
​
​
​
​
​
​
​
​
12 months ago
12 months ago
12 months ago
​
​
​
​
​
​
​
​
​
12 months ago
12 months ago
12 months ago
​
​
​
​
​
​
​
​
​
​
12 months ago
12 months ago
​
​
12 months ago
​
12 months ago
​
​
​
12 months ago
12 months ago
​
​
​
12 months ago
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var helpContentTopicID = -1;
  3. var SelectedPlatform = 0;
  4. var oSelectedPlatform = 0;
  5. var SelectedStation = 0;
  6. var oSelectedStation = 0;
  7. var SelectedLine = 0;
  8. var oSelectedLine = 0;
  9. var SelectedTrack = 0;
  10. var oSelectedTrack = 0;
  11. var SelectedModule = 0;
  12. var oSelectedModule = 0;
  13. var muploader = null;
  14. var uploads_store_id = 0;
  15. var uploads_store = new Ext.data.ArrayStore({
  16. autoDestroy: false,
  17. storeId: 'up_store',
  18. idIndex: 0,
  19. fields: [
  20. {name: 'id', type: 'int' },
  21. {name: 'file_name', type: 'string'},
  22. {name: 'file_id', type: 'string'},
  23. {name: 'size', type: 'string'},
  24. {name: 'progress', type: 'int'},
  25. {name: 'status', type: 'string' }
  26. ]
  27. });
  28. var uploaded_store_id = 0;
  29. var uploaded_store = new Ext.data.ArrayStore({
  30. autoDestroy: false,
  31. storeId: 'mod_store',
  32. idIndex: 0,
  33. fields: [
  34. {name: 'id', type: 'int' },
  35. {name: 'file_name', type: 'string'},
  36. {name: 'size', type: 'int'},
  37. {name: 'status', type: 'int'},
  38. {name: 'ts', type: 'string' },
  39. {name: 'memo', type: 'string' }
  40. ]
  41. });
  42. function progressRenderer( value, meta, record ){
  43. Ext.defer( function( id ){
  44. var p = new Ext.ProgressBar({
  45. id: 'progress_'+id,
  46. renderTo: 'div_'+id,
  47. animate: false,
  48. width: '100%',
  49. value: 0,
  50. text: 'Upload Pending',
  51. });
  52. }, 50, undefined, [ record.data.file_id ] );
  53. return '<div id="div_' + record.data.file_id + '"></div>';
  54. };
  55. var fileUploadsColModel_ops = {
  56. columns: [
  57. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  58. {header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  59. {header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  60. {header: "<?=$Labels->GetLabel('_PROGRESS_');?>", width: 150, renderer: progressRenderer, dataIndex: 'progress' },
  61. {header: " ", width: 50, dataIndex: 'status3' }
  62. ],
  63. defaults: {
  64. sortable: false,
  65. fixed: true,
  66. menuDisabled: true,
  67. width: 100
  68. }
  69. };
  70. function onModuleFileRenderer( value, meta, record ){
  71. if( value == 0 ){
  72. rv = '<img title="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" alt="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" src="/style/assets/bul_green.png">';
  73. } else {
  74. if( value < 101 ){
  75. rv = '<img title="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" alt="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" src="/style/assets/bul_gray.png">';
  76. } else {
  77. rv = '<img title="<?=$Labels->GetLabel('_UPLO_DONE_');?>" alt="<?=$Labels->GetLabel('_UPLO_DONE_');?>" src="/style/assets/bul_blue.png">';
  78. };
  79. };
  80. return rv;
  81. };
  82. var fileModuleColModel_ops = {
  83. columns: [
  84. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  85. {header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  86. {header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, /*renderer: plupload.formatSize,*/ align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  87. {header: "<?=$Labels->GetLabel('_TIME_');?>", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
  88. {header: "<?=$Labels->GetLabel('_STATUS_');?>", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
  89. {header: "<?=$Labels->GetLabel('_MEMO_');?>", dataIndex: 'memo' }
  90. ],
  91. defaults: {
  92. sortable: false,
  93. fixed: true,
  94. menuDisabled: true,
  95. width: 100
  96. }
  97. };
  98. var fileUploadsSelModel_ops = {
  99. singleSelect: true
  100. };
  101. var targetWidthTable_store = new Ext.data.ArrayStore({
  102. autoDestroy: false,
  103. storeId: 'width_table_store',
  104. idIndex: 0,
  105. fields: [
  106. {name: 'id', type: 'int' },
  107. {name: 'width', type: 'int'},
  108. {name: 'range', type: 'sting'},
  109. {name: 'range_m', type: 'sting'}
  110. ]
  111. });
  112. var cWTRowSelected = null;
  113. var cWTRowSelectedRange = 0;
  114. var cWTRowSelectedRangeP = 0;
  115. var WTSelectedSensor = 0;
  116. var widthTableSelModel_ops = {
  117. singleSelect: true,
  118. listeners: {
  119. rowselect: function( sm, row, rec ) {
  120. cWTRowSelected = rec.data.id;
  121. cWTRowSelectedRange = rec.data.range_m;
  122. cWTRowSelectedRangeP = rec.data.range;
  123. //todo
  124. Ext.getCmp('edit_btn_width_table').enable();
  125. }
  126. }
  127. };
  128. function deleteWTRow(){
  129. Ext.Ajax.request({
  130. url: '/lib/controller/delWidthTableRecord.php',
  131. params: {
  132. UID: <?=$UserID;?>,
  133. SID: '<?=$Session;?>',
  134. DID: WTSelectedSensor,
  135. RID: cWTRowSelected
  136. },
  137. success: function( response, opts ){
  138. Ext.getCmp('del_btn_width_table').disable();
  139. loadWidthTable( WTSelectedSensor );
  140. },
  141. failure: failureAJAXFunction
  142. });
  143. };
  144. var targetWidthTableColModel_ops = {
  145. columns: [
  146. {header: "<?=$Labels->GetLabel('_WIDTH_CORRECT_');?> (%)", width: 250, align: 'center', css: 'vertical-align: middle;', dataIndex: 'width' },
  147. {header: "<?=$Labels->GetLabel('_RANGE_');?> (%)", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range' },
  148. {header: "<?=$Labels->GetLabel('_RANGE_').' ('.$Labels->GetLabel('_METERS_') . ')';?>", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range_m' },
  149. ],
  150. defaults: {
  151. sortable: false,
  152. fixed: true,
  153. menuDisabled: true
  154. }
  155. };
  156. function loadModuleFiles( sensorID ){
  157. Ext.Ajax.request({
  158. url: '/lib/controller/getDeviceFiles.php',
  159. params: {
  160. UID: <?=$UserID;?>,
  161. SID: '<?=$Session;?>',
  162. DID: sensorID
  163. },
  164. success: function( response, opts ){
  165. var data = Ext.decode( response.responseText );
  166. uploaded_store.removeAll();
  167. uploaded_store.loadData( data.files );
  168. },
  169. failure: failureAJAXFunction
  170. });
  171. };
  172. function loadHelpContent( topicID ){
  173. if( helpContentTopicID == topicID ) return;
  174. helpContentTopicID = topicID;
  175. Ext.Ajax.request({
  176. url: '/lib/controller/getHelpTopic.php',
  177. params: {
  178. UID: <?=$UserID;?>,
  179. SID: '<?=$Session;?>',
  180. TID: topicID
  181. },
  182. success: function( response, opts ){
  183. var tData = Ext.decode(response.responseText);
  184. var tPanel = Ext.getCmp('help_content');
  185. tPanel.removeAll( true );
  186. tPanel.add( tData );
  187. tPanel.doLayout();
  188. },
  189. failure: failureAJAXFunction
  190. });
  191. };
  192. function moveStation( station_id, dir ){
  193. doStationOperation( station_id, 5, JSON.stringify( { DIR: dir, LINE: SelectedLine } ), true );
  194. };
  195. var moduleControlWindow = null;
  196. function moduleControl(){
  197. if( moduleControlWindow == null ){
  198. moduleControlWindow = new Ext.Window({
  199. title: 'Module Control',
  200. height: Ext.getBody().getViewSize().height*0.9,
  201. width: Ext.getBody().getViewSize().width*0.9,
  202. modal: true,
  203. items:[{
  204. html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=1&MID='+SelectedModule+'"></iframe>'
  205. }],
  206. listeners:{
  207. beforedestroy: function(){
  208. moduleControlWindow = null;
  209. }
  210. }
  211. });
  212. };
  213. moduleControlWindow.show();
  214. };
  215. function moduleCamControl(){
  216. if( moduleControlWindow == null ){
  217. moduleControlWindow = new Ext.Window({
  218. title: 'Module Control',
  219. height: Ext.getBody().getViewSize().height*0.9,
  220. width: Ext.getBody().getViewSize().width*0.9,
  221. modal: true,
  222. items:[{
  223. html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=3&MID='+SelectedModule+'"></iframe>'
  224. }],
  225. listeners:{
  226. beforedestroy: function(){
  227. moduleControlWindow = null;
  228. }
  229. }
  230. });
  231. };
  232. moduleControlWindow.show();
  233. };
  234. function moduleHostControl(){
  235. if( moduleControlWindow == null ){
  236. moduleControlWindow = new Ext.Window({
  237. title: 'Module Control',
  238. height: Ext.getBody().getViewSize().height*0.9,
  239. width: Ext.getBody().getViewSize().width*0.9,
  240. modal: true,
  241. items:[{
  242. html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=2&MID='+SelectedModule+'"></iframe>'
  243. }],
  244. listeners:{
  245. beforedestroy: function(){
  246. moduleControlWindow = null;
  247. }
  248. }
  249. });
  250. };
  251. moduleControlWindow.show();
  252. };
  253. function bindStationToLine( station_id ){
  254. doStationOperation( station_id, 3, SelectedLine, true );
  255. };
  256. function clearHelpContent(){
  257. helpContentTopicID = -1;
  258. };
  259. function loadApplicationSettings(){
  260. contentView.l[3] = {v:2,p:''};
  261. Ext.Ajax.request({
  262. url: '/lib/controller/getApplicationSettings.php',
  263. params: {
  264. UID: <?=$UserID;?>,
  265. SID: '<?=$Session;?>',
  266. },
  267. success: function( response, opts ){
  268. var data = Ext.decode(response.responseText);
  269. if( data.status == 'ok' ){
  270. var tPanel = Ext.getCmp('application_settings_container');
  271. var res = Ext.decode( data.content );
  272. tPanel.removeAll( true );
  273. tPanel.add( res );
  274. tPanel.doLayout();
  275. tPanel = Ext.getCmp('application_op_small');
  276. tPanel.removeAll( true );
  277. tPanel.add({
  278. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  279. });
  280. tPanel.doLayout();
  281. } else {
  282. Ext.Msg.show({
  283. title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
  284. msg: data.msg,
  285. buttons: Ext.Msg.OK,
  286. icon: Ext.MessageBox.ERROR
  287. });
  288. };
  289. },
  290. failure: failureAJAXFunction
  291. });
  292. };
  293. function loadHistorySettings(){
  294. contentView.l[3] = {v:3,p:''};
  295. Ext.Ajax.request({
  296. url: '/lib/controller/getHistorySettings.php',
  297. params: {
  298. UID: <?=$UserID;?>,
  299. SID: '<?=$Session;?>',
  300. },
  301. success: function( response, opts ){
  302. var data = Ext.decode(response.responseText);
  303. if( data.status == 'ok' ){
  304. var tPanel = Ext.getCmp('history_settings_container');
  305. var res = Ext.decode( data.content );
  306. tPanel.removeAll( true );
  307. tPanel.add( res );
  308. tPanel.doLayout();
  309. tPanel = Ext.getCmp('history_op_small');
  310. tPanel.removeAll( true );
  311. tPanel.add({
  312. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  313. });
  314. tPanel.doLayout();
  315. } else {
  316. Ext.Msg.show({
  317. title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
  318. msg: data.msg,
  319. buttons: Ext.Msg.OK,
  320. icon: Ext.MessageBox.ERROR
  321. });
  322. };
  323. },
  324. failure: failureAJAXFunction
  325. });
  326. };
  327. function loadMediaSettings(){
  328. contentView.l[3] = {v:1,p:''};
  329. Ext.Ajax.request({
  330. url: '/lib/controller/getMediaSettings.php',
  331. params: {
  332. UID: <?=$UserID;?>,
  333. SID: '<?=$Session;?>',
  334. },
  335. success: function( response, opts ){
  336. var data = Ext.decode(response.responseText);
  337. if( data.status == 'ok' ){
  338. var tPanel = Ext.getCmp('media_settings_container');
  339. var res = Ext.decode( data.content );
  340. tPanel.removeAll( true );
  341. tPanel.add( res );
  342. tPanel.doLayout();
  343. tPanel = Ext.getCmp('encoder_op_small');
  344. tPanel.removeAll( true );
  345. tPanel.add({
  346. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  347. });
  348. tPanel.doLayout();
  349. } else {
  350. Ext.Msg.show({
  351. title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
  352. msg: data.msg,
  353. buttons: Ext.Msg.OK,
  354. icon: Ext.MessageBox.ERROR
  355. });
  356. };
  357. },
  358. failure: failureAJAXFunction
  359. });
  360. };
  361. function loadMetroLines( suse ){
  362. if( suse == undefined ){
  363. suse = 0;
  364. };
  365. oSelectedLine = 0;
  366. Ext.Ajax.request({
  367. url: '/lib/controller/getLines.php',
  368. params: {
  369. UID: <?=$UserID;?>,
  370. SID: '<?=$Session;?>',
  371. },
  372. success: function( response, opts ){
  373. var tData = Ext.decode(response.responseText);
  374. var tPanel = Ext.getCmp('lines_container');
  375. if( tData.status == 'ok' ){
  376. var res = Ext.decode( tData.lines );
  377. tPanel.removeAll( true );
  378. tPanel.add( res );
  379. tPanel.doLayout();
  380. if( suse == 0 ){
  381. var zPanel = Ext.getCmp('line_op_small');
  382. zPanel.removeAll( true );
  383. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  384. zPanel.doLayout();
  385. var tComp = Ext.getCmp('stations_tab');
  386. tComp.setDisabled( true );
  387. } else {
  388. editLine( suse );
  389. };
  390. } else {
  391. tPanel.removeAll( true );
  392. tPanel.doLayout();
  393. var zPanel = Ext.getCmp('line_op_small');
  394. zPanel.removeAll( true );
  395. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  396. zPanel.doLayout();
  397. var tComp = Ext.getCmp('stations_tab');
  398. tComp.setDisabled( true );
  399. };
  400. },
  401. failure: failureAJAXFunction
  402. });
  403. };
  404. function loadMetroStations( line_id, suse ){
  405. if( suse == undefined ){
  406. suse = 0;
  407. };
  408. oSelectedStation = 0;
  409. Ext.Ajax.request({
  410. url: '/lib/controller/getStations.php',
  411. params: {
  412. UID: <?=$UserID;?>,
  413. SID: '<?=$Session;?>',
  414. LID: line_id
  415. },
  416. success: function( response, opts ){
  417. var tData = Ext.decode(response.responseText);
  418. var tPanel = Ext.getCmp('stations_container');
  419. if( tData.status == 'ok' ){
  420. tPanel.removeAll( true );
  421. var res = Ext.decode( tData.line_tag );
  422. tPanel.add( res );
  423. res = Ext.decode( tData.stations );
  424. tPanel.add( res );
  425. tPanel.doLayout();
  426. if( suse == 0 ){
  427. var zPanel = Ext.getCmp('station_op_small');
  428. zPanel.removeAll( true );
  429. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  430. zPanel.doLayout();
  431. var tComp = Ext.getCmp('platform_tab');
  432. tComp.setDisabled( true );
  433. } else {
  434. editStation( suse );
  435. };
  436. } else {
  437. tPanel.removeAll( true );
  438. tPanel.doLayout();
  439. var zPanel = Ext.getCmp('station_op_small');
  440. zPanel.removeAll( true );
  441. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  442. zPanel.doLayout();
  443. var tComp = Ext.getCmp('platform_tab');
  444. tComp.setDisabled( true );
  445. };
  446. },
  447. failure: failureAJAXFunction
  448. });
  449. };
  450. function loadMetroStationPlatforms( station_id, suse ){
  451. if( suse == undefined ){
  452. suse = 0;
  453. };
  454. oSelectedPlatform = 0;
  455. Ext.Ajax.request({
  456. url: '/lib/controller/getPlatforms.php',
  457. params: {
  458. UID: <?=$UserID;?>,
  459. SID: '<?=$Session;?>',
  460. OID: station_id
  461. },
  462. success: function( response, opts ){
  463. var tData = Ext.decode(response.responseText);
  464. var tPanel = Ext.getCmp('platform_container');
  465. if( tData.status == 'ok' ){
  466. tPanel.removeAll( true );
  467. var res = Ext.decode( tData.line_tag );
  468. tPanel.add( res );
  469. res = Ext.decode( tData.platforms );
  470. tPanel.add( res );
  471. tPanel.doLayout();
  472. if( suse == 0 ){
  473. var zPanel = Ext.getCmp('platform_op_small');
  474. zPanel.removeAll( true );
  475. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  476. zPanel.doLayout();
  477. var tComp = Ext.getCmp('modules_tab');
  478. tComp.setDisabled( true );
  479. } else {
  480. editPlatform( suse );
  481. };
  482. } else {
  483. tPanel.removeAll( true );
  484. tPanel.doLayout();
  485. var zPanel = Ext.getCmp('platform_op_small');
  486. zPanel.removeAll( true );
  487. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  488. zPanel.doLayout();
  489. var tComp = Ext.getCmp('modules_tab');
  490. tComp.setDisabled( true );
  491. };
  492. },
  493. failure: failureAJAXFunction
  494. });
  495. };
  496. function loadModules(){
  497. loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  498. };
  499. function loadMetroPlatformModules( platform_id, suse ){
  500. if( suse == undefined ){
  501. suse = 0;
  502. };
  503. oSelectedPlatform = 0;
  504. Ext.Ajax.request({
  505. url: '/lib/controller/getModules.php',
  506. params: {
  507. UID: <?=$UserID;?>,
  508. SID: '<?=$Session;?>',
  509. OID: platform_id
  510. },
  511. success: function( response, opts ){
  512. var tData = Ext.decode(response.responseText);
  513. var tPanel = Ext.getCmp('module_container');
  514. if( tData.b_a_b ) Ext.getCmp('mod_add_btn').disable(); else Ext.getCmp('mod_add_btn').enable();
  515. if( tData.status == 'ok' ){
  516. tPanel.removeAll( true );
  517. //var res = Ext.decode( tData.line_tag );
  518. //tPanel.add( res );
  519. res = Ext.decode( tData.modules );
  520. tPanel.add( res );
  521. tPanel.doLayout();
  522. if( suse == 0 ){
  523. var zPanel = Ext.getCmp('module_op_small');
  524. zPanel.removeAll( true );
  525. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  526. zPanel.doLayout();
  527. } else {
  528. editModule( suse );
  529. };
  530. } else {
  531. tPanel.removeAll( true );
  532. tPanel.doLayout();
  533. var zPanel = Ext.getCmp('module_op_small');
  534. zPanel.removeAll( true );
  535. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  536. zPanel.doLayout();
  537. };
  538. },
  539. failure: failureAJAXFunction
  540. });
  541. };
  542. var addMetroStationPlatformWindow = null;
  543. function addStationPlatform( station_id ){
  544. if( addMetroStationPlatformWindow == null ){
  545. addMetroStationPlatformWindow = new Ext.Window({
  546. title: 'Add Platform',
  547. width: 480,
  548. height: 405,
  549. modal: true,
  550. resizable: false,
  551. items:[{
  552. xtype: 'form',
  553. fzrame: false,
  554. bzorder: false,
  555. labelWidth: 150,
  556. labelAlign: 'right',
  557. items: [{
  558. xtype: 'textfield',
  559. fieldLabel: "Platform Name",
  560. id: 'pl_name',
  561. width: 200,
  562. },{
  563. xtype: 'textfield',
  564. fieldLabel: "Platform Level",
  565. id: 'pl_lvl',
  566. width: 50,
  567. },{
  568. xtype: 'combo',
  569. fieldLabel: "Platform Type",
  570. id: 'pl_lay',
  571. width: 200,
  572. lazyRender: true,
  573. mode: 'local',
  574. forceSelection: true,
  575. triggerAction: 'all',
  576. editable: false,
  577. readOnly: false,
  578. disableKeyFilter: true,
  579. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  580. store: new Ext.data.ArrayStore({
  581. fields: ['abbr','name','icon'],
  582. data: [['A','Layout A','/style/assets/pt_layout_A.png'],['B','Layout B','/style/assets/pt_layout_B.png'],['C','Layout C','/style/assets/pt_layout_C.png'],['D','Layout D','/style/assets/pt_layout_D.png'],['E','Layout E','/style/assets/pt_layout_E.png'],['F','Layout F','/style/assets/pt_layout_F.png']]
  583. }),
  584. valueField: 'abbr',
  585. displayField: 'name',
  586. value: 'A',
  587. listeners:{
  588. select: function( t, r, i ){
  589. t.getEl().setStyle({
  590. 'background-image': 'url(' + r.data.icon + ')',
  591. 'background-repeat': 'no-repeat',
  592. 'background-position': '3px center',
  593. 'background-size': '16px 16px',
  594. 'padding-left': '25px'
  595. });
  596. tt = document.getElementById('lp_preview');
  597. tt.src = r.data.icon;
  598. if( r.data.abbr == 'A' || r.data.abbr == 'B' ){
  599. Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Name');
  600. Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Abbr.');
  601. Ext.getCmp('bot_tr_name').hide();
  602. Ext.getCmp('bot_tr_abbr').hide();
  603. } else {
  604. Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Name');
  605. Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Abbr.');
  606. Ext.getCmp('bot_tr_name').show();
  607. Ext.getCmp('bot_tr_abbr').show();
  608. }
  609. },
  610. afterrender: function( t ){
  611. t.getEl().setStyle({
  612. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  613. 'background-repeat': 'no-repeat',
  614. 'background-position': '3px center',
  615. 'background-size': '16px 16px',
  616. 'padding-left': '25px'
  617. });
  618. }
  619. }
  620. },{
  621. xtype: 'spacer',
  622. height: 10
  623. },{
  624. xtype: 'spacer',
  625. html: '<center><img style="border: 1px solid yellow;" id="lp_preview" src="/style/assets/pt_layout_A.png" width="120"></center>'
  626. },{
  627. xtype: 'spacer',
  628. height: 10
  629. },{
  630. xtype: 'textfield',
  631. fieldLabel: "Track Name",
  632. id: 'up_tr_name',
  633. width: 200,
  634. },{
  635. xtype: 'textfield',
  636. fieldLabel: "Track Abbr.",
  637. id: 'up_tr_abbr',
  638. width: 50,
  639. },{
  640. xtype: 'textfield',
  641. fieldLabel: "Bottom Track Name",
  642. hidden: true,
  643. id: 'bot_tr_name',
  644. width: 200,
  645. },{
  646. xtype: 'textfield',
  647. fieldLabel: "Bottom Track Abbr.",
  648. hidden: true,
  649. id: 'bot_tr_abbr',
  650. width: 50,
  651. },{
  652. xtype: 'spacer',
  653. height: 300
  654. }]
  655. }],
  656. bbar:['->',{
  657. text: 'Cancel',
  658. handler: function(){
  659. addMetroStationPlatformWindow.close();
  660. }
  661. },{
  662. text: 'Add',
  663. handler: function(){
  664. var tt = {
  665. name: Ext.getCmp('pl_name').getValue(),
  666. level: Ext.getCmp('pl_lvl').getValue(),
  667. layout: Ext.getCmp('pl_lay').getValue(),
  668. up_trn: Ext.getCmp('up_tr_name').getValue(),
  669. up_tra: Ext.getCmp('up_tr_abbr').getValue(),
  670. bt_trn: Ext.getCmp('bot_tr_name').getValue(),
  671. bt_tra: Ext.getCmp('bot_tr_abbr').getValue()
  672. };
  673. SelectedPlatform = 0;
  674. doPlatformOperation( SelectedStation, 1, JSON.stringify(tt), true );
  675. addMetroStationPlatformWindow.close();
  676. }
  677. }],
  678. listeners:{
  679. beforedestroy: function(){
  680. addMetroStationPlatformWindow = null;
  681. }
  682. }
  683. });
  684. };
  685. addMetroStationPlatformWindow.show();
  686. };
  687. var addMetroStationWindow = null;
  688. function addMetroStation( line_id ){
  689. if( addMetroStationWindow == null ){
  690. //debugger;
  691. addMetroStationWindow = new Ext.Window({
  692. title: 'Add Station',
  693. width: 800,
  694. height: 600,
  695. items:[{
  696. xtype: 'tabpanel',
  697. frame: false,
  698. id: 'jjua_content',
  699. border: false,
  700. activeTab: 0,
  701. items:[{
  702. xtype: 'panel',
  703. flex: 1,
  704. title: 'Assign Existed Station',
  705. items:[{
  706. xtype: 'spacer',
  707. height: 10
  708. },{
  709. xtype: 'textfield',
  710. id: 'zizi',
  711. width: '100%',
  712. enableKeyEvents : true,
  713. emptyText: 'Start Type Station Name Here',
  714. value: '',
  715. listeners:{
  716. keyup: function( t, e ){
  717. nv = t.getRawValue();
  718. if( nv.length > 2 ){
  719. Ext.Ajax.request({
  720. url: '/lib/controller/getStations.php',
  721. params: {
  722. UID: <?=$UserID;?>,
  723. SID: '<?=$Session;?>',
  724. LID: SelectedLine,
  725. ABQ: nv
  726. },
  727. success: function( response, opts ){
  728. var tData = Ext.decode(response.responseText);
  729. var tPanel = Ext.getCmp('ex_station_container');
  730. if( tData.status == 'ok' ){
  731. tPanel.removeAll( true );
  732. var res = Ext.decode( tData.stations );
  733. tPanel.add( res );
  734. tPanel.doLayout();
  735. } else {
  736. tPanel.removeAll( true );
  737. tPanel.doLayout();
  738. };
  739. },
  740. failure: failureAJAXFunction
  741. });
  742. };
  743. }
  744. }
  745. },{
  746. xtype: 'spacer',
  747. height: 10
  748. },{
  749. xtype: 'panel',
  750. id: 'ex_station_container',
  751. flex: 1,
  752. height: 500,
  753. items:[]
  754. }]
  755. }]
  756. }],
  757. listeners:{
  758. beforedestroy: function(){
  759. addMetroStationWindow = null;
  760. }
  761. }
  762. });
  763. };
  764. addMetroStationWindow.show();
  765. };
  766. function editResource( rid ){
  767. var loadEditor = true;
  768. if( settingsAreChanged ){
  769. Ext.Msg.show({
  770. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  771. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  772. buttons: Ext.Msg.YESNO,
  773. icon: Ext.MessageBox.WARNING,
  774. fn: function(btn, text){
  775. if( btn == 'yes' ){
  776. cleanupChangeNotifier();
  777. } else {
  778. loadEditor = false;
  779. };
  780. }
  781. });
  782. };
  783. if( loadEditor ){
  784. Ext.Ajax.request({
  785. url: '/lib/controller/getResourceEditor.php',
  786. params: {
  787. RID: rid,
  788. UID: <?=$UserID;?>,
  789. SID: '<?=$Session;?>',
  790. },
  791. success: function( response, opts ){
  792. var data = Ext.decode(response.responseText);
  793. var resourceEdPanel = Ext.getCmp('res_ed_small');
  794. if( resourceEdPanel ){
  795. resourceEdPanel.removeAll( true );
  796. resourceEdPanel.add( data );
  797. resourceEdPanel.doLayout();
  798. };
  799. },
  800. failure: failureAJAXFunction
  801. });
  802. };
  803. };
  804. function editFilter( fid ){
  805. var loadEditor = true;
  806. if( settingsAreChanged ){
  807. Ext.Msg.show({
  808. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  809. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  810. buttons: Ext.Msg.YESNO,
  811. icon: Ext.MessageBox.WARNING,
  812. fn: function(btn, text){
  813. if( btn == 'yes' ){
  814. cleanupChangeNotifier();
  815. } else {
  816. loadEditor = false;
  817. };
  818. }
  819. });
  820. };
  821. if( loadEditor ){
  822. Ext.Ajax.request({
  823. url: '/lib/controller/getFilterEditor.php',
  824. params: {
  825. FID: fid,
  826. UID: <?=$UserID;?>,
  827. SID: '<?=$Session;?>',
  828. },
  829. success: function( response, opts ){
  830. var data = Ext.decode(response.responseText);
  831. var resourceEdPanel = Ext.getCmp('flt_ed_small');
  832. if( resourceEdPanel ){
  833. resourceEdPanel.removeAll( true );
  834. resourceEdPanel.add( data );
  835. resourceEdPanel.doLayout();
  836. };
  837. },
  838. failure: failureAJAXFunction
  839. });
  840. };
  841. };
  842. function editModule( s_id ){
  843. if( oSelectedModule ){
  844. var tt = document.getElementById('MODULE_TAG_'+oSelectedModule );
  845. if( tt != null ){
  846. tt.classList.remove('selected_green');
  847. tt.classList.add('active_green');
  848. } else oSelectedModule = 0;
  849. };
  850. var tt = document.getElementById('MODULE_TAG_'+s_id );
  851. if( tt!= undefined ){
  852. tt.classList.remove('active_green');
  853. tt.classList.add('selected_green');
  854. };
  855. if( oSelectedModule == s_id ) return;
  856. Ext.Ajax.request({
  857. url: '/lib/controller/getModuleEditor.php',
  858. params: {
  859. MID: s_id,
  860. UID: <?=$UserID;?>,
  861. SID: '<?=$Session;?>'
  862. },
  863. success: function( response, opts ){
  864. var data = Ext.decode( response.responseText );
  865. var tComp = Ext.getCmp('module_op_small');
  866. if( tComp!= null ){
  867. tComp.removeAll( true );
  868. tComp.add( data );
  869. tComp.doLayout();
  870. };
  871. oSelectedModule = s_id;
  872. if( SelectedModule != s_id ){
  873. SelectedModule = s_id;
  874. //tComp = Ext.getCmp('btn_unb_station');
  875. //tComp.setDisabled( false );
  876. //tComp = Ext.getCmp('btn_del_station');
  877. //tComp.setDisabled( false );
  878. //tComp = Ext.getCmp('modules_tab');
  879. //tComp.setDisabled( false );
  880. };
  881. }
  882. });
  883. };
  884. function enableModule( ID ){
  885. Ext.Ajax.request({
  886. url: '/lib/controller/doModuleOperation.php',
  887. params: {
  888. OPID: 2,
  889. OPCODE: 1,
  890. MID: ID,
  891. UID: <?=$UserID;?>,
  892. SID: '<?=$Session;?>'
  893. },
  894. success: function(){
  895. //showSettings( SelectedNodeID, 2 );
  896. loadModules();
  897. }
  898. });
  899. };
  900. function disableModule( ID ){
  901. Ext.Ajax.request({
  902. url: '/lib/controller/doModuleOperation.php',
  903. params: {
  904. OPID: 2,
  905. OPCODE: 0,
  906. MID: ID,
  907. UID: <?=$UserID;?>,
  908. SID: '<?=$Session;?>'
  909. },
  910. success: function(){
  911. //showSettings( SelectedNodeID, 2 );
  912. loadModules();
  913. }
  914. });
  915. };
  916. //cursor: url('data:image/svg+xml;utf8,<svg fill="%23FF0000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>') 24 24, auto;
  917. function doApplicationOperation( op, param, reload = false ){
  918. Ext.Ajax.request({
  919. url: '/lib/controller/doApplicationOperation.php',
  920. params: {
  921. OPID: op,
  922. OPCODE: param,
  923. UID: <?=$UserID;?>,
  924. SID: '<?=$Session;?>'
  925. },
  926. success: function(){
  927. //if( reload ) loadDetectedCameras();
  928. //if( reload ) loadAssignedCameras();
  929. }
  930. });
  931. };
  932. function doModuleOperation( moduleid, op, param, reload = false ){
  933. Ext.Ajax.request({
  934. url: '/lib/controller/doModuleOperations.php',
  935. params: {
  936. MID: moduleid,
  937. OPID: op,
  938. OPCODE: param,
  939. UID: <?=$UserID;?>,
  940. SID: '<?=$Session;?>'
  941. },
  942. success: function(){
  943. if( reload ) loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  944. }
  945. });
  946. };
  947. function doLineOperation( lineID, operation, param, reload ){
  948. Ext.Ajax.request({
  949. url: '/lib/controller/doLineOperations.php',
  950. params: {
  951. ID: lineID,
  952. OPID: operation,
  953. OPCODE: param,
  954. UID: <?=$UserID;?>,
  955. SID: '<?=$Session;?>'
  956. },
  957. success: function(){
  958. oSelectedLine = 0;
  959. if( reload ) loadMetroLines( SelectedLine );
  960. }
  961. });
  962. };
  963. function doStationOperation( StationID, operation, param, reload ){
  964. Ext.Ajax.request({
  965. url: '/lib/controller/doStationOperations.php',
  966. params: {
  967. ID: StationID,
  968. OPID: operation,
  969. OPCODE: param,
  970. UID: <?=$UserID;?>,
  971. SID: '<?=$Session;?>'
  972. },
  973. success: function(){
  974. if( reload ) loadMetroStations( SelectedLine, SelectedStation );
  975. }
  976. });
  977. };
  978. function doPlatformOperation( PlatformID, operation, param, reload ){
  979. Ext.Ajax.request({
  980. url: '/lib/controller/doPlatformOperations.php',
  981. params: {
  982. ID: PlatformID,
  983. OPID: operation,
  984. OPCODE: param,
  985. UID: <?=$UserID;?>,
  986. SID: '<?=$Session;?>'
  987. },
  988. success: function(){
  989. if( reload ) loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  990. }
  991. });
  992. };
  993. function doScadaOperation( PlatformID, ScadaID, operation, param, reload ){
  994. Ext.Ajax.request({
  995. url: '/lib/controller/doPlatformOperations.php',
  996. params: {
  997. ID: PlatformID,
  998. SCA: ScadaID,
  999. OPID: operation,
  1000. OPCODE: param,
  1001. UID: <?=$UserID;?>,
  1002. SID: '<?=$Session;?>'
  1003. },
  1004. success: function(){
  1005. if( reload ) loadSCADAModules( SelectedPlatform, SelectedScadaModule );
  1006. }
  1007. });
  1008. };
  1009. function removeModule( ID ){
  1010. Ext.Msg.show({
  1011. title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
  1012. msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
  1013. buttons: Ext.Msg.YESNOCANCEL,
  1014. fn: function( btn, text ){
  1015. if( btn == 'yes' ){
  1016. Ext.Ajax.request({
  1017. url: '/lib/controller/doModuleOperation.php',
  1018. params: {
  1019. OPID: 1,
  1020. MID: ID,
  1021. UID: <?=$UserID;?>,
  1022. SID: '<?=$Session;?>'
  1023. },
  1024. success: function(){
  1025. //showSettings( SelectedNodeID, 2 );
  1026. loadModules();
  1027. }
  1028. });
  1029. };
  1030. },
  1031. icon: Ext.MessageBox.QUESTION
  1032. });
  1033. };
  1034. function disableServOps(){
  1035. var tC = Ext.getCmp('servopPanel01');
  1036. tC.removeClass('servopInfo_item01');
  1037. tC.addClass('servopInfo_item00');
  1038. tC.disable();
  1039. Ext.getCmp('tbtn_sop01').disable();
  1040. //tC.doLayout();
  1041. tC = Ext.getCmp('servopPanel02');
  1042. tC.removeClass('servopInfo_item11');
  1043. tC.addClass('servopInfo_item10');
  1044. tC.disable();
  1045. Ext.getCmp('tbtn_sop02').disable();
  1046. //tC.doLayout();
  1047. tC = Ext.getCmp('servopPanel03');
  1048. tC.removeClass('servopInfo_item21');
  1049. tC.addClass('servopInfo_item20');
  1050. tC.disable();
  1051. Ext.getCmp('tbtn_sop03').disable();
  1052. //tC.doLayout();
  1053. tC = Ext.getCmp('servopPanel04');
  1054. tC.removeClass('servopInfo_item31');
  1055. tC.addClass('servopInfo_item30');
  1056. tC.disable();
  1057. Ext.getCmp('tbtn_sop04').disable();
  1058. //tC.doLayout();
  1059. };
  1060. function enableServOps(){
  1061. var tC = Ext.getCmp('servopPanel01');
  1062. if( tC != undefined ){
  1063. tC.removeClass('servopInfo_item00');
  1064. tC.addClass('servopInfo_item01');
  1065. Ext.getCmp('tbtn_sop01').enable();
  1066. tC.enable();
  1067. };
  1068. //tC.doLayout();
  1069. tC = Ext.getCmp('servopPanel02');
  1070. if( tC != undefined ){
  1071. tC.removeClass('servopInfo_item10');
  1072. tC.addClass('servopInfo_item11');
  1073. tC.enable();
  1074. Ext.getCmp('tbtn_sop02').enable();
  1075. };
  1076. //tC.doLayout();
  1077. tC = Ext.getCmp('servopPanel03');
  1078. if( tC != undefined ){
  1079. tC.removeClass('servopInfo_item20');
  1080. tC.addClass('servopInfo_item21');
  1081. tC.enable();
  1082. Ext.getCmp('tbtn_sop03').enable();
  1083. };
  1084. //tC.doLayout();
  1085. tC = Ext.getCmp('servopPanel04');
  1086. if( tC != undefined ){
  1087. tC.removeClass('servopInfo_item30');
  1088. tC.addClass('servopInfo_item31');
  1089. tC.enable();
  1090. Ext.getCmp('tbtn_sop04').enable();
  1091. };
  1092. //tC.doLayout();
  1093. };
  1094. function serverStatusUpdater(){
  1095. Ext.Ajax.request({
  1096. url: '/lib/controller/getServerStatus.php',
  1097. params: {
  1098. SERVID: 1,
  1099. UID: <?=$UserID;?>,
  1100. SID: '<?=$Session;?>'
  1101. },
  1102. success: function( response, opts ){
  1103. // If the response is JSON, you have to decode it
  1104. var sps = document.getElementById("INFO_SPS");
  1105. if( sps == undefined ) return;
  1106. var data = Ext.decode(response.responseText);
  1107. if( data.status == 'ok' ){
  1108. serverIsOnLine = true;
  1109. enableServOps();
  1110. document.getElementById('HW_INFO').innerHTML = data.hw_info;
  1111. document.getElementById('OS_INFO').innerHTML = data.os_info;
  1112. document.getElementById('SW_INFO').innerHTML = data.build;
  1113. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  1114. setDonatStatus( 1, 1, data.stats.stat_mem );
  1115. setDonatStatus( 1, 2, data.stats.stat_disk );
  1116. setDonatStatus( 1, 3, data.stats.temp0 );
  1117. sps.classList.remove('setEd_infoPanel');
  1118. sps.classList.add('setEl_infoPanel');
  1119. } else {
  1120. serverIsOnLine = false;
  1121. disableServOps();
  1122. if( data.status == 'na' ){
  1123. setDonatStatus( 1, 0, -1 );
  1124. setDonatStatus( 1, 1, -1 );
  1125. setDonatStatus( 1, 2, -1 );
  1126. setDonatStatus( 1, 3, -1 );
  1127. sps.classList.remove('setEl_infoPanel');
  1128. sps.classList.add('setEd_infoPanel');
  1129. } else {
  1130. Ext.Msg.show({
  1131. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1132. msg: data.messages,
  1133. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1134. fn: function(){
  1135. },
  1136. icon: Ext.MessageBox.INFO //QUESTION
  1137. });
  1138. };
  1139. };
  1140. if( tlInterval == null ){
  1141. tlInterval = window.setInterval( serverStatusUpdater, 1200, selectedSite );
  1142. };
  1143. },
  1144. failure: failureAJAXFunction
  1145. });
  1146. };
  1147. var scadaEditorStatusTimeout = null;
  1148. function stopScadaEditorStatusUpdate(){
  1149. if( scadaEditorStatusTimeout != null ) clearTimeout( scadaEditorStatusTimeout );
  1150. };
  1151. function fetchScadaEditorStatus(){
  1152. if( scadaEditorStatusTimeout != null ) clearTimeout( scadaEditorStatusTimeout );
  1153. scadaEditorStatusTimeout = null;
  1154. Ext.Ajax.request({
  1155. url: '/lib/controller/getScadaStatus.php',
  1156. params: {
  1157. UID: <?=$UserID;?>,
  1158. SID: '<?=$Session;?>',
  1159. MODE: 0,
  1160. MID: SelectedScadaModule
  1161. },
  1162. success: function( response, opts ){
  1163. var data = Ext.decode(response.responseText);
  1164. if( data.status == 'ok' ){
  1165. if( data.online ){
  1166. var lt = document.getElementById('scae_onl_sts');
  1167. if( lt != undefined ) lt.src = "/style/assets/bul_green.png";
  1168. lt = document.getElementById('sce_in_1_img');
  1169. if( data.inputs[0] ){
  1170. if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
  1171. } else {
  1172. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1173. };
  1174. lt = document.getElementById('sce_in_2_img');
  1175. if( data.inputs[1] ){
  1176. if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
  1177. } else {
  1178. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1179. };
  1180. lt = document.getElementById('sce_in_3_img');
  1181. if( data.inputs[2] ){
  1182. if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
  1183. } else {
  1184. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1185. };
  1186. lt = document.getElementById('sce_in_4_img');
  1187. if( data.inputs[3] ){
  1188. if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png";
  1189. } else {
  1190. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1191. };
  1192. var tT = Ext.getCmp('sc_tbtn_1');
  1193. if( tT != undefined ){
  1194. tT.enable();
  1195. tT.suspendEvents();
  1196. tT.toggle( data.outputs[0] );
  1197. tT.resumeEvents();
  1198. };
  1199. tT = Ext.getCmp('sc_tbtn_2');
  1200. if( tT != undefined ){
  1201. tT.enable();
  1202. tT.suspendEvents();
  1203. tT.toggle( data.outputs[1] );
  1204. tT.resumeEvents();
  1205. };
  1206. tT = Ext.getCmp('sc_tbtn_3');
  1207. if( tT != undefined ){
  1208. tT.enable();
  1209. tT.suspendEvents();
  1210. tT.toggle( data.outputs[2] );
  1211. tT.resumeEvents();
  1212. };
  1213. tT = Ext.getCmp('sc_tbtn_4');
  1214. if( tT != undefined ){
  1215. tT.enable();
  1216. tT.suspendEvents();
  1217. tT.toggle( data.outputs[3] );
  1218. tT.resumeEvents();
  1219. };
  1220. var cv = Ext.getCmp('c_sca_e_panel');
  1221. if( cv != undefined ) cv.c_do_val = data.ov;
  1222. } else {
  1223. var lt = document.getElementById('scae_onl_sts');
  1224. if( lt != undefined ) lt.src = "/style/assets/bul_gray.png";
  1225. lt = document.getElementById('sce_in_1_img');
  1226. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1227. lt = document.getElementById('sce_in_2_img');
  1228. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1229. lt = document.getElementById('sce_in_3_img');
  1230. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1231. lt = document.getElementById('sce_in_4_img');
  1232. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1233. var tT = Ext.getCmp('sc_tbtn_1');
  1234. if( tT != undefined ){
  1235. tT.disable();
  1236. tT.suspendEvents();
  1237. tT.toggle( false );
  1238. tT.resumeEvents();
  1239. };
  1240. tT = Ext.getCmp('sc_tbtn_2');
  1241. if( tT != undefined ){
  1242. tT.disable();
  1243. tT.suspendEvents();
  1244. tT.toggle( false );
  1245. tT.resumeEvents();
  1246. };
  1247. tT = Ext.getCmp('sc_tbtn_3');
  1248. if( tT != undefined ){
  1249. tT.disable();
  1250. tT.suspendEvents();
  1251. tT.toggle( false );
  1252. tT.resumeEvents();
  1253. };
  1254. tT = Ext.getCmp('sc_tbtn_4');
  1255. if( tT != undefined ){
  1256. tT.disable();
  1257. tT.suspendEvents();
  1258. tT.toggle( false );
  1259. tT.resumeEvents();
  1260. };
  1261. };
  1262. var tT = Ext.getCmp('sce_cb_o_1');
  1263. if( tT != undefined ){
  1264. tT.suspendEvents();
  1265. tT.setValue( data.cb_out_a );
  1266. tT.resumeEvents();
  1267. };
  1268. tT = Ext.getCmp('sce_cb_o_2');
  1269. if( tT != undefined ){
  1270. tT.suspendEvents();
  1271. tT.setValue( data.cb_out_b );
  1272. tT.resumeEvents();
  1273. };
  1274. tT = Ext.getCmp('sce_cb_o_3');
  1275. if( tT != undefined ){
  1276. tT.suspendEvents();
  1277. tT.setValue( data.cb_out_c );
  1278. tT.resumeEvents();
  1279. };
  1280. tT = Ext.getCmp('sce_cb_o_4');
  1281. if( tT != undefined ){
  1282. tT.suspendEvents();
  1283. tT.setValue( data.cb_out_d );
  1284. tT.resumeEvents();
  1285. };
  1286. tT = Ext.getCmp('sce_cb_i_1');
  1287. if( tT != undefined ){
  1288. tT.suspendEvents();
  1289. tT.setValue( data.cb_in_a );
  1290. tT.resumeEvents();
  1291. };
  1292. tT = Ext.getCmp('sce_cb_i_2');
  1293. if( tT != undefined ){
  1294. tT.suspendEvents();
  1295. tT.setValue( data.cb_in_b );
  1296. tT.resumeEvents();
  1297. };
  1298. tT = Ext.getCmp('sce_cb_i_3');
  1299. if( tT != undefined ){
  1300. tT.suspendEvents();
  1301. tT.setValue( data.cb_in_c );
  1302. tT.resumeEvents();
  1303. };
  1304. tT = Ext.getCmp('sce_cb_i_4');
  1305. if( tT != undefined ){
  1306. tT.suspendEvents();
  1307. tT.setValue( data.cb_in_d );
  1308. tT.resumeEvents();
  1309. };
  1310. scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
  1311. } else {
  1312. //show error msg
  1313. };
  1314. },
  1315. failure: failureAJAXFunction
  1316. });
  1317. };
  1318. var devUploadTimeout = null;
  1319. var devUploadID = -1;
  1320. function fetchDeviceUploadStatus(){
  1321. clearTimeout( devUploadTimeout );
  1322. if( devUploadID < 1 ) return;
  1323. Ext.Ajax.request({
  1324. url: '/lib/controller/getDeviceUploadStatus.php',
  1325. params: {
  1326. UID: <?=$UserID;?>,
  1327. SID: '<?=$Session;?>',
  1328. DID: devUploadID
  1329. },
  1330. success: function( response, opts ){
  1331. var data = Ext.decode(response.responseText);
  1332. var tT = Ext.getCmp('upp_ttext');
  1333. if( tT != undefined ){
  1334. if( data.count > 0 ){
  1335. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1336. };
  1337. if( data.current != undefined ){
  1338. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1339. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1340. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1341. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1342. } else {
  1343. Ext.getCmp('upload_progres_panel').hide();
  1344. Ext.getCmp('uploaded_grid').show();
  1345. loadModuleFiles( devUploadID );
  1346. };
  1347. };
  1348. },
  1349. failure: failureAJAXFunction
  1350. });
  1351. };
  1352. function downloadSettings(){
  1353. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1354. ReportMask.show();
  1355. const formData = new FormData();
  1356. formData.append("UID",<?=$UserID;?>);
  1357. formData.append("SID",'<?=$Session;?>');
  1358. fetch('/lib/controller/downloadSettings.php',{
  1359. method: "POST",
  1360. body: formData
  1361. })
  1362. .then(resp => resp.blob())
  1363. .then(blob => {
  1364. const url = window.URL.createObjectURL(blob);
  1365. const a = document.createElement('a');
  1366. a.style.display = 'none';
  1367. a.href = url;
  1368. var today=new Date();
  1369. var SY=1900+today.getYear();
  1370. var SMO=today.getMonth()+1;
  1371. var SD=today.getDate();
  1372. var SH = today.getHours();
  1373. var SM = today.getMinutes();
  1374. var SS = today.getSeconds();
  1375. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1376. document.body.appendChild(a);
  1377. a.click();
  1378. window.URL.revokeObjectURL(url);
  1379. ReportMask.hide();
  1380. Ext.Msg.show({
  1381. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1382. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1383. buttons: Ext.Msg.OK,
  1384. icon: Ext.MessageBox.INFO
  1385. });
  1386. })
  1387. .catch(() => {
  1388. ReportMask.hide();
  1389. Ext.Msg.show({
  1390. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1391. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1392. buttons: Ext.Msg.OK,
  1393. icon: Ext.MessageBox.ERROR
  1394. });
  1395. });
  1396. };
  1397. var addModuleWindow = null;
  1398. function addModule(){
  1399. Ext.Ajax.request({
  1400. url: '/lib/controller/getAddModuleWindow.php',
  1401. params: {
  1402. UID: <?=$UserID;?>,
  1403. SID: '<?=$Session;?>',
  1404. PID: SelectedPlatform
  1405. },
  1406. success: function( response, opts ){
  1407. var data = Ext.decode(response.responseText);
  1408. addModuleWindow = new Ext.Window( data );
  1409. addModuleWindow.show();
  1410. },
  1411. failure: failureAJAXFunction
  1412. });
  1413. };
  1414. var addScadaModuleWindow = null;
  1415. function addScadaModule(){
  1416. if( addScadaModuleWindow == null ){
  1417. addScadaModuleWindow = new Ext.Window({
  1418. title: "<?=$Labels->GetLabel( '_ADD_SCADA_MODULE_' );?>",
  1419. modal: true,
  1420. width: 400,
  1421. height: 148,
  1422. closeAction: 'hide',
  1423. resizable: false,
  1424. items:[{
  1425. xtype: 'form',
  1426. labelAlign: 'right',
  1427. border: false,
  1428. frame: false,
  1429. items: [{
  1430. id: 'scm_dev_name',
  1431. xtype: 'textfield',
  1432. fieldLabel: "<?=$Labels->GetLabel( '_NAME_LABEL_' );?>",
  1433. value: ''
  1434. },{
  1435. id: 'scm_dev_ip',
  1436. xtype: 'textfield',
  1437. minLength: 7,
  1438. maxLength: 15,
  1439. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_IP_' );?>",
  1440. value: ''
  1441. },{
  1442. xtype: 'numberfield',
  1443. id: 'scm_dev_port',
  1444. maxValue: 65535,
  1445. minValue: 27,
  1446. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_PORT_' );?>",
  1447. value: '502'
  1448. }]
  1449. }],
  1450. bbar:['->',{
  1451. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1452. handler: function(){
  1453. addScadaModuleWindow.hide();
  1454. }
  1455. },{
  1456. text: '<?=$Labels->GetLabel( '__ADD__' );?>',
  1457. handler: function(){
  1458. var mod_name = Ext.getCmp('scm_dev_name').getValue();
  1459. var mod_ip = Ext.getCmp('scm_dev_ip').getValue();
  1460. var mod_port = Ext.getCmp('scm_dev_port').getValue();
  1461. Ext.Ajax.request({
  1462. url: '/lib/controller/doPlatformOperations.php',
  1463. params: {
  1464. OPID: 12,
  1465. ID: SelectedPlatform,
  1466. MIP: mod_ip,
  1467. MPO: mod_port,
  1468. MNA: mod_name,
  1469. UID: <?=$UserID;?>,
  1470. SID: '<?=$Session;?>'
  1471. },
  1472. success: function( response, opts ){
  1473. var data = Ext.decode(response.responseText);
  1474. if( data.success ){
  1475. addScadaModuleWindow.close();
  1476. loadSCADAModules();
  1477. } else {
  1478. Ext.Msg.show({
  1479. title: "<?=$Labels->GetLabel("_ERROR_MSG_");?>",
  1480. msg: data.msg,
  1481. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1482. fn: function(){
  1483. //SettingsLidar3D.hide();
  1484. },
  1485. icon: Ext.MessageBox.ERROR //QUESTION
  1486. });
  1487. };
  1488. }
  1489. });
  1490. }
  1491. }]
  1492. });
  1493. };
  1494. Ext.getCmp('scm_dev_name').setValue( '' );
  1495. Ext.getCmp('scm_dev_ip').setValue( '' );
  1496. Ext.getCmp('scm_dev_port').setValue( 502 );
  1497. addScadaModuleWindow.show();
  1498. };
  1499. function addFilter(){
  1500. var addFilterWindow = new Ext.Window({
  1501. id: 'fulu_boa',
  1502. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1503. modal: true,
  1504. width: 400,
  1505. height: 300,
  1506. items:[{
  1507. xtype: 'form',
  1508. items: [{
  1509. xtype: 'combo',
  1510. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1511. id: 'flt_type',
  1512. lazyRender: true,
  1513. mode: 'local',
  1514. forceSelection: true,
  1515. triggerAction: 'all',
  1516. editable: false,
  1517. disableKeyFilter: true,
  1518. store: new Ext.data.ArrayStore({
  1519. fields: ['az_t','az_txt'],
  1520. data: [<?php
  1521. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1522. //$JIJI=$DATABASE->Query( $QS );
  1523. $OOP = array();
  1524. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1525. echo implode(',', $OOP );
  1526. ?>]
  1527. }),
  1528. valueField: 'az_t',
  1529. displayField: 'az_txt',
  1530. value: 1,
  1531. listeners:{
  1532. select: function( t, r, i ){
  1533. var n = r.data.az_t;
  1534. Ext.Ajax.request({
  1535. url: '/lib/controller/getFilterInfo.php',
  1536. params: {
  1537. FID: n,
  1538. UID: <?=$UserID;?>,
  1539. SID: '<?=$Session;?>'
  1540. },
  1541. success: function( response, opts ){
  1542. Ext.getCmp('filt_infopan').update( response.responseText );
  1543. }
  1544. });
  1545. }
  1546. }
  1547. },{
  1548. xtype: 'panel',
  1549. id: 'filt_infopan',
  1550. html: ''
  1551. }]
  1552. }],
  1553. bbar:[{
  1554. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  1555. handler: function(){
  1556. addFilterWindow.close();
  1557. }
  1558. },{
  1559. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  1560. handler: function(){
  1561. var mtyp = Ext.getCmp('flt_type').getValue();
  1562. Ext.Ajax.request({
  1563. url: '/lib/controller/addFilter.php',
  1564. params: {
  1565. SERVID: 1,
  1566. TYPE: mtyp,
  1567. UID: <?=$UserID;?>,
  1568. SID: '<?=$Session;?>'
  1569. },
  1570. success: function( response, opts ){
  1571. // If the response is JSON, you have to decode it
  1572. var data = Ext.decode(response.responseText);
  1573. if( data.status == 'ok' ){
  1574. addFilterWindow.close();
  1575. loadFilters();
  1576. } else {
  1577. Ext.Msg.show({
  1578. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1579. msg: data.message,
  1580. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1581. fn: function(){
  1582. //SettingsLidar3D.hide();
  1583. },
  1584. icon: Ext.MessageBox.INFO //QUESTION
  1585. });
  1586. }
  1587. },
  1588. failure: failureAJAXFunction
  1589. });
  1590. }
  1591. }]
  1592. });
  1593. addFilterWindow.show();
  1594. Ext.Ajax.request({
  1595. url: '/lib/controller/getFilterInfo.php',
  1596. params: {
  1597. FID: 1,
  1598. UID: <?=$UserID;?>,
  1599. SID: '<?=$Session;?>'
  1600. },
  1601. success: function( response, opts ){
  1602. Ext.getCmp('filt_infopan').update( response.responseText );
  1603. }
  1604. });
  1605. };
  1606. function showSettingsProfile(){
  1607. stopStatusUpdater();
  1608. //if( contentView.l[3] == undefined ){
  1609. // contentView.l[3] = {v:0,p:''};
  1610. //};
  1611. Ext.Ajax.request({
  1612. url: '/lib/controller/getProfileSettings.php',
  1613. params: {
  1614. UID: <?=$UserID;?>,
  1615. TYP: contentView.l[3].v,
  1616. SID: '<?=$Session;?>',
  1617. },
  1618. success: function( response, opts ){
  1619. var tData = Ext.decode(response.responseText);
  1620. if( tData.status == 'ok' ){
  1621. var tPanel = Ext.getCmp('main_content');
  1622. tPanel.removeAll( true );
  1623. tPanel.add(Ext.decode(tData.content));
  1624. tPanel.doLayout();
  1625. };
  1626. },
  1627. failure: failureAJAXFunction
  1628. });
  1629. };
  1630. function showSettingsServer(){
  1631. stopStatusUpdater();
  1632. if( contentView.l[3] == undefined ){
  1633. contentView.l[3] = {v:0,p:''};
  1634. };
  1635. Ext.Ajax.request({
  1636. url: '/lib/controller/getServerSettings.php',
  1637. params: {
  1638. UID: <?=$UserID;?>,
  1639. TYP: contentView.l[3].v,
  1640. SID: '<?=$Session;?>',
  1641. },
  1642. success: function( response, opts ){
  1643. var tData = Ext.decode(response.responseText);
  1644. var tPanel = Ext.getCmp('main_content');
  1645. tPanel.removeAll( true );
  1646. tPanel.add(Ext.decode(tData.content));
  1647. tPanel.doLayout();
  1648. if( contentView.l[3].v == 0 ) serverStatusUpdater();
  1649. },
  1650. failure: failureAJAXFunction
  1651. });
  1652. };
  1653. function showSettingsInfrastructure(){
  1654. stopStatusUpdater();
  1655. if( contentView.l[3] == undefined ){
  1656. contentView.l[3] = {v:0,p:''};
  1657. };
  1658. var tPanel = Ext.getCmp('main_content');
  1659. tPanel.removeAll( true );
  1660. tPanel.add({
  1661. xtype: 'tabpanel',
  1662. frame: false,
  1663. id: 'node_settings_content',
  1664. border: false,
  1665. activeTab: contentView.l[3].v,
  1666. listeners:{
  1667. tabchange: function( tp, t ){
  1668. switch( t.getId() ){
  1669. case 'lines_tab': {
  1670. stopStatusUpdater();
  1671. loadMetroLines( SelectedLine );
  1672. break;
  1673. };
  1674. case 'stations_tab': {
  1675. stopStatusUpdater();
  1676. loadMetroStations( SelectedLine, SelectedStation );
  1677. break;
  1678. };
  1679. case 'platform_tab':{
  1680. stopStatusUpdater();
  1681. loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  1682. break;
  1683. };
  1684. case 'modules_tab':{
  1685. stopStatusUpdater();
  1686. loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  1687. break;
  1688. };
  1689. };
  1690. }
  1691. },
  1692. items: [{
  1693. xtype: 'panel',
  1694. id: 'lines_tab',
  1695. title: "<?=$Labels->GetLabel( '_LBL_LINES_' );?>",
  1696. layout: 'hbox',
  1697. items:[{
  1698. xtype: 'panel',
  1699. id: 'lines_container',
  1700. tbar:[{
  1701. text: "<?=$Labels->GetLabel( '_SMM_ADD_LINE_' );?>",
  1702. handler: function(){}
  1703. }],
  1704. flex: 1,
  1705. height: PanelH-15,
  1706. autoScroll: 'auto',
  1707. items:[]
  1708. },{
  1709. xtype: 'panel',
  1710. id: 'line_op_small',
  1711. flex: 1,
  1712. height: PanelH-15,
  1713. layout: 'fit',
  1714. items:[{
  1715. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1716. }]
  1717. }]
  1718. },{
  1719. xtype: 'panel',
  1720. id: 'stations_tab',
  1721. disabled: (SelectedLine == 0 ),
  1722. title: "<?=$Labels->GetLabel( '_LBL_STATIONS_' );?>",
  1723. layout: 'hbox',
  1724. items:[{
  1725. xtype: 'panel',
  1726. id: 'stations_container',
  1727. tbar:[{
  1728. text: "<?=$Labels->GetLabel( '_SMM_ADD_STATION_' );?>",
  1729. handler: addMetroStation
  1730. }],
  1731. flex: 1,
  1732. height: PanelH-15,
  1733. autoScroll: 'auto',
  1734. items:[]
  1735. },{
  1736. xtype: 'panel',
  1737. id: 'station_op_small',
  1738. flex: 1,
  1739. height: PanelH-15,
  1740. layout: 'fit',
  1741. items:[{
  1742. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1743. }]
  1744. }]
  1745. },{
  1746. xtype: 'panel',
  1747. id: 'platform_tab',
  1748. disabled: (SelectedStation == 0),
  1749. title: "<?=$Labels->GetLabel( '_LBL_PLATFORMS_' );?>",
  1750. layout: 'hbox',
  1751. items:[{
  1752. xtype: 'panel',
  1753. id: 'platform_container',
  1754. tbar:[{
  1755. text: "<?=$Labels->GetLabel( '_SMM_ADD_PLATFORM_' );?>",
  1756. handler: addStationPlatform
  1757. }],
  1758. flex: 1,
  1759. height: PanelH-15,
  1760. autoScroll: 'auto',
  1761. items:[]
  1762. },{
  1763. xtype: 'panel',
  1764. id: 'platform_op_small',
  1765. flex: 1,
  1766. height: PanelH-15,
  1767. layout: 'fit',
  1768. items:[{
  1769. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1770. }]
  1771. }]
  1772. },{
  1773. xtype: 'panel',
  1774. id: 'modules_tab',
  1775. disabled: ( SelectedPlatform==0 ),
  1776. title: "<?=$Labels->GetLabel('_MODULES_');?>",
  1777. layout: 'hbox',
  1778. items:[{
  1779. xtype: 'panel',
  1780. id: 'module_container',
  1781. tbar:[{
  1782. id: 'mod_add_btn',
  1783. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1784. handler: addModule
  1785. }],
  1786. flex: 1,
  1787. height: PanelH-15,
  1788. autoScroll: 'auto',
  1789. items:[]
  1790. },{
  1791. xtype: 'panel',
  1792. id: 'module_op_small',
  1793. flex: 1,
  1794. height: PanelH-15,
  1795. layout: 'fit',
  1796. items:[{
  1797. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1798. }]
  1799. }]
  1800. }]
  1801. });
  1802. tPanel.doLayout();
  1803. oSelectedLine = 0;
  1804. loadMetroLines( SelectedLine );
  1805. };
  1806. var SNAPE_Icon = L.icon({
  1807. iconUrl: '/style/assets/cursor.png',
  1808. iconSize: [32, 32], // size of the icon
  1809. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  1810. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  1811. //shadowUrl: 'leaf-shadow.png',
  1812. //shadowSize: [50, 64], // size of the shadow
  1813. //shadowAnchor: [4, 62], // the same for the shadow
  1814. });
  1815. function updateSchemeLocation( e ){
  1816. Ext.Ajax.request({
  1817. url: '/lib/controller/doStationOperations.php',
  1818. params: {
  1819. STATION: SelectedStation,
  1820. OPID: 11,
  1821. TYPE: 0,
  1822. UID: <?=$UserID;?>,
  1823. SID: '<?=$Session;?>',
  1824. Y: e.target._latlng.lat,
  1825. X: e.target._latlng.lng
  1826. },
  1827. failure: failureAJAXFunction
  1828. });
  1829. };
  1830. function updateGisLocation( e ){
  1831. Ext.Ajax.request({
  1832. url: '/lib/controller/doStationOperations.php',
  1833. params: {
  1834. STATION: SelectedStation,
  1835. OPID: 11,
  1836. TYPE: 1,
  1837. UID: <?=$UserID;?>,
  1838. SID: '<?=$Session;?>',
  1839. LAT: e.target._latlng.lat,
  1840. LON: e.target._latlng.lng
  1841. },
  1842. failure: failureAJAXFunction
  1843. });
  1844. };
  1845. var schematic_editor = null;
  1846. function inintSchematicEditor( map_id, x, y ){
  1847. var mapLayers = [];
  1848. if( schematic_editor != null ){
  1849. schematic_editor.off();
  1850. schematic_editor.remove();
  1851. schematic_editor = null;
  1852. };
  1853. schematic_editor = L.map( map_id,{
  1854. crs: L.CRS.Simple,
  1855. attributionControl: false,
  1856. preferCanvas: true,
  1857. zoomControl: true,
  1858. center: [x,y],
  1859. zoom: 0,
  1860. minZoom: -3,
  1861. maxZoom: 0,
  1862. keyboard: false
  1863. });
  1864. var bounds = [[SCHEMATIC_SET.bounds_lx,SCHEMATIC_SET.bounds_ly], [SCHEMATIC_SET.bounds_rx,SCHEMATIC_SET.bounds_ry]];
  1865. var image = L.imageOverlay( SCHEMATIC_SET.layer_url, bounds ).addTo( schematic_editor );
  1866. L.marker([x, y], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( schematic_editor ).on('dragend', updateSchemeLocation );
  1867. };
  1868. var gis_editor = null;
  1869. function inintGisEditor( map_id, Lat, Lon ){
  1870. var mapLayers = [];
  1871. if( gis_editor != null ){
  1872. //ToDo: must be moved to Upper Menu changer
  1873. gis_editor.off();
  1874. gis_editor.remove();
  1875. gis_editor = null;
  1876. };
  1877. gis_editor = L.map( map_id,{
  1878. attributionControl: false,
  1879. preferCanvas: true,
  1880. zoomControl: true,
  1881. center: [Lat, Lon],
  1882. /*zoomControl: false,
  1883. zoom: 17,
  1884. minZoom: 17,
  1885. maxZoom: 17,*/
  1886. keyboard: false
  1887. });
  1888. gis_editor.setView([Lat, Lon], 17 );
  1889. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  1890. // attribution: MAP_SET.attribution,
  1891. // maxNativeZoom: MAP_SET.maxNativeZoom,
  1892. // maxZoom: MAP_SET.maxZoom
  1893. //});
  1894. L.tileLayer( MAP_SET.layer_url, {
  1895. attribution: MAP_SET.attribution,
  1896. attributionControl: false,
  1897. maxNativeZoom: MAP_SET.maxNativeZoom,
  1898. //minZoom: 0,
  1899. maxZoom: MAP_SET.maxZoom
  1900. }).addTo( gis_editor );
  1901. L.marker([Lat, Lon], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( gis_editor ).on('dragend', updateGisLocation );
  1902. };
  1903. function editPlatform( s_id ){
  1904. if( oSelectedPlatform ){
  1905. var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
  1906. if( tt!= null ){
  1907. tt.classList.remove('selected_green');
  1908. tt.classList.add('active_green');
  1909. } else oSelectedPlatform = 0;
  1910. };
  1911. var tt = document.getElementById('PLATFORM_TAG_'+s_id );
  1912. if( tt!= undefined ){
  1913. tt.classList.remove('active_green');
  1914. tt.classList.add('selected_green');
  1915. };
  1916. if( oSelectedPlatform == s_id ) return;
  1917. Ext.Ajax.request({
  1918. url: '/lib/controller/getPlatformEditor.php',
  1919. params: {
  1920. PID: s_id,
  1921. UID: <?=$UserID;?>,
  1922. SID: '<?=$Session;?>'
  1923. },
  1924. success: function( response, opts ){
  1925. var data = Ext.decode( response.responseText );
  1926. var tComp = Ext.getCmp('platform_op_small');
  1927. if( tComp!= null ){
  1928. tComp.removeAll( true );
  1929. tComp.add( data );
  1930. tComp.doLayout();
  1931. };
  1932. oSelectedPlatform = s_id;
  1933. if( SelectedPlatform != s_id ){
  1934. SelectedPlatform = s_id;
  1935. //tComp = Ext.getCmp('btn_unb_station');
  1936. //tComp.setDisabled( false );
  1937. //tComp = Ext.getCmp('btn_del_station');
  1938. //tComp.setDisabled( false );
  1939. tComp = Ext.getCmp('modules_tab');
  1940. tComp.setDisabled( false );
  1941. };
  1942. }
  1943. });
  1944. };
  1945. function editStation( s_id ){
  1946. if( oSelectedStation ){
  1947. var tt = document.getElementById('STATION_TAG_'+oSelectedStation );
  1948. tt.classList.remove('selected_green');
  1949. tt.classList.add('active_green');
  1950. };
  1951. var tt = document.getElementById('STATION_TAG_'+s_id );
  1952. if( tt!= undefined ){
  1953. tt.classList.remove('active_green');
  1954. tt.classList.add('selected_green');
  1955. };
  1956. if( oSelectedStation == s_id ) return;
  1957. Ext.Ajax.request({
  1958. url: '/lib/controller/getStationEditor.php',
  1959. params: {
  1960. CID: s_id,
  1961. UID: <?=$UserID;?>,
  1962. SID: '<?=$Session;?>'
  1963. },
  1964. success: function( response, opts ){
  1965. var data = Ext.decode( response.responseText );
  1966. var tComp = Ext.getCmp('station_op_small');
  1967. if( tComp!= null ){
  1968. tComp.removeAll( true );
  1969. tComp.add( data );
  1970. tComp.doLayout();
  1971. };
  1972. tComp = Ext.getCmp('btn_unb_station');
  1973. tComp.setDisabled( false );
  1974. tComp = Ext.getCmp('btn_del_station');
  1975. tComp.setDisabled( false );
  1976. oSelectedStation = s_id;
  1977. if( SelectedStation != s_id ){
  1978. SelectedStation = s_id;
  1979. SelectedPlatform = 0;
  1980. SelectedModule = 0;
  1981. tComp = Ext.getCmp('platform_tab');
  1982. tComp.setDisabled( false );
  1983. tComp = Ext.getCmp('modules_tab');
  1984. tComp.setDisabled( true );
  1985. };
  1986. },
  1987. failure: function(){
  1988. }
  1989. });
  1990. };
  1991. function editLine( l_id ){
  1992. if( oSelectedLine ){
  1993. var tt = document.getElementById('LINE_TAG_'+oSelectedLine );
  1994. if( tt.classList.contains('selected_blue') ){
  1995. tt.classList.remove('selected_blue');
  1996. tt.classList.add('active_blue');
  1997. };
  1998. if( tt.classList.contains('selected_gray') ){
  1999. tt.classList.remove('selected_gray');
  2000. tt.classList.add('active_gray');
  2001. };
  2002. };
  2003. var tt = document.getElementById('LINE_TAG_'+l_id );
  2004. if( tt!= undefined ){
  2005. if( tt.classList.contains('active_blue') ){
  2006. tt.classList.remove('active_blue');
  2007. tt.classList.add('selected_blue');
  2008. };
  2009. if( tt.classList.contains('active_gray') ){
  2010. tt.classList.remove('active_gray');
  2011. tt.classList.add('selected_gray');
  2012. };
  2013. };
  2014. if( oSelectedLine == l_id ) return;
  2015. Ext.Ajax.request({
  2016. url: '/lib/controller/getLineEditor.php',
  2017. params: {
  2018. LID: l_id,
  2019. UID: <?=$UserID;?>,
  2020. SID: '<?=$Session;?>'
  2021. },
  2022. success: function( response, opts ){
  2023. var data = Ext.decode( response.responseText );
  2024. var tComp = Ext.getCmp('line_op_small');
  2025. if( tComp!= null ){
  2026. tComp.removeAll( true );
  2027. tComp.add( data );
  2028. tComp.doLayout();
  2029. };
  2030. tComp = Ext.getCmp('stations_tab');
  2031. tComp.setDisabled( false );
  2032. oSelectedLine = l_id;
  2033. if( SelectedLine != l_id ){
  2034. SelectedLine = l_id;
  2035. SelectedStation = 0;
  2036. SelectedPlatform = 0;
  2037. SelectedModule = 0;
  2038. tComp = Ext.getCmp('platform_tab');
  2039. tComp.setDisabled( true );
  2040. tComp = Ext.getCmp('modules_tab');
  2041. tComp.setDisabled( true );
  2042. };
  2043. }
  2044. });
  2045. };
  2046. function editSensorHW( cid ){
  2047. SelectedSensor = cid;
  2048. Ext.Ajax.request({
  2049. url: '/lib/controller/getSensorEditor.php',
  2050. params: {
  2051. CID: SelectedSensor,
  2052. UID: <?=$UserID;?>,
  2053. SID: '<?=$Session;?>'
  2054. },
  2055. success: function( response, opts ){
  2056. var data = Ext.decode( response.responseText );
  2057. var tComp = Ext.getCmp('sens_op_small');
  2058. if( data.status == 'ok' ){
  2059. if( tComp!= null ){
  2060. var content = Ext.decode( data.content );
  2061. tComp.removeAll( true );
  2062. tComp.add( content );
  2063. tComp.doLayout();
  2064. };
  2065. } else {
  2066. if( tComp!= null ){
  2067. tComp.removeAll( true );
  2068. tComp.add( data );
  2069. tComp.doLayout();
  2070. };
  2071. };
  2072. },
  2073. failure: function(){
  2074. }
  2075. });
  2076. };
  2077. var cameraEditorContent = null;
  2078. function editCamera( cid, etyp ){
  2079. SelectedCam = cid;
  2080. switch( etyp ){
  2081. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  2082. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  2083. };
  2084. Ext.Ajax.request({
  2085. url: '/lib/controller/getCameraEditor.php',
  2086. params: {
  2087. CID: SelectedCam,
  2088. UID: <?=$UserID;?>,
  2089. SID: '<?=$Session;?>'
  2090. },
  2091. success: function( response, opts ){
  2092. var data = Ext.decode( response.responseText );
  2093. if( data.status == 'ok' ){
  2094. if( cameraEditorContent!= null ){
  2095. var content = Ext.decode( data.content );
  2096. cameraEditorContent.removeAll( true );
  2097. cameraEditorContent.add( content );
  2098. cameraEditorContent.doLayout();
  2099. };
  2100. } else {
  2101. if( cameraEditorContent!= null ){
  2102. cameraEditorContent.removeAll( true );
  2103. cameraEditorContent.add( data );
  2104. cameraEditorContent.doLayout();
  2105. };
  2106. };
  2107. },
  2108. failure: function(){
  2109. }
  2110. });
  2111. };
  2112. function showSettingsUpgrade(){
  2113. stopStatusUpdater();
  2114. content_lvl1 = 1;
  2115. content_lvl2 = 4;
  2116. var tPanel = Ext.getCmp('main_content');
  2117. tPanel.removeAll( true );
  2118. initial_md5 = '';
  2119. tPanel.add({
  2120. columnWidth: 1.0,
  2121. frame: false,
  2122. border: false,
  2123. items: [{
  2124. frame: false,
  2125. border: false,
  2126. collapsible: false,
  2127. draggable: false,
  2128. layout: 'vbox',
  2129. //layoutConfig: {
  2130. // align : 'stretch',
  2131. // pack : 'start',
  2132. //},
  2133. height: PanelH,
  2134. items:[{
  2135. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2136. xtype: 'panel',
  2137. height: PanelH-300,
  2138. //flex: 1,
  2139. frame: true,
  2140. width: '100%',
  2141. border: false,
  2142. layout: {
  2143. type: 'table',
  2144. columns: 2,
  2145. tableAttrs: {
  2146. valign: 'top',
  2147. style: 'valign:top;width:100%;'
  2148. }
  2149. },
  2150. defaults: {
  2151. frame: true,
  2152. border: false,
  2153. height: ( PanelH-400 ) / 2,
  2154. style: 'margin: 5px;width:400px;display:block;'
  2155. },
  2156. items:[{
  2157. title: 'Current System Info',
  2158. width: '100%',
  2159. //flex: 1,
  2160. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2161. },{
  2162. title: 'Tasks',
  2163. //width: 400,
  2164. layout: 'vbox',
  2165. items:[{
  2166. xtype: 'button',
  2167. width: '100%',
  2168. text: 'Create Database Backup',
  2169. handler: function(){
  2170. createNewTask( 2 );
  2171. }
  2172. },{
  2173. xtype: 'button',
  2174. width: '100%',
  2175. text: 'Create Full Snapeshot',
  2176. handler: function(){
  2177. createNewTask( 255 );
  2178. }
  2179. }]
  2180. },{
  2181. title: 'Archives',
  2182. height: 250,
  2183. width: '100%',
  2184. tbar:[{
  2185. text: 'Restore',
  2186. id: 'ar_restore_btn',
  2187. handler: function(){
  2188. createNewTask(1, selectedArchiveRecord.data.file_name );
  2189. }
  2190. },{
  2191. text: 'Download',
  2192. id: 'ar_download_btn',
  2193. handler: function(){
  2194. if( selectedArchiveRecord!= null ){
  2195. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2196. };
  2197. }
  2198. },{
  2199. text: 'Delete',
  2200. id: 'ar_delete_btn',
  2201. handler: function(){
  2202. createNewTask(100, selectedArchiveRecord.data.file_name );
  2203. }
  2204. }],
  2205. items:[{
  2206. xtype: 'grid',
  2207. id: 'archives_grid',
  2208. border: false,
  2209. frame: false,
  2210. autoScroll: true,
  2211. //width: '100%',
  2212. lazyRender: true,
  2213. height: 210,
  2214. ds: archives_store,
  2215. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2216. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2217. viewConfig: {
  2218. // forceFit: true
  2219. },
  2220. }]
  2221. },{
  2222. title: 'Task Status',
  2223. height: 250,
  2224. //flex: 1,
  2225. items:[{
  2226. xtype: 'spacer',
  2227. height: 4
  2228. },{
  2229. id: 'ctask_status',
  2230. border: true,
  2231. html: ''
  2232. },{
  2233. xtype: 'spacer',
  2234. height: 4
  2235. },{
  2236. xtype: 'textarea',
  2237. id: 'task_log',
  2238. height: ( PanelH-320 ) / 2 - 120,
  2239. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2240. readOnly: true,
  2241. autoScroll: true,
  2242. value: ''
  2243. },{
  2244. xtype: 'progress',
  2245. id: 'task_progress',
  2246. value: 1.0,
  2247. text: 'idle',
  2248. disabled: true
  2249. }],
  2250. tbar:[{
  2251. text: 'Cancel Task',
  2252. id: 'ch_ta_btn',
  2253. disabled: true,
  2254. handler: deleteNewTask
  2255. }]
  2256. }]
  2257. },{
  2258. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2259. xtype: 'panel',
  2260. height: 300,
  2261. //flex: 1,
  2262. frame: true,
  2263. border: false,
  2264. //layout: 'vbox',
  2265. items:[{
  2266. xtype:'button',
  2267. id: 'pickfiles',
  2268. width: '100%',
  2269. text: 'Choose File'
  2270. },{
  2271. height: 200,
  2272. xtype: 'grid',
  2273. id: 'upload_grid',
  2274. border: false,
  2275. frame: false,
  2276. mode: 'local',
  2277. lazyRender: true,
  2278. width: '100%',
  2279. autoScroll: true,
  2280. ds: uploads_store,
  2281. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2282. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2283. viewConfig: {
  2284. forceFit: true
  2285. },
  2286. bbar: [{
  2287. text: 'Clear',
  2288. width: '100%',
  2289. handler: function(){
  2290. muploader.splice();
  2291. uploads_store.removeAll();
  2292. }
  2293. }]
  2294. },{
  2295. xtype:'button',
  2296. id: 'umpalumpa',
  2297. width: '100%',
  2298. disabled: true,
  2299. text: 'Upload',
  2300. handler: function(){
  2301. if( muploader!= null ){
  2302. muploader.start();
  2303. };
  2304. }
  2305. }],
  2306. listeners:{
  2307. afterrender: function(){
  2308. muploader = new plupload.Uploader({
  2309. runtimes : 'html5,html4',
  2310. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2311. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2312. max_file_size : '1000mb',
  2313. chunk_size: '200kb',
  2314. max_retries: 3,
  2315. multi_selection: false,
  2316. max_file_count: 1,
  2317. // Fake server response here
  2318. url: '/lib/php/setup_toolkit/upload.php',
  2319. //url: "/echo/json",
  2320. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2321. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2322. filters : [
  2323. //{title : "Image files", extensions : "jpg,gif,png"},
  2324. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2325. ],
  2326. init: {
  2327. PostInit: function() {
  2328. //$('filelist').innerHTML = '';
  2329. //$('uploadfiles').onclick = function() {
  2330. // uploader.start();
  2331. // return false;
  2332. //};
  2333. },
  2334. FilesAdded: function( up, files ) {
  2335. Ext.getCmp('umpalumpa').enable();
  2336. plupload.each( files, function(file) {
  2337. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2338. uploads_store_id++;
  2339. Ext.getCmp('upload_grid').doLayout();
  2340. });
  2341. },
  2342. UploadProgress: function(up, file) {
  2343. var pb = Ext.getCmp( 'progress_'+file.id );
  2344. if( file.percent < 100 ){
  2345. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2346. } else {
  2347. pb.updateProgress( 1.0, 'Uploaded', false );
  2348. };
  2349. },
  2350. Error: function(up, err) {
  2351. Ext.Msg.show({
  2352. title:'Upload Status',
  2353. msg: "Error #" + err.code + ": " + err.message,
  2354. buttons: Ext.Msg.OK,
  2355. icon: Ext.MessageBox.ERROR
  2356. });
  2357. }
  2358. }
  2359. });
  2360. muploader.init();
  2361. }
  2362. }
  2363. }]
  2364. }]
  2365. });
  2366. muploader = null;
  2367. uploads_store.removeAll();
  2368. tPanel.doLayout();
  2369. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2370. updateTaskStatus();
  2371. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2372. };
  2373. var SelectedScadaModule = 0;
  2374. function loadSCADAModules( platform_id, suse ){
  2375. if( suse == undefined ){
  2376. suse = 0;
  2377. };
  2378. Ext.Ajax.request({
  2379. url: '/lib/controller/getScadaModules.php',
  2380. params: {
  2381. UID: <?=$UserID;?>,
  2382. SID: '<?=$Session;?>',
  2383. PID: platform_id
  2384. },
  2385. success: function( response, opts ){
  2386. var tData = Ext.decode(response.responseText);
  2387. var tPanel = Ext.getCmp('scada_container');
  2388. if( tData.status == 'ok' ){
  2389. tPanel.removeAll( true );
  2390. var res = Ext.decode( tData.modules );
  2391. tPanel.add( res );
  2392. tPanel.doLayout();
  2393. if( suse == 0 ){
  2394. var zPanel = Ext.getCmp('scada_op_small');
  2395. zPanel.removeAll( true );
  2396. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2397. zPanel.doLayout();
  2398. } else {
  2399. editScadaModule( suse );
  2400. };
  2401. } else {
  2402. tPanel.removeAll( true );
  2403. tPanel.doLayout();
  2404. var zPanel = Ext.getCmp('scada_op_small');
  2405. zPanel.removeAll( true );
  2406. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2407. zPanel.doLayout();
  2408. };
  2409. },
  2410. failure: failureAJAXFunction
  2411. });
  2412. };
  2413. function editScadaModule( smid ){
  2414. SelectedScadaModule = smid;
  2415. Ext.Ajax.request({
  2416. url: '/lib/controller/getScadaEditor.php',
  2417. params: {
  2418. MID: SelectedScadaModule,
  2419. UID: <?=$UserID;?>,
  2420. SID: '<?=$Session;?>'
  2421. },
  2422. success: function( response, opts ){
  2423. var data = Ext.decode( response.responseText );
  2424. var tComp = Ext.getCmp('scada_op_small');
  2425. if( tComp!= null ){
  2426. tComp.removeAll( true );
  2427. tComp.add( data );
  2428. tComp.doLayout();
  2429. };
  2430. }
  2431. });
  2432. };
  2433. function loadSensorDetectionSettings( sensid ){
  2434. Ext.Ajax.request({
  2435. url: '/lib/controller/getSensorDetectionEditor.php',
  2436. params: {
  2437. UID: <?=$UserID;?>,
  2438. SID: '<?=$Session;?>',
  2439. SEN: sensid
  2440. },
  2441. success: function( response, opts ){
  2442. var data = Ext.decode( response.responseText );
  2443. var tComp = Ext.getCmp('main_content');
  2444. if( data.status == 'ok' ){
  2445. if( tComp!= null ){
  2446. var content = Ext.decode( data.content );
  2447. tComp.removeAll( true );
  2448. tComp.add( content );
  2449. tComp.doLayout();
  2450. };
  2451. } else {
  2452. if( tComp!= null ){
  2453. tComp.removeAll( true );
  2454. tComp.add( data );
  2455. tComp.doLayout();
  2456. };
  2457. };
  2458. },
  2459. failure: function(){
  2460. }
  2461. });
  2462. };
  2463. function initSettingsView(){
  2464. if( tlInterval!= null ){
  2465. window.clearInterval( tlInterval );
  2466. tlInterval = null;
  2467. timelineObj = null;
  2468. };
  2469. var tP = Ext.getCmp('left_side_menu');
  2470. //tP.doLayout();
  2471. //tP.setVisible( false );
  2472. tP.removeAll( true );
  2473. tP.add({
  2474. id: 'sme_inner',
  2475. layout:'accordion',
  2476. //height: PanelH,
  2477. frame: false,
  2478. border: false,
  2479. layoutConfig:{
  2480. animate: true//,
  2481. //activeOnTop: true
  2482. },
  2483. items:[]
  2484. });
  2485. tP.doLayout();
  2486. tP = Ext.getCmp('sme_inner');
  2487. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2488. tP.add({
  2489. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2490. layout: 'vbox',
  2491. height: 120,
  2492. pack: 'center',
  2493. align : 'strech',
  2494. collapsed: ( contentView.l[1].v != 0 ),
  2495. items:[{
  2496. xtype: 'button',
  2497. width: '100%',
  2498. id:'sys_edit',
  2499. text: "<?=$Labels->GetLabel('_SRV_SETTINGS_');?>",
  2500. enableToggle: true,
  2501. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 0 ),
  2502. allowDepress: false,
  2503. toggleGroup: '_settings',
  2504. handler: function(){
  2505. changeContent( 1, 0, '' );
  2506. changeContent( 2, 0, '' );
  2507. updateUserContent();
  2508. showSettingsServer();
  2509. }
  2510. }
  2511. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2512. ,{
  2513. xtype: 'button',
  2514. width: '100%',
  2515. id:'map_edit',
  2516. text: "<?=$Labels->GetLabel('_IFR_STRUCT_');?>",
  2517. enableToggle: true,
  2518. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 0 ),
  2519. allowDepress: false,
  2520. toggleGroup: '_settings',
  2521. handler: function(){
  2522. changeContent( 1, 0, '' );
  2523. changeContent( 2, 1, '' );
  2524. updateUserContent();
  2525. showSettingsInfrastructure();
  2526. }
  2527. }
  2528. <?php }; ?>
  2529. ]
  2530. });
  2531. <?php
  2532. }; ?>
  2533. tP.add({
  2534. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  2535. collapsed: ( contentView.l[1].v != 1 ),
  2536. items:[{
  2537. xtype:'button',
  2538. text:'<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  2539. enableToggle: true,
  2540. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 1 ),
  2541. allowDepress: false,
  2542. toggleGroup: '_settings',
  2543. width: '100%',
  2544. handler: function(){
  2545. changeContent( 1, 1, 0 );
  2546. //changeContent( 2, 0, '' ); - will do automatically
  2547. updateUserContent();
  2548. showSettingsProfile();
  2549. }
  2550. }]
  2551. });
  2552. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2553. tP.add({
  2554. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  2555. collapsed: ( contentView.l[1].v != 2 ),
  2556. items:[{
  2557. xtype: 'button',
  2558. width: '100%',
  2559. id:'adm_acc',
  2560. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  2561. enableToggle: true,
  2562. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 2 ),
  2563. allowDepress: false,
  2564. toggleGroup: '_settings',
  2565. handler: function( b, e ){
  2566. changeContent( 1, 2, 0 );
  2567. changeContent( 2, 0, '' );
  2568. updateUserContent();
  2569. loadUserEditor();
  2570. }
  2571. },{
  2572. xtype: 'button',
  2573. width: '100%',
  2574. id:'adm_acclog',
  2575. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  2576. enableToggle: true,
  2577. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 2 ),
  2578. allowDepress: false,
  2579. toggleGroup: '_settings',
  2580. handler: function( b, e ){
  2581. changeContent( 1, 2, 0 );
  2582. changeContent( 2, 1, '' );
  2583. updateUserContent();
  2584. loadAccessLog();
  2585. }
  2586. },{
  2587. xtype: 'button',
  2588. width: '100%',
  2589. id:'adm_servlog',
  2590. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  2591. enableToggle: true,
  2592. pressed: ( contentView.l[2].v == 2 && contentView.l[1].v == 2 ),
  2593. allowDepress: false,
  2594. toggleGroup: '_settings',
  2595. handler: function( b, e ){
  2596. changeContent( 1, 2, 0 );
  2597. changeContent( 2, 2, '' );
  2598. updateUserContent();
  2599. loadServerLog();
  2600. }
  2601. }]
  2602. });
  2603. <?php
  2604. };
  2605. ?>
  2606. tP.setVisible( true );
  2607. tP.doLayout();
  2608. switch( contentView.l[1].v ){
  2609. case 0:{
  2610. switch( contentView.l[2].v ){
  2611. case 0: showSettingsServer(); break;
  2612. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2613. case 1: showSettingsInfrastructure(); break;
  2614. <?php }; ?>
  2615. //case 4: showSettingsUpgrade(); break;
  2616. };
  2617. break;
  2618. };
  2619. case 1:{
  2620. switch( contentView.l[2].v ){
  2621. case 0: showSettingsProfile(); break;
  2622. };
  2623. break;
  2624. };
  2625. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2626. case 2:{
  2627. switch( contentView.l[2].v ){
  2628. case 0: loadUserEditor(); break;
  2629. case 1: loadAccessLog(); break;
  2630. case 2: loadServerLog(); break;
  2631. };
  2632. break;
  2633. };
  2634. <?php }; ?>
  2635. };
  2636. };