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.

171 lines
4.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/argus/server.php');
  4. if( $CUser->Data['id'] > 1 ){
  5. $PID = intval( $_POST['PID'] );
  6. $QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$PID}";
  7. $RR = $DATABASE->Query( $QS, false );
  8. if( count( $RR ) ){
  9. $MODS = array();
  10. $ATN = '';
  11. $ATS = '';
  12. $BTN = '';
  13. $BTS = '';
  14. foreach( $RR as $CT ){
  15. if( $CT['side'] == 'U' ){
  16. $FID = intval( $CT['far_module_id'] );
  17. $NID = intval( $CT['near_module_id'] );
  18. if( !$FID ) $MODS['UL']=$CT['id'];
  19. if( !$NID ) $MODS['UR']=$CT['id'];
  20. $ATN = $CT['name'];
  21. $ATS = $CT['short'];
  22. } else {
  23. $FID = intval( $CT['far_module_id'] );
  24. $NID = intval( $CT['near_module_id'] );
  25. if( !$FID ) $MODS['BR']=$CT['id'];
  26. if( !$NID ) $MODS['BL']=$CT['id'];
  27. $BTN = $CT['name'];
  28. $BTS = $CT['short'];
  29. };
  30. };
  31. //If no mods = all are defined
  32. if( count( $MODS ) ){
  33. $PAPA = array();
  34. $LOCK = count( $MODS );
  35. $CVAL = '';
  36. foreach( $MODS as $KEY=>$VALUE ){
  37. $PAPA[] = "['".$KEY . "','" .$Labels->GetLabel( 'MOD_LOC_'.$KEY ) . "','" .'/style/assets/ms_'.strtolower( $KEY ).".png']";
  38. if( $CVAL == '' ) $CVAL = $KEY;
  39. };
  40. $CDATA = implode(',', $PAPA );
  41. $WTPL =<<<DATA_BOUNDARY
  42. {
  43. id: 'huba_buba',
  44. title: "{$Labels->GetLabel( '_ADD_MODULE_' )}",
  45. modal: true,
  46. resizable: false,
  47. width: 450,
  48. height: 290,
  49. items:[{
  50. xtype: 'form',
  51. labelWidth: 150,
  52. labelAlign: 'right',
  53. items: [{
  54. xtype: 'textfield',
  55. fieldLabel: "{$Labels->GetLabel( 'MOD_NAME' )}",
  56. id: 'mod_name',
  57. width: 200,
  58. },{
  59. xtype: 'textfield',
  60. fieldLabel: "{$Labels->GetLabel( 'MOD_IP' )}",
  61. id: 'mod_ip',
  62. width: 200,
  63. },{
  64. xtype: 'textfield',
  65. fieldLabel: "{$Labels->GetLabel( 'MOD_IDENT' )}",
  66. id: 'mod_id',
  67. width: 200,
  68. },{
  69. xtype: 'combo',
  70. fieldLabel: "{$Labels->GetLabel( 'MOD_LOCATION' )}",
  71. id: 'mod_loc',
  72. width: 200,
  73. lazyRender: true,
  74. mode: 'local',
  75. forceSelection: true,
  76. triggerAction: 'all',
  77. editable: false,
  78. readOnly: ({$LOCK}==1),
  79. disableKeyFilter: true,
  80. tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
  81. store: new Ext.data.ArrayStore({
  82. fields: ['abbr','name','icon'],
  83. data: [{$CDATA}]
  84. }),
  85. valueField: 'abbr',
  86. displayField: 'name',
  87. value: '{$CVAL}',
  88. listeners:{
  89. select: function( t, r, i ){
  90. t.getEl().setStyle({
  91. 'background-image': 'url(' + r.data.icon + ')',
  92. 'background-repeat': 'no-repeat',
  93. 'background-position': '3px center',
  94. 'background-size': '16px 16px',
  95. 'padding-left': '25px'
  96. });
  97. },
  98. afterrender: function( t ){
  99. t.getEl().setStyle({
  100. 'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
  101. 'background-repeat': 'no-repeat',
  102. 'background-position': '3px center',
  103. 'background-size': '16px 16px',
  104. 'padding-left': '25px'
  105. });
  106. }
  107. }
  108. },{
  109. xtype: 'panel',
  110. id: 'infopan',
  111. 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>'
  112. }]
  113. }],
  114. bbar:[{
  115. text: '{$Labels->GetLabel( '_CANCEL_' )}',
  116. handler: function(){
  117. var tt = Ext.getCmp('huba_buba');
  118. tt.close();
  119. }
  120. },{
  121. text: '{$Labels->GetLabel( '_ADD_' )}',
  122. handler: function(){
  123. var name = Ext.getCmp('mod_name').getValue();
  124. var addr = Ext.getCmp('mod_ip').getValue();
  125. var iden = Ext.getCmp('mod_id').getValue();
  126. var loca = Ext.getCmp('mod_loc').getValue();
  127. Ext.Ajax.request({
  128. url: '/lib/controller/doModuleOperations.php',
  129. params: {
  130. OPID: 300,
  131. NAM: name,
  132. I4P: addr,
  133. PID: {$PID},
  134. IDT: iden,
  135. LOC: loca,
  136. UID: {$UserID},
  137. SID: '{$Session}'
  138. },
  139. success: function( response, opts ){
  140. // If the response is JSON, you have to decode it
  141. var data = Ext.decode(response.responseText);
  142. if( data.status == 'ok' ){
  143. addModuleWindow.close();
  144. loadModules();
  145. } else {
  146. Ext.Msg.show({
  147. title: "{$Labels->GetLabel("_INFO_MSG_")}",
  148. msg: data.msg,
  149. buttons: Ext.Msg.OK,//YESNOCANCEL,
  150. fn: function(){
  151. //SettingsLidar3D.hide();
  152. },
  153. icon: Ext.MessageBox.INFO //QUESTION
  154. });
  155. }
  156. },
  157. failure: failureAJAXFunction
  158. });
  159. }
  160. }]
  161. }
  162. DATA_BOUNDARY;
  163. };
  164. echo $WTPL;
  165. } else {
  166. echo '{ xtype: \'panel\', html: \'No Tracks On Platform!\'}';
  167. };
  168. } else {
  169. header('location: /');
  170. };
  171. ?>