|
|
|
@ -164,7 +164,183 @@ DATA_BOUNDARY; |
|
|
|
}; |
|
|
|
echo $WTPL; |
|
|
|
} else { |
|
|
|
echo '{ xtype: \'panel\', html: \'No Tracks On Platform!\'}'; |
|
|
|
$QS = "SELECT * FROM `metro_platforms` WHERE `id`={$PID}"; |
|
|
|
$RR = $DATABASE->Query( $QS, false ); |
|
|
|
$UP_TRN = "Platform_{$PID}_UTR"; |
|
|
|
$BT_TRN = "Platform_{$PID}_BTR"; |
|
|
|
$UP_TRA = "{$PID}_UTR"; |
|
|
|
$BT_TRA = "{$PID}_BTR"; |
|
|
|
if( $RR[0]['layout'] == 'A' || $LAY == 'B' ){ |
|
|
|
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')"; |
|
|
|
$DATABASE->Query( $QS ); |
|
|
|
} else { |
|
|
|
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')"; |
|
|
|
$DATABASE->Query( $QS ); |
|
|
|
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'B','{$BT_TRN}','{$BT_TRA}')"; |
|
|
|
$DATABASE->Query( $QS ); |
|
|
|
}; |
|
|
|
$QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$PID}"; |
|
|
|
$RR = $DATABASE->Query( $QS, false ); |
|
|
|
if( count( $RR ) ){ |
|
|
|
$MODS = array(); |
|
|
|
$ATN = ''; |
|
|
|
$ATS = ''; |
|
|
|
$BTN = ''; |
|
|
|
$BTS = ''; |
|
|
|
foreach( $RR as $CT ){ |
|
|
|
if( $CT['side'] == 'U' ){ |
|
|
|
$FID = intval( $CT['far_module_id'] ); |
|
|
|
$NID = intval( $CT['near_module_id'] ); |
|
|
|
if( !$FID ) $MODS['UL']=$CT['id']; |
|
|
|
if( !$NID ) $MODS['UR']=$CT['id']; |
|
|
|
$ATN = $CT['name']; |
|
|
|
$ATS = $CT['short']; |
|
|
|
} else { |
|
|
|
$FID = intval( $CT['far_module_id'] ); |
|
|
|
$NID = intval( $CT['near_module_id'] ); |
|
|
|
if( !$FID ) $MODS['BR']=$CT['id']; |
|
|
|
if( !$NID ) $MODS['BL']=$CT['id']; |
|
|
|
$BTN = $CT['name']; |
|
|
|
$BTS = $CT['short']; |
|
|
|
}; |
|
|
|
}; |
|
|
|
//If no mods = all are defined
|
|
|
|
if( count( $MODS ) ){ |
|
|
|
$PAPA = array(); |
|
|
|
$LOCK = count( $MODS ); |
|
|
|
$CVAL = ''; |
|
|
|
foreach( $MODS as $KEY=>$VALUE ){ |
|
|
|
$PAPA[] = "['".$KEY . "','" .$Labels->GetLabel( 'MOD_LOC_'.$KEY ) . "','" .'/style/assets/ms_'.strtolower( $KEY ).".png']"; |
|
|
|
if( $CVAL == '' ) $CVAL = $KEY; |
|
|
|
}; |
|
|
|
$CDATA = implode(',', $PAPA ); |
|
|
|
$WTPL =<<<DATA_BOUNDARY |
|
|
|
{ |
|
|
|
id: 'huba_buba', |
|
|
|
title: "{$Labels->GetLabel( '_ADD_MODULE_' )}", |
|
|
|
modal: true, |
|
|
|
resizable: false, |
|
|
|
width: 450, |
|
|
|
height: 290, |
|
|
|
items:[{ |
|
|
|
xtype: 'form', |
|
|
|
labelWidth: 150, |
|
|
|
labelAlign: 'right', |
|
|
|
items: [{ |
|
|
|
xtype: 'textfield', |
|
|
|
fieldLabel: "{$Labels->GetLabel( 'MOD_NAME' )}", |
|
|
|
id: 'mod_name', |
|
|
|
width: 200, |
|
|
|
},{ |
|
|
|
xtype: 'textfield', |
|
|
|
fieldLabel: "{$Labels->GetLabel( 'MOD_IP' )}", |
|
|
|
id: 'mod_ip', |
|
|
|
width: 200, |
|
|
|
},{ |
|
|
|
xtype: 'textfield', |
|
|
|
fieldLabel: "{$Labels->GetLabel( 'MOD_IDENT' )}", |
|
|
|
id: 'mod_id', |
|
|
|
width: 200, |
|
|
|
},{ |
|
|
|
xtype: 'combo', |
|
|
|
fieldLabel: "{$Labels->GetLabel( 'MOD_LOCATION' )}", |
|
|
|
id: 'mod_loc', |
|
|
|
width: 200, |
|
|
|
lazyRender: true, |
|
|
|
mode: 'local', |
|
|
|
forceSelection: true, |
|
|
|
triggerAction: 'all', |
|
|
|
editable: false, |
|
|
|
readOnly: ({$LOCK}==1), |
|
|
|
disableKeyFilter: true, |
|
|
|
tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/> {name}</div></tpl>', |
|
|
|
store: new Ext.data.ArrayStore({ |
|
|
|
fields: ['abbr','name','icon'], |
|
|
|
data: [{$CDATA}] |
|
|
|
}), |
|
|
|
valueField: 'abbr', |
|
|
|
displayField: 'name', |
|
|
|
value: '{$CVAL}', |
|
|
|
listeners:{ |
|
|
|
select: function( t, r, i ){ |
|
|
|
t.getEl().setStyle({ |
|
|
|
'background-image': 'url(' + r.data.icon + ')', |
|
|
|
'background-repeat': 'no-repeat', |
|
|
|
'background-position': '3px center', |
|
|
|
'background-size': '16px 16px', |
|
|
|
'padding-left': '25px' |
|
|
|
}); |
|
|
|
}, |
|
|
|
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' |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
},{ |
|
|
|
xtype: 'panel', |
|
|
|
id: 'infopan', |
|
|
|
html: '<table width="100%" border=1><tr><td class="mod_sch_ucell">{$ATN}[{$ATS}]</td></tr><tr><td class="mod_sch_bcell">{$BTN}[{$BTS}]</td></tr></table>' |
|
|
|
}] |
|
|
|
}], |
|
|
|
bbar:[{ |
|
|
|
text: '{$Labels->GetLabel( '_CANCEL_' )}', |
|
|
|
handler: function(){ |
|
|
|
var tt = Ext.getCmp('huba_buba'); |
|
|
|
tt.close(); |
|
|
|
} |
|
|
|
},{ |
|
|
|
text: '{$Labels->GetLabel( '_ADD_' )}', |
|
|
|
handler: function(){ |
|
|
|
var name = Ext.getCmp('mod_name').getValue(); |
|
|
|
var addr = Ext.getCmp('mod_ip').getValue(); |
|
|
|
var iden = Ext.getCmp('mod_id').getValue(); |
|
|
|
var loca = Ext.getCmp('mod_loc').getValue(); |
|
|
|
Ext.Ajax.request({ |
|
|
|
url: '/lib/controller/doModuleOperations.php', |
|
|
|
params: { |
|
|
|
OPID: 300, |
|
|
|
NAM: name, |
|
|
|
I4P: addr, |
|
|
|
PID: {$PID}, |
|
|
|
IDT: iden, |
|
|
|
LOC: loca, |
|
|
|
UID: {$UserID}, |
|
|
|
SID: '{$Session}' |
|
|
|
}, |
|
|
|
success: function( response, opts ){ |
|
|
|
// If the response is JSON, you have to decode it
|
|
|
|
var data = Ext.decode(response.responseText); |
|
|
|
if( data.status == 'ok' ){ |
|
|
|
addModuleWindow.close(); |
|
|
|
loadModules(); |
|
|
|
} else { |
|
|
|
Ext.Msg.show({ |
|
|
|
title: "{$Labels->GetLabel("_INFO_MSG_")}", |
|
|
|
msg: data.msg, |
|
|
|
buttons: Ext.Msg.OK,//YESNOCANCEL,
|
|
|
|
fn: function(){ |
|
|
|
//SettingsLidar3D.hide();
|
|
|
|
}, |
|
|
|
icon: Ext.MessageBox.INFO //QUESTION
|
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
failure: failureAJAXFunction |
|
|
|
}); |
|
|
|
} |
|
|
|
}] |
|
|
|
} |
|
|
|
DATA_BOUNDARY; |
|
|
|
}; |
|
|
|
echo $WTPL; |
|
|
|
} else { |
|
|
|
echo '{ xtype: \'panel\', html: \'Error Creating Tracks On Platform (to fix)!\'}'; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
header('location: /'); |
|
|
|
|