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.
 
 
 
 

313 lines
14 KiB

<?php
require_once('../ajax_asm.php');
require_once('../php/argus/server.php');
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['PID'] );
$QS = "SELECT * FROM `metro_platforms` WHERE `id`={$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
$TTPL=<<<JOJOKA
{
xtype: 'panel',
border: false,
frame: false,
tbar:[{
id: 'btn_del_platform',
text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}',
handler: function(){
Ext.Msg.show({
title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
buttons: Ext.Msg.OKCANCEL,
fn: function(btn){
if( btn == 'ok' ){
SelectedPlatform = 0;
oSelectedPlatform = 0;
doPlatformOperation( {$CR['id']}, 200, '', true );
};
},
icon: Ext.MessageBox.QUESTION
});
}
}],
items:[%%%ITEMS%%%]
}
JOJOKA;
$ITEMS = array();
$QS = "SELECT count(`id`) cnt FROM `metro_tracks` WHERE `platform_id`={$EID}";
$Rt = $DATABASE->Query( $QS, false );
$TCO = $Rt[0]['cnt'];
$NAME =$CR['name'] .'<br/>';
$PINFO = getPlatformInfo( $CR['id'] );
$QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CR['id']} ORDER BY `side` ASC";
$TI = $DATABASE->Query( $QS, false );
$TRACKS = '';
if( count( $TI ) ){
$COS = count( $PINFO['PREV'] );
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
$TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[0]['short']}</td>";
$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 );}}}]}";
if( count( $TI ) > 1 ){
$COS = count( $PINFO['NEXT'] );
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
$TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[1]['short']}</td>";
$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 );}}}]}";
};
} else {
$COS = count( $PINFO['PREV'] );
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
$TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
$COS = count( $PINFO['NEXT'] );
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
$TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
};
$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>';
$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`";
$Sz = $DATABASE->Query( $QS, false );
if( count( $Sz ) ){
$LINE_COLORS = array();
$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`";
$Rz = $DATABASE->Query( $QS, false );
if( count( $Rz ) ){
$LINES='<table><tr>';
foreach( $Rz as $Z ){
$LINE_COLORS[$Z['short']] = '#'.$Z['color'];
$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>";
};
$LINES.='</tr></table>';
};
$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_')}'}";
foreach( $Sz as $Z ){
$AS = 'false';
for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){
if( $Z['line_id'] == $PINFO[$idx]['id'] ){
$AS = 'true';
break;
};
};
//
$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);};}}";
};
$ROUTING .= "]}";
} else {
$ROUTING = "{xtype:'spacer',height:0}";
};
$TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
if( $PINFO['PREV_IS_MULTI'] ){
foreach( $PINFO['PREV'] as $P ){
$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>";
}
} else {
if( count( $PINFO['PREV'] )){
$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>";
} else {
$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>";
};
};
$TOP .="</table></td>{$TRU}</tr></table></td>";
$BOTTOM ="<td><table width=\"100%\" border=0><tr>{$TRB}<td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
if( $PINFO['NEXT_IS_MULTI'] ){
foreach( $PINFO['NEXT'] as $P ){
$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>";
}
} else {
if( count( $PINFO['NEXT'] )){
$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>";
} else {
$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>";
};
};
$BOTTOM .="</table></td></tr></table></td>";
$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>'}";
$ED =<<<kokakskhkajhskr
{
xtype: 'tabpanel',
border: false,
frame: false,
height: PanelH - 283,
activeTab: 0,
listeners:{
tabchange: function( tp, t ){
switch( t.getId() ){
case 'scada_tab': {
loadSCADAModules( SelectedPlatform );
break;
};
};
}
},
items:[{
xtype: 'panel',
title: '{$Labels->GetLabel('_GENERAL_')}',
items: [{
xtype: 'form',
height: PanelH - 283,
labelWidth: 150,
labelAlign: 'right',
margins: {top:10, right:10, bottom:10, left:10},
padding:8,
items: [{
xtype: 'combo',
id: 'sens_se',
fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
['D','{$Labels->GetLabel('__DISABLED__')}'],
['E','{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$CR['status']}',
width: 200,
listeners:{
select: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 2, b, true );
}
}
},{
xtype: 'textfield',
id: 'plt_name',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
maxlength: 64,
value: '{$CR['name']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 6, c, true );
}
}
},{
xtype: 'textfield',
id: 'plt_lvl',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
maxlength: 2,
value: '{$CR['level']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 7, c, true );
}
}
},{
xtype: 'combo',
fieldLabel: "Platform Type",
id: 'pl_lay_A',
width: 200,
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
readOnly: false,
disableKeyFilter: true,
tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
store: new Ext.data.ArrayStore({
fields: ['abbr','name','icon'],
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']]
}),
valueField: 'abbr',
displayField: 'name',
value: '{$CR['layout']}',
init_value: '{$CR['layout']}',
listeners:{
select: function( t, r, i ){
if( r.data.abbr < 'C' && t.init_value > 'B' ){
Ext.Msg.show({
title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
buttons: Ext.Msg.OKCANCEL,
fn: function(btn){
if( btn == 'ok' ){
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
} else {
t.suspendEvents();
t.setValue( t.init_value, true );
t.resumeEvents();
t.getEl().setStyle({
'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.init_value )].data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center',
'background-size': '16px 16px',
'padding-left': '25px'
});
};
},
icon: Ext.MessageBox.QUESTION
});
} else {
t.getEl().setStyle({
'background-image': 'url(' + r.data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center',
'background-size': '16px 16px',
'padding-left': '25px'
});
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
};
},
afterrender: function( t ){
t.getEl().setStyle({
'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center',
'background-size': '16px 16px',
'padding-left': '25px'
});
}
}
},{$ROUTING}]
}]
},{
xtype: 'panel',
title: '{$Labels->GetLabel('_LBL_TRACKS_')}',
items: [{$TRACKS}]
},{
xtype: 'panel',
id: 'scada_tab',
title: '{$Labels->GetLabel('_LBL_SCADA_')}',
layout: 'hbox',
items: [{
xtype: 'panel',
width: '40%',
id: 'scada_container',
tbar:[{
text: "{$Labels->GetLabel( '_ADD_' )}",
handler: addScadaModule
}],
flex: 1,
height: PanelH-15,
autoScroll: 'auto',
items:[]
},{
xtype: 'panel',
id: 'scada_op_small',
flex: 1,
height: PanelH-15,
layout: 'fit',
items:[{
html: "<div class='setEd_infoPanel' id='NUNU'>{$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_')}</div>"
}]
}]
}],
}
kokakskhkajhskr;
$ITEMS[1] = $ED;
$CONTENT = implode(',',$ITEMS);
$TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
echo $TTPL;
} else {
echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
};
} else {
header('location: /');
};
?>