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.

2317 lines
63 KiB

​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
2 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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 removeModule( ID ){
  989. Ext.Msg.show({
  990. title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
  991. msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
  992. buttons: Ext.Msg.YESNOCANCEL,
  993. fn: function( btn, text ){
  994. if( btn == 'yes' ){
  995. Ext.Ajax.request({
  996. url: '/lib/controller/doModuleOperation.php',
  997. params: {
  998. OPID: 1,
  999. MID: ID,
  1000. UID: <?=$UserID;?>,
  1001. SID: '<?=$Session;?>'
  1002. },
  1003. success: function(){
  1004. //showSettings( SelectedNodeID, 2 );
  1005. loadModules();
  1006. }
  1007. });
  1008. };
  1009. },
  1010. icon: Ext.MessageBox.QUESTION
  1011. });
  1012. };
  1013. function disableServOps(){
  1014. var tC = Ext.getCmp('servopPanel01');
  1015. tC.removeClass('servopInfo_item01');
  1016. tC.addClass('servopInfo_item00');
  1017. tC.disable();
  1018. Ext.getCmp('tbtn_sop01').disable();
  1019. //tC.doLayout();
  1020. tC = Ext.getCmp('servopPanel02');
  1021. tC.removeClass('servopInfo_item11');
  1022. tC.addClass('servopInfo_item10');
  1023. tC.disable();
  1024. Ext.getCmp('tbtn_sop02').disable();
  1025. //tC.doLayout();
  1026. tC = Ext.getCmp('servopPanel03');
  1027. tC.removeClass('servopInfo_item21');
  1028. tC.addClass('servopInfo_item20');
  1029. tC.disable();
  1030. Ext.getCmp('tbtn_sop03').disable();
  1031. //tC.doLayout();
  1032. tC = Ext.getCmp('servopPanel04');
  1033. tC.removeClass('servopInfo_item31');
  1034. tC.addClass('servopInfo_item30');
  1035. tC.disable();
  1036. Ext.getCmp('tbtn_sop04').disable();
  1037. //tC.doLayout();
  1038. };
  1039. function enableServOps(){
  1040. var tC = Ext.getCmp('servopPanel01');
  1041. if( tC != undefined ){
  1042. tC.removeClass('servopInfo_item00');
  1043. tC.addClass('servopInfo_item01');
  1044. Ext.getCmp('tbtn_sop01').enable();
  1045. tC.enable();
  1046. };
  1047. //tC.doLayout();
  1048. tC = Ext.getCmp('servopPanel02');
  1049. if( tC != undefined ){
  1050. tC.removeClass('servopInfo_item10');
  1051. tC.addClass('servopInfo_item11');
  1052. tC.enable();
  1053. Ext.getCmp('tbtn_sop02').enable();
  1054. };
  1055. //tC.doLayout();
  1056. tC = Ext.getCmp('servopPanel03');
  1057. if( tC != undefined ){
  1058. tC.removeClass('servopInfo_item20');
  1059. tC.addClass('servopInfo_item21');
  1060. tC.enable();
  1061. Ext.getCmp('tbtn_sop03').enable();
  1062. };
  1063. //tC.doLayout();
  1064. tC = Ext.getCmp('servopPanel04');
  1065. if( tC != undefined ){
  1066. tC.removeClass('servopInfo_item30');
  1067. tC.addClass('servopInfo_item31');
  1068. tC.enable();
  1069. Ext.getCmp('tbtn_sop04').enable();
  1070. };
  1071. //tC.doLayout();
  1072. };
  1073. function serverStatusUpdater(){
  1074. Ext.Ajax.request({
  1075. url: '/lib/controller/getServerStatus.php',
  1076. params: {
  1077. SERVID: 1,
  1078. UID: <?=$UserID;?>,
  1079. SID: '<?=$Session;?>'
  1080. },
  1081. success: function( response, opts ){
  1082. // If the response is JSON, you have to decode it
  1083. var sps = document.getElementById("INFO_SPS");
  1084. if( sps == undefined ) return;
  1085. var data = Ext.decode(response.responseText);
  1086. if( data.status == 'ok' ){
  1087. serverIsOnLine = true;
  1088. enableServOps();
  1089. document.getElementById('HW_INFO').innerHTML = data.hw_info;
  1090. document.getElementById('OS_INFO').innerHTML = data.os_info;
  1091. document.getElementById('SW_INFO').innerHTML = data.build;
  1092. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  1093. setDonatStatus( 1, 1, data.stats.stat_mem );
  1094. setDonatStatus( 1, 2, data.stats.stat_disk );
  1095. setDonatStatus( 1, 3, data.stats.temp0 );
  1096. sps.classList.remove('setEd_infoPanel');
  1097. sps.classList.add('setEl_infoPanel');
  1098. } else {
  1099. serverIsOnLine = false;
  1100. disableServOps();
  1101. if( data.status == 'na' ){
  1102. setDonatStatus( 1, 0, -1 );
  1103. setDonatStatus( 1, 1, -1 );
  1104. setDonatStatus( 1, 2, -1 );
  1105. setDonatStatus( 1, 3, -1 );
  1106. sps.classList.remove('setEl_infoPanel');
  1107. sps.classList.add('setEd_infoPanel');
  1108. } else {
  1109. Ext.Msg.show({
  1110. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1111. msg: data.messages,
  1112. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1113. fn: function(){
  1114. },
  1115. icon: Ext.MessageBox.INFO //QUESTION
  1116. });
  1117. };
  1118. };
  1119. if( tlInterval == null ){
  1120. tlInterval = window.setInterval( serverStatusUpdater, 1200, selectedSite );
  1121. };
  1122. },
  1123. failure: failureAJAXFunction
  1124. });
  1125. };
  1126. var devUploadTimeout = null;
  1127. var devUploadID = -1;
  1128. function fetchDeviceUploadStatus(){
  1129. clearTimeout( devUploadTimeout );
  1130. if( devUploadID < 1 ) return;
  1131. Ext.Ajax.request({
  1132. url: '/lib/controller/getDeviceUploadStatus.php',
  1133. params: {
  1134. UID: <?=$UserID;?>,
  1135. SID: '<?=$Session;?>',
  1136. DID: devUploadID
  1137. },
  1138. success: function( response, opts ){
  1139. var data = Ext.decode(response.responseText);
  1140. var tT = Ext.getCmp('upp_ttext');
  1141. if( tT != undefined ){
  1142. if( data.count > 0 ){
  1143. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1144. };
  1145. if( data.current != undefined ){
  1146. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1147. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1148. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1149. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1150. } else {
  1151. Ext.getCmp('upload_progres_panel').hide();
  1152. Ext.getCmp('uploaded_grid').show();
  1153. loadModuleFiles( devUploadID );
  1154. };
  1155. };
  1156. },
  1157. failure: failureAJAXFunction
  1158. });
  1159. };
  1160. function downloadSettings(){
  1161. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1162. ReportMask.show();
  1163. const formData = new FormData();
  1164. formData.append("UID",<?=$UserID;?>);
  1165. formData.append("SID",'<?=$Session;?>');
  1166. fetch('/lib/controller/downloadSettings.php',{
  1167. method: "POST",
  1168. body: formData
  1169. })
  1170. .then(resp => resp.blob())
  1171. .then(blob => {
  1172. const url = window.URL.createObjectURL(blob);
  1173. const a = document.createElement('a');
  1174. a.style.display = 'none';
  1175. a.href = url;
  1176. var today=new Date();
  1177. var SY=1900+today.getYear();
  1178. var SMO=today.getMonth()+1;
  1179. var SD=today.getDate();
  1180. var SH = today.getHours();
  1181. var SM = today.getMinutes();
  1182. var SS = today.getSeconds();
  1183. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1184. document.body.appendChild(a);
  1185. a.click();
  1186. window.URL.revokeObjectURL(url);
  1187. ReportMask.hide();
  1188. Ext.Msg.show({
  1189. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1190. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1191. buttons: Ext.Msg.OK,
  1192. icon: Ext.MessageBox.INFO
  1193. });
  1194. })
  1195. .catch(() => {
  1196. ReportMask.hide();
  1197. Ext.Msg.show({
  1198. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1199. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1200. buttons: Ext.Msg.OK,
  1201. icon: Ext.MessageBox.ERROR
  1202. });
  1203. });
  1204. };
  1205. function addModule(){
  1206. Ext.Ajax.request({
  1207. url: '/lib/controller/getAddModuleWindow.php',
  1208. params: {
  1209. UID: <?=$UserID;?>,
  1210. SID: '<?=$Session;?>',
  1211. PID: SelectedPlatform
  1212. },
  1213. success: function( response, opts ){
  1214. var data = Ext.decode(response.responseText);
  1215. var addModuleWindow = new Ext.Window( data );
  1216. addModuleWindow.show();
  1217. },
  1218. failure: failureAJAXFunction
  1219. });
  1220. };
  1221. function addFilter(){
  1222. var addFilterWindow = new Ext.Window({
  1223. id: 'fulu_boa',
  1224. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1225. modal: true,
  1226. width: 400,
  1227. height: 300,
  1228. items:[{
  1229. xtype: 'form',
  1230. items: [{
  1231. xtype: 'combo',
  1232. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1233. id: 'flt_type',
  1234. lazyRender: true,
  1235. mode: 'local',
  1236. forceSelection: true,
  1237. triggerAction: 'all',
  1238. editable: false,
  1239. disableKeyFilter: true,
  1240. store: new Ext.data.ArrayStore({
  1241. fields: ['az_t','az_txt'],
  1242. data: [<?php
  1243. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1244. //$JIJI=$DATABASE->Query( $QS );
  1245. $OOP = array();
  1246. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1247. echo implode(',', $OOP );
  1248. ?>]
  1249. }),
  1250. valueField: 'az_t',
  1251. displayField: 'az_txt',
  1252. value: 1,
  1253. listeners:{
  1254. select: function( t, r, i ){
  1255. var n = r.data.az_t;
  1256. Ext.Ajax.request({
  1257. url: '/lib/controller/getFilterInfo.php',
  1258. params: {
  1259. FID: n,
  1260. UID: <?=$UserID;?>,
  1261. SID: '<?=$Session;?>'
  1262. },
  1263. success: function( response, opts ){
  1264. Ext.getCmp('filt_infopan').update( response.responseText );
  1265. }
  1266. });
  1267. }
  1268. }
  1269. },{
  1270. xtype: 'panel',
  1271. id: 'filt_infopan',
  1272. html: ''
  1273. }]
  1274. }],
  1275. bbar:[{
  1276. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  1277. handler: function(){
  1278. addFilterWindow.close();
  1279. }
  1280. },{
  1281. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  1282. handler: function(){
  1283. var mtyp = Ext.getCmp('flt_type').getValue();
  1284. Ext.Ajax.request({
  1285. url: '/lib/controller/addFilter.php',
  1286. params: {
  1287. SERVID: 1,
  1288. TYPE: mtyp,
  1289. UID: <?=$UserID;?>,
  1290. SID: '<?=$Session;?>'
  1291. },
  1292. success: function( response, opts ){
  1293. // If the response is JSON, you have to decode it
  1294. var data = Ext.decode(response.responseText);
  1295. if( data.status == 'ok' ){
  1296. addFilterWindow.close();
  1297. loadFilters();
  1298. } else {
  1299. Ext.Msg.show({
  1300. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1301. msg: data.message,
  1302. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1303. fn: function(){
  1304. //SettingsLidar3D.hide();
  1305. },
  1306. icon: Ext.MessageBox.INFO //QUESTION
  1307. });
  1308. }
  1309. },
  1310. failure: failureAJAXFunction
  1311. });
  1312. }
  1313. }]
  1314. });
  1315. addFilterWindow.show();
  1316. Ext.Ajax.request({
  1317. url: '/lib/controller/getFilterInfo.php',
  1318. params: {
  1319. FID: 1,
  1320. UID: <?=$UserID;?>,
  1321. SID: '<?=$Session;?>'
  1322. },
  1323. success: function( response, opts ){
  1324. Ext.getCmp('filt_infopan').update( response.responseText );
  1325. }
  1326. });
  1327. };
  1328. function showSettingsServer(){
  1329. stopStatusUpdater();
  1330. if( contentView.l[3] == undefined ){
  1331. contentView.l[3] = {v:0,p:''};
  1332. };
  1333. Ext.Ajax.request({
  1334. url: '/lib/controller/getServerSettings.php',
  1335. params: {
  1336. UID: <?=$UserID;?>,
  1337. TYP: contentView.l[3].v,
  1338. SID: '<?=$Session;?>',
  1339. },
  1340. success: function( response, opts ){
  1341. var tData = Ext.decode(response.responseText);
  1342. var tPanel = Ext.getCmp('main_content');
  1343. tPanel.removeAll( true );
  1344. tPanel.add(Ext.decode(tData.content));
  1345. tPanel.doLayout();
  1346. if( contentView.l[3].v == 0 ) serverStatusUpdater();
  1347. },
  1348. failure: failureAJAXFunction
  1349. });
  1350. };
  1351. function showSettingsInfrastructure(){
  1352. stopStatusUpdater();
  1353. if( contentView.l[3] == undefined ){
  1354. contentView.l[3] = {v:0,p:''};
  1355. };
  1356. var tPanel = Ext.getCmp('main_content');
  1357. tPanel.removeAll( true );
  1358. tPanel.add({
  1359. xtype: 'tabpanel',
  1360. frame: false,
  1361. id: 'node_settings_content',
  1362. border: false,
  1363. activeTab: contentView.l[3].v,
  1364. listeners:{
  1365. tabchange: function( tp, t ){
  1366. switch( t.getId() ){
  1367. case 'lines_tab': {
  1368. stopStatusUpdater();
  1369. loadMetroLines( SelectedLine );
  1370. break;
  1371. };
  1372. case 'stations_tab': {
  1373. stopStatusUpdater();
  1374. loadMetroStations( SelectedLine, SelectedStation );
  1375. break;
  1376. };
  1377. case 'platform_tab':{
  1378. stopStatusUpdater();
  1379. loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
  1380. break;
  1381. };
  1382. case 'modules_tab':{
  1383. stopStatusUpdater();
  1384. loadMetroPlatformModules( SelectedPlatform, SelectedModule );
  1385. break;
  1386. };
  1387. };
  1388. }
  1389. },
  1390. items: [{
  1391. xtype: 'panel',
  1392. id: 'lines_tab',
  1393. title: "<?=$Labels->GetLabel( '_LBL_LINES_' );?>",
  1394. layout: 'hbox',
  1395. items:[{
  1396. xtype: 'panel',
  1397. id: 'lines_container',
  1398. tbar:[{
  1399. text: "<?=$Labels->GetLabel( '_SMM_ADD_LINE_' );?>",
  1400. handler: function(){}
  1401. }],
  1402. flex: 1,
  1403. height: PanelH-15,
  1404. autoScroll: 'auto',
  1405. items:[]
  1406. },{
  1407. xtype: 'panel',
  1408. id: 'line_op_small',
  1409. flex: 1,
  1410. height: PanelH-15,
  1411. layout: 'fit',
  1412. items:[{
  1413. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1414. }]
  1415. }]
  1416. },{
  1417. xtype: 'panel',
  1418. id: 'stations_tab',
  1419. disabled: (SelectedLine == 0 ),
  1420. title: "<?=$Labels->GetLabel( '_LBL_STATIONS_' );?>",
  1421. layout: 'hbox',
  1422. items:[{
  1423. xtype: 'panel',
  1424. id: 'stations_container',
  1425. tbar:[{
  1426. text: "<?=$Labels->GetLabel( '_SMM_ADD_STATION_' );?>",
  1427. handler: addMetroStation
  1428. }],
  1429. flex: 1,
  1430. height: PanelH-15,
  1431. autoScroll: 'auto',
  1432. items:[]
  1433. },{
  1434. xtype: 'panel',
  1435. id: 'station_op_small',
  1436. flex: 1,
  1437. height: PanelH-15,
  1438. layout: 'fit',
  1439. items:[{
  1440. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1441. }]
  1442. }]
  1443. },{
  1444. xtype: 'panel',
  1445. id: 'platform_tab',
  1446. disabled: (SelectedStation == 0),
  1447. title: "<?=$Labels->GetLabel( '_LBL_PLATFORMS_' );?>",
  1448. layout: 'hbox',
  1449. items:[{
  1450. xtype: 'panel',
  1451. id: 'platform_container',
  1452. tbar:[{
  1453. text: "<?=$Labels->GetLabel( '_SMM_ADD_PLATFORM_' );?>",
  1454. handler: addStationPlatform
  1455. }],
  1456. flex: 1,
  1457. height: PanelH-15,
  1458. autoScroll: 'auto',
  1459. items:[]
  1460. },{
  1461. xtype: 'panel',
  1462. id: 'platform_op_small',
  1463. flex: 1,
  1464. height: PanelH-15,
  1465. layout: 'fit',
  1466. items:[{
  1467. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1468. }]
  1469. }]
  1470. },{
  1471. xtype: 'panel',
  1472. id: 'modules_tab',
  1473. disabled: ( SelectedPlatform==0 ),
  1474. title: "<?=$Labels->GetLabel('_MODULES_');?>",
  1475. layout: 'hbox',
  1476. items:[{
  1477. xtype: 'panel',
  1478. id: 'module_container',
  1479. tbar:[{
  1480. id: 'mod_add_btn',
  1481. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1482. handler: addModule
  1483. }],
  1484. flex: 1,
  1485. height: PanelH-15,
  1486. autoScroll: 'auto',
  1487. items:[]
  1488. },{
  1489. xtype: 'panel',
  1490. id: 'module_op_small',
  1491. flex: 1,
  1492. height: PanelH-15,
  1493. layout: 'fit',
  1494. items:[{
  1495. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1496. }]
  1497. }]
  1498. }]
  1499. });
  1500. tPanel.doLayout();
  1501. oSelectedLine = 0;
  1502. loadMetroLines( SelectedLine );
  1503. };
  1504. var SNAPE_Icon = L.icon({
  1505. iconUrl: '/style/assets/cursor.png',
  1506. iconSize: [32, 32], // size of the icon
  1507. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  1508. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  1509. //shadowUrl: 'leaf-shadow.png',
  1510. //shadowSize: [50, 64], // size of the shadow
  1511. //shadowAnchor: [4, 62], // the same for the shadow
  1512. });
  1513. function updateSchemeLocation( e ){
  1514. Ext.Ajax.request({
  1515. url: '/lib/controller/doStationOperations.php',
  1516. params: {
  1517. STATION: SelectedStation,
  1518. OPID: 11,
  1519. TYPE: 0,
  1520. UID: <?=$UserID;?>,
  1521. SID: '<?=$Session;?>',
  1522. Y: e.target._latlng.lat,
  1523. X: e.target._latlng.lng
  1524. },
  1525. failure: failureAJAXFunction
  1526. });
  1527. };
  1528. function updateGisLocation( e ){
  1529. Ext.Ajax.request({
  1530. url: '/lib/controller/doStationOperations.php',
  1531. params: {
  1532. STATION: SelectedStation,
  1533. OPID: 11,
  1534. TYPE: 1,
  1535. UID: <?=$UserID;?>,
  1536. SID: '<?=$Session;?>',
  1537. LAT: e.target._latlng.lat,
  1538. LON: e.target._latlng.lng
  1539. },
  1540. failure: failureAJAXFunction
  1541. });
  1542. };
  1543. var schematic_editor = null;
  1544. function inintSchematicEditor( map_id, x, y ){
  1545. var mapLayers = [];
  1546. if( schematic_editor != null ){
  1547. schematic_editor.off();
  1548. schematic_editor.remove();
  1549. schematic_editor = null;
  1550. };
  1551. schematic_editor = L.map( map_id,{
  1552. crs: L.CRS.Simple,
  1553. attributionControl: false,
  1554. preferCanvas: true,
  1555. zoomControl: true,
  1556. center: [x,y],
  1557. zoom: 0,
  1558. minZoom: -3,
  1559. maxZoom: 0,
  1560. keyboard: false
  1561. });
  1562. var bounds = [[SCHEMATIC_SET.bounds_lx,SCHEMATIC_SET.bounds_ly], [SCHEMATIC_SET.bounds_rx,SCHEMATIC_SET.bounds_ry]];
  1563. var image = L.imageOverlay( SCHEMATIC_SET.layer_url, bounds ).addTo( schematic_editor );
  1564. L.marker([x, y], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( schematic_editor ).on('dragend', updateSchemeLocation );
  1565. };
  1566. var gis_editor = null;
  1567. function inintGisEditor( map_id, Lat, Lon ){
  1568. var mapLayers = [];
  1569. if( gis_editor != null ){
  1570. //ToDo: must be moved to Upper Menu changer
  1571. gis_editor.off();
  1572. gis_editor.remove();
  1573. gis_editor = null;
  1574. };
  1575. gis_editor = L.map( map_id,{
  1576. attributionControl: false,
  1577. preferCanvas: true,
  1578. zoomControl: true,
  1579. center: [Lat, Lon],
  1580. /*zoomControl: false,
  1581. zoom: 17,
  1582. minZoom: 17,
  1583. maxZoom: 17,*/
  1584. keyboard: false
  1585. });
  1586. gis_editor.setView([Lat, Lon], 17 );
  1587. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  1588. // attribution: MAP_SET.attribution,
  1589. // maxNativeZoom: MAP_SET.maxNativeZoom,
  1590. // maxZoom: MAP_SET.maxZoom
  1591. //});
  1592. L.tileLayer( MAP_SET.layer_url, {
  1593. attribution: MAP_SET.attribution,
  1594. attributionControl: false,
  1595. maxNativeZoom: MAP_SET.maxNativeZoom,
  1596. //minZoom: 0,
  1597. maxZoom: MAP_SET.maxZoom
  1598. }).addTo( gis_editor );
  1599. L.marker([Lat, Lon], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( gis_editor ).on('dragend', updateGisLocation );
  1600. };
  1601. function editPlatform( s_id ){
  1602. if( oSelectedPlatform ){
  1603. var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
  1604. tt.classList.remove('selected_green');
  1605. tt.classList.add('active_green');
  1606. };
  1607. var tt = document.getElementById('PLATFORM_TAG_'+s_id );
  1608. if( tt!= undefined ){
  1609. tt.classList.remove('active_green');
  1610. tt.classList.add('selected_green');
  1611. };
  1612. if( oSelectedPlatform == s_id ) return;
  1613. Ext.Ajax.request({
  1614. url: '/lib/controller/getPlatformEditor.php',
  1615. params: {
  1616. PID: s_id,
  1617. UID: <?=$UserID;?>,
  1618. SID: '<?=$Session;?>'
  1619. },
  1620. success: function( response, opts ){
  1621. var data = Ext.decode( response.responseText );
  1622. var tComp = Ext.getCmp('platform_op_small');
  1623. if( tComp!= null ){
  1624. tComp.removeAll( true );
  1625. tComp.add( data );
  1626. tComp.doLayout();
  1627. };
  1628. oSelectedPlatform = s_id;
  1629. if( SelectedPlatform != s_id ){
  1630. SelectedPlatform = s_id;
  1631. //tComp = Ext.getCmp('btn_unb_station');
  1632. //tComp.setDisabled( false );
  1633. //tComp = Ext.getCmp('btn_del_station');
  1634. //tComp.setDisabled( false );
  1635. tComp = Ext.getCmp('modules_tab');
  1636. tComp.setDisabled( false );
  1637. };
  1638. }
  1639. });
  1640. };
  1641. function editStation( s_id ){
  1642. if( oSelectedStation ){
  1643. var tt = document.getElementById('STATION_TAG_'+oSelectedStation );
  1644. tt.classList.remove('selected_green');
  1645. tt.classList.add('active_green');
  1646. };
  1647. var tt = document.getElementById('STATION_TAG_'+s_id );
  1648. if( tt!= undefined ){
  1649. tt.classList.remove('active_green');
  1650. tt.classList.add('selected_green');
  1651. };
  1652. if( oSelectedStation == s_id ) return;
  1653. Ext.Ajax.request({
  1654. url: '/lib/controller/getStationEditor.php',
  1655. params: {
  1656. CID: s_id,
  1657. UID: <?=$UserID;?>,
  1658. SID: '<?=$Session;?>'
  1659. },
  1660. success: function( response, opts ){
  1661. var data = Ext.decode( response.responseText );
  1662. var tComp = Ext.getCmp('station_op_small');
  1663. if( tComp!= null ){
  1664. tComp.removeAll( true );
  1665. tComp.add( data );
  1666. tComp.doLayout();
  1667. };
  1668. tComp = Ext.getCmp('btn_unb_station');
  1669. tComp.setDisabled( false );
  1670. tComp = Ext.getCmp('btn_del_station');
  1671. tComp.setDisabled( false );
  1672. oSelectedStation = s_id;
  1673. if( SelectedStation != s_id ){
  1674. SelectedStation = s_id;
  1675. SelectedPlatform = 0;
  1676. SelectedModule = 0;
  1677. tComp = Ext.getCmp('platform_tab');
  1678. tComp.setDisabled( false );
  1679. tComp = Ext.getCmp('modules_tab');
  1680. tComp.setDisabled( true );
  1681. };
  1682. },
  1683. failure: function(){
  1684. }
  1685. });
  1686. };
  1687. function editLine( l_id ){
  1688. if( oSelectedLine ){
  1689. var tt = document.getElementById('LINE_TAG_'+oSelectedLine );
  1690. if( tt.classList.contains('selected_blue') ){
  1691. tt.classList.remove('selected_blue');
  1692. tt.classList.add('active_blue');
  1693. };
  1694. if( tt.classList.contains('selected_gray') ){
  1695. tt.classList.remove('selected_gray');
  1696. tt.classList.add('active_gray');
  1697. };
  1698. };
  1699. var tt = document.getElementById('LINE_TAG_'+l_id );
  1700. if( tt!= undefined ){
  1701. if( tt.classList.contains('active_blue') ){
  1702. tt.classList.remove('active_blue');
  1703. tt.classList.add('selected_blue');
  1704. };
  1705. if( tt.classList.contains('active_gray') ){
  1706. tt.classList.remove('active_gray');
  1707. tt.classList.add('selected_gray');
  1708. };
  1709. };
  1710. if( oSelectedLine == l_id ) return;
  1711. Ext.Ajax.request({
  1712. url: '/lib/controller/getLineEditor.php',
  1713. params: {
  1714. LID: l_id,
  1715. UID: <?=$UserID;?>,
  1716. SID: '<?=$Session;?>'
  1717. },
  1718. success: function( response, opts ){
  1719. var data = Ext.decode( response.responseText );
  1720. var tComp = Ext.getCmp('line_op_small');
  1721. if( tComp!= null ){
  1722. tComp.removeAll( true );
  1723. tComp.add( data );
  1724. tComp.doLayout();
  1725. };
  1726. tComp = Ext.getCmp('stations_tab');
  1727. tComp.setDisabled( false );
  1728. oSelectedLine = l_id;
  1729. if( SelectedLine != l_id ){
  1730. SelectedLine = l_id;
  1731. SelectedStation = 0;
  1732. SelectedPlatform = 0;
  1733. SelectedModule = 0;
  1734. tComp = Ext.getCmp('platform_tab');
  1735. tComp.setDisabled( true );
  1736. tComp = Ext.getCmp('modules_tab');
  1737. tComp.setDisabled( true );
  1738. };
  1739. }
  1740. });
  1741. };
  1742. function editSensorHW( cid ){
  1743. SelectedSensor = cid;
  1744. Ext.Ajax.request({
  1745. url: '/lib/controller/getSensorEditor.php',
  1746. params: {
  1747. CID: SelectedSensor,
  1748. UID: <?=$UserID;?>,
  1749. SID: '<?=$Session;?>'
  1750. },
  1751. success: function( response, opts ){
  1752. var data = Ext.decode( response.responseText );
  1753. var tComp = Ext.getCmp('sens_op_small');
  1754. if( data.status == 'ok' ){
  1755. if( tComp!= null ){
  1756. var content = Ext.decode( data.content );
  1757. tComp.removeAll( true );
  1758. tComp.add( content );
  1759. tComp.doLayout();
  1760. };
  1761. } else {
  1762. if( tComp!= null ){
  1763. tComp.removeAll( true );
  1764. tComp.add( data );
  1765. tComp.doLayout();
  1766. };
  1767. };
  1768. },
  1769. failure: function(){
  1770. }
  1771. });
  1772. };
  1773. var cameraEditorContent = null;
  1774. function editCamera( cid, etyp ){
  1775. SelectedCam = cid;
  1776. switch( etyp ){
  1777. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  1778. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  1779. };
  1780. Ext.Ajax.request({
  1781. url: '/lib/controller/getCameraEditor.php',
  1782. params: {
  1783. CID: SelectedCam,
  1784. UID: <?=$UserID;?>,
  1785. SID: '<?=$Session;?>'
  1786. },
  1787. success: function( response, opts ){
  1788. var data = Ext.decode( response.responseText );
  1789. if( data.status == 'ok' ){
  1790. if( cameraEditorContent!= null ){
  1791. var content = Ext.decode( data.content );
  1792. cameraEditorContent.removeAll( true );
  1793. cameraEditorContent.add( content );
  1794. cameraEditorContent.doLayout();
  1795. };
  1796. } else {
  1797. if( cameraEditorContent!= null ){
  1798. cameraEditorContent.removeAll( true );
  1799. cameraEditorContent.add( data );
  1800. cameraEditorContent.doLayout();
  1801. };
  1802. };
  1803. },
  1804. failure: function(){
  1805. }
  1806. });
  1807. };
  1808. function showSettingsUpgrade(){
  1809. stopStatusUpdater();
  1810. content_lvl1 = 1;
  1811. content_lvl2 = 4;
  1812. var tPanel = Ext.getCmp('main_content');
  1813. tPanel.removeAll( true );
  1814. initial_md5 = '';
  1815. tPanel.add({
  1816. columnWidth: 1.0,
  1817. frame: false,
  1818. border: false,
  1819. items: [{
  1820. frame: false,
  1821. border: false,
  1822. collapsible: false,
  1823. draggable: false,
  1824. layout: 'vbox',
  1825. //layoutConfig: {
  1826. // align : 'stretch',
  1827. // pack : 'start',
  1828. //},
  1829. height: PanelH,
  1830. items:[{
  1831. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  1832. xtype: 'panel',
  1833. height: PanelH-300,
  1834. //flex: 1,
  1835. frame: true,
  1836. width: '100%',
  1837. border: false,
  1838. layout: {
  1839. type: 'table',
  1840. columns: 2,
  1841. tableAttrs: {
  1842. valign: 'top',
  1843. style: 'valign:top;width:100%;'
  1844. }
  1845. },
  1846. defaults: {
  1847. frame: true,
  1848. border: false,
  1849. height: ( PanelH-400 ) / 2,
  1850. style: 'margin: 5px;width:400px;display:block;'
  1851. },
  1852. items:[{
  1853. title: 'Current System Info',
  1854. width: '100%',
  1855. //flex: 1,
  1856. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  1857. },{
  1858. title: 'Tasks',
  1859. //width: 400,
  1860. layout: 'vbox',
  1861. items:[{
  1862. xtype: 'button',
  1863. width: '100%',
  1864. text: 'Create Database Backup',
  1865. handler: function(){
  1866. createNewTask( 2 );
  1867. }
  1868. },{
  1869. xtype: 'button',
  1870. width: '100%',
  1871. text: 'Create Full Snapeshot',
  1872. handler: function(){
  1873. createNewTask( 255 );
  1874. }
  1875. }]
  1876. },{
  1877. title: 'Archives',
  1878. height: 250,
  1879. width: '100%',
  1880. tbar:[{
  1881. text: 'Restore',
  1882. id: 'ar_restore_btn',
  1883. handler: function(){
  1884. createNewTask(1, selectedArchiveRecord.data.file_name );
  1885. }
  1886. },{
  1887. text: 'Download',
  1888. id: 'ar_download_btn',
  1889. handler: function(){
  1890. if( selectedArchiveRecord!= null ){
  1891. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  1892. };
  1893. }
  1894. },{
  1895. text: 'Delete',
  1896. id: 'ar_delete_btn',
  1897. handler: function(){
  1898. createNewTask(100, selectedArchiveRecord.data.file_name );
  1899. }
  1900. }],
  1901. items:[{
  1902. xtype: 'grid',
  1903. id: 'archives_grid',
  1904. border: false,
  1905. frame: false,
  1906. autoScroll: true,
  1907. //width: '100%',
  1908. lazyRender: true,
  1909. height: 210,
  1910. ds: archives_store,
  1911. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  1912. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  1913. viewConfig: {
  1914. // forceFit: true
  1915. },
  1916. }]
  1917. },{
  1918. title: 'Task Status',
  1919. height: 250,
  1920. //flex: 1,
  1921. items:[{
  1922. xtype: 'spacer',
  1923. height: 4
  1924. },{
  1925. id: 'ctask_status',
  1926. border: true,
  1927. html: ''
  1928. },{
  1929. xtype: 'spacer',
  1930. height: 4
  1931. },{
  1932. xtype: 'textarea',
  1933. id: 'task_log',
  1934. height: ( PanelH-320 ) / 2 - 120,
  1935. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  1936. readOnly: true,
  1937. autoScroll: true,
  1938. value: ''
  1939. },{
  1940. xtype: 'progress',
  1941. id: 'task_progress',
  1942. value: 1.0,
  1943. text: 'idle',
  1944. disabled: true
  1945. }],
  1946. tbar:[{
  1947. text: 'Cancel Task',
  1948. id: 'ch_ta_btn',
  1949. disabled: true,
  1950. handler: deleteNewTask
  1951. }]
  1952. }]
  1953. },{
  1954. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  1955. xtype: 'panel',
  1956. height: 300,
  1957. //flex: 1,
  1958. frame: true,
  1959. border: false,
  1960. //layout: 'vbox',
  1961. items:[{
  1962. xtype:'button',
  1963. id: 'pickfiles',
  1964. width: '100%',
  1965. text: 'Choose File'
  1966. },{
  1967. height: 200,
  1968. xtype: 'grid',
  1969. id: 'upload_grid',
  1970. border: false,
  1971. frame: false,
  1972. mode: 'local',
  1973. lazyRender: true,
  1974. width: '100%',
  1975. autoScroll: true,
  1976. ds: uploads_store,
  1977. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  1978. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  1979. viewConfig: {
  1980. forceFit: true
  1981. },
  1982. bbar: [{
  1983. text: 'Clear',
  1984. width: '100%',
  1985. handler: function(){
  1986. muploader.splice();
  1987. uploads_store.removeAll();
  1988. }
  1989. }]
  1990. },{
  1991. xtype:'button',
  1992. id: 'umpalumpa',
  1993. width: '100%',
  1994. disabled: true,
  1995. text: 'Upload',
  1996. handler: function(){
  1997. if( muploader!= null ){
  1998. muploader.start();
  1999. };
  2000. }
  2001. }],
  2002. listeners:{
  2003. afterrender: function(){
  2004. muploader = new plupload.Uploader({
  2005. runtimes : 'html5,html4',
  2006. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2007. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2008. max_file_size : '1000mb',
  2009. chunk_size: '200kb',
  2010. max_retries: 3,
  2011. multi_selection: false,
  2012. max_file_count: 1,
  2013. // Fake server response here
  2014. url: '/lib/php/setup_toolkit/upload.php',
  2015. //url: "/echo/json",
  2016. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2017. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2018. filters : [
  2019. //{title : "Image files", extensions : "jpg,gif,png"},
  2020. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2021. ],
  2022. init: {
  2023. PostInit: function() {
  2024. //$('filelist').innerHTML = '';
  2025. //$('uploadfiles').onclick = function() {
  2026. // uploader.start();
  2027. // return false;
  2028. //};
  2029. },
  2030. FilesAdded: function( up, files ) {
  2031. Ext.getCmp('umpalumpa').enable();
  2032. plupload.each( files, function(file) {
  2033. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2034. uploads_store_id++;
  2035. Ext.getCmp('upload_grid').doLayout();
  2036. });
  2037. },
  2038. UploadProgress: function(up, file) {
  2039. var pb = Ext.getCmp( 'progress_'+file.id );
  2040. if( file.percent < 100 ){
  2041. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2042. } else {
  2043. pb.updateProgress( 1.0, 'Uploaded', false );
  2044. };
  2045. },
  2046. Error: function(up, err) {
  2047. Ext.Msg.show({
  2048. title:'Upload Status',
  2049. msg: "Error #" + err.code + ": " + err.message,
  2050. buttons: Ext.Msg.OK,
  2051. icon: Ext.MessageBox.ERROR
  2052. });
  2053. }
  2054. }
  2055. });
  2056. muploader.init();
  2057. }
  2058. }
  2059. }]
  2060. }]
  2061. });
  2062. muploader = null;
  2063. uploads_store.removeAll();
  2064. tPanel.doLayout();
  2065. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2066. updateTaskStatus();
  2067. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2068. };
  2069. function loadSensorDetectionSettings( sensid ){
  2070. Ext.Ajax.request({
  2071. url: '/lib/controller/getSensorDetectionEditor.php',
  2072. params: {
  2073. UID: <?=$UserID;?>,
  2074. SID: '<?=$Session;?>',
  2075. SEN: sensid
  2076. },
  2077. success: function( response, opts ){
  2078. var data = Ext.decode( response.responseText );
  2079. var tComp = Ext.getCmp('main_content');
  2080. if( data.status == 'ok' ){
  2081. if( tComp!= null ){
  2082. var content = Ext.decode( data.content );
  2083. tComp.removeAll( true );
  2084. tComp.add( content );
  2085. tComp.doLayout();
  2086. };
  2087. } else {
  2088. if( tComp!= null ){
  2089. tComp.removeAll( true );
  2090. tComp.add( data );
  2091. tComp.doLayout();
  2092. };
  2093. };
  2094. },
  2095. failure: function(){
  2096. }
  2097. });
  2098. };
  2099. function initSettingsView(){
  2100. if( tlInterval!= null ){
  2101. window.clearInterval( tlInterval );
  2102. tlInterval = null;
  2103. timelineObj = null;
  2104. };
  2105. var tP = Ext.getCmp('left_side_menu');
  2106. //tP.doLayout();
  2107. //tP.setVisible( false );
  2108. tP.removeAll( true );
  2109. tP.add({
  2110. id: 'sme_inner',
  2111. layout:'accordion',
  2112. //height: PanelH,
  2113. frame: false,
  2114. border: false,
  2115. layoutConfig:{
  2116. animate: true//,
  2117. //activeOnTop: true
  2118. },
  2119. items:[]
  2120. });
  2121. tP.doLayout();
  2122. tP = Ext.getCmp('sme_inner');
  2123. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2124. tP.add({
  2125. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2126. layout: 'vbox',
  2127. height: 120,
  2128. pack: 'center',
  2129. align : 'strech',
  2130. collapsed: ( contentView.l[1].v != 0 ),
  2131. items:[{
  2132. xtype: 'button',
  2133. width: '100%',
  2134. id:'sys_edit',
  2135. text: "<?=$Labels->GetLabel('_SRV_SETTINGS_');?>",
  2136. enableToggle: true,
  2137. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 0 ),
  2138. allowDepress: false,
  2139. toggleGroup: 'sys_settings',
  2140. handler: function(){
  2141. changeContent( 2, 0, '' );
  2142. updateUserContent();
  2143. showSettingsServer();
  2144. }
  2145. }
  2146. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2147. ,{
  2148. xtype: 'button',
  2149. width: '100%',
  2150. id:'map_edit',
  2151. text: "<?=$Labels->GetLabel('_IFR_STRUCT_');?>",
  2152. enableToggle: true,
  2153. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 0 ),
  2154. allowDepress: false,
  2155. toggleGroup: 'sys_settings',
  2156. handler: function(){
  2157. changeContent( 2, 1, '' );
  2158. updateUserContent();
  2159. showSettingsInfrastructure();
  2160. }
  2161. }
  2162. <?php }; ?>
  2163. ]
  2164. });
  2165. <?php
  2166. }; ?>
  2167. tP.add({
  2168. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  2169. items:[<?php
  2170. $ZIGA = array();
  2171. foreach( $Site_Languages as $SL ){
  2172. if( $SL['id'] == $CUser->Data['language'] ){
  2173. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  2174. } else {
  2175. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  2176. };
  2177. };
  2178. echo implode(',',$ZIGA );
  2179. ?>]
  2180. });
  2181. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2182. tP.add({
  2183. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  2184. collapsed: ( contentView.l[1].v != 3 ),
  2185. items:[{
  2186. xtype: 'button',
  2187. width: '100%',
  2188. id:'adm_acc',
  2189. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  2190. enableToggle: true,
  2191. pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 3 ),
  2192. allowDepress: false,
  2193. toggleGroup: 'adm_settings',
  2194. handler: function( b, e ){
  2195. loadUserEditor();
  2196. }
  2197. },{
  2198. xtype: 'button',
  2199. width: '100%',
  2200. id:'adm_acclog',
  2201. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  2202. enableToggle: true,
  2203. pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 3 ),
  2204. allowDepress: false,
  2205. toggleGroup: 'adm_settings',
  2206. handler: function( b, e ){
  2207. loadAccessLog();
  2208. }
  2209. },{
  2210. xtype: 'button',
  2211. width: '100%',
  2212. id:'adm_servlog',
  2213. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  2214. enableToggle: true,
  2215. pressed: ( contentView.l[2].v == 2 && contentView.l[1].v == 3 ),
  2216. allowDepress: false,
  2217. toggleGroup: 'adm_settings',
  2218. handler: function( b, e ){
  2219. loadServerLog();
  2220. }
  2221. }]
  2222. });
  2223. <?php
  2224. };
  2225. ?>
  2226. tP.setVisible( true );
  2227. tP.doLayout();
  2228. switch( contentView.l[1].v ){
  2229. default:{
  2230. switch( contentView.l[2].v ){
  2231. default: showSettingsServer(); break;
  2232. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2233. case 1: showSettingsInfrastructure(); break;
  2234. <?php }; ?>
  2235. //case 4: showSettingsUpgrade(); break;
  2236. };
  2237. };
  2238. case 1:{
  2239. switch( contentView.l[2].v ){
  2240. case 0: break;
  2241. };
  2242. break;
  2243. };
  2244. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2245. case 3:{
  2246. switch( contentView.l[2].v ){
  2247. case 0: loadUserEditor(); break;
  2248. };
  2249. break;
  2250. };
  2251. <?php }; ?>
  2252. };
  2253. };