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.

2702 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. } else {
  1221. var lt = document.getElementById('scae_onl_sts');
  1222. if( lt != undefined ) lt.src = "/style/assets/bul_gray.png";
  1223. lt = document.getElementById('sce_in_1_img');
  1224. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1225. lt = document.getElementById('sce_in_2_img');
  1226. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1227. lt = document.getElementById('sce_in_3_img');
  1228. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1229. lt = document.getElementById('sce_in_4_img');
  1230. if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png";
  1231. var tT = Ext.getCmp('sc_tbtn_1');
  1232. if( tT != undefined ){
  1233. tT.disable();
  1234. tT.suspendEvents();
  1235. tT.toggle( false );
  1236. tT.resumeEvents();
  1237. };
  1238. tT = Ext.getCmp('sc_tbtn_2');
  1239. if( tT != undefined ){
  1240. tT.disable();
  1241. tT.suspendEvents();
  1242. tT.toggle( false );
  1243. tT.resumeEvents();
  1244. };
  1245. tT = Ext.getCmp('sc_tbtn_3');
  1246. if( tT != undefined ){
  1247. tT.disable();
  1248. tT.suspendEvents();
  1249. tT.toggle( false );
  1250. tT.resumeEvents();
  1251. };
  1252. tT = Ext.getCmp('sc_tbtn_4');
  1253. if( tT != undefined ){
  1254. tT.disable();
  1255. tT.suspendEvents();
  1256. tT.toggle( false );
  1257. tT.resumeEvents();
  1258. };
  1259. };
  1260. var tT = Ext.getCmp('sce_cb_o_1');
  1261. if( tT != undefined ){
  1262. tT.suspendEvents();
  1263. tT.setValue( data.cb_out_a );
  1264. tT.resumeEvents();
  1265. };
  1266. tT = Ext.getCmp('sce_cb_o_2');
  1267. if( tT != undefined ){
  1268. tT.suspendEvents();
  1269. tT.setValue( data.cb_out_b );
  1270. tT.resumeEvents();
  1271. };
  1272. tT = Ext.getCmp('sce_cb_o_3');
  1273. if( tT != undefined ){
  1274. tT.suspendEvents();
  1275. tT.setValue( data.cb_out_c );
  1276. tT.resumeEvents();
  1277. };
  1278. tT = Ext.getCmp('sce_cb_o_4');
  1279. if( tT != undefined ){
  1280. tT.suspendEvents();
  1281. tT.setValue( data.cb_out_d );
  1282. tT.resumeEvents();
  1283. };
  1284. tT = Ext.getCmp('sce_cb_i_1');
  1285. if( tT != undefined ){
  1286. tT.suspendEvents();
  1287. tT.setValue( data.cb_in_a );
  1288. tT.resumeEvents();
  1289. };
  1290. tT = Ext.getCmp('sce_cb_i_2');
  1291. if( tT != undefined ){
  1292. tT.suspendEvents();
  1293. tT.setValue( data.cb_in_b );
  1294. tT.resumeEvents();
  1295. };
  1296. tT = Ext.getCmp('sce_cb_i_3');
  1297. if( tT != undefined ){
  1298. tT.suspendEvents();
  1299. tT.setValue( data.cb_in_c );
  1300. tT.resumeEvents();
  1301. };
  1302. tT = Ext.getCmp('sce_cb_i_4');
  1303. if( tT != undefined ){
  1304. tT.suspendEvents();
  1305. tT.setValue( data.cb_in_d );
  1306. tT.resumeEvents();
  1307. };
  1308. scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
  1309. } else {
  1310. //show error msg
  1311. };
  1312. },
  1313. failure: failureAJAXFunction
  1314. });
  1315. };
  1316. var devUploadTimeout = null;
  1317. var devUploadID = -1;
  1318. function fetchDeviceUploadStatus(){
  1319. clearTimeout( devUploadTimeout );
  1320. if( devUploadID < 1 ) return;
  1321. Ext.Ajax.request({
  1322. url: '/lib/controller/getDeviceUploadStatus.php',
  1323. params: {
  1324. UID: <?=$UserID;?>,
  1325. SID: '<?=$Session;?>',
  1326. DID: devUploadID
  1327. },
  1328. success: function( response, opts ){
  1329. var data = Ext.decode(response.responseText);
  1330. var tT = Ext.getCmp('upp_ttext');
  1331. if( tT != undefined ){
  1332. if( data.count > 0 ){
  1333. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1334. };
  1335. if( data.current != undefined ){
  1336. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1337. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1338. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1339. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1340. } else {
  1341. Ext.getCmp('upload_progres_panel').hide();
  1342. Ext.getCmp('uploaded_grid').show();
  1343. loadModuleFiles( devUploadID );
  1344. };
  1345. };
  1346. },
  1347. failure: failureAJAXFunction
  1348. });
  1349. };
  1350. function downloadSettings(){
  1351. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1352. ReportMask.show();
  1353. const formData = new FormData();
  1354. formData.append("UID",<?=$UserID;?>);
  1355. formData.append("SID",'<?=$Session;?>');
  1356. fetch('/lib/controller/downloadSettings.php',{
  1357. method: "POST",
  1358. body: formData
  1359. })
  1360. .then(resp => resp.blob())
  1361. .then(blob => {
  1362. const url = window.URL.createObjectURL(blob);
  1363. const a = document.createElement('a');
  1364. a.style.display = 'none';
  1365. a.href = url;
  1366. var today=new Date();
  1367. var SY=1900+today.getYear();
  1368. var SMO=today.getMonth()+1;
  1369. var SD=today.getDate();
  1370. var SH = today.getHours();
  1371. var SM = today.getMinutes();
  1372. var SS = today.getSeconds();
  1373. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1374. document.body.appendChild(a);
  1375. a.click();
  1376. window.URL.revokeObjectURL(url);
  1377. ReportMask.hide();
  1378. Ext.Msg.show({
  1379. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1380. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1381. buttons: Ext.Msg.OK,
  1382. icon: Ext.MessageBox.INFO
  1383. });
  1384. })
  1385. .catch(() => {
  1386. ReportMask.hide();
  1387. Ext.Msg.show({
  1388. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1389. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1390. buttons: Ext.Msg.OK,
  1391. icon: Ext.MessageBox.ERROR
  1392. });
  1393. });
  1394. };
  1395. var addModuleWindow = null;
  1396. function addModule(){
  1397. Ext.Ajax.request({
  1398. url: '/lib/controller/getAddModuleWindow.php',
  1399. params: {
  1400. UID: <?=$UserID;?>,
  1401. SID: '<?=$Session;?>',
  1402. PID: SelectedPlatform
  1403. },
  1404. success: function( response, opts ){
  1405. var data = Ext.decode(response.responseText);
  1406. addModuleWindow = new Ext.Window( data );
  1407. addModuleWindow.show();
  1408. },
  1409. failure: failureAJAXFunction
  1410. });
  1411. };
  1412. var addScadaModuleWindow = null;
  1413. function addScadaModule(){
  1414. if( addScadaModuleWindow == null ){
  1415. addScadaModuleWindow = new Ext.Window({
  1416. title: "<?=$Labels->GetLabel( '_ADD_SCADA_MODULE_' );?>",
  1417. modal: true,
  1418. width: 400,
  1419. height: 148,
  1420. closeAction: 'hide',
  1421. resizable: false,
  1422. items:[{
  1423. xtype: 'form',
  1424. labelAlign: 'right',
  1425. border: false,
  1426. frame: false,
  1427. items: [{
  1428. id: 'scm_dev_name',
  1429. xtype: 'textfield',
  1430. fieldLabel: "<?=$Labels->GetLabel( '_NAME_LABEL_' );?>",
  1431. value: ''
  1432. },{
  1433. id: 'scm_dev_ip',
  1434. xtype: 'textfield',
  1435. minLength: 7,
  1436. maxLength: 15,
  1437. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_IP_' );?>",
  1438. value: ''
  1439. },{
  1440. xtype: 'numberfield',
  1441. id: 'scm_dev_port',
  1442. maxValue: 65535,
  1443. minValue: 27,
  1444. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_PORT_' );?>",
  1445. value: '502'
  1446. }]
  1447. }],
  1448. bbar:['->',{
  1449. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1450. handler: function(){
  1451. addScadaModuleWindow.hide();
  1452. }
  1453. },{
  1454. text: '<?=$Labels->GetLabel( '__ADD__' );?>',
  1455. handler: function(){
  1456. var mod_name = Ext.getCmp('scm_dev_name').getValue();
  1457. var mod_ip = Ext.getCmp('scm_dev_ip').getValue();
  1458. var mod_port = Ext.getCmp('scm_dev_port').getValue();
  1459. Ext.Ajax.request({
  1460. url: '/lib/controller/doPlatformOperations.php',
  1461. params: {
  1462. OPID: 12,
  1463. ID: SelectedPlatform,
  1464. MIP: mod_ip,
  1465. MPO: mod_port,
  1466. MNA: mod_name,
  1467. UID: <?=$UserID;?>,
  1468. SID: '<?=$Session;?>'
  1469. },
  1470. success: function( response, opts ){
  1471. var data = Ext.decode(response.responseText);
  1472. if( data.success ){
  1473. addScadaModuleWindow.close();
  1474. loadSCADAModules();
  1475. } else {
  1476. Ext.Msg.show({
  1477. title: "<?=$Labels->GetLabel("_ERROR_MSG_");?>",
  1478. msg: data.msg,
  1479. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1480. fn: function(){
  1481. //SettingsLidar3D.hide();
  1482. },
  1483. icon: Ext.MessageBox.ERROR //QUESTION
  1484. });
  1485. };
  1486. }
  1487. });
  1488. }
  1489. }]
  1490. });
  1491. };
  1492. Ext.getCmp('scm_dev_name').setValue( '' );
  1493. Ext.getCmp('scm_dev_ip').setValue( '' );
  1494. Ext.getCmp('scm_dev_port').setValue( 502 );
  1495. addScadaModuleWindow.show();
  1496. };
  1497. function addFilter(){
  1498. var addFilterWindow = new Ext.Window({
  1499. id: 'fulu_boa',
  1500. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1501. modal: true,
  1502. width: 400,
  1503. height: 300,
  1504. items:[{
  1505. xtype: 'form',
  1506. items: [{
  1507. xtype: 'combo',
  1508. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1509. id: 'flt_type',
  1510. lazyRender: true,
  1511. mode: 'local',
  1512. forceSelection: true,
  1513. triggerAction: 'all',
  1514. editable: false,
  1515. disableKeyFilter: true,
  1516. store: new Ext.data.ArrayStore({
  1517. fields: ['az_t','az_txt'],
  1518. data: [<?php
  1519. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1520. //$JIJI=$DATABASE->Query( $QS );
  1521. $OOP = array();
  1522. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1523. echo implode(',', $OOP );
  1524. ?>]
  1525. }),
  1526. valueField: 'az_t',
  1527. displayField: 'az_txt',
  1528. value: 1,
  1529. listeners:{
  1530. select: function( t, r, i ){
  1531. var n = r.data.az_t;
  1532. Ext.Ajax.request({
  1533. url: '/lib/controller/getFilterInfo.php',
  1534. params: {
  1535. FID: n,
  1536. UID: <?=$UserID;?>,
  1537. SID: '<?=$Session;?>'
  1538. },
  1539. success: function( response, opts ){
  1540. Ext.getCmp('filt_infopan').update( response.responseText );
  1541. }
  1542. });
  1543. }
  1544. }
  1545. },{
  1546. xtype: 'panel',
  1547. id: 'filt_infopan',
  1548. html: ''
  1549. }]
  1550. }],
  1551. bbar:[{
  1552. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  1553. handler: function(){
  1554. addFilterWindow.close();
  1555. }
  1556. },{
  1557. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  1558. handler: function(){
  1559. var mtyp = Ext.getCmp('flt_type').getValue();
  1560. Ext.Ajax.request({
  1561. url: '/lib/controller/addFilter.php',
  1562. params: {
  1563. SERVID: 1,
  1564. TYPE: mtyp,
  1565. UID: <?=$UserID;?>,
  1566. SID: '<?=$Session;?>'
  1567. },
  1568. success: function( response, opts ){
  1569. // If the response is JSON, you have to decode it
  1570. var data = Ext.decode(response.responseText);
  1571. if( data.status == 'ok' ){
  1572. addFilterWindow.close();
  1573. loadFilters();
  1574. } else {
  1575. Ext.Msg.show({
  1576. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1577. msg: data.message,
  1578. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1579. fn: function(){
  1580. //SettingsLidar3D.hide();
  1581. },
  1582. icon: Ext.MessageBox.INFO //QUESTION
  1583. });
  1584. }
  1585. },
  1586. failure: failureAJAXFunction
  1587. });
  1588. }
  1589. }]
  1590. });
  1591. addFilterWindow.show();
  1592. Ext.Ajax.request({
  1593. url: '/lib/controller/getFilterInfo.php',
  1594. params: {
  1595. FID: 1,
  1596. UID: <?=$UserID;?>,
  1597. SID: '<?=$Session;?>'
  1598. },
  1599. success: function( response, opts ){
  1600. Ext.getCmp('filt_infopan').update( response.responseText );
  1601. }
  1602. });
  1603. };
  1604. function showSettingsProfile(){
  1605. stopStatusUpdater();
  1606. //if( contentView.l[3] == undefined ){
  1607. // contentView.l[3] = {v:0,p:''};
  1608. //};
  1609. Ext.Ajax.request({
  1610. url: '/lib/controller/getProfileSettings.php',
  1611. params: {
  1612. UID: <?=$UserID;?>,
  1613. TYP: contentView.l[3].v,
  1614. SID: '<?=$Session;?>',
  1615. },
  1616. success: function( response, opts ){
  1617. var tData = Ext.decode(response.responseText);
  1618. if( tData.status == 'ok' ){
  1619. var tPanel = Ext.getCmp('main_content');
  1620. tPanel.removeAll( true );
  1621. tPanel.add(Ext.decode(tData.content));
  1622. tPanel.doLayout();
  1623. };
  1624. },
  1625. failure: failureAJAXFunction
  1626. });
  1627. };
  1628. function showSettingsServer(){
  1629. stopStatusUpdater();
  1630. if( contentView.l[3] == undefined ){
  1631. contentView.l[3] = {v:0,p:''};
  1632. };
  1633. Ext.Ajax.request({
  1634. url: '/lib/controller/getServerSettings.php',
  1635. params: {
  1636. UID: <?=$UserID;?>,
  1637. TYP: contentView.l[3].v,
  1638. SID: '<?=$Session;?>',
  1639. },
  1640. success: function( response, opts ){
  1641. var tData = Ext.decode(response.responseText);
  1642. var tPanel = Ext.getCmp('main_content');
  1643. tPanel.removeAll( true );
  1644. tPanel.add(Ext.decode(tData.content));
  1645. tPanel.doLayout();
  1646. if( contentView.l[3].v == 0 ) serverStatusUpdater();
  1647. },
  1648. failure: failureAJAXFunction
  1649. });
  1650. };
  1651. function showSettingsInfrastructure(){
  1652. stopStatusUpdater();
  1653. if( contentView.l[3] == undefined ){
  1654. contentView.l[3] = {v:0,p:''};
  1655. };
  1656. var tPanel = Ext.getCmp('main_content');
  1657. tPanel.removeAll( true );
  1658. tPanel.add({
  1659. xtype: 'tabpanel',
  1660. frame: false,
  1661. id: 'node_settings_content',
  1662. border: false,
  1663. activeTab: contentView.l[3].v,
  1664. listeners:{
  1665. tabchange: function( tp, t ){
  1666. switch( t.getId() ){
  1667. case 'lines_tab': {
  1668. stopStatusUpdater();
  1669. loadMetroLines( SelectedLine );
  1670. break;
  1671. };
  1672. case 'stations_tab': {
  1673. stopStatusUpdater();
  1674. loadMetroStations( SelectedLine, SelectedStation );
  1675. break;
  1676. };
  1677. case 'platform_tab':{
  1678. stopStatusUpdater();
  1679. loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  1680. break;
  1681. };
  1682. case 'modules_tab':{
  1683. stopStatusUpdater();
  1684. loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  1685. break;
  1686. };
  1687. };
  1688. }
  1689. },
  1690. items: [{
  1691. xtype: 'panel',
  1692. id: 'lines_tab',
  1693. title: "<?=$Labels->GetLabel( '_LBL_LINES_' );?>",
  1694. layout: 'hbox',
  1695. items:[{
  1696. xtype: 'panel',
  1697. id: 'lines_container',
  1698. tbar:[{
  1699. text: "<?=$Labels->GetLabel( '_SMM_ADD_LINE_' );?>",
  1700. handler: function(){}
  1701. }],
  1702. flex: 1,
  1703. height: PanelH-15,
  1704. autoScroll: 'auto',
  1705. items:[]
  1706. },{
  1707. xtype: 'panel',
  1708. id: 'line_op_small',
  1709. flex: 1,
  1710. height: PanelH-15,
  1711. layout: 'fit',
  1712. items:[{
  1713. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1714. }]
  1715. }]
  1716. },{
  1717. xtype: 'panel',
  1718. id: 'stations_tab',
  1719. disabled: (SelectedLine == 0 ),
  1720. title: "<?=$Labels->GetLabel( '_LBL_STATIONS_' );?>",
  1721. layout: 'hbox',
  1722. items:[{
  1723. xtype: 'panel',
  1724. id: 'stations_container',
  1725. tbar:[{
  1726. text: "<?=$Labels->GetLabel( '_SMM_ADD_STATION_' );?>",
  1727. handler: addMetroStation
  1728. }],
  1729. flex: 1,
  1730. height: PanelH-15,
  1731. autoScroll: 'auto',
  1732. items:[]
  1733. },{
  1734. xtype: 'panel',
  1735. id: 'station_op_small',
  1736. flex: 1,
  1737. height: PanelH-15,
  1738. layout: 'fit',
  1739. items:[{
  1740. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1741. }]
  1742. }]
  1743. },{
  1744. xtype: 'panel',
  1745. id: 'platform_tab',
  1746. disabled: (SelectedStation == 0),
  1747. title: "<?=$Labels->GetLabel( '_LBL_PLATFORMS_' );?>",
  1748. layout: 'hbox',
  1749. items:[{
  1750. xtype: 'panel',
  1751. id: 'platform_container',
  1752. tbar:[{
  1753. text: "<?=$Labels->GetLabel( '_SMM_ADD_PLATFORM_' );?>",
  1754. handler: addStationPlatform
  1755. }],
  1756. flex: 1,
  1757. height: PanelH-15,
  1758. autoScroll: 'auto',
  1759. items:[]
  1760. },{
  1761. xtype: 'panel',
  1762. id: 'platform_op_small',
  1763. flex: 1,
  1764. height: PanelH-15,
  1765. layout: 'fit',
  1766. items:[{
  1767. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1768. }]
  1769. }]
  1770. },{
  1771. xtype: 'panel',
  1772. id: 'modules_tab',
  1773. disabled: ( SelectedPlatform==0 ),
  1774. title: "<?=$Labels->GetLabel('_MODULES_');?>",
  1775. layout: 'hbox',
  1776. items:[{
  1777. xtype: 'panel',
  1778. id: 'module_container',
  1779. tbar:[{
  1780. id: 'mod_add_btn',
  1781. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1782. handler: addModule
  1783. }],
  1784. flex: 1,
  1785. height: PanelH-15,
  1786. autoScroll: 'auto',
  1787. items:[]
  1788. },{
  1789. xtype: 'panel',
  1790. id: 'module_op_small',
  1791. flex: 1,
  1792. height: PanelH-15,
  1793. layout: 'fit',
  1794. items:[{
  1795. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1796. }]
  1797. }]
  1798. }]
  1799. });
  1800. tPanel.doLayout();
  1801. oSelectedLine = 0;
  1802. loadMetroLines( SelectedLine );
  1803. };
  1804. var SNAPE_Icon = L.icon({
  1805. iconUrl: '/style/assets/cursor.png',
  1806. iconSize: [32, 32], // size of the icon
  1807. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  1808. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  1809. //shadowUrl: 'leaf-shadow.png',
  1810. //shadowSize: [50, 64], // size of the shadow
  1811. //shadowAnchor: [4, 62], // the same for the shadow
  1812. });
  1813. function updateSchemeLocation( e ){
  1814. Ext.Ajax.request({
  1815. url: '/lib/controller/doStationOperations.php',
  1816. params: {
  1817. STATION: SelectedStation,
  1818. OPID: 11,
  1819. TYPE: 0,
  1820. UID: <?=$UserID;?>,
  1821. SID: '<?=$Session;?>',
  1822. Y: e.target._latlng.lat,
  1823. X: e.target._latlng.lng
  1824. },
  1825. failure: failureAJAXFunction
  1826. });
  1827. };
  1828. function updateGisLocation( e ){
  1829. Ext.Ajax.request({
  1830. url: '/lib/controller/doStationOperations.php',
  1831. params: {
  1832. STATION: SelectedStation,
  1833. OPID: 11,
  1834. TYPE: 1,
  1835. UID: <?=$UserID;?>,
  1836. SID: '<?=$Session;?>',
  1837. LAT: e.target._latlng.lat,
  1838. LON: e.target._latlng.lng
  1839. },
  1840. failure: failureAJAXFunction
  1841. });
  1842. };
  1843. var schematic_editor = null;
  1844. function inintSchematicEditor( map_id, x, y ){
  1845. var mapLayers = [];
  1846. if( schematic_editor != null ){
  1847. schematic_editor.off();
  1848. schematic_editor.remove();
  1849. schematic_editor = null;
  1850. };
  1851. schematic_editor = L.map( map_id,{
  1852. crs: L.CRS.Simple,
  1853. attributionControl: false,
  1854. preferCanvas: true,
  1855. zoomControl: true,
  1856. center: [x,y],
  1857. zoom: 0,
  1858. minZoom: -3,
  1859. maxZoom: 0,
  1860. keyboard: false
  1861. });
  1862. var bounds = [[SCHEMATIC_SET.bounds_lx,SCHEMATIC_SET.bounds_ly], [SCHEMATIC_SET.bounds_rx,SCHEMATIC_SET.bounds_ry]];
  1863. var image = L.imageOverlay( SCHEMATIC_SET.layer_url, bounds ).addTo( schematic_editor );
  1864. L.marker([x, y], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( schematic_editor ).on('dragend', updateSchemeLocation );
  1865. };
  1866. var gis_editor = null;
  1867. function inintGisEditor( map_id, Lat, Lon ){
  1868. var mapLayers = [];
  1869. if( gis_editor != null ){
  1870. //ToDo: must be moved to Upper Menu changer
  1871. gis_editor.off();
  1872. gis_editor.remove();
  1873. gis_editor = null;
  1874. };
  1875. gis_editor = L.map( map_id,{
  1876. attributionControl: false,
  1877. preferCanvas: true,
  1878. zoomControl: true,
  1879. center: [Lat, Lon],
  1880. /*zoomControl: false,
  1881. zoom: 17,
  1882. minZoom: 17,
  1883. maxZoom: 17,*/
  1884. keyboard: false
  1885. });
  1886. gis_editor.setView([Lat, Lon], 17 );
  1887. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  1888. // attribution: MAP_SET.attribution,
  1889. // maxNativeZoom: MAP_SET.maxNativeZoom,
  1890. // maxZoom: MAP_SET.maxZoom
  1891. //});
  1892. L.tileLayer( MAP_SET.layer_url, {
  1893. attribution: MAP_SET.attribution,
  1894. attributionControl: false,
  1895. maxNativeZoom: MAP_SET.maxNativeZoom,
  1896. //minZoom: 0,
  1897. maxZoom: MAP_SET.maxZoom
  1898. }).addTo( gis_editor );
  1899. L.marker([Lat, Lon], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( gis_editor ).on('dragend', updateGisLocation );
  1900. };
  1901. function editPlatform( s_id ){
  1902. if( oSelectedPlatform ){
  1903. var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
  1904. if( tt!= null ){
  1905. tt.classList.remove('selected_green');
  1906. tt.classList.add('active_green');
  1907. } else oSelectedPlatform = 0;
  1908. };
  1909. var tt = document.getElementById('PLATFORM_TAG_'+s_id );
  1910. if( tt!= undefined ){
  1911. tt.classList.remove('active_green');
  1912. tt.classList.add('selected_green');
  1913. };
  1914. if( oSelectedPlatform == s_id ) return;
  1915. Ext.Ajax.request({
  1916. url: '/lib/controller/getPlatformEditor.php',
  1917. params: {
  1918. PID: s_id,
  1919. UID: <?=$UserID;?>,
  1920. SID: '<?=$Session;?>'
  1921. },
  1922. success: function( response, opts ){
  1923. var data = Ext.decode( response.responseText );
  1924. var tComp = Ext.getCmp('platform_op_small');
  1925. if( tComp!= null ){
  1926. tComp.removeAll( true );
  1927. tComp.add( data );
  1928. tComp.doLayout();
  1929. };
  1930. oSelectedPlatform = s_id;
  1931. if( SelectedPlatform != s_id ){
  1932. SelectedPlatform = s_id;
  1933. //tComp = Ext.getCmp('btn_unb_station');
  1934. //tComp.setDisabled( false );
  1935. //tComp = Ext.getCmp('btn_del_station');
  1936. //tComp.setDisabled( false );
  1937. tComp = Ext.getCmp('modules_tab');
  1938. tComp.setDisabled( false );
  1939. };
  1940. }
  1941. });
  1942. };
  1943. function editStation( s_id ){
  1944. if( oSelectedStation ){
  1945. var tt = document.getElementById('STATION_TAG_'+oSelectedStation );
  1946. tt.classList.remove('selected_green');
  1947. tt.classList.add('active_green');
  1948. };
  1949. var tt = document.getElementById('STATION_TAG_'+s_id );
  1950. if( tt!= undefined ){
  1951. tt.classList.remove('active_green');
  1952. tt.classList.add('selected_green');
  1953. };
  1954. if( oSelectedStation == s_id ) return;
  1955. Ext.Ajax.request({
  1956. url: '/lib/controller/getStationEditor.php',
  1957. params: {
  1958. CID: s_id,
  1959. UID: <?=$UserID;?>,
  1960. SID: '<?=$Session;?>'
  1961. },
  1962. success: function( response, opts ){
  1963. var data = Ext.decode( response.responseText );
  1964. var tComp = Ext.getCmp('station_op_small');
  1965. if( tComp!= null ){
  1966. tComp.removeAll( true );
  1967. tComp.add( data );
  1968. tComp.doLayout();
  1969. };
  1970. tComp = Ext.getCmp('btn_unb_station');
  1971. tComp.setDisabled( false );
  1972. tComp = Ext.getCmp('btn_del_station');
  1973. tComp.setDisabled( false );
  1974. oSelectedStation = s_id;
  1975. if( SelectedStation != s_id ){
  1976. SelectedStation = s_id;
  1977. SelectedPlatform = 0;
  1978. SelectedModule = 0;
  1979. tComp = Ext.getCmp('platform_tab');
  1980. tComp.setDisabled( false );
  1981. tComp = Ext.getCmp('modules_tab');
  1982. tComp.setDisabled( true );
  1983. };
  1984. },
  1985. failure: function(){
  1986. }
  1987. });
  1988. };
  1989. function editLine( l_id ){
  1990. if( oSelectedLine ){
  1991. var tt = document.getElementById('LINE_TAG_'+oSelectedLine );
  1992. if( tt.classList.contains('selected_blue') ){
  1993. tt.classList.remove('selected_blue');
  1994. tt.classList.add('active_blue');
  1995. };
  1996. if( tt.classList.contains('selected_gray') ){
  1997. tt.classList.remove('selected_gray');
  1998. tt.classList.add('active_gray');
  1999. };
  2000. };
  2001. var tt = document.getElementById('LINE_TAG_'+l_id );
  2002. if( tt!= undefined ){
  2003. if( tt.classList.contains('active_blue') ){
  2004. tt.classList.remove('active_blue');
  2005. tt.classList.add('selected_blue');
  2006. };
  2007. if( tt.classList.contains('active_gray') ){
  2008. tt.classList.remove('active_gray');
  2009. tt.classList.add('selected_gray');
  2010. };
  2011. };
  2012. if( oSelectedLine == l_id ) return;
  2013. Ext.Ajax.request({
  2014. url: '/lib/controller/getLineEditor.php',
  2015. params: {
  2016. LID: l_id,
  2017. UID: <?=$UserID;?>,
  2018. SID: '<?=$Session;?>'
  2019. },
  2020. success: function( response, opts ){
  2021. var data = Ext.decode( response.responseText );
  2022. var tComp = Ext.getCmp('line_op_small');
  2023. if( tComp!= null ){
  2024. tComp.removeAll( true );
  2025. tComp.add( data );
  2026. tComp.doLayout();
  2027. };
  2028. tComp = Ext.getCmp('stations_tab');
  2029. tComp.setDisabled( false );
  2030. oSelectedLine = l_id;
  2031. if( SelectedLine != l_id ){
  2032. SelectedLine = l_id;
  2033. SelectedStation = 0;
  2034. SelectedPlatform = 0;
  2035. SelectedModule = 0;
  2036. tComp = Ext.getCmp('platform_tab');
  2037. tComp.setDisabled( true );
  2038. tComp = Ext.getCmp('modules_tab');
  2039. tComp.setDisabled( true );
  2040. };
  2041. }
  2042. });
  2043. };
  2044. function editSensorHW( cid ){
  2045. SelectedSensor = cid;
  2046. Ext.Ajax.request({
  2047. url: '/lib/controller/getSensorEditor.php',
  2048. params: {
  2049. CID: SelectedSensor,
  2050. UID: <?=$UserID;?>,
  2051. SID: '<?=$Session;?>'
  2052. },
  2053. success: function( response, opts ){
  2054. var data = Ext.decode( response.responseText );
  2055. var tComp = Ext.getCmp('sens_op_small');
  2056. if( data.status == 'ok' ){
  2057. if( tComp!= null ){
  2058. var content = Ext.decode( data.content );
  2059. tComp.removeAll( true );
  2060. tComp.add( content );
  2061. tComp.doLayout();
  2062. };
  2063. } else {
  2064. if( tComp!= null ){
  2065. tComp.removeAll( true );
  2066. tComp.add( data );
  2067. tComp.doLayout();
  2068. };
  2069. };
  2070. },
  2071. failure: function(){
  2072. }
  2073. });
  2074. };
  2075. var cameraEditorContent = null;
  2076. function editCamera( cid, etyp ){
  2077. SelectedCam = cid;
  2078. switch( etyp ){
  2079. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  2080. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  2081. };
  2082. Ext.Ajax.request({
  2083. url: '/lib/controller/getCameraEditor.php',
  2084. params: {
  2085. CID: SelectedCam,
  2086. UID: <?=$UserID;?>,
  2087. SID: '<?=$Session;?>'
  2088. },
  2089. success: function( response, opts ){
  2090. var data = Ext.decode( response.responseText );
  2091. if( data.status == 'ok' ){
  2092. if( cameraEditorContent!= null ){
  2093. var content = Ext.decode( data.content );
  2094. cameraEditorContent.removeAll( true );
  2095. cameraEditorContent.add( content );
  2096. cameraEditorContent.doLayout();
  2097. };
  2098. } else {
  2099. if( cameraEditorContent!= null ){
  2100. cameraEditorContent.removeAll( true );
  2101. cameraEditorContent.add( data );
  2102. cameraEditorContent.doLayout();
  2103. };
  2104. };
  2105. },
  2106. failure: function(){
  2107. }
  2108. });
  2109. };
  2110. function showSettingsUpgrade(){
  2111. stopStatusUpdater();
  2112. content_lvl1 = 1;
  2113. content_lvl2 = 4;
  2114. var tPanel = Ext.getCmp('main_content');
  2115. tPanel.removeAll( true );
  2116. initial_md5 = '';
  2117. tPanel.add({
  2118. columnWidth: 1.0,
  2119. frame: false,
  2120. border: false,
  2121. items: [{
  2122. frame: false,
  2123. border: false,
  2124. collapsible: false,
  2125. draggable: false,
  2126. layout: 'vbox',
  2127. //layoutConfig: {
  2128. // align : 'stretch',
  2129. // pack : 'start',
  2130. //},
  2131. height: PanelH,
  2132. items:[{
  2133. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2134. xtype: 'panel',
  2135. height: PanelH-300,
  2136. //flex: 1,
  2137. frame: true,
  2138. width: '100%',
  2139. border: false,
  2140. layout: {
  2141. type: 'table',
  2142. columns: 2,
  2143. tableAttrs: {
  2144. valign: 'top',
  2145. style: 'valign:top;width:100%;'
  2146. }
  2147. },
  2148. defaults: {
  2149. frame: true,
  2150. border: false,
  2151. height: ( PanelH-400 ) / 2,
  2152. style: 'margin: 5px;width:400px;display:block;'
  2153. },
  2154. items:[{
  2155. title: 'Current System Info',
  2156. width: '100%',
  2157. //flex: 1,
  2158. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2159. },{
  2160. title: 'Tasks',
  2161. //width: 400,
  2162. layout: 'vbox',
  2163. items:[{
  2164. xtype: 'button',
  2165. width: '100%',
  2166. text: 'Create Database Backup',
  2167. handler: function(){
  2168. createNewTask( 2 );
  2169. }
  2170. },{
  2171. xtype: 'button',
  2172. width: '100%',
  2173. text: 'Create Full Snapeshot',
  2174. handler: function(){
  2175. createNewTask( 255 );
  2176. }
  2177. }]
  2178. },{
  2179. title: 'Archives',
  2180. height: 250,
  2181. width: '100%',
  2182. tbar:[{
  2183. text: 'Restore',
  2184. id: 'ar_restore_btn',
  2185. handler: function(){
  2186. createNewTask(1, selectedArchiveRecord.data.file_name );
  2187. }
  2188. },{
  2189. text: 'Download',
  2190. id: 'ar_download_btn',
  2191. handler: function(){
  2192. if( selectedArchiveRecord!= null ){
  2193. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2194. };
  2195. }
  2196. },{
  2197. text: 'Delete',
  2198. id: 'ar_delete_btn',
  2199. handler: function(){
  2200. createNewTask(100, selectedArchiveRecord.data.file_name );
  2201. }
  2202. }],
  2203. items:[{
  2204. xtype: 'grid',
  2205. id: 'archives_grid',
  2206. border: false,
  2207. frame: false,
  2208. autoScroll: true,
  2209. //width: '100%',
  2210. lazyRender: true,
  2211. height: 210,
  2212. ds: archives_store,
  2213. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2214. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2215. viewConfig: {
  2216. // forceFit: true
  2217. },
  2218. }]
  2219. },{
  2220. title: 'Task Status',
  2221. height: 250,
  2222. //flex: 1,
  2223. items:[{
  2224. xtype: 'spacer',
  2225. height: 4
  2226. },{
  2227. id: 'ctask_status',
  2228. border: true,
  2229. html: ''
  2230. },{
  2231. xtype: 'spacer',
  2232. height: 4
  2233. },{
  2234. xtype: 'textarea',
  2235. id: 'task_log',
  2236. height: ( PanelH-320 ) / 2 - 120,
  2237. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2238. readOnly: true,
  2239. autoScroll: true,
  2240. value: ''
  2241. },{
  2242. xtype: 'progress',
  2243. id: 'task_progress',
  2244. value: 1.0,
  2245. text: 'idle',
  2246. disabled: true
  2247. }],
  2248. tbar:[{
  2249. text: 'Cancel Task',
  2250. id: 'ch_ta_btn',
  2251. disabled: true,
  2252. handler: deleteNewTask
  2253. }]
  2254. }]
  2255. },{
  2256. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2257. xtype: 'panel',
  2258. height: 300,
  2259. //flex: 1,
  2260. frame: true,
  2261. border: false,
  2262. //layout: 'vbox',
  2263. items:[{
  2264. xtype:'button',
  2265. id: 'pickfiles',
  2266. width: '100%',
  2267. text: 'Choose File'
  2268. },{
  2269. height: 200,
  2270. xtype: 'grid',
  2271. id: 'upload_grid',
  2272. border: false,
  2273. frame: false,
  2274. mode: 'local',
  2275. lazyRender: true,
  2276. width: '100%',
  2277. autoScroll: true,
  2278. ds: uploads_store,
  2279. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2280. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2281. viewConfig: {
  2282. forceFit: true
  2283. },
  2284. bbar: [{
  2285. text: 'Clear',
  2286. width: '100%',
  2287. handler: function(){
  2288. muploader.splice();
  2289. uploads_store.removeAll();
  2290. }
  2291. }]
  2292. },{
  2293. xtype:'button',
  2294. id: 'umpalumpa',
  2295. width: '100%',
  2296. disabled: true,
  2297. text: 'Upload',
  2298. handler: function(){
  2299. if( muploader!= null ){
  2300. muploader.start();
  2301. };
  2302. }
  2303. }],
  2304. listeners:{
  2305. afterrender: function(){
  2306. muploader = new plupload.Uploader({
  2307. runtimes : 'html5,html4',
  2308. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2309. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2310. max_file_size : '1000mb',
  2311. chunk_size: '200kb',
  2312. max_retries: 3,
  2313. multi_selection: false,
  2314. max_file_count: 1,
  2315. // Fake server response here
  2316. url: '/lib/php/setup_toolkit/upload.php',
  2317. //url: "/echo/json",
  2318. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2319. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2320. filters : [
  2321. //{title : "Image files", extensions : "jpg,gif,png"},
  2322. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2323. ],
  2324. init: {
  2325. PostInit: function() {
  2326. //$('filelist').innerHTML = '';
  2327. //$('uploadfiles').onclick = function() {
  2328. // uploader.start();
  2329. // return false;
  2330. //};
  2331. },
  2332. FilesAdded: function( up, files ) {
  2333. Ext.getCmp('umpalumpa').enable();
  2334. plupload.each( files, function(file) {
  2335. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2336. uploads_store_id++;
  2337. Ext.getCmp('upload_grid').doLayout();
  2338. });
  2339. },
  2340. UploadProgress: function(up, file) {
  2341. var pb = Ext.getCmp( 'progress_'+file.id );
  2342. if( file.percent < 100 ){
  2343. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2344. } else {
  2345. pb.updateProgress( 1.0, 'Uploaded', false );
  2346. };
  2347. },
  2348. Error: function(up, err) {
  2349. Ext.Msg.show({
  2350. title:'Upload Status',
  2351. msg: "Error #" + err.code + ": " + err.message,
  2352. buttons: Ext.Msg.OK,
  2353. icon: Ext.MessageBox.ERROR
  2354. });
  2355. }
  2356. }
  2357. });
  2358. muploader.init();
  2359. }
  2360. }
  2361. }]
  2362. }]
  2363. });
  2364. muploader = null;
  2365. uploads_store.removeAll();
  2366. tPanel.doLayout();
  2367. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2368. updateTaskStatus();
  2369. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2370. };
  2371. var SelectedScadaModule = 0;
  2372. function loadSCADAModules( platform_id, suse ){
  2373. if( suse == undefined ){
  2374. suse = 0;
  2375. };
  2376. Ext.Ajax.request({
  2377. url: '/lib/controller/getScadaModules.php',
  2378. params: {
  2379. UID: <?=$UserID;?>,
  2380. SID: '<?=$Session;?>',
  2381. PID: platform_id
  2382. },
  2383. success: function( response, opts ){
  2384. var tData = Ext.decode(response.responseText);
  2385. var tPanel = Ext.getCmp('scada_container');
  2386. if( tData.status == 'ok' ){
  2387. tPanel.removeAll( true );
  2388. var res = Ext.decode( tData.modules );
  2389. tPanel.add( res );
  2390. tPanel.doLayout();
  2391. if( suse == 0 ){
  2392. var zPanel = Ext.getCmp('scada_op_small');
  2393. zPanel.removeAll( true );
  2394. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2395. zPanel.doLayout();
  2396. } else {
  2397. editScadaModule( suse );
  2398. };
  2399. } else {
  2400. tPanel.removeAll( true );
  2401. tPanel.doLayout();
  2402. var zPanel = Ext.getCmp('scada_op_small');
  2403. zPanel.removeAll( true );
  2404. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2405. zPanel.doLayout();
  2406. };
  2407. },
  2408. failure: failureAJAXFunction
  2409. });
  2410. };
  2411. function editScadaModule( smid ){
  2412. SelectedScadaModule = smid;
  2413. Ext.Ajax.request({
  2414. url: '/lib/controller/getScadaEditor.php',
  2415. params: {
  2416. MID: SelectedScadaModule,
  2417. UID: <?=$UserID;?>,
  2418. SID: '<?=$Session;?>'
  2419. },
  2420. success: function( response, opts ){
  2421. var data = Ext.decode( response.responseText );
  2422. var tComp = Ext.getCmp('scada_op_small');
  2423. if( tComp!= null ){
  2424. tComp.removeAll( true );
  2425. tComp.add( data );
  2426. tComp.doLayout();
  2427. };
  2428. }
  2429. });
  2430. };
  2431. function loadSensorDetectionSettings( sensid ){
  2432. Ext.Ajax.request({
  2433. url: '/lib/controller/getSensorDetectionEditor.php',
  2434. params: {
  2435. UID: <?=$UserID;?>,
  2436. SID: '<?=$Session;?>',
  2437. SEN: sensid
  2438. },
  2439. success: function( response, opts ){
  2440. var data = Ext.decode( response.responseText );
  2441. var tComp = Ext.getCmp('main_content');
  2442. if( data.status == 'ok' ){
  2443. if( tComp!= null ){
  2444. var content = Ext.decode( data.content );
  2445. tComp.removeAll( true );
  2446. tComp.add( content );
  2447. tComp.doLayout();
  2448. };
  2449. } else {
  2450. if( tComp!= null ){
  2451. tComp.removeAll( true );
  2452. tComp.add( data );
  2453. tComp.doLayout();
  2454. };
  2455. };
  2456. },
  2457. failure: function(){
  2458. }
  2459. });
  2460. };
  2461. function initSettingsView(){
  2462. if( tlInterval!= null ){
  2463. window.clearInterval( tlInterval );
  2464. tlInterval = null;
  2465. timelineObj = null;
  2466. };
  2467. var tP = Ext.getCmp('left_side_menu');
  2468. //tP.doLayout();
  2469. //tP.setVisible( false );
  2470. tP.removeAll( true );
  2471. tP.add({
  2472. id: 'sme_inner',
  2473. layout:'accordion',
  2474. //height: PanelH,
  2475. frame: false,
  2476. border: false,
  2477. layoutConfig:{
  2478. animate: true//,
  2479. //activeOnTop: true
  2480. },
  2481. items:[]
  2482. });
  2483. tP.doLayout();
  2484. tP = Ext.getCmp('sme_inner');
  2485. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2486. tP.add({
  2487. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2488. layout: 'vbox',
  2489. height: 120,
  2490. pack: 'center',
  2491. align : 'strech',
  2492. collapsed: ( contentView.l[1].v != 0 ),
  2493. items:[{
  2494. xtype: 'button',
  2495. width: '100%',
  2496. id:'sys_edit',
  2497. text: "<?=$Labels->GetLabel('_SRV_SETTINGS_');?>",
  2498. enableToggle: true,
  2499. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 0 ),
  2500. allowDepress: false,
  2501. toggleGroup: '_settings',
  2502. handler: function(){
  2503. changeContent( 1, 0, '' );
  2504. changeContent( 2, 0, '' );
  2505. updateUserContent();
  2506. showSettingsServer();
  2507. }
  2508. }
  2509. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2510. ,{
  2511. xtype: 'button',
  2512. width: '100%',
  2513. id:'map_edit',
  2514. text: "<?=$Labels->GetLabel('_IFR_STRUCT_');?>",
  2515. enableToggle: true,
  2516. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 0 ),
  2517. allowDepress: false,
  2518. toggleGroup: '_settings',
  2519. handler: function(){
  2520. changeContent( 1, 0, '' );
  2521. changeContent( 2, 1, '' );
  2522. updateUserContent();
  2523. showSettingsInfrastructure();
  2524. }
  2525. }
  2526. <?php }; ?>
  2527. ]
  2528. });
  2529. <?php
  2530. }; ?>
  2531. tP.add({
  2532. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  2533. collapsed: ( contentView.l[1].v != 1 ),
  2534. items:[{
  2535. xtype:'button',
  2536. text:'<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  2537. enableToggle: true,
  2538. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 1 ),
  2539. allowDepress: false,
  2540. toggleGroup: '_settings',
  2541. width: '100%',
  2542. handler: function(){
  2543. changeContent( 1, 1, 0 );
  2544. //changeContent( 2, 0, '' ); - will do automatically
  2545. updateUserContent();
  2546. showSettingsProfile();
  2547. }
  2548. }]
  2549. });
  2550. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2551. tP.add({
  2552. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  2553. collapsed: ( contentView.l[1].v != 2 ),
  2554. items:[{
  2555. xtype: 'button',
  2556. width: '100%',
  2557. id:'adm_acc',
  2558. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  2559. enableToggle: true,
  2560. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 2 ),
  2561. allowDepress: false,
  2562. toggleGroup: '_settings',
  2563. handler: function( b, e ){
  2564. changeContent( 1, 2, 0 );
  2565. changeContent( 2, 0, '' );
  2566. updateUserContent();
  2567. loadUserEditor();
  2568. }
  2569. },{
  2570. xtype: 'button',
  2571. width: '100%',
  2572. id:'adm_acclog',
  2573. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  2574. enableToggle: true,
  2575. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 2 ),
  2576. allowDepress: false,
  2577. toggleGroup: '_settings',
  2578. handler: function( b, e ){
  2579. changeContent( 1, 2, 0 );
  2580. changeContent( 2, 1, '' );
  2581. updateUserContent();
  2582. loadAccessLog();
  2583. }
  2584. },{
  2585. xtype: 'button',
  2586. width: '100%',
  2587. id:'adm_servlog',
  2588. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  2589. enableToggle: true,
  2590. pressed: ( contentView.l[2].v == 2 && contentView.l[1].v == 2 ),
  2591. allowDepress: false,
  2592. toggleGroup: '_settings',
  2593. handler: function( b, e ){
  2594. changeContent( 1, 2, 0 );
  2595. changeContent( 2, 2, '' );
  2596. updateUserContent();
  2597. loadServerLog();
  2598. }
  2599. }]
  2600. });
  2601. <?php
  2602. };
  2603. ?>
  2604. tP.setVisible( true );
  2605. tP.doLayout();
  2606. switch( contentView.l[1].v ){
  2607. case 0:{
  2608. switch( contentView.l[2].v ){
  2609. case 0: showSettingsServer(); break;
  2610. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2611. case 1: showSettingsInfrastructure(); break;
  2612. <?php }; ?>
  2613. //case 4: showSettingsUpgrade(); break;
  2614. };
  2615. break;
  2616. };
  2617. case 1:{
  2618. switch( contentView.l[2].v ){
  2619. case 0: showSettingsProfile(); break;
  2620. };
  2621. break;
  2622. };
  2623. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2624. case 2:{
  2625. switch( contentView.l[2].v ){
  2626. case 0: loadUserEditor(); break;
  2627. case 1: loadAccessLog(); break;
  2628. case 2: loadServerLog(); break;
  2629. };
  2630. break;
  2631. };
  2632. <?php }; ?>
  2633. };
  2634. };