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.

345 lines
15 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
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/argus/server.php');
  4. if( $CUser->Data['id'] > 1 ){
  5. $EID = intval( $_POST['PID'] );
  6. $QS = "SELECT * FROM `metro_platforms` WHERE `id`={$EID}";
  7. $Result = $DATABASE->Query( $QS, false );
  8. if( count( $Result ) ){
  9. $CR = $Result[0];
  10. $TTPL=<<<JOJOKA
  11. {
  12. xtype: 'panel',
  13. border: false,
  14. frame: false,
  15. tbar:[{
  16. id: 'btn_del_platform',
  17. text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}',
  18. handler: function(){
  19. Ext.Msg.show({
  20. title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
  21. msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
  22. buttons: Ext.Msg.OKCANCEL,
  23. fn: function(btn){
  24. if( btn == 'ok' ){
  25. SelectedPlatform = 0;
  26. oSelectedPlatform = 0;
  27. doPlatformOperation( {$CR['id']}, 200, '', true );
  28. };
  29. },
  30. icon: Ext.MessageBox.QUESTION
  31. });
  32. }
  33. }],
  34. items:[%%%ITEMS%%%]
  35. }
  36. JOJOKA;
  37. $ITEMS = array();
  38. $QS = "SELECT count(`id`) cnt FROM `metro_tracks` WHERE `platform_id`={$EID}";
  39. $Rt = $DATABASE->Query( $QS, false );
  40. $TCO = $Rt[0]['cnt'];
  41. $NAME =$CR['name'] .'<br/>';
  42. $PINFO = getPlatformInfo( $CR['id'] );
  43. $QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CR['id']} ORDER BY `side` ASC";
  44. $TI = $DATABASE->Query( $QS, false );
  45. $TRACKS = '';
  46. if( count( $TI ) ){
  47. $COS = count( $PINFO['PREV'] );
  48. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  49. $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[0]['short']}</td>";
  50. $TRACKS = "{ xtype: 'form', border: false, frame: false, labelWidth: 150,labelAlign: 'right',margins: {top:10, right:10, bottom:10, left:10},padding:8,labelAlign:'right', items:[{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',html: '".$Labels->GetLabel('_UPPR_TRACK_')."'},{ xtype: 'textfield', fieldLabel:'Name', value: '{$TI[0]['name']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 8, c, true );}}},{ xtype: 'textfield', fieldLabel:'Abbreviation', value: '{$TI[0]['short']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 9, c, true );}}}]}";
  51. if( count( $TI ) > 1 ){
  52. $COS = count( $PINFO['NEXT'] );
  53. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  54. $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[1]['short']}</td>";
  55. $TRACKS .= ",{ xtype: 'form', border: false, frame: false, labelWidth: 150,labelAlign: 'right',margins: {top:10, right:10, bottom:10, left:10},padding:8, labelAlign:'right', items:[{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',html: '".$Labels->GetLabel('_BTOM_TRACK_')."'},{ xtype: 'textfield', fieldLabel:'Name', value: '{$TI[1]['name']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 10, c, true );}}},{ xtype: 'textfield', fieldLabel:'Abbreviation', value: '{$TI[1]['short']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 11, c, true );}}}]}";
  56. };
  57. } else {
  58. $COS = count( $PINFO['PREV'] );
  59. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  60. $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
  61. $COS = count( $PINFO['NEXT'] );
  62. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  63. $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
  64. };
  65. $INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_SMM_PAT_LEVEL_').':</td><td><div class="level_label">'.$CR['level'].'</div></td><!--/tr><tr--><td width="130px" align="right">'.$Labels->GetLabel('_LBL_TRACKS_').':</td><td>'.$TCO.'</td><!--/tr><tr--><td align="right">'.$Labels->GetLabel('_MODULES_').':</td><td>'. ( $TCO * 2 ) .'</td></tr></table>';
  66. $QS = "SELECT `sl`.`line_id`, `ln`.`short`,`ln`.`color`,`ln`.`name`,`sl`.`index` FROM `metro_lines` `ln` LEFT JOIN `metro_stations_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`station_id`={$CR['station_id']} ORDER BY `ln`.`short`";
  67. $Sz = $DATABASE->Query( $QS, false );
  68. if( count( $Sz ) ){
  69. $LINE_COLORS = array();
  70. $QS = "SELECT `ln`.`short`,`ln`.`color` FROM `metro_lines` `ln` LEFT JOIN `metro_platforms_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`platform_id`={$EID} ORDER BY `ln`.`short`";
  71. $Rz = $DATABASE->Query( $QS, false );
  72. if( count( $Rz ) ){
  73. $LINES='<table><tr>';
  74. foreach( $Rz as $Z ){
  75. $LINE_COLORS[$Z['short']] = '#'.$Z['color'];
  76. $LINES.="<td><div style=\"border-radius:16px;width:32px;height:32px;background-color:#{$Z['color']};color:#fff;font-size:16px;padding-left:10px;padding-top:6px;\">{$Z['short']}</div></td>";
  77. };
  78. $LINES.='</tr></table>';
  79. };
  80. $ROUTING = "{ xtype:'panel', width: '100%', layout: 'table', defaults: {margins: {top:10, right:10, bottom:10, left:10},padding:8},baseCls: 'x-plain', layoutConfig: {columns: 2},frame: false,border: false, height: PanelH - 500, items:[{xtype:'panel',border:false,frame:false,colspan:2,html:'{$Labels->GetLabel('_SMM_MET_ROUTE_')}'}";
  81. foreach( $Sz as $Z ){
  82. $AS = 'false';
  83. for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){
  84. if( $Z['line_id'] == $PINFO[$idx]['id'] ){
  85. $AS = 'true';
  86. break;
  87. };
  88. };
  89. //
  90. $ROUTING .=",{xtype:'panel',width:70, height:60,border:false,frame:false,style:{float:'right'},html: '<div style=\"border-radius:16px;width:32px;height:32px;background-color:#{$Z['color']};color:#fff;font-size:16px;padding-left:10px;padding-top:6px;\">{$Z['short']}</div>'},{ xtype: 'button',enableToggle:true,pressed:{$AS},text:'{$Labels->GetLabel('_ACTIVE_')}',handler:function(b,e){if(b.pressed){ doPlatformOperation({$CR['id']},3,{$Z['line_id']},true);}else{doPlatformOperation({$CR['id']},4,{$Z['line_id']},true);};}}";
  91. };
  92. $ROUTING .= "]}";
  93. } else {
  94. $ROUTING = "{xtype:'spacer',height: PanelH - 500}";
  95. };
  96. $TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
  97. if( $PINFO['PREV_IS_MULTI'] ){
  98. foreach( $PINFO['PREV'] as $P ){
  99. $TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['PREV'][0]['bg_style']}\"><tr><td class=\"ar_to_left\">&nbsp;</td><td align=\"left\">{$P['name']}</td></tr></table></td></tr>";
  100. }
  101. } else {
  102. if( count( $PINFO['PREV'] )){
  103. $TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['PREV'][0]['bg_style']}\"><tr><td class=\"ar_to_left\">&nbsp;</td><td align=\"left\">{$PINFO['PREV'][0]['name']}</td></tr></table></td></tr>";
  104. } else {
  105. $TOP .="<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000;\"><tr><td class=\"ar_to_left\">&nbsp;</td><td align=\"left\">{$Labels->GetLabel('_SMM_NO_NESTA_')}</td></tr></table></td></tr>";
  106. };
  107. };
  108. $TOP .="</table></td>{$TRU}</tr></table></td>";
  109. $BOTTOM ="<td><table width=\"100%\" border=0><tr>{$TRB}<td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
  110. if( $PINFO['NEXT_IS_MULTI'] ){
  111. foreach( $PINFO['NEXT'] as $P ){
  112. $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$P['bg_style']}\"><tr><td align=\"right\">{$P['name']}</td><td class=\"ar_to_right\">&nbsp;</td></tr></table></td></tr>";
  113. }
  114. } else {
  115. if( count( $PINFO['NEXT'] )){
  116. $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['NEXT'][0]['bg_style']}\"><tr><td align=\"right\">{$PINFO['NEXT'][0]['name']}</td><td class=\"ar_to_right\">&nbsp;</td></tr></table></td></tr>";
  117. } else {
  118. $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000;\"><tr><td align=\"right\">{$Labels->GetLabel('_SMM_NO_NESTA_')}</td><td class=\"ar_to_right\">&nbsp;</td></tr></table></td></tr>";
  119. };
  120. };
  121. $BOTTOM .="</table></td></tr></table></td>";
  122. $ITEMS[0]="{ xtype:'panel', border: false, frame: false, html: '<table border=0 width=\"100%\" class=\"setEd_infoPanel\" id=\"SENSOR_N\"><tr><td valign=\"middle\" width=\"100%\" align=\"left\" colspan=3 style=\"padding-left:30px;font-size: 22px; font-weight: bold;\">{$NAME}</td></tr><tr><td colspan=3>{$INFO}</td></tr><tr><td></td>{$TOP}<td></td></tr><tr><td>&nbsp;</td><td width=\"100%\">".createPlatformAnimation( $CR['layout'], array(), $LINE_COLORS )."</td><td>&nbsp;</td></tr><tr><td></td>{$BOTTOM}<td></td></tr></table>'}";
  123. $ED =<<<kokakskhkajhskr
  124. {
  125. xtype: 'tabpanel',
  126. border: false,
  127. frame: false,
  128. height: PanelH - 283,
  129. activeTab: 0,
  130. listeners:{
  131. tabchange: function( tp, t ){
  132. switch( t.getId() ){
  133. case 'scada_tab': {
  134. loadSCADAModules( SelectedPlatform );
  135. break;
  136. };
  137. };
  138. }
  139. },
  140. items:[{
  141. xtype: 'panel',
  142. title: '{$Labels->GetLabel('_GENERAL_')}',
  143. items: [{
  144. xtype: 'panel',
  145. layout: 'table',
  146. border: false,
  147. frame: false,
  148. width: '100%',
  149. wdefaults: { bodyStyle:'padding:10px; text-align: center;'},
  150. layoutConfig: { columns: 2 },
  151. items:[{
  152. xtype: 'form',
  153. height: PanelH - 500,
  154. labelWidth: 150,
  155. labelAlign: 'right',
  156. border: false,
  157. frame: false,
  158. margins: {top:10, right:10, bottom:10, left:10},
  159. padding:8,
  160. items: [{
  161. xtype: 'combo',
  162. id: 'sens_se',
  163. fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
  164. lazyRender: true,
  165. mode: 'local',
  166. forceSelection: true,
  167. triggerAction: 'all',
  168. editable: false,
  169. disableKeyFilter: true,
  170. store: new Ext.data.ArrayStore({
  171. fields: ['mode','mode_txt'],
  172. data: [
  173. ['D','{$Labels->GetLabel('__DISABLED__')}'],
  174. ['E','{$Labels->GetLabel('___ENABLED__')}']
  175. ]
  176. }),
  177. valueField: 'mode',
  178. displayField: 'mode_txt',
  179. value: '{$CR['status']}',
  180. width: 200,
  181. listeners:{
  182. select: function( a, c, b ){
  183. doPlatformOperation( {$CR['id']}, 2, b, true );
  184. }
  185. }
  186. },{
  187. xtype: 'textfield',
  188. id: 'plt_name',
  189. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
  190. maxlength: 64,
  191. value: '{$CR['name']}',
  192. listeners:{
  193. change: function( a, c, b ){
  194. doPlatformOperation( {$CR['id']}, 6, c, true );
  195. }
  196. }
  197. },{
  198. xtype: 'textfield',
  199. id: 'plt_lvl',
  200. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
  201. maxlength: 2,
  202. value: '{$CR['level']}',
  203. listeners:{
  204. change: function( a, c, b ){
  205. doPlatformOperation( {$CR['id']}, 7, c, true );
  206. }
  207. }
  208. },{
  209. xtype: 'textfield',
  210. id: 'plt_lsname',
  211. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LSNAME_')}',
  212. maxlength: 2,
  213. value: '{$CR['left_side']}',
  214. listeners:{
  215. change: function( a, c, b ){
  216. doPlatformOperation( {$CR['id']}, 25, c, true );
  217. }
  218. }
  219. },{
  220. xtype: 'textfield',
  221. id: 'plt_rsname',
  222. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_RSNAME_')}',
  223. maxlength: 2,
  224. value: '{$CR['right_side']}',
  225. listeners:{
  226. change: function( a, c, b ){
  227. doPlatformOperation( {$CR['id']}, 26, c, true );
  228. }
  229. }
  230. },{
  231. xtype: 'combo',
  232. fieldLabel: "Platform Type",
  233. id: 'pl_lay_A',
  234. width: 200,
  235. lazyRender: true,
  236. mode: 'local',
  237. forceSelection: true,
  238. triggerAction: 'all',
  239. editable: false,
  240. readOnly: false,
  241. disableKeyFilter: true,
  242. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  243. store: new Ext.data.ArrayStore({
  244. fields: ['abbr','name','icon'],
  245. 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']]
  246. }),
  247. valueField: 'abbr',
  248. displayField: 'name',
  249. value: '{$CR['layout']}',
  250. init_value: '{$CR['layout']}',
  251. listeners:{
  252. select: function( t, r, i ){
  253. if( r.data.abbr < 'C' && t.init_value > 'B' ){
  254. Ext.Msg.show({
  255. title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
  256. msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
  257. buttons: Ext.Msg.OKCANCEL,
  258. fn: function(btn){
  259. if( btn == 'ok' ){
  260. doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
  261. } else {
  262. t.suspendEvents();
  263. t.setValue( t.init_value, true );
  264. t.resumeEvents();
  265. t.getEl().setStyle({
  266. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.init_value )].data.icon + ')',
  267. 'background-repeat': 'no-repeat',
  268. 'background-position': '3px center',
  269. 'background-size': '16px 16px',
  270. 'padding-left': '25px'
  271. });
  272. };
  273. },
  274. icon: Ext.MessageBox.QUESTION
  275. });
  276. } else {
  277. t.getEl().setStyle({
  278. 'background-image': 'url(' + r.data.icon + ')',
  279. 'background-repeat': 'no-repeat',
  280. 'background-position': '3px center',
  281. 'background-size': '16px 16px',
  282. 'padding-left': '25px'
  283. });
  284. doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
  285. };
  286. },
  287. afterrender: function( t ){
  288. t.getEl().setStyle({
  289. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  290. 'background-repeat': 'no-repeat',
  291. 'background-position': '3px center',
  292. 'background-size': '16px 16px',
  293. 'padding-left': '25px'
  294. });
  295. }
  296. }
  297. }]
  298. },{$ROUTING}]
  299. }]
  300. },{
  301. xtype: 'panel',
  302. title: '{$Labels->GetLabel('_LBL_TRACKS_')}',
  303. items: [{$TRACKS}]
  304. },{
  305. xtype: 'panel',
  306. id: 'scada_tab',
  307. title: '{$Labels->GetLabel('_LBL_SCADA_')}',
  308. layout: 'hbox',
  309. items: [{
  310. xtype: 'panel',
  311. width: '40%',
  312. id: 'scada_container',
  313. tbar:[{
  314. text: "{$Labels->GetLabel( '_ADD_' )}",
  315. handler: addScadaModule
  316. }],
  317. flex: 1,
  318. height: PanelH-15,
  319. autoScroll: 'auto',
  320. items:[]
  321. },{
  322. xtype: 'panel',
  323. id: 'scada_op_small',
  324. flex: 1,
  325. height: PanelH-15,
  326. layout: 'fit',
  327. items:[{
  328. html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>"
  329. }]
  330. }]
  331. }],
  332. }
  333. kokakskhkajhskr;
  334. $ITEMS[1] = $ED;
  335. $CONTENT = implode(',',$ITEMS);
  336. $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
  337. echo $TTPL;
  338. } else {
  339. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  340. };
  341. } else {
  342. header('location: /');
  343. };
  344. ?>