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.

312 lines
14 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,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:0}";
  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: 'form',
  145. height: PanelH - 283,
  146. labelWidth: 150,
  147. labelAlign: 'right',
  148. margins: {top:10, right:10, bottom:10, left:10},
  149. padding:8,
  150. items: [{
  151. xtype: 'combo',
  152. id: 'sens_se',
  153. fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
  154. lazyRender: true,
  155. mode: 'local',
  156. forceSelection: true,
  157. triggerAction: 'all',
  158. editable: false,
  159. disableKeyFilter: true,
  160. store: new Ext.data.ArrayStore({
  161. fields: ['mode','mode_txt'],
  162. data: [
  163. ['D','{$Labels->GetLabel('__DISABLED__')}'],
  164. ['E','{$Labels->GetLabel('___ENABLED__')}']
  165. ]
  166. }),
  167. valueField: 'mode',
  168. displayField: 'mode_txt',
  169. value: '{$CR['status']}',
  170. width: 200,
  171. listeners:{
  172. select: function( a, c, b ){
  173. doPlatformOperation( {$CR['id']}, 2, b, true );
  174. }
  175. }
  176. },{
  177. xtype: 'textfield',
  178. id: 'plt_name',
  179. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
  180. maxlength: 64,
  181. value: '{$CR['name']}',
  182. listeners:{
  183. change: function( a, c, b ){
  184. doPlatformOperation( {$CR['id']}, 6, c, true );
  185. }
  186. }
  187. },{
  188. xtype: 'textfield',
  189. id: 'plt_lvl',
  190. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
  191. maxlength: 2,
  192. value: '{$CR['level']}',
  193. listeners:{
  194. change: function( a, c, b ){
  195. doPlatformOperation( {$CR['id']}, 7, c, true );
  196. }
  197. }
  198. },{
  199. xtype: 'combo',
  200. fieldLabel: "Platform Type",
  201. id: 'pl_lay_A',
  202. width: 200,
  203. lazyRender: true,
  204. mode: 'local',
  205. forceSelection: true,
  206. triggerAction: 'all',
  207. editable: false,
  208. readOnly: false,
  209. disableKeyFilter: true,
  210. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  211. store: new Ext.data.ArrayStore({
  212. fields: ['abbr','name','icon'],
  213. 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']]
  214. }),
  215. valueField: 'abbr',
  216. displayField: 'name',
  217. value: '{$CR['layout']}',
  218. init_value: '{$CR['layout']}',
  219. listeners:{
  220. select: function( t, r, i ){
  221. if( r.data.abbr < 'C' && t.init_value > 'B' ){
  222. Ext.Msg.show({
  223. title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
  224. msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
  225. buttons: Ext.Msg.OKCANCEL,
  226. fn: function(btn){
  227. if( btn == 'ok' ){
  228. doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
  229. } else {
  230. t.suspendEvents();
  231. t.setValue( t.init_value, true );
  232. t.resumeEvents();
  233. t.getEl().setStyle({
  234. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.init_value )].data.icon + ')',
  235. 'background-repeat': 'no-repeat',
  236. 'background-position': '3px center',
  237. 'background-size': '16px 16px',
  238. 'padding-left': '25px'
  239. });
  240. };
  241. },
  242. icon: Ext.MessageBox.QUESTION
  243. });
  244. } else {
  245. t.getEl().setStyle({
  246. 'background-image': 'url(' + r.data.icon + ')',
  247. 'background-repeat': 'no-repeat',
  248. 'background-position': '3px center',
  249. 'background-size': '16px 16px',
  250. 'padding-left': '25px'
  251. });
  252. doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
  253. };
  254. },
  255. afterrender: function( t ){
  256. t.getEl().setStyle({
  257. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  258. 'background-repeat': 'no-repeat',
  259. 'background-position': '3px center',
  260. 'background-size': '16px 16px',
  261. 'padding-left': '25px'
  262. });
  263. }
  264. }
  265. },{$ROUTING}]
  266. }]
  267. },{
  268. xtype: 'panel',
  269. title: '{$Labels->GetLabel('_LBL_TRACKS_')}',
  270. items: [{$TRACKS}]
  271. },{
  272. xtype: 'panel',
  273. id: 'scada_tab',
  274. title: '{$Labels->GetLabel('_LBL_SCADA_')}',
  275. layout: 'hbox',
  276. items: [{
  277. xtype: 'panel',
  278. width: '40%',
  279. id: 'scada_container',
  280. tbar:[{
  281. text: "{$Labels->GetLabel( '_ADD_' )}",
  282. handler: addScadaModule
  283. }],
  284. flex: 1,
  285. height: PanelH-15,
  286. autoScroll: 'auto',
  287. items:[]
  288. },{
  289. xtype: 'panel',
  290. id: 'scada_op_small',
  291. flex: 1,
  292. height: PanelH-15,
  293. layout: 'fit',
  294. items:[{
  295. html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>"
  296. }]
  297. }]
  298. }],
  299. }
  300. kokakskhkajhskr;
  301. $ITEMS[1] = $ED;
  302. $CONTENT = implode(',',$ITEMS);
  303. $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
  304. echo $TTPL;
  305. } else {
  306. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  307. };
  308. } else {
  309. header('location: /');
  310. };
  311. ?>