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.

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