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.

2522 lines
69 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
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 loadMetroPlatformModules( platform_id, suse ){
  497. if( suse == undefined ){
  498. suse = 0;
  499. };
  500. oSelectedPlatform = 0;
  501. Ext.Ajax.request({
  502. url: '/lib/controller/getModules.php',
  503. params: {
  504. UID: <?=$UserID;?>,
  505. SID: '<?=$Session;?>',
  506. OID: platform_id
  507. },
  508. success: function( response, opts ){
  509. var tData = Ext.decode(response.responseText);
  510. var tPanel = Ext.getCmp('module_container');
  511. if( tData.b_a_b ) Ext.getCmp('mod_add_btn').disable(); else Ext.getCmp('mod_add_btn').enable();
  512. if( tData.status == 'ok' ){
  513. tPanel.removeAll( true );
  514. //var res = Ext.decode( tData.line_tag );
  515. //tPanel.add( res );
  516. res = Ext.decode( tData.modules );
  517. tPanel.add( res );
  518. tPanel.doLayout();
  519. if( suse == 0 ){
  520. var zPanel = Ext.getCmp('module_op_small');
  521. zPanel.removeAll( true );
  522. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  523. zPanel.doLayout();
  524. } else {
  525. editModule( suse );
  526. };
  527. } else {
  528. tPanel.removeAll( true );
  529. tPanel.doLayout();
  530. var zPanel = Ext.getCmp('module_op_small');
  531. zPanel.removeAll( true );
  532. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  533. zPanel.doLayout();
  534. };
  535. },
  536. failure: failureAJAXFunction
  537. });
  538. };
  539. var addMetroStationPlatformWindow = null;
  540. function addStationPlatform( station_id ){
  541. if( addMetroStationPlatformWindow == null ){
  542. addMetroStationPlatformWindow = new Ext.Window({
  543. title: 'Add Platform',
  544. width: 480,
  545. height: 405,
  546. modal: true,
  547. resizable: false,
  548. items:[{
  549. xtype: 'form',
  550. fzrame: false,
  551. bzorder: false,
  552. labelWidth: 150,
  553. labelAlign: 'right',
  554. items: [{
  555. xtype: 'textfield',
  556. fieldLabel: "Platform Name",
  557. id: 'pl_name',
  558. width: 200,
  559. },{
  560. xtype: 'textfield',
  561. fieldLabel: "Platform Level",
  562. id: 'pl_lvl',
  563. width: 50,
  564. },{
  565. xtype: 'combo',
  566. fieldLabel: "Platform Type",
  567. id: 'pl_lay',
  568. width: 200,
  569. lazyRender: true,
  570. mode: 'local',
  571. forceSelection: true,
  572. triggerAction: 'all',
  573. editable: false,
  574. readOnly: false,
  575. disableKeyFilter: true,
  576. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  577. store: new Ext.data.ArrayStore({
  578. fields: ['abbr','name','icon'],
  579. 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']]
  580. }),
  581. valueField: 'abbr',
  582. displayField: 'name',
  583. value: 'A',
  584. listeners:{
  585. select: function( t, r, i ){
  586. t.getEl().setStyle({
  587. 'background-image': 'url(' + r.data.icon + ')',
  588. 'background-repeat': 'no-repeat',
  589. 'background-position': '3px center',
  590. 'background-size': '16px 16px',
  591. 'padding-left': '25px'
  592. });
  593. tt = document.getElementById('lp_preview');
  594. tt.src = r.data.icon;
  595. if( r.data.abbr == 'A' || r.data.abbr == 'B' ){
  596. Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Name');
  597. Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Abbr.');
  598. Ext.getCmp('bot_tr_name').hide();
  599. Ext.getCmp('bot_tr_abbr').hide();
  600. } else {
  601. Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Name');
  602. Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Abbr.');
  603. Ext.getCmp('bot_tr_name').show();
  604. Ext.getCmp('bot_tr_abbr').show();
  605. }
  606. },
  607. afterrender: function( t ){
  608. t.getEl().setStyle({
  609. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  610. 'background-repeat': 'no-repeat',
  611. 'background-position': '3px center',
  612. 'background-size': '16px 16px',
  613. 'padding-left': '25px'
  614. });
  615. }
  616. }
  617. },{
  618. xtype: 'spacer',
  619. height: 10
  620. },{
  621. xtype: 'spacer',
  622. html: '<center><img style="border: 1px solid yellow;" id="lp_preview" src="/style/assets/pt_layout_A.png" width="120"></center>'
  623. },{
  624. xtype: 'spacer',
  625. height: 10
  626. },{
  627. xtype: 'textfield',
  628. fieldLabel: "Track Name",
  629. id: 'up_tr_name',
  630. width: 200,
  631. },{
  632. xtype: 'textfield',
  633. fieldLabel: "Track Abbr.",
  634. id: 'up_tr_abbr',
  635. width: 50,
  636. },{
  637. xtype: 'textfield',
  638. fieldLabel: "Bottom Track Name",
  639. hidden: true,
  640. id: 'bot_tr_name',
  641. width: 200,
  642. },{
  643. xtype: 'textfield',
  644. fieldLabel: "Bottom Track Abbr.",
  645. hidden: true,
  646. id: 'bot_tr_abbr',
  647. width: 50,
  648. },{
  649. xtype: 'spacer',
  650. height: 300
  651. }]
  652. }],
  653. bbar:['->',{
  654. text: 'Cancel',
  655. handler: function(){
  656. addMetroStationPlatformWindow.close();
  657. }
  658. },{
  659. text: 'Add',
  660. handler: function(){
  661. var tt = {
  662. name: Ext.getCmp('pl_name').getValue(),
  663. level: Ext.getCmp('pl_lvl').getValue(),
  664. layout: Ext.getCmp('pl_lay').getValue(),
  665. up_trn: Ext.getCmp('up_tr_name').getValue(),
  666. up_tra: Ext.getCmp('up_tr_abbr').getValue(),
  667. bt_trn: Ext.getCmp('bot_tr_name').getValue(),
  668. bt_tra: Ext.getCmp('bot_tr_abbr').getValue()
  669. };
  670. SelectedPlatform = 0;
  671. doPlatformOperation( SelectedStation, 1, JSON.stringify(tt), true );
  672. addMetroStationPlatformWindow.close();
  673. }
  674. }],
  675. listeners:{
  676. beforedestroy: function(){
  677. addMetroStationPlatformWindow = null;
  678. }
  679. }
  680. });
  681. };
  682. addMetroStationPlatformWindow.show();
  683. };
  684. var addMetroStationWindow = null;
  685. function addMetroStation( line_id ){
  686. if( addMetroStationWindow == null ){
  687. //debugger;
  688. addMetroStationWindow = new Ext.Window({
  689. title: 'Add Station',
  690. width: 800,
  691. height: 600,
  692. items:[{
  693. xtype: 'tabpanel',
  694. frame: false,
  695. id: 'jjua_content',
  696. border: false,
  697. activeTab: 0,
  698. items:[{
  699. xtype: 'panel',
  700. flex: 1,
  701. title: 'Assign Existed Station',
  702. items:[{
  703. xtype: 'spacer',
  704. height: 10
  705. },{
  706. xtype: 'textfield',
  707. id: 'zizi',
  708. width: '100%',
  709. enableKeyEvents : true,
  710. emptyText: 'Start Type Station Name Here',
  711. value: '',
  712. listeners:{
  713. keyup: function( t, e ){
  714. nv = t.getRawValue();
  715. if( nv.length > 2 ){
  716. Ext.Ajax.request({
  717. url: '/lib/controller/getStations.php',
  718. params: {
  719. UID: <?=$UserID;?>,
  720. SID: '<?=$Session;?>',
  721. LID: SelectedLine,
  722. ABQ: nv
  723. },
  724. success: function( response, opts ){
  725. var tData = Ext.decode(response.responseText);
  726. var tPanel = Ext.getCmp('ex_station_container');
  727. if( tData.status == 'ok' ){
  728. tPanel.removeAll( true );
  729. var res = Ext.decode( tData.stations );
  730. tPanel.add( res );
  731. tPanel.doLayout();
  732. } else {
  733. tPanel.removeAll( true );
  734. tPanel.doLayout();
  735. };
  736. },
  737. failure: failureAJAXFunction
  738. });
  739. };
  740. }
  741. }
  742. },{
  743. xtype: 'spacer',
  744. height: 10
  745. },{
  746. xtype: 'panel',
  747. id: 'ex_station_container',
  748. flex: 1,
  749. height: 500,
  750. items:[]
  751. }]
  752. }]
  753. }],
  754. listeners:{
  755. beforedestroy: function(){
  756. addMetroStationWindow = null;
  757. }
  758. }
  759. });
  760. };
  761. addMetroStationWindow.show();
  762. };
  763. function editResource( rid ){
  764. var loadEditor = true;
  765. if( settingsAreChanged ){
  766. Ext.Msg.show({
  767. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  768. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  769. buttons: Ext.Msg.YESNO,
  770. icon: Ext.MessageBox.WARNING,
  771. fn: function(btn, text){
  772. if( btn == 'yes' ){
  773. cleanupChangeNotifier();
  774. } else {
  775. loadEditor = false;
  776. };
  777. }
  778. });
  779. };
  780. if( loadEditor ){
  781. Ext.Ajax.request({
  782. url: '/lib/controller/getResourceEditor.php',
  783. params: {
  784. RID: rid,
  785. UID: <?=$UserID;?>,
  786. SID: '<?=$Session;?>',
  787. },
  788. success: function( response, opts ){
  789. var data = Ext.decode(response.responseText);
  790. var resourceEdPanel = Ext.getCmp('res_ed_small');
  791. if( resourceEdPanel ){
  792. resourceEdPanel.removeAll( true );
  793. resourceEdPanel.add( data );
  794. resourceEdPanel.doLayout();
  795. };
  796. },
  797. failure: failureAJAXFunction
  798. });
  799. };
  800. };
  801. function editFilter( fid ){
  802. var loadEditor = true;
  803. if( settingsAreChanged ){
  804. Ext.Msg.show({
  805. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  806. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  807. buttons: Ext.Msg.YESNO,
  808. icon: Ext.MessageBox.WARNING,
  809. fn: function(btn, text){
  810. if( btn == 'yes' ){
  811. cleanupChangeNotifier();
  812. } else {
  813. loadEditor = false;
  814. };
  815. }
  816. });
  817. };
  818. if( loadEditor ){
  819. Ext.Ajax.request({
  820. url: '/lib/controller/getFilterEditor.php',
  821. params: {
  822. FID: fid,
  823. UID: <?=$UserID;?>,
  824. SID: '<?=$Session;?>',
  825. },
  826. success: function( response, opts ){
  827. var data = Ext.decode(response.responseText);
  828. var resourceEdPanel = Ext.getCmp('flt_ed_small');
  829. if( resourceEdPanel ){
  830. resourceEdPanel.removeAll( true );
  831. resourceEdPanel.add( data );
  832. resourceEdPanel.doLayout();
  833. };
  834. },
  835. failure: failureAJAXFunction
  836. });
  837. };
  838. };
  839. function editModule( s_id ){
  840. if( oSelectedModule ){
  841. var tt = document.getElementById('MODULE_TAG_'+oSelectedModule );
  842. tt.classList.remove('selected_green');
  843. tt.classList.add('active_green');
  844. };
  845. var tt = document.getElementById('MODULE_TAG_'+s_id );
  846. if( tt!= undefined ){
  847. tt.classList.remove('active_green');
  848. tt.classList.add('selected_green');
  849. };
  850. if( oSelectedModule == s_id ) return;
  851. Ext.Ajax.request({
  852. url: '/lib/controller/getModuleEditor.php',
  853. params: {
  854. MID: s_id,
  855. UID: <?=$UserID;?>,
  856. SID: '<?=$Session;?>'
  857. },
  858. success: function( response, opts ){
  859. var data = Ext.decode( response.responseText );
  860. var tComp = Ext.getCmp('module_op_small');
  861. if( tComp!= null ){
  862. tComp.removeAll( true );
  863. tComp.add( data );
  864. tComp.doLayout();
  865. };
  866. oSelectedModule = s_id;
  867. if( SelectedModule != s_id ){
  868. SelectedModule = s_id;
  869. //tComp = Ext.getCmp('btn_unb_station');
  870. //tComp.setDisabled( false );
  871. //tComp = Ext.getCmp('btn_del_station');
  872. //tComp.setDisabled( false );
  873. //tComp = Ext.getCmp('modules_tab');
  874. //tComp.setDisabled( false );
  875. };
  876. }
  877. });
  878. };
  879. function enableModule( ID ){
  880. Ext.Ajax.request({
  881. url: '/lib/controller/doModuleOperation.php',
  882. params: {
  883. OPID: 2,
  884. OPCODE: 1,
  885. MID: ID,
  886. UID: <?=$UserID;?>,
  887. SID: '<?=$Session;?>'
  888. },
  889. success: function(){
  890. //showSettings( SelectedNodeID, 2 );
  891. loadModules();
  892. }
  893. });
  894. };
  895. function disableModule( ID ){
  896. Ext.Ajax.request({
  897. url: '/lib/controller/doModuleOperation.php',
  898. params: {
  899. OPID: 2,
  900. OPCODE: 0,
  901. MID: ID,
  902. UID: <?=$UserID;?>,
  903. SID: '<?=$Session;?>'
  904. },
  905. success: function(){
  906. //showSettings( SelectedNodeID, 2 );
  907. loadModules();
  908. }
  909. });
  910. };
  911. //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;
  912. function doApplicationOperation( op, param, reload = false ){
  913. Ext.Ajax.request({
  914. url: '/lib/controller/doApplicationOperation.php',
  915. params: {
  916. OPID: op,
  917. OPCODE: param,
  918. UID: <?=$UserID;?>,
  919. SID: '<?=$Session;?>'
  920. },
  921. success: function(){
  922. //if( reload ) loadDetectedCameras();
  923. //if( reload ) loadAssignedCameras();
  924. }
  925. });
  926. };
  927. function doModuleOperation( moduleid, op, param, reload = false ){
  928. Ext.Ajax.request({
  929. url: '/lib/controller/doModuleOperations.php',
  930. params: {
  931. MID: moduleid,
  932. OPID: op,
  933. OPCODE: param,
  934. UID: <?=$UserID;?>,
  935. SID: '<?=$Session;?>'
  936. },
  937. success: function(){
  938. if( reload ) loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  939. }
  940. });
  941. };
  942. function doLineOperation( lineID, operation, param, reload ){
  943. Ext.Ajax.request({
  944. url: '/lib/controller/doLineOperations.php',
  945. params: {
  946. ID: lineID,
  947. OPID: operation,
  948. OPCODE: param,
  949. UID: <?=$UserID;?>,
  950. SID: '<?=$Session;?>'
  951. },
  952. success: function(){
  953. oSelectedLine = 0;
  954. if( reload ) loadMetroLines( SelectedLine );
  955. }
  956. });
  957. };
  958. function doStationOperation( StationID, operation, param, reload ){
  959. Ext.Ajax.request({
  960. url: '/lib/controller/doStationOperations.php',
  961. params: {
  962. ID: StationID,
  963. OPID: operation,
  964. OPCODE: param,
  965. UID: <?=$UserID;?>,
  966. SID: '<?=$Session;?>'
  967. },
  968. success: function(){
  969. if( reload ) loadMetroStations( SelectedLine, SelectedStation );
  970. }
  971. });
  972. };
  973. function doPlatformOperation( PlatformID, operation, param, reload ){
  974. Ext.Ajax.request({
  975. url: '/lib/controller/doPlatformOperations.php',
  976. params: {
  977. ID: PlatformID,
  978. OPID: operation,
  979. OPCODE: param,
  980. UID: <?=$UserID;?>,
  981. SID: '<?=$Session;?>'
  982. },
  983. success: function(){
  984. if( reload ) loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  985. }
  986. });
  987. };
  988. function doScadaOperation( PlatformID, ScadaID, operation, param, reload ){
  989. Ext.Ajax.request({
  990. url: '/lib/controller/doPlatformOperations.php',
  991. params: {
  992. ID: PlatformID,
  993. SCA: ScadaID,
  994. OPID: operation,
  995. OPCODE: param,
  996. UID: <?=$UserID;?>,
  997. SID: '<?=$Session;?>'
  998. },
  999. success: function(){
  1000. if( reload ) loadSCADAModules( SelectedPlatform, SelectedScadaModule );
  1001. }
  1002. });
  1003. };
  1004. function removeModule( ID ){
  1005. Ext.Msg.show({
  1006. title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
  1007. msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
  1008. buttons: Ext.Msg.YESNOCANCEL,
  1009. fn: function( btn, text ){
  1010. if( btn == 'yes' ){
  1011. Ext.Ajax.request({
  1012. url: '/lib/controller/doModuleOperation.php',
  1013. params: {
  1014. OPID: 1,
  1015. MID: ID,
  1016. UID: <?=$UserID;?>,
  1017. SID: '<?=$Session;?>'
  1018. },
  1019. success: function(){
  1020. //showSettings( SelectedNodeID, 2 );
  1021. loadModules();
  1022. }
  1023. });
  1024. };
  1025. },
  1026. icon: Ext.MessageBox.QUESTION
  1027. });
  1028. };
  1029. function disableServOps(){
  1030. var tC = Ext.getCmp('servopPanel01');
  1031. tC.removeClass('servopInfo_item01');
  1032. tC.addClass('servopInfo_item00');
  1033. tC.disable();
  1034. Ext.getCmp('tbtn_sop01').disable();
  1035. //tC.doLayout();
  1036. tC = Ext.getCmp('servopPanel02');
  1037. tC.removeClass('servopInfo_item11');
  1038. tC.addClass('servopInfo_item10');
  1039. tC.disable();
  1040. Ext.getCmp('tbtn_sop02').disable();
  1041. //tC.doLayout();
  1042. tC = Ext.getCmp('servopPanel03');
  1043. tC.removeClass('servopInfo_item21');
  1044. tC.addClass('servopInfo_item20');
  1045. tC.disable();
  1046. Ext.getCmp('tbtn_sop03').disable();
  1047. //tC.doLayout();
  1048. tC = Ext.getCmp('servopPanel04');
  1049. tC.removeClass('servopInfo_item31');
  1050. tC.addClass('servopInfo_item30');
  1051. tC.disable();
  1052. Ext.getCmp('tbtn_sop04').disable();
  1053. //tC.doLayout();
  1054. };
  1055. function enableServOps(){
  1056. var tC = Ext.getCmp('servopPanel01');
  1057. if( tC != undefined ){
  1058. tC.removeClass('servopInfo_item00');
  1059. tC.addClass('servopInfo_item01');
  1060. Ext.getCmp('tbtn_sop01').enable();
  1061. tC.enable();
  1062. };
  1063. //tC.doLayout();
  1064. tC = Ext.getCmp('servopPanel02');
  1065. if( tC != undefined ){
  1066. tC.removeClass('servopInfo_item10');
  1067. tC.addClass('servopInfo_item11');
  1068. tC.enable();
  1069. Ext.getCmp('tbtn_sop02').enable();
  1070. };
  1071. //tC.doLayout();
  1072. tC = Ext.getCmp('servopPanel03');
  1073. if( tC != undefined ){
  1074. tC.removeClass('servopInfo_item20');
  1075. tC.addClass('servopInfo_item21');
  1076. tC.enable();
  1077. Ext.getCmp('tbtn_sop03').enable();
  1078. };
  1079. //tC.doLayout();
  1080. tC = Ext.getCmp('servopPanel04');
  1081. if( tC != undefined ){
  1082. tC.removeClass('servopInfo_item30');
  1083. tC.addClass('servopInfo_item31');
  1084. tC.enable();
  1085. Ext.getCmp('tbtn_sop04').enable();
  1086. };
  1087. //tC.doLayout();
  1088. };
  1089. function serverStatusUpdater(){
  1090. Ext.Ajax.request({
  1091. url: '/lib/controller/getServerStatus.php',
  1092. params: {
  1093. SERVID: 1,
  1094. UID: <?=$UserID;?>,
  1095. SID: '<?=$Session;?>'
  1096. },
  1097. success: function( response, opts ){
  1098. // If the response is JSON, you have to decode it
  1099. var sps = document.getElementById("INFO_SPS");
  1100. if( sps == undefined ) return;
  1101. var data = Ext.decode(response.responseText);
  1102. if( data.status == 'ok' ){
  1103. serverIsOnLine = true;
  1104. enableServOps();
  1105. document.getElementById('HW_INFO').innerHTML = data.hw_info;
  1106. document.getElementById('OS_INFO').innerHTML = data.os_info;
  1107. document.getElementById('SW_INFO').innerHTML = data.build;
  1108. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  1109. setDonatStatus( 1, 1, data.stats.stat_mem );
  1110. setDonatStatus( 1, 2, data.stats.stat_disk );
  1111. setDonatStatus( 1, 3, data.stats.temp0 );
  1112. sps.classList.remove('setEd_infoPanel');
  1113. sps.classList.add('setEl_infoPanel');
  1114. } else {
  1115. serverIsOnLine = false;
  1116. disableServOps();
  1117. if( data.status == 'na' ){
  1118. setDonatStatus( 1, 0, -1 );
  1119. setDonatStatus( 1, 1, -1 );
  1120. setDonatStatus( 1, 2, -1 );
  1121. setDonatStatus( 1, 3, -1 );
  1122. sps.classList.remove('setEl_infoPanel');
  1123. sps.classList.add('setEd_infoPanel');
  1124. } else {
  1125. Ext.Msg.show({
  1126. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1127. msg: data.messages,
  1128. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1129. fn: function(){
  1130. },
  1131. icon: Ext.MessageBox.INFO //QUESTION
  1132. });
  1133. };
  1134. };
  1135. if( tlInterval == null ){
  1136. tlInterval = window.setInterval( serverStatusUpdater, 1200, selectedSite );
  1137. };
  1138. },
  1139. failure: failureAJAXFunction
  1140. });
  1141. };
  1142. var devUploadTimeout = null;
  1143. var devUploadID = -1;
  1144. function fetchDeviceUploadStatus(){
  1145. clearTimeout( devUploadTimeout );
  1146. if( devUploadID < 1 ) return;
  1147. Ext.Ajax.request({
  1148. url: '/lib/controller/getDeviceUploadStatus.php',
  1149. params: {
  1150. UID: <?=$UserID;?>,
  1151. SID: '<?=$Session;?>',
  1152. DID: devUploadID
  1153. },
  1154. success: function( response, opts ){
  1155. var data = Ext.decode(response.responseText);
  1156. var tT = Ext.getCmp('upp_ttext');
  1157. if( tT != undefined ){
  1158. if( data.count > 0 ){
  1159. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1160. };
  1161. if( data.current != undefined ){
  1162. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1163. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1164. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1165. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1166. } else {
  1167. Ext.getCmp('upload_progres_panel').hide();
  1168. Ext.getCmp('uploaded_grid').show();
  1169. loadModuleFiles( devUploadID );
  1170. };
  1171. };
  1172. },
  1173. failure: failureAJAXFunction
  1174. });
  1175. };
  1176. function downloadSettings(){
  1177. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1178. ReportMask.show();
  1179. const formData = new FormData();
  1180. formData.append("UID",<?=$UserID;?>);
  1181. formData.append("SID",'<?=$Session;?>');
  1182. fetch('/lib/controller/downloadSettings.php',{
  1183. method: "POST",
  1184. body: formData
  1185. })
  1186. .then(resp => resp.blob())
  1187. .then(blob => {
  1188. const url = window.URL.createObjectURL(blob);
  1189. const a = document.createElement('a');
  1190. a.style.display = 'none';
  1191. a.href = url;
  1192. var today=new Date();
  1193. var SY=1900+today.getYear();
  1194. var SMO=today.getMonth()+1;
  1195. var SD=today.getDate();
  1196. var SH = today.getHours();
  1197. var SM = today.getMinutes();
  1198. var SS = today.getSeconds();
  1199. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1200. document.body.appendChild(a);
  1201. a.click();
  1202. window.URL.revokeObjectURL(url);
  1203. ReportMask.hide();
  1204. Ext.Msg.show({
  1205. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1206. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1207. buttons: Ext.Msg.OK,
  1208. icon: Ext.MessageBox.INFO
  1209. });
  1210. })
  1211. .catch(() => {
  1212. ReportMask.hide();
  1213. Ext.Msg.show({
  1214. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1215. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1216. buttons: Ext.Msg.OK,
  1217. icon: Ext.MessageBox.ERROR
  1218. });
  1219. });
  1220. };
  1221. function addModule(){
  1222. Ext.Ajax.request({
  1223. url: '/lib/controller/getAddModuleWindow.php',
  1224. params: {
  1225. UID: <?=$UserID;?>,
  1226. SID: '<?=$Session;?>',
  1227. PID: SelectedPlatform
  1228. },
  1229. success: function( response, opts ){
  1230. var data = Ext.decode(response.responseText);
  1231. var addModuleWindow = new Ext.Window( data );
  1232. addModuleWindow.show();
  1233. },
  1234. failure: failureAJAXFunction
  1235. });
  1236. };
  1237. var addScadaModuleWindow = null;
  1238. function addScadaModule(){
  1239. if( addScadaModuleWindow == null ){
  1240. addScadaModuleWindow = new Ext.Window({
  1241. title: "<?=$Labels->GetLabel( '_ADD_SCADA_MODULE_' );?>",
  1242. modal: true,
  1243. width: 400,
  1244. height: 148,
  1245. closeAction: 'hide',
  1246. resizable: false,
  1247. items:[{
  1248. xtype: 'form',
  1249. labelAlign: 'right',
  1250. border: false,
  1251. frame: false,
  1252. items: [{
  1253. id: 'scm_dev_name',
  1254. xtype: 'textfield',
  1255. fieldLabel: "<?=$Labels->GetLabel( '_NAME_LABEL_' );?>",
  1256. value: ''
  1257. },{
  1258. id: 'scm_dev_ip',
  1259. xtype: 'textfield',
  1260. minLength: 7,
  1261. maxLength: 15,
  1262. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_IP_' );?>",
  1263. value: ''
  1264. },{
  1265. xtype: 'numberfield',
  1266. id: 'scm_dev_port',
  1267. maxValue: 65535,
  1268. minValue: 27,
  1269. fieldLabel: "<?=$Labels->GetLabel( '_DEVICE_PORT_' );?>",
  1270. value: '502'
  1271. }]
  1272. }],
  1273. bbar:['->',{
  1274. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1275. handler: function(){
  1276. addScadaModuleWindow.hide();
  1277. }
  1278. },{
  1279. text: '<?=$Labels->GetLabel( '__ADD__' );?>',
  1280. handler: function(){
  1281. var mod_name = Ext.getCmp('scm_dev_name').getValue();
  1282. var mod_ip = Ext.getCmp('scm_dev_ip').getValue();
  1283. var mod_port = Ext.getCmp('scm_dev_port').getValue();
  1284. Ext.Ajax.request({
  1285. url: '/lib/controller/doPlatformOperations.php',
  1286. params: {
  1287. OPID: 12,
  1288. ID: SelectedPlatform,
  1289. MIP: mod_ip,
  1290. MPO: mod_port,
  1291. MNA: mod_name,
  1292. UID: <?=$UserID;?>,
  1293. SID: '<?=$Session;?>'
  1294. },
  1295. success: function( response, opts ){
  1296. var data = Ext.decode(response.responseText);
  1297. if( data.success ){
  1298. addScadaModuleWindow.close();
  1299. loadSCADAModules();
  1300. } else {
  1301. Ext.Msg.show({
  1302. title: "<?=$Labels->GetLabel("_ERROR_MSG_");?>",
  1303. msg: data.msg,
  1304. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1305. fn: function(){
  1306. //SettingsLidar3D.hide();
  1307. },
  1308. icon: Ext.MessageBox.ERROR //QUESTION
  1309. });
  1310. };
  1311. }
  1312. });
  1313. }
  1314. }]
  1315. });
  1316. };
  1317. Ext.getCmp('scm_dev_name').setValue( '' );
  1318. Ext.getCmp('scm_dev_ip').setValue( '' );
  1319. Ext.getCmp('scm_dev_port').setValue( 502 );
  1320. addScadaModuleWindow.show();
  1321. };
  1322. function addFilter(){
  1323. var addFilterWindow = new Ext.Window({
  1324. id: 'fulu_boa',
  1325. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1326. modal: true,
  1327. width: 400,
  1328. height: 300,
  1329. items:[{
  1330. xtype: 'form',
  1331. items: [{
  1332. xtype: 'combo',
  1333. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1334. id: 'flt_type',
  1335. lazyRender: true,
  1336. mode: 'local',
  1337. forceSelection: true,
  1338. triggerAction: 'all',
  1339. editable: false,
  1340. disableKeyFilter: true,
  1341. store: new Ext.data.ArrayStore({
  1342. fields: ['az_t','az_txt'],
  1343. data: [<?php
  1344. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1345. //$JIJI=$DATABASE->Query( $QS );
  1346. $OOP = array();
  1347. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1348. echo implode(',', $OOP );
  1349. ?>]
  1350. }),
  1351. valueField: 'az_t',
  1352. displayField: 'az_txt',
  1353. value: 1,
  1354. listeners:{
  1355. select: function( t, r, i ){
  1356. var n = r.data.az_t;
  1357. Ext.Ajax.request({
  1358. url: '/lib/controller/getFilterInfo.php',
  1359. params: {
  1360. FID: n,
  1361. UID: <?=$UserID;?>,
  1362. SID: '<?=$Session;?>'
  1363. },
  1364. success: function( response, opts ){
  1365. Ext.getCmp('filt_infopan').update( response.responseText );
  1366. }
  1367. });
  1368. }
  1369. }
  1370. },{
  1371. xtype: 'panel',
  1372. id: 'filt_infopan',
  1373. html: ''
  1374. }]
  1375. }],
  1376. bbar:[{
  1377. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  1378. handler: function(){
  1379. addFilterWindow.close();
  1380. }
  1381. },{
  1382. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  1383. handler: function(){
  1384. var mtyp = Ext.getCmp('flt_type').getValue();
  1385. Ext.Ajax.request({
  1386. url: '/lib/controller/addFilter.php',
  1387. params: {
  1388. SERVID: 1,
  1389. TYPE: mtyp,
  1390. UID: <?=$UserID;?>,
  1391. SID: '<?=$Session;?>'
  1392. },
  1393. success: function( response, opts ){
  1394. // If the response is JSON, you have to decode it
  1395. var data = Ext.decode(response.responseText);
  1396. if( data.status == 'ok' ){
  1397. addFilterWindow.close();
  1398. loadFilters();
  1399. } else {
  1400. Ext.Msg.show({
  1401. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1402. msg: data.message,
  1403. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1404. fn: function(){
  1405. //SettingsLidar3D.hide();
  1406. },
  1407. icon: Ext.MessageBox.INFO //QUESTION
  1408. });
  1409. }
  1410. },
  1411. failure: failureAJAXFunction
  1412. });
  1413. }
  1414. }]
  1415. });
  1416. addFilterWindow.show();
  1417. Ext.Ajax.request({
  1418. url: '/lib/controller/getFilterInfo.php',
  1419. params: {
  1420. FID: 1,
  1421. UID: <?=$UserID;?>,
  1422. SID: '<?=$Session;?>'
  1423. },
  1424. success: function( response, opts ){
  1425. Ext.getCmp('filt_infopan').update( response.responseText );
  1426. }
  1427. });
  1428. };
  1429. function showSettingsProfile(){
  1430. stopStatusUpdater();
  1431. //if( contentView.l[3] == undefined ){
  1432. // contentView.l[3] = {v:0,p:''};
  1433. //};
  1434. Ext.Ajax.request({
  1435. url: '/lib/controller/getProfileSettings.php',
  1436. params: {
  1437. UID: <?=$UserID;?>,
  1438. TYP: contentView.l[3].v,
  1439. SID: '<?=$Session;?>',
  1440. },
  1441. success: function( response, opts ){
  1442. var tData = Ext.decode(response.responseText);
  1443. if( tData.status == 'ok' ){
  1444. var tPanel = Ext.getCmp('main_content');
  1445. tPanel.removeAll( true );
  1446. tPanel.add(Ext.decode(tData.content));
  1447. tPanel.doLayout();
  1448. };
  1449. },
  1450. failure: failureAJAXFunction
  1451. });
  1452. };
  1453. function showSettingsServer(){
  1454. stopStatusUpdater();
  1455. if( contentView.l[3] == undefined ){
  1456. contentView.l[3] = {v:0,p:''};
  1457. };
  1458. Ext.Ajax.request({
  1459. url: '/lib/controller/getServerSettings.php',
  1460. params: {
  1461. UID: <?=$UserID;?>,
  1462. TYP: contentView.l[3].v,
  1463. SID: '<?=$Session;?>',
  1464. },
  1465. success: function( response, opts ){
  1466. var tData = Ext.decode(response.responseText);
  1467. var tPanel = Ext.getCmp('main_content');
  1468. tPanel.removeAll( true );
  1469. tPanel.add(Ext.decode(tData.content));
  1470. tPanel.doLayout();
  1471. if( contentView.l[3].v == 0 ) serverStatusUpdater();
  1472. },
  1473. failure: failureAJAXFunction
  1474. });
  1475. };
  1476. function showSettingsInfrastructure(){
  1477. stopStatusUpdater();
  1478. if( contentView.l[3] == undefined ){
  1479. contentView.l[3] = {v:0,p:''};
  1480. };
  1481. var tPanel = Ext.getCmp('main_content');
  1482. tPanel.removeAll( true );
  1483. tPanel.add({
  1484. xtype: 'tabpanel',
  1485. frame: false,
  1486. id: 'node_settings_content',
  1487. border: false,
  1488. activeTab: contentView.l[3].v,
  1489. listeners:{
  1490. tabchange: function( tp, t ){
  1491. switch( t.getId() ){
  1492. case 'lines_tab': {
  1493. stopStatusUpdater();
  1494. loadMetroLines( SelectedLine );
  1495. break;
  1496. };
  1497. case 'stations_tab': {
  1498. stopStatusUpdater();
  1499. loadMetroStations( SelectedLine, SelectedStation );
  1500. break;
  1501. };
  1502. case 'platform_tab':{
  1503. stopStatusUpdater();
  1504. loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  1505. break;
  1506. };
  1507. case 'modules_tab':{
  1508. stopStatusUpdater();
  1509. loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  1510. break;
  1511. };
  1512. };
  1513. }
  1514. },
  1515. items: [{
  1516. xtype: 'panel',
  1517. id: 'lines_tab',
  1518. title: "<?=$Labels->GetLabel( '_LBL_LINES_' );?>",
  1519. layout: 'hbox',
  1520. items:[{
  1521. xtype: 'panel',
  1522. id: 'lines_container',
  1523. tbar:[{
  1524. text: "<?=$Labels->GetLabel( '_SMM_ADD_LINE_' );?>",
  1525. handler: function(){}
  1526. }],
  1527. flex: 1,
  1528. height: PanelH-15,
  1529. autoScroll: 'auto',
  1530. items:[]
  1531. },{
  1532. xtype: 'panel',
  1533. id: 'line_op_small',
  1534. flex: 1,
  1535. height: PanelH-15,
  1536. layout: 'fit',
  1537. items:[{
  1538. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1539. }]
  1540. }]
  1541. },{
  1542. xtype: 'panel',
  1543. id: 'stations_tab',
  1544. disabled: (SelectedLine == 0 ),
  1545. title: "<?=$Labels->GetLabel( '_LBL_STATIONS_' );?>",
  1546. layout: 'hbox',
  1547. items:[{
  1548. xtype: 'panel',
  1549. id: 'stations_container',
  1550. tbar:[{
  1551. text: "<?=$Labels->GetLabel( '_SMM_ADD_STATION_' );?>",
  1552. handler: addMetroStation
  1553. }],
  1554. flex: 1,
  1555. height: PanelH-15,
  1556. autoScroll: 'auto',
  1557. items:[]
  1558. },{
  1559. xtype: 'panel',
  1560. id: 'station_op_small',
  1561. flex: 1,
  1562. height: PanelH-15,
  1563. layout: 'fit',
  1564. items:[{
  1565. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1566. }]
  1567. }]
  1568. },{
  1569. xtype: 'panel',
  1570. id: 'platform_tab',
  1571. disabled: (SelectedStation == 0),
  1572. title: "<?=$Labels->GetLabel( '_LBL_PLATFORMS_' );?>",
  1573. layout: 'hbox',
  1574. items:[{
  1575. xtype: 'panel',
  1576. id: 'platform_container',
  1577. tbar:[{
  1578. text: "<?=$Labels->GetLabel( '_SMM_ADD_PLATFORM_' );?>",
  1579. handler: addStationPlatform
  1580. }],
  1581. flex: 1,
  1582. height: PanelH-15,
  1583. autoScroll: 'auto',
  1584. items:[]
  1585. },{
  1586. xtype: 'panel',
  1587. id: 'platform_op_small',
  1588. flex: 1,
  1589. height: PanelH-15,
  1590. layout: 'fit',
  1591. items:[{
  1592. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1593. }]
  1594. }]
  1595. },{
  1596. xtype: 'panel',
  1597. id: 'modules_tab',
  1598. disabled: ( SelectedPlatform==0 ),
  1599. title: "<?=$Labels->GetLabel('_MODULES_');?>",
  1600. layout: 'hbox',
  1601. items:[{
  1602. xtype: 'panel',
  1603. id: 'module_container',
  1604. tbar:[{
  1605. id: 'mod_add_btn',
  1606. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1607. handler: addModule
  1608. }],
  1609. flex: 1,
  1610. height: PanelH-15,
  1611. autoScroll: 'auto',
  1612. items:[]
  1613. },{
  1614. xtype: 'panel',
  1615. id: 'module_op_small',
  1616. flex: 1,
  1617. height: PanelH-15,
  1618. layout: 'fit',
  1619. items:[{
  1620. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1621. }]
  1622. }]
  1623. }]
  1624. });
  1625. tPanel.doLayout();
  1626. oSelectedLine = 0;
  1627. loadMetroLines( SelectedLine );
  1628. };
  1629. var SNAPE_Icon = L.icon({
  1630. iconUrl: '/style/assets/cursor.png',
  1631. iconSize: [32, 32], // size of the icon
  1632. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  1633. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  1634. //shadowUrl: 'leaf-shadow.png',
  1635. //shadowSize: [50, 64], // size of the shadow
  1636. //shadowAnchor: [4, 62], // the same for the shadow
  1637. });
  1638. function updateSchemeLocation( e ){
  1639. Ext.Ajax.request({
  1640. url: '/lib/controller/doStationOperations.php',
  1641. params: {
  1642. STATION: SelectedStation,
  1643. OPID: 11,
  1644. TYPE: 0,
  1645. UID: <?=$UserID;?>,
  1646. SID: '<?=$Session;?>',
  1647. Y: e.target._latlng.lat,
  1648. X: e.target._latlng.lng
  1649. },
  1650. failure: failureAJAXFunction
  1651. });
  1652. };
  1653. function updateGisLocation( e ){
  1654. Ext.Ajax.request({
  1655. url: '/lib/controller/doStationOperations.php',
  1656. params: {
  1657. STATION: SelectedStation,
  1658. OPID: 11,
  1659. TYPE: 1,
  1660. UID: <?=$UserID;?>,
  1661. SID: '<?=$Session;?>',
  1662. LAT: e.target._latlng.lat,
  1663. LON: e.target._latlng.lng
  1664. },
  1665. failure: failureAJAXFunction
  1666. });
  1667. };
  1668. var schematic_editor = null;
  1669. function inintSchematicEditor( map_id, x, y ){
  1670. var mapLayers = [];
  1671. if( schematic_editor != null ){
  1672. schematic_editor.off();
  1673. schematic_editor.remove();
  1674. schematic_editor = null;
  1675. };
  1676. schematic_editor = L.map( map_id,{
  1677. crs: L.CRS.Simple,
  1678. attributionControl: false,
  1679. preferCanvas: true,
  1680. zoomControl: true,
  1681. center: [x,y],
  1682. zoom: 0,
  1683. minZoom: -3,
  1684. maxZoom: 0,
  1685. keyboard: false
  1686. });
  1687. var bounds = [[SCHEMATIC_SET.bounds_lx,SCHEMATIC_SET.bounds_ly], [SCHEMATIC_SET.bounds_rx,SCHEMATIC_SET.bounds_ry]];
  1688. var image = L.imageOverlay( SCHEMATIC_SET.layer_url, bounds ).addTo( schematic_editor );
  1689. L.marker([x, y], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( schematic_editor ).on('dragend', updateSchemeLocation );
  1690. };
  1691. var gis_editor = null;
  1692. function inintGisEditor( map_id, Lat, Lon ){
  1693. var mapLayers = [];
  1694. if( gis_editor != null ){
  1695. //ToDo: must be moved to Upper Menu changer
  1696. gis_editor.off();
  1697. gis_editor.remove();
  1698. gis_editor = null;
  1699. };
  1700. gis_editor = L.map( map_id,{
  1701. attributionControl: false,
  1702. preferCanvas: true,
  1703. zoomControl: true,
  1704. center: [Lat, Lon],
  1705. /*zoomControl: false,
  1706. zoom: 17,
  1707. minZoom: 17,
  1708. maxZoom: 17,*/
  1709. keyboard: false
  1710. });
  1711. gis_editor.setView([Lat, Lon], 17 );
  1712. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  1713. // attribution: MAP_SET.attribution,
  1714. // maxNativeZoom: MAP_SET.maxNativeZoom,
  1715. // maxZoom: MAP_SET.maxZoom
  1716. //});
  1717. L.tileLayer( MAP_SET.layer_url, {
  1718. attribution: MAP_SET.attribution,
  1719. attributionControl: false,
  1720. maxNativeZoom: MAP_SET.maxNativeZoom,
  1721. //minZoom: 0,
  1722. maxZoom: MAP_SET.maxZoom
  1723. }).addTo( gis_editor );
  1724. L.marker([Lat, Lon], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( gis_editor ).on('dragend', updateGisLocation );
  1725. };
  1726. function editPlatform( s_id ){
  1727. if( oSelectedPlatform ){
  1728. var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
  1729. tt.classList.remove('selected_green');
  1730. tt.classList.add('active_green');
  1731. };
  1732. var tt = document.getElementById('PLATFORM_TAG_'+s_id );
  1733. if( tt!= undefined ){
  1734. tt.classList.remove('active_green');
  1735. tt.classList.add('selected_green');
  1736. };
  1737. if( oSelectedPlatform == s_id ) return;
  1738. Ext.Ajax.request({
  1739. url: '/lib/controller/getPlatformEditor.php',
  1740. params: {
  1741. PID: s_id,
  1742. UID: <?=$UserID;?>,
  1743. SID: '<?=$Session;?>'
  1744. },
  1745. success: function( response, opts ){
  1746. var data = Ext.decode( response.responseText );
  1747. var tComp = Ext.getCmp('platform_op_small');
  1748. if( tComp!= null ){
  1749. tComp.removeAll( true );
  1750. tComp.add( data );
  1751. tComp.doLayout();
  1752. };
  1753. oSelectedPlatform = s_id;
  1754. if( SelectedPlatform != s_id ){
  1755. SelectedPlatform = s_id;
  1756. //tComp = Ext.getCmp('btn_unb_station');
  1757. //tComp.setDisabled( false );
  1758. //tComp = Ext.getCmp('btn_del_station');
  1759. //tComp.setDisabled( false );
  1760. tComp = Ext.getCmp('modules_tab');
  1761. tComp.setDisabled( false );
  1762. };
  1763. }
  1764. });
  1765. };
  1766. function editStation( s_id ){
  1767. if( oSelectedStation ){
  1768. var tt = document.getElementById('STATION_TAG_'+oSelectedStation );
  1769. tt.classList.remove('selected_green');
  1770. tt.classList.add('active_green');
  1771. };
  1772. var tt = document.getElementById('STATION_TAG_'+s_id );
  1773. if( tt!= undefined ){
  1774. tt.classList.remove('active_green');
  1775. tt.classList.add('selected_green');
  1776. };
  1777. if( oSelectedStation == s_id ) return;
  1778. Ext.Ajax.request({
  1779. url: '/lib/controller/getStationEditor.php',
  1780. params: {
  1781. CID: s_id,
  1782. UID: <?=$UserID;?>,
  1783. SID: '<?=$Session;?>'
  1784. },
  1785. success: function( response, opts ){
  1786. var data = Ext.decode( response.responseText );
  1787. var tComp = Ext.getCmp('station_op_small');
  1788. if( tComp!= null ){
  1789. tComp.removeAll( true );
  1790. tComp.add( data );
  1791. tComp.doLayout();
  1792. };
  1793. tComp = Ext.getCmp('btn_unb_station');
  1794. tComp.setDisabled( false );
  1795. tComp = Ext.getCmp('btn_del_station');
  1796. tComp.setDisabled( false );
  1797. oSelectedStation = s_id;
  1798. if( SelectedStation != s_id ){
  1799. SelectedStation = s_id;
  1800. SelectedPlatform = 0;
  1801. SelectedModule = 0;
  1802. tComp = Ext.getCmp('platform_tab');
  1803. tComp.setDisabled( false );
  1804. tComp = Ext.getCmp('modules_tab');
  1805. tComp.setDisabled( true );
  1806. };
  1807. },
  1808. failure: function(){
  1809. }
  1810. });
  1811. };
  1812. function editLine( l_id ){
  1813. if( oSelectedLine ){
  1814. var tt = document.getElementById('LINE_TAG_'+oSelectedLine );
  1815. if( tt.classList.contains('selected_blue') ){
  1816. tt.classList.remove('selected_blue');
  1817. tt.classList.add('active_blue');
  1818. };
  1819. if( tt.classList.contains('selected_gray') ){
  1820. tt.classList.remove('selected_gray');
  1821. tt.classList.add('active_gray');
  1822. };
  1823. };
  1824. var tt = document.getElementById('LINE_TAG_'+l_id );
  1825. if( tt!= undefined ){
  1826. if( tt.classList.contains('active_blue') ){
  1827. tt.classList.remove('active_blue');
  1828. tt.classList.add('selected_blue');
  1829. };
  1830. if( tt.classList.contains('active_gray') ){
  1831. tt.classList.remove('active_gray');
  1832. tt.classList.add('selected_gray');
  1833. };
  1834. };
  1835. if( oSelectedLine == l_id ) return;
  1836. Ext.Ajax.request({
  1837. url: '/lib/controller/getLineEditor.php',
  1838. params: {
  1839. LID: l_id,
  1840. UID: <?=$UserID;?>,
  1841. SID: '<?=$Session;?>'
  1842. },
  1843. success: function( response, opts ){
  1844. var data = Ext.decode( response.responseText );
  1845. var tComp = Ext.getCmp('line_op_small');
  1846. if( tComp!= null ){
  1847. tComp.removeAll( true );
  1848. tComp.add( data );
  1849. tComp.doLayout();
  1850. };
  1851. tComp = Ext.getCmp('stations_tab');
  1852. tComp.setDisabled( false );
  1853. oSelectedLine = l_id;
  1854. if( SelectedLine != l_id ){
  1855. SelectedLine = l_id;
  1856. SelectedStation = 0;
  1857. SelectedPlatform = 0;
  1858. SelectedModule = 0;
  1859. tComp = Ext.getCmp('platform_tab');
  1860. tComp.setDisabled( true );
  1861. tComp = Ext.getCmp('modules_tab');
  1862. tComp.setDisabled( true );
  1863. };
  1864. }
  1865. });
  1866. };
  1867. function editSensorHW( cid ){
  1868. SelectedSensor = cid;
  1869. Ext.Ajax.request({
  1870. url: '/lib/controller/getSensorEditor.php',
  1871. params: {
  1872. CID: SelectedSensor,
  1873. UID: <?=$UserID;?>,
  1874. SID: '<?=$Session;?>'
  1875. },
  1876. success: function( response, opts ){
  1877. var data = Ext.decode( response.responseText );
  1878. var tComp = Ext.getCmp('sens_op_small');
  1879. if( data.status == 'ok' ){
  1880. if( tComp!= null ){
  1881. var content = Ext.decode( data.content );
  1882. tComp.removeAll( true );
  1883. tComp.add( content );
  1884. tComp.doLayout();
  1885. };
  1886. } else {
  1887. if( tComp!= null ){
  1888. tComp.removeAll( true );
  1889. tComp.add( data );
  1890. tComp.doLayout();
  1891. };
  1892. };
  1893. },
  1894. failure: function(){
  1895. }
  1896. });
  1897. };
  1898. var cameraEditorContent = null;
  1899. function editCamera( cid, etyp ){
  1900. SelectedCam = cid;
  1901. switch( etyp ){
  1902. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  1903. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  1904. };
  1905. Ext.Ajax.request({
  1906. url: '/lib/controller/getCameraEditor.php',
  1907. params: {
  1908. CID: SelectedCam,
  1909. UID: <?=$UserID;?>,
  1910. SID: '<?=$Session;?>'
  1911. },
  1912. success: function( response, opts ){
  1913. var data = Ext.decode( response.responseText );
  1914. if( data.status == 'ok' ){
  1915. if( cameraEditorContent!= null ){
  1916. var content = Ext.decode( data.content );
  1917. cameraEditorContent.removeAll( true );
  1918. cameraEditorContent.add( content );
  1919. cameraEditorContent.doLayout();
  1920. };
  1921. } else {
  1922. if( cameraEditorContent!= null ){
  1923. cameraEditorContent.removeAll( true );
  1924. cameraEditorContent.add( data );
  1925. cameraEditorContent.doLayout();
  1926. };
  1927. };
  1928. },
  1929. failure: function(){
  1930. }
  1931. });
  1932. };
  1933. function showSettingsUpgrade(){
  1934. stopStatusUpdater();
  1935. content_lvl1 = 1;
  1936. content_lvl2 = 4;
  1937. var tPanel = Ext.getCmp('main_content');
  1938. tPanel.removeAll( true );
  1939. initial_md5 = '';
  1940. tPanel.add({
  1941. columnWidth: 1.0,
  1942. frame: false,
  1943. border: false,
  1944. items: [{
  1945. frame: false,
  1946. border: false,
  1947. collapsible: false,
  1948. draggable: false,
  1949. layout: 'vbox',
  1950. //layoutConfig: {
  1951. // align : 'stretch',
  1952. // pack : 'start',
  1953. //},
  1954. height: PanelH,
  1955. items:[{
  1956. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  1957. xtype: 'panel',
  1958. height: PanelH-300,
  1959. //flex: 1,
  1960. frame: true,
  1961. width: '100%',
  1962. border: false,
  1963. layout: {
  1964. type: 'table',
  1965. columns: 2,
  1966. tableAttrs: {
  1967. valign: 'top',
  1968. style: 'valign:top;width:100%;'
  1969. }
  1970. },
  1971. defaults: {
  1972. frame: true,
  1973. border: false,
  1974. height: ( PanelH-400 ) / 2,
  1975. style: 'margin: 5px;width:400px;display:block;'
  1976. },
  1977. items:[{
  1978. title: 'Current System Info',
  1979. width: '100%',
  1980. //flex: 1,
  1981. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  1982. },{
  1983. title: 'Tasks',
  1984. //width: 400,
  1985. layout: 'vbox',
  1986. items:[{
  1987. xtype: 'button',
  1988. width: '100%',
  1989. text: 'Create Database Backup',
  1990. handler: function(){
  1991. createNewTask( 2 );
  1992. }
  1993. },{
  1994. xtype: 'button',
  1995. width: '100%',
  1996. text: 'Create Full Snapeshot',
  1997. handler: function(){
  1998. createNewTask( 255 );
  1999. }
  2000. }]
  2001. },{
  2002. title: 'Archives',
  2003. height: 250,
  2004. width: '100%',
  2005. tbar:[{
  2006. text: 'Restore',
  2007. id: 'ar_restore_btn',
  2008. handler: function(){
  2009. createNewTask(1, selectedArchiveRecord.data.file_name );
  2010. }
  2011. },{
  2012. text: 'Download',
  2013. id: 'ar_download_btn',
  2014. handler: function(){
  2015. if( selectedArchiveRecord!= null ){
  2016. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2017. };
  2018. }
  2019. },{
  2020. text: 'Delete',
  2021. id: 'ar_delete_btn',
  2022. handler: function(){
  2023. createNewTask(100, selectedArchiveRecord.data.file_name );
  2024. }
  2025. }],
  2026. items:[{
  2027. xtype: 'grid',
  2028. id: 'archives_grid',
  2029. border: false,
  2030. frame: false,
  2031. autoScroll: true,
  2032. //width: '100%',
  2033. lazyRender: true,
  2034. height: 210,
  2035. ds: archives_store,
  2036. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2037. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2038. viewConfig: {
  2039. // forceFit: true
  2040. },
  2041. }]
  2042. },{
  2043. title: 'Task Status',
  2044. height: 250,
  2045. //flex: 1,
  2046. items:[{
  2047. xtype: 'spacer',
  2048. height: 4
  2049. },{
  2050. id: 'ctask_status',
  2051. border: true,
  2052. html: ''
  2053. },{
  2054. xtype: 'spacer',
  2055. height: 4
  2056. },{
  2057. xtype: 'textarea',
  2058. id: 'task_log',
  2059. height: ( PanelH-320 ) / 2 - 120,
  2060. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2061. readOnly: true,
  2062. autoScroll: true,
  2063. value: ''
  2064. },{
  2065. xtype: 'progress',
  2066. id: 'task_progress',
  2067. value: 1.0,
  2068. text: 'idle',
  2069. disabled: true
  2070. }],
  2071. tbar:[{
  2072. text: 'Cancel Task',
  2073. id: 'ch_ta_btn',
  2074. disabled: true,
  2075. handler: deleteNewTask
  2076. }]
  2077. }]
  2078. },{
  2079. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2080. xtype: 'panel',
  2081. height: 300,
  2082. //flex: 1,
  2083. frame: true,
  2084. border: false,
  2085. //layout: 'vbox',
  2086. items:[{
  2087. xtype:'button',
  2088. id: 'pickfiles',
  2089. width: '100%',
  2090. text: 'Choose File'
  2091. },{
  2092. height: 200,
  2093. xtype: 'grid',
  2094. id: 'upload_grid',
  2095. border: false,
  2096. frame: false,
  2097. mode: 'local',
  2098. lazyRender: true,
  2099. width: '100%',
  2100. autoScroll: true,
  2101. ds: uploads_store,
  2102. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2103. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2104. viewConfig: {
  2105. forceFit: true
  2106. },
  2107. bbar: [{
  2108. text: 'Clear',
  2109. width: '100%',
  2110. handler: function(){
  2111. muploader.splice();
  2112. uploads_store.removeAll();
  2113. }
  2114. }]
  2115. },{
  2116. xtype:'button',
  2117. id: 'umpalumpa',
  2118. width: '100%',
  2119. disabled: true,
  2120. text: 'Upload',
  2121. handler: function(){
  2122. if( muploader!= null ){
  2123. muploader.start();
  2124. };
  2125. }
  2126. }],
  2127. listeners:{
  2128. afterrender: function(){
  2129. muploader = new plupload.Uploader({
  2130. runtimes : 'html5,html4',
  2131. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2132. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2133. max_file_size : '1000mb',
  2134. chunk_size: '200kb',
  2135. max_retries: 3,
  2136. multi_selection: false,
  2137. max_file_count: 1,
  2138. // Fake server response here
  2139. url: '/lib/php/setup_toolkit/upload.php',
  2140. //url: "/echo/json",
  2141. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2142. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2143. filters : [
  2144. //{title : "Image files", extensions : "jpg,gif,png"},
  2145. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2146. ],
  2147. init: {
  2148. PostInit: function() {
  2149. //$('filelist').innerHTML = '';
  2150. //$('uploadfiles').onclick = function() {
  2151. // uploader.start();
  2152. // return false;
  2153. //};
  2154. },
  2155. FilesAdded: function( up, files ) {
  2156. Ext.getCmp('umpalumpa').enable();
  2157. plupload.each( files, function(file) {
  2158. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2159. uploads_store_id++;
  2160. Ext.getCmp('upload_grid').doLayout();
  2161. });
  2162. },
  2163. UploadProgress: function(up, file) {
  2164. var pb = Ext.getCmp( 'progress_'+file.id );
  2165. if( file.percent < 100 ){
  2166. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2167. } else {
  2168. pb.updateProgress( 1.0, 'Uploaded', false );
  2169. };
  2170. },
  2171. Error: function(up, err) {
  2172. Ext.Msg.show({
  2173. title:'Upload Status',
  2174. msg: "Error #" + err.code + ": " + err.message,
  2175. buttons: Ext.Msg.OK,
  2176. icon: Ext.MessageBox.ERROR
  2177. });
  2178. }
  2179. }
  2180. });
  2181. muploader.init();
  2182. }
  2183. }
  2184. }]
  2185. }]
  2186. });
  2187. muploader = null;
  2188. uploads_store.removeAll();
  2189. tPanel.doLayout();
  2190. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2191. updateTaskStatus();
  2192. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2193. };
  2194. var SelectedScadaModule = 0;
  2195. function loadSCADAModules( platform_id, suse ){
  2196. if( suse == undefined ){
  2197. suse = 0;
  2198. };
  2199. Ext.Ajax.request({
  2200. url: '/lib/controller/getScadaModules.php',
  2201. params: {
  2202. UID: <?=$UserID;?>,
  2203. SID: '<?=$Session;?>',
  2204. PID: platform_id
  2205. },
  2206. success: function( response, opts ){
  2207. var tData = Ext.decode(response.responseText);
  2208. var tPanel = Ext.getCmp('scada_container');
  2209. if( tData.status == 'ok' ){
  2210. tPanel.removeAll( true );
  2211. var res = Ext.decode( tData.modules );
  2212. tPanel.add( res );
  2213. tPanel.doLayout();
  2214. if( suse == 0 ){
  2215. var zPanel = Ext.getCmp('scada_op_small');
  2216. zPanel.removeAll( true );
  2217. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2218. zPanel.doLayout();
  2219. } else {
  2220. editScadaModule( suse );
  2221. };
  2222. } else {
  2223. tPanel.removeAll( true );
  2224. tPanel.doLayout();
  2225. var zPanel = Ext.getCmp('scada_op_small');
  2226. zPanel.removeAll( true );
  2227. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  2228. zPanel.doLayout();
  2229. };
  2230. },
  2231. failure: failureAJAXFunction
  2232. });
  2233. };
  2234. function editScadaModule( smid ){
  2235. SelectedScadaModule = smid;
  2236. Ext.Ajax.request({
  2237. url: '/lib/controller/getScadaEditor.php',
  2238. params: {
  2239. MID: SelectedScadaModule,
  2240. UID: <?=$UserID;?>,
  2241. SID: '<?=$Session;?>'
  2242. },
  2243. success: function( response, opts ){
  2244. var data = Ext.decode( response.responseText );
  2245. var tComp = Ext.getCmp('scada_op_small');
  2246. if( tComp!= null ){
  2247. tComp.removeAll( true );
  2248. tComp.add( data );
  2249. tComp.doLayout();
  2250. };
  2251. }
  2252. });
  2253. };
  2254. function loadSensorDetectionSettings( sensid ){
  2255. Ext.Ajax.request({
  2256. url: '/lib/controller/getSensorDetectionEditor.php',
  2257. params: {
  2258. UID: <?=$UserID;?>,
  2259. SID: '<?=$Session;?>',
  2260. SEN: sensid
  2261. },
  2262. success: function( response, opts ){
  2263. var data = Ext.decode( response.responseText );
  2264. var tComp = Ext.getCmp('main_content');
  2265. if( data.status == 'ok' ){
  2266. if( tComp!= null ){
  2267. var content = Ext.decode( data.content );
  2268. tComp.removeAll( true );
  2269. tComp.add( content );
  2270. tComp.doLayout();
  2271. };
  2272. } else {
  2273. if( tComp!= null ){
  2274. tComp.removeAll( true );
  2275. tComp.add( data );
  2276. tComp.doLayout();
  2277. };
  2278. };
  2279. },
  2280. failure: function(){
  2281. }
  2282. });
  2283. };
  2284. function initSettingsView(){
  2285. if( tlInterval!= null ){
  2286. window.clearInterval( tlInterval );
  2287. tlInterval = null;
  2288. timelineObj = null;
  2289. };
  2290. var tP = Ext.getCmp('left_side_menu');
  2291. //tP.doLayout();
  2292. //tP.setVisible( false );
  2293. tP.removeAll( true );
  2294. tP.add({
  2295. id: 'sme_inner',
  2296. layout:'accordion',
  2297. //height: PanelH,
  2298. frame: false,
  2299. border: false,
  2300. layoutConfig:{
  2301. animate: true//,
  2302. //activeOnTop: true
  2303. },
  2304. items:[]
  2305. });
  2306. tP.doLayout();
  2307. tP = Ext.getCmp('sme_inner');
  2308. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2309. tP.add({
  2310. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2311. layout: 'vbox',
  2312. height: 120,
  2313. pack: 'center',
  2314. align : 'strech',
  2315. collapsed: ( contentView.l[1].v != 0 ),
  2316. items:[{
  2317. xtype: 'button',
  2318. width: '100%',
  2319. id:'sys_edit',
  2320. text: "<?=$Labels->GetLabel('_SRV_SETTINGS_');?>",
  2321. enableToggle: true,
  2322. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 0 ),
  2323. allowDepress: false,
  2324. toggleGroup: '_settings',
  2325. handler: function(){
  2326. changeContent( 1, 0, '' );
  2327. changeContent( 2, 0, '' );
  2328. updateUserContent();
  2329. showSettingsServer();
  2330. }
  2331. }
  2332. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2333. ,{
  2334. xtype: 'button',
  2335. width: '100%',
  2336. id:'map_edit',
  2337. text: "<?=$Labels->GetLabel('_IFR_STRUCT_');?>",
  2338. enableToggle: true,
  2339. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 0 ),
  2340. allowDepress: false,
  2341. toggleGroup: '_settings',
  2342. handler: function(){
  2343. changeContent( 1, 0, '' );
  2344. changeContent( 2, 1, '' );
  2345. updateUserContent();
  2346. showSettingsInfrastructure();
  2347. }
  2348. }
  2349. <?php }; ?>
  2350. ]
  2351. });
  2352. <?php
  2353. }; ?>
  2354. tP.add({
  2355. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  2356. collapsed: ( contentView.l[1].v != 1 ),
  2357. items:[{
  2358. xtype:'button',
  2359. text:'<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  2360. enableToggle: true,
  2361. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 1 ),
  2362. allowDepress: false,
  2363. toggleGroup: '_settings',
  2364. width: '100%',
  2365. handler: function(){
  2366. changeContent( 1, 1, 0 );
  2367. //changeContent( 2, 0, '' ); - will do automatically
  2368. updateUserContent();
  2369. showSettingsProfile();
  2370. }
  2371. }]
  2372. });
  2373. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2374. tP.add({
  2375. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  2376. collapsed: ( contentView.l[1].v != 2 ),
  2377. items:[{
  2378. xtype: 'button',
  2379. width: '100%',
  2380. id:'adm_acc',
  2381. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  2382. enableToggle: true,
  2383. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 2 ),
  2384. allowDepress: false,
  2385. toggleGroup: '_settings',
  2386. handler: function( b, e ){
  2387. changeContent( 1, 2, 0 );
  2388. changeContent( 2, 0, '' );
  2389. updateUserContent();
  2390. loadUserEditor();
  2391. }
  2392. },{
  2393. xtype: 'button',
  2394. width: '100%',
  2395. id:'adm_acclog',
  2396. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  2397. enableToggle: true,
  2398. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 2 ),
  2399. allowDepress: false,
  2400. toggleGroup: '_settings',
  2401. handler: function( b, e ){
  2402. changeContent( 1, 2, 0 );
  2403. changeContent( 2, 1, '' );
  2404. updateUserContent();
  2405. loadAccessLog();
  2406. }
  2407. },{
  2408. xtype: 'button',
  2409. width: '100%',
  2410. id:'adm_servlog',
  2411. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  2412. enableToggle: true,
  2413. pressed: ( contentView.l[2].v == 2 && contentView.l[1].v == 2 ),
  2414. allowDepress: false,
  2415. toggleGroup: '_settings',
  2416. handler: function( b, e ){
  2417. changeContent( 1, 2, 0 );
  2418. changeContent( 2, 2, '' );
  2419. updateUserContent();
  2420. loadServerLog();
  2421. }
  2422. }]
  2423. });
  2424. <?php
  2425. };
  2426. ?>
  2427. tP.setVisible( true );
  2428. tP.doLayout();
  2429. switch( contentView.l[1].v ){
  2430. case 0:{
  2431. switch( contentView.l[2].v ){
  2432. case 0: showSettingsServer(); break;
  2433. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2434. case 1: showSettingsInfrastructure(); break;
  2435. <?php }; ?>
  2436. //case 4: showSettingsUpgrade(); break;
  2437. };
  2438. break;
  2439. };
  2440. case 1:{
  2441. switch( contentView.l[2].v ){
  2442. case 0: showSettingsProfile(); break;
  2443. };
  2444. break;
  2445. };
  2446. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2447. case 2:{
  2448. switch( contentView.l[2].v ){
  2449. case 0: loadUserEditor(); break;
  2450. case 1: loadAccessLog(); break;
  2451. case 2: loadServerLog(); break;
  2452. };
  2453. break;
  2454. };
  2455. <?php }; ?>
  2456. };
  2457. };