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.

164 lines
4.3 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 mtyp = Ext.getCmp('mod_type').getValue();
  124. Ext.Ajax.request({
  125. url: '/lib/controller/addModule.php',
  126. params: {
  127. SERVID: 1,
  128. TYPE: mtyp,
  129. UID: {$UserID},
  130. SID: '{$Session}'
  131. },
  132. success: function( response, opts ){
  133. // If the response is JSON, you have to decode it
  134. var data = Ext.decode(response.responseText);
  135. if( data.status == 'ok' ){
  136. addModuleWindow.close();
  137. loadModules();
  138. } else {
  139. Ext.Msg.show({
  140. title: "{$Labels->GetLabel("_INFO_MSG_")}",
  141. msg: data.message,
  142. buttons: Ext.Msg.OK,//YESNOCANCEL,
  143. fn: function(){
  144. //SettingsLidar3D.hide();
  145. },
  146. icon: Ext.MessageBox.INFO //QUESTION
  147. });
  148. }
  149. },
  150. failure: failureAJAXFunction
  151. });
  152. }
  153. }]
  154. }
  155. DATA_BOUNDARY;
  156. };
  157. echo $WTPL;
  158. } else {
  159. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  160. };
  161. } else {
  162. header('location: /');
  163. };
  164. ?>