Web UI for ARGUS server
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.

228 lines
5.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $EID = intval( $_POST['DID'] );
  5. $TPL =<<<EFUFU
  6. {
  7. title: 'Width Table Editor',
  8. frame: true,
  9. border: false,
  10. xtype: 'editorgrid',
  11. id: 'tw_grid',
  12. cm: new Ext.grid.ColumnModel({
  13. columns: [
  14. {header: "Width [%]", width: 100, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'width' },
  15. {header: "Range [%]", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'range' },
  16. {header: "Range [m]", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'range_m' },
  17. ],
  18. defaults: {
  19. sortable: true,
  20. menuDisabled: true,
  21. width: 100
  22. }/*,
  23. listeners: {
  24. hiddenchange: function(cm, colIndex, hidden) {
  25. //saveConfig(colIndex, hidden);
  26. }
  27. }*/
  28. }),
  29. sm: new Ext.grid.RowSelectionModel({
  30. singleSelect: true,
  31. listeners: {
  32. rowselect: function(sm, row, rec ) {
  33. //loadEventProperties( rec.data );
  34. //SelectedEvent = rec.data.id;
  35. //SelectedRow = row;
  36. //alert( SelectedEvent );
  37. //var CB = Ext.getCmp('con_to_src');
  38. //CB.enable();
  39. }
  40. }
  41. }),
  42. ds: new Ext.data.JsonStore({
  43. root: 'rows',
  44. totalProperty: 'totalCount',
  45. idProperty: 'id',
  46. autoLoad: true,
  47. fields: [{
  48. name: 'id',
  49. type: 'int'
  50. },{
  51. name: 'width',
  52. type: 'int'
  53. },{
  54. name: 'range',
  55. type: 'int'
  56. },{
  57. name: 'range_m',
  58. type: 'int'
  59. }],
  60. baseParams:{
  61. UID: {$UserID},
  62. SID: '{$Session}',
  63. NID: {$EID}
  64. },
  65. proxy:
  66. new Ext.data.HttpProxy({
  67. method: 'POST',
  68. noCache: false,
  69. type: 'ajax',
  70. prettyUrls: false,
  71. url: '/lib/controller/getWidthTable.php',
  72. headers: {
  73. UIDZ: {$UserID},
  74. SIDZ: '{$Session}',
  75. NIDZ: {$EID}
  76. }
  77. })
  78. }),
  79. tbar:[{
  80. text: 'Add Row',
  81. handler: function(){
  82. var wiwin = new Ext.Window({
  83. title: 'Add Row',
  84. width: 300,
  85. height: 220,
  86. modal: true,
  87. layout: 'fit',
  88. items:{
  89. xtype: 'form',
  90. id: 'm_a_w_f',
  91. border: false,
  92. frame: true,
  93. labelWidth: 160,
  94. hideLabel: false,
  95. items:[{
  96. xtype: 'radio',
  97. fieldLabel: 'Range by Meters',
  98. id: 'ra_ty_me',
  99. name: 'ra_ra_ty',
  100. checked: true,
  101. listeners:{
  102. check: function( t, n ){
  103. if( n ){
  104. Ext.getCmp('ra_ra_vam').enable();
  105. Ext.getCmp('ra_ra_vap').disable();
  106. } else {
  107. Ext.getCmp('ra_ra_vap').enable();
  108. Ext.getCmp('ra_ra_vam').disable();
  109. };
  110. }
  111. }
  112. },{
  113. xtype: 'radio',
  114. fieldLabel: 'Range by Percents',
  115. id: 'ra_ty_pe',
  116. name: 'ra_ra_ty',
  117. checked: false
  118. },{
  119. xtype: 'numberfield',
  120. id: 'ra_ra_vam',
  121. fieldLabel: 'Range [m]',
  122. hideLabel: false,
  123. width: 60,
  124. listeners:{
  125. change: function( t, n, o ){
  126. var cmm = Ext.getCmp('node_range').getValue() / 100;
  127. if( cmm > 0 ){
  128. Ext.getCmp('ra_ra_vap').setValue( n / cmm );
  129. } else {
  130. Ext.getCmp('ra_ra_vap').setValue( 0 );
  131. };
  132. }
  133. }
  134. },{
  135. xtype: 'numberfield',
  136. id: 'ra_ra_vap',
  137. fieldLabel: 'Range [%]',
  138. hideLabel: false,
  139. disabled: true,
  140. minValue: 1,
  141. maxValue: 100,
  142. width: 60,
  143. listeners:{
  144. change: function( t, n, o ){
  145. var cmm = Ext.getCmp('node_range').getValue() / 100;
  146. if( cmm > 0 ){
  147. Ext.getCmp('ra_ra_vam').setValue( n * cmm );
  148. } else {
  149. Ext.getCmp('ra_ra_vam').setValue( 0 );
  150. };
  151. }
  152. }
  153. },{
  154. xtype: 'numberfield',
  155. id: 'wi_wi_va',
  156. fieldLabel: 'Width [%]',
  157. width: 60,
  158. minValue: 1,
  159. maxValue: 5000,
  160. value: 100
  161. }]
  162. },
  163. bbar:[{
  164. text: 'Cancel',
  165. handler: function(){
  166. wiwin.close();
  167. }
  168. },{
  169. text: 'Add',
  170. handler: function(){
  171. var CT = Ext.getCmp('ra_ty_me').getValue();
  172. if( CT ){
  173. var CV = Ext.getCmp('ra_ra_vam').getValue();
  174. } else {
  175. var CV = Ext.getCmp('ra_ra_vap').getValue();
  176. };
  177. var CW = Ext.getCmp('wi_wi_va').getValue();
  178. Ext.Ajax.request({
  179. url: '/lib/controller/addWidthTableRow.php',
  180. params: {
  181. UID: {$UserID},
  182. SID: '{$Session}',
  183. NID: {$EID},
  184. SBM: CT,
  185. RNG: CV,
  186. WDZ: CW
  187. },
  188. success: function( response, opts ){
  189. //get DS and reload!
  190. },
  191. failure: failureAJAXFunction
  192. });
  193. }
  194. }]
  195. });
  196. wiwin.show();
  197. var cmm = Ext.getCmp('node_range').getValue();
  198. Ext.getCmp('ra_ra_vam').setRawValue( cmm );
  199. Ext.getCmp('ra_ra_vap').setRawValue( 100 );
  200. }
  201. },{
  202. text: 'Remove Row',
  203. handler: function(){
  204. }
  205. },{
  206. text: 'Clear Table',
  207. handler: function(){
  208. }
  209. }]
  210. }
  211. EFUFU;
  212. $TPL = str_ireplace( '%%%NAME%%%', $R_name, $TPL );
  213. $TPL = str_ireplace( '%%%INFO%%%', $R_dev, $TPL );
  214. $TPL = str_ireplace( '%%%SPD%%%', $Labels->GetLabel('UART_COM_SPEED'), $TPL );
  215. $TPL = str_ireplace( '%%%SPD_VAL%%%', $Z['speed'], $TPL );
  216. $TPL = str_ireplace( '%%%BITS_VAL%%%',$Z['bit'], $TPL );
  217. $TPL = str_ireplace( '%%%PARITY_VAL%%%',$Z['parity'], $TPL );
  218. $TPL = str_ireplace( '%%%STOPS_VAL%%%',$Z['stop_bit'], $TPL );
  219. $TPL = str_ireplace( '%%%%RES_ID%%%',$EID, $TPL );
  220. $TPL = str_ireplace( '%%%USER_ID%%%',$UserID, $TPL );
  221. $TPL = str_ireplace( '%%%SESSION%%%',$Session, $TPL );
  222. echo $TPL;
  223. } else {
  224. header('location: /');
  225. };
  226. ?>