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.

285 lines
13 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
​
​
​
​
​
​
​
​
​
​
​
​
​
  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_station',
  17. text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}',
  18. handler: function(){
  19. Ext.Msg.show({
  20. title:'{$Labels->GetLabel('_REMOVE_MODULE_')}?',
  21. msg: '{$Labels->GetLabel('_REMOVE_MODU_QUES_')}?',
  22. buttons: Ext.Msg.OKCANCEL,
  23. fn: function(btn){
  24. if( btn == 'ok' ){
  25. SelectedModule = 0;
  26. doModuleOperation( {$CR['id']}, 200, '', true );
  27. };
  28. },
  29. icon: Ext.MessageBox.QUESTION
  30. });
  31. }
  32. }],
  33. items:[%%%ITEMS%%%]
  34. }
  35. JOJOKA;
  36. $ITEMS = array();
  37. $QS = "SELECT count(`id`) cnt FROM `metro_tracks` WHERE `platform_id`={$EID}";
  38. $Rt = $DATABASE->Query( $QS, false );
  39. $TCO = $Rt[0]['cnt'];
  40. $NAME =$CR['name'] .'<br/>';
  41. $PINFO = getPlatformInfo( $CR['id'] );
  42. $QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CR['id']} ORDER BY `side` ASC";
  43. $TI = $DATABASE->Query( $QS, false );
  44. $TRACKS = '';
  45. if( count( $TI ) ){
  46. $COS = count( $PINFO['PREV'] );
  47. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  48. $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[0]['short']}</td>";
  49. $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 );}}}]}";
  50. if( count( $TI ) > 1 ){
  51. $COS = count( $PINFO['NEXT'] );
  52. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  53. $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[1]['short']}</td>";
  54. $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 );}}}]}";
  55. };
  56. } else {
  57. $COS = count( $PINFO['PREV'] );
  58. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  59. $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
  60. $COS = count( $PINFO['NEXT'] );
  61. if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
  62. $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
  63. };
  64. $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>';
  65. $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`";
  66. $Sz = $DATABASE->Query( $QS, false );
  67. if( count( $Sz ) ){
  68. $LINE_COLORS = array();
  69. $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`";
  70. $Rz = $DATABASE->Query( $QS, false );
  71. if( count( $Rz ) ){
  72. $LINES='<table><tr>';
  73. foreach( $Rz as $Z ){
  74. $LINE_COLORS[$Z['short']] = '#'.$Z['color'];
  75. $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>";
  76. };
  77. $LINES.='</tr></table>';
  78. };
  79. $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_')}'}";
  80. foreach( $Sz as $Z ){
  81. $AS = 'false';
  82. for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){
  83. if( $Z['line_id'] == $PINFO[$idx]['id'] ){
  84. $AS = 'true';
  85. break;
  86. };
  87. };
  88. //
  89. $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);};}}";
  90. };
  91. $ROUTING .= "]}";
  92. } else {
  93. $ROUTING = "{xtype:'spacer',height:0}";
  94. };
  95. $TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
  96. if( $PINFO['PREV_IS_MULTI'] ){
  97. foreach( $PINFO['PREV'] as $P ){
  98. $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>";
  99. }
  100. } else {
  101. if( count( $PINFO['PREV'] )){
  102. $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>";
  103. } else {
  104. $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>";
  105. };
  106. };
  107. $TOP .="</table></td>{$TRU}</tr></table></td>";
  108. $BOTTOM ="<td><table width=\"100%\" border=0><tr>{$TRB}<td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
  109. if( $PINFO['NEXT_IS_MULTI'] ){
  110. foreach( $PINFO['NEXT'] as $P ){
  111. $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>";
  112. }
  113. } else {
  114. if( count( $PINFO['NEXT'] )){
  115. $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>";
  116. } else {
  117. $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>";
  118. };
  119. };
  120. $BOTTOM .="</table></td></tr></table></td>";
  121. $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>'}";
  122. $ED =<<<kokakskhkajhskr
  123. {
  124. xtype: 'tabpanel',
  125. border: false,
  126. frame: false,
  127. height: PanelH - 283,
  128. activeTab: 0,
  129. listeners:{
  130. tabchange: function( tp, t ){
  131. switch( t.getId() ){
  132. case 'scada_tab': {
  133. loadSCADAModules( SelectedPlatform );
  134. break;
  135. };
  136. };
  137. }
  138. },
  139. items:[{
  140. xtype: 'panel',
  141. title: '{$Labels->GetLabel('_GENERAL_')}',
  142. items: [{
  143. xtype: 'form',
  144. height: PanelH - 283,
  145. labelWidth: 150,
  146. labelAlign: 'right',
  147. margins: {top:10, right:10, bottom:10, left:10},
  148. padding:8,
  149. items: [{
  150. xtype: 'combo',
  151. id: 'sens_se',
  152. fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
  153. lazyRender: true,
  154. mode: 'local',
  155. forceSelection: true,
  156. triggerAction: 'all',
  157. editable: false,
  158. disableKeyFilter: true,
  159. store: new Ext.data.ArrayStore({
  160. fields: ['mode','mode_txt'],
  161. data: [
  162. ['D','{$Labels->GetLabel('__DISABLED__')}'],
  163. ['E','{$Labels->GetLabel('___ENABLED__')}']
  164. ]
  165. }),
  166. valueField: 'mode',
  167. displayField: 'mode_txt',
  168. value: '{$CR['status']}',
  169. width: 200,
  170. listeners:{
  171. select: function( a, c, b ){
  172. doPlatformOperation( {$CR['id']}, 2, b, true );
  173. }
  174. }
  175. },{
  176. xtype: 'textfield',
  177. id: 'plt_name',
  178. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
  179. maxlength: 64,
  180. value: '{$CR['name']}',
  181. listeners:{
  182. change: function( a, c, b ){
  183. doPlatformOperation( {$CR['id']}, 6, c, true );
  184. }
  185. }
  186. },{
  187. xtype: 'textfield',
  188. id: 'plt_lvl',
  189. fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
  190. maxlength: 2,
  191. value: '{$CR['level']}',
  192. listeners:{
  193. change: function( a, c, b ){
  194. doPlatformOperation( {$CR['id']}, 7, c, true );
  195. }
  196. }
  197. },{
  198. xtype: 'combo',
  199. fieldLabel: "Platform Type",
  200. id: 'pl_lay',
  201. width: 200,
  202. lazyRender: true,
  203. mode: 'local',
  204. forceSelection: true,
  205. triggerAction: 'all',
  206. editable: false,
  207. readOnly: false,
  208. disableKeyFilter: true,
  209. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  210. store: new Ext.data.ArrayStore({
  211. fields: ['abbr','name','icon'],
  212. 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']]
  213. }),
  214. valueField: 'abbr',
  215. displayField: 'name',
  216. value: '{$CR['layout']}',
  217. listeners:{
  218. select: function( t, r, i ){
  219. t.getEl().setStyle({
  220. 'background-image': 'url(' + r.data.icon + ')',
  221. 'background-repeat': 'no-repeat',
  222. 'background-position': '3px center',
  223. 'background-size': '16px 16px',
  224. 'padding-left': '25px'
  225. });
  226. doPlatformOperation( {$CR['id']}, 19, r.data.abbr, true );
  227. },
  228. afterrender: function( t ){
  229. t.getEl().setStyle({
  230. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  231. 'background-repeat': 'no-repeat',
  232. 'background-position': '3px center',
  233. 'background-size': '16px 16px',
  234. 'padding-left': '25px'
  235. });
  236. }
  237. }
  238. },{$ROUTING}]
  239. }]
  240. },{
  241. xtype: 'panel',
  242. title: '{$Labels->GetLabel('_LBL_TRACKS_')}',
  243. items: [{$TRACKS}]
  244. },{
  245. xtype: 'panel',
  246. id: 'scada_tab',
  247. title: '{$Labels->GetLabel('_LBL_SCADA_')}',
  248. layout: 'hbox',
  249. items: [{
  250. xtype: 'panel',
  251. width: '40%',
  252. id: 'scada_container',
  253. tbar:[{
  254. text: "{$Labels->GetLabel( '_ADD_' )}",
  255. handler: addScadaModule
  256. }],
  257. flex: 1,
  258. height: PanelH-15,
  259. autoScroll: 'auto',
  260. items:[]
  261. },{
  262. xtype: 'panel',
  263. id: 'scada_op_small',
  264. flex: 1,
  265. height: PanelH-15,
  266. layout: 'fit',
  267. items:[{
  268. html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>"
  269. }]
  270. }]
  271. }],
  272. }
  273. kokakskhkajhskr;
  274. $ITEMS[1] = $ED;
  275. $CONTENT = implode(',',$ITEMS);
  276. $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
  277. echo $TTPL;
  278. } else {
  279. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  280. };
  281. } else {
  282. header('location: /');
  283. };
  284. ?>