/source/gl/mb/form/form_config.html

http://prosporous.googlecode.com/ · HTML · 450 lines · 424 code · 11 blank · 15 comment · 0 complexity · da667699ea57446d070b5fc7f14d157e MD5 · raw file

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>??????</title>
  6. <{$showjs}>
  7. <link rel="stylesheet" type="text/css" href="/Plug-in/ext/resources/css/xtheme-slate.css" />
  8. <{$ajax}>
  9. <link rel="stylesheet" type="text/css" href="../css/main1.css" />
  10. <style type=text/css>
  11. <!--
  12. .x-btn-left{
  13. background-position:2px 0;
  14. }
  15. .x-btn-over .x-btn-left{
  16. background-position:2px -63px;
  17. }
  18. .i_sx{background-image:url(../img/arrow_refresh_small.png) !important;}
  19. .i_cs{background-image:url(../img/application_form_add.png) !important;}
  20. .i_sc{background-image:url(../img/application_form_delete.png) !important;}
  21. .i_qk{background-image:url(../img/application_delete.png) !important;}
  22. .i_px{background-image:url(../img/sucaiwcom8170000bzc.gif) !important;}
  23. .x-grid-record-del{text-decoration:line-through;background:#FFF893;color:#000;}
  24. .x-grid-record-new{color:#00933B;}
  25. --> </style>
  26. <script type="text/javascript" src="/Plug-in/ext/Ext.grid.CheckColumn.js"></script>
  27. <script type="text/javascript">
  28. Ext.onReady(function(){
  29. var myMask = new Ext.LoadMask(Ext.getBody(), {
  30. msg: '???...'
  31. });
  32. var fm = Ext.form;
  33. var sm = new Ext.grid.CheckboxSelectionModel();
  34. var fields = [
  35. sm,
  36. {name: 'id', mapping : 'id'},
  37. {name: 'fname', mapping : 'fname'},
  38. {name: 'name', mapping : 'name'},
  39. {name: 'type', mapping : 'type'},
  40. {name : 'cfg', mapping : 'cfg'},
  41. {name : 'xr', mapping : 'xr'},
  42. {name : 'del',type:'int'},
  43. {name : 'isnew',type:'int'}
  44. ];
  45. var store = new Ext.data.JsonStore({
  46. id:'store',
  47. url: 'form_config.php',
  48. fields: fields
  49. });
  50. var comboStore = new Ext.data.JsonStore({
  51. id:'comboStore',
  52. url: 'form_config.php',
  53. fields: ['name','value']
  54. });
  55. comboStore.load({params:{op: 'combo_store'}});
  56. var donotrender = new Ext.grid.CheckColumn({
  57. header: "??????",
  58. dataIndex: 'xr',
  59. width: 80
  60. });
  61. var delRender = new Ext.grid.CheckColumn({
  62. header:'??',
  63. dataIndex:'del',
  64. width:50
  65. })
  66. var row_id=0;
  67. var cm = new Ext.grid.ColumnModel([
  68. {
  69. id : 'id',
  70. header: "????",
  71. dataIndex: 'id',
  72. width: 80/*,
  73. renderer:function(value,cellmeta,record,rowIndex){
  74. return rowIndex+1;}*/
  75. },{
  76. id : 'fname',
  77. header: "???",
  78. dataIndex: 'fname',
  79. width: 80
  80. },{
  81. id : 'name',
  82. header: "???",
  83. dataIndex: 'name',
  84. width: 100,
  85. editor: new fm.TextField({
  86. allowBlank: false
  87. })
  88. },
  89. {
  90. id : 'type',
  91. header: "??",
  92. dataIndex: 'type',
  93. width: 130,
  94. editor: new fm.ComboBox({
  95. id : 'catalog',
  96. name : 'catalog',
  97. emptyText :'??????',
  98. fieldLabel : '??',
  99. allowBlank : true,
  100. store:comboStore,
  101. hiddenName : 'type',
  102. selectOnFocus:true,
  103. mode:'local',
  104. readOnly :true,
  105. displayField: "value",
  106. valueField :'name',
  107. forceSelection: true,
  108. triggerAction: "all"
  109. })
  110. },{id : 'cfg', header: "????", sortable: true,width:80, dataIndex: 'cfg',renderer:function(val){
  111. return val==1?'<img src="../img/wrench.png" width="12">????':'<img src="../img/wrench_orange.png" width="12">????';
  112. }},donotrender,
  113. //??
  114. delRender
  115. ]);
  116. store.load({params:{op: 'formitem',tid:'<{$tid}>',lg:'<{$lg}>'}});
  117. var grid = new Ext.grid.EditorGridPanel({
  118. id :'grid',
  119. store : store,
  120. cm : cm,
  121. sm : sm,
  122. autoExpandColumn : 'name',
  123. plugins : [donotrender,delRender],
  124. region : 'center',
  125. frame : false,
  126. clicksToEdit : 2,
  127. ddGroup :'GridDD',
  128. enableDragDrop : true,
  129. border : false,
  130. title : false,
  131. tbar:[{xtype: 'button',text:'<{$tname}> - ????[<{$sytable}>]',iconCls:'i_tablecfg'}],
  132. listeners: {
  133. 'render': function(){
  134. bbar2.render(this.tbar);
  135. },
  136. "beforeedit":{
  137. fn: function(items){
  138. row_id=items.row;
  139. },
  140. scope: this
  141. },
  142. "afterEdit": {
  143. fn: function(items){
  144. myMask.show();
  145. Ext.Ajax.request(
  146. {
  147. waitMsg:'????....',
  148. method:'POST',
  149. params:{op:'items_config_save_ingrid',id:items.record.data.id,value:items.value,field:items.field},
  150. url:'form_config.php',
  151. success:function(form, action) {
  152. store.reload();
  153. myMask.hide();
  154. },
  155. failure: function(form, action) {
  156. }
  157. }
  158. );
  159. },
  160. scope: this
  161. }
  162. },
  163. viewConfig : {
  164. forceFit :true,
  165. getRowClass : function(record,rowIndex,rowParams,store){
  166. //????
  167. if(record.data.del=='1'){
  168. return 'x-grid-record-del';
  169. }else if(record.data.isnew=='1'){
  170. return 'x-grid-record-new';
  171. }else{
  172. return '';
  173. }
  174. }
  175. }
  176. });
  177. grid.on('celldblclick', function(grid, row, col, e) {
  178. // var row = grid.getSelectionModel().getSelected();
  179. // alert(row.data.id);
  180. var record = grid.getStore().getAt(row); //Get the Record
  181. var fieldName = grid.getColumnModel().getDataIndex(col); //Get field name
  182. //
  183. //alert(fieldName);
  184. if(fieldName=='cfg'){
  185. var data = record.get('id');
  186. var pr=top.Ext.get(data);
  187. if(pr){
  188. pr.close();
  189. }
  190. top.xajax_loadUrl(record.get('fname')+'_'+record.get('type')+'_'+'????','./form/fldcfg.php?op=cfg&id='+data,680,520,false,data)
  191. // Ext.MessageBox.alert('show','????????'+data)
  192. }else{
  193. return true;}
  194. });
  195. bbar2 = new Ext.Toolbar({
  196. renderTo:grid.tbar
  197. ,items:['->',{
  198. text:'??',iconCls:'i_sx',handler:function(){
  199. myMask.show();
  200. store.reload();
  201. myMask.hide();
  202. }
  203. },'-',{
  204. text:'?????????',iconCls:'i_cs',handler:function(){
  205. myMask.show();
  206. Ext.Ajax.request(
  207. {
  208. waitMsg:'????....',
  209. method:'POST',
  210. params:{op:'cs',tid:"<{$tid}>",lg:'<{$lg}>'},
  211. url:'form_config.php',
  212. success:function(form, action) {
  213. store.reload();
  214. myMask.hide();
  215. },
  216. failure: function(form, action) {
  217. }
  218. }
  219. );
  220. }
  221. },'-',{
  222. text:'???????',iconCls:'i_px',handler:function(){
  223. myMask.show();
  224. Ext.Ajax.request(
  225. {
  226. waitMsg:'????....',
  227. method:'POST',
  228. params:{op:'pxcs',tid:"<{$tid}>",lg:'<{$lg}>'},
  229. url:'form_config.php',
  230. success:function(form, action) {
  231. store.reload();
  232. myMask.hide();
  233. },
  234. failure: function(form, action) {
  235. }
  236. }
  237. );
  238. }
  239. },'-',{
  240. text:'???????????',iconCls:'i_qk',handler:function(){
  241. Ext.Msg.confirm('??','???????????',function(a){
  242. if(a == 'yes'){
  243. myMask.show();
  244. Ext.Ajax.request({
  245. waitMsg:'????....',
  246. method:'POST',
  247. params:{op:'qk',tid:"<{$tid}>",lg:'<{$lg}>'},
  248. url:'form_config.php',
  249. success:function(form, action) {
  250. store.removeAll() ;
  251. myMask.hide();
  252. },
  253. failure: function(form, action) {
  254. }
  255. });
  256. }
  257. })
  258. }
  259. },{
  260. text:'????',
  261. iconCls:'i_sc',
  262. handler:function(){
  263. myMask.show();
  264. var selections = grid.selModel.getSelections();
  265. var prez = [];
  266. for(i = 0; i< grid.selModel.getCount(); i++){
  267. prez.push(selections[i].json.id);
  268. }
  269. var encoded_array= Ext.encode(prez);
  270. Ext.Ajax.request(
  271. {
  272. waitMsg:'????....',
  273. method:'POST',
  274. params:{op:'form_component_del',ids:encoded_array,field:'xr',val:1},
  275. url:'form_config.php',
  276. success:function(form, action) {
  277. store.reload();
  278. myMask.hide();
  279. },
  280. failure: function(form, action) {
  281. }
  282. }
  283. );
  284. }
  285. },{
  286. text:'????',
  287. iconCls:'i_sc',
  288. handler:function(){
  289. myMask.show();
  290. var selections = grid.selModel.getSelections();
  291. var prez = [];
  292. for(i = 0; i< grid.selModel.getCount(); i++){
  293. prez.push(selections[i].json.id);
  294. }
  295. var encoded_array= Ext.encode(prez);
  296. Ext.Ajax.request(
  297. {
  298. waitMsg:'????....',
  299. method:'POST',
  300. params:{op:'form_component_del',ids:encoded_array,field:'xr',val:0},
  301. url:'form_config.php',
  302. success:function(form, action) {
  303. store.reload();
  304. myMask.hide();
  305. },
  306. failure: function(form, action) {
  307. }
  308. }
  309. );
  310. }
  311. },{
  312. text:'??',
  313. iconCls:'i_sc',
  314. handler:function(){
  315. myMask.show();
  316. var selections = grid.selModel.getSelections();
  317. var prez = [];
  318. for(i = 0; i< grid.selModel.getCount(); i++){
  319. prez.push(selections[i].json.id);
  320. }
  321. var encoded_array= Ext.encode(prez);
  322. Ext.Ajax.request(
  323. {
  324. waitMsg:'????....',
  325. method:'POST',
  326. params:{op:'form_component_del',ids:encoded_array,field:'del',val:1},
  327. url:'form_config.php',
  328. success:function(form, action) {
  329. store.reload();
  330. myMask.hide();
  331. },
  332. failure: function(form, action) {
  333. }
  334. }
  335. );
  336. }
  337. },{
  338. text:'???',
  339. iconCls:'i_sc',
  340. handler:function(){
  341. myMask.show();
  342. var selections = grid.selModel.getSelections();
  343. var prez = [];
  344. for(i = 0; i< grid.selModel.getCount(); i++){
  345. prez.push(selections[i].json.id);
  346. }
  347. var encoded_array= Ext.encode(prez);
  348. Ext.Ajax.request(
  349. {
  350. waitMsg:'????....',
  351. method:'POST',
  352. params:{op:'form_component_del',ids:encoded_array,field:'del',val:0},
  353. url:'form_config.php',
  354. success:function(form, action) {
  355. store.reload();
  356. myMask.hide();
  357. },
  358. failure: function(form, action) {
  359. }
  360. }
  361. );
  362. }
  363. }, '-'
  364. ]
  365. });
  366. var viewport = new Ext.Viewport({
  367. layout : 'fit',
  368. items:[
  369. grid
  370. ]
  371. });
  372. donotrender.on('click',function(a,b,c){
  373. myMask.show();
  374. Ext.Ajax.request(
  375. {
  376. waitMsg:'????....',
  377. method:'POST',
  378. params:{op:'items_config_save_ingrid',id:c.data.id,value:c.data[a.dataIndex],field:a.dataIndex},
  379. url:'form_config.php',
  380. success:function(form, action) {
  381. store.reload();
  382. myMask.hide();
  383. },
  384. failure: function(form, action) {
  385. }
  386. }
  387. );
  388. });
  389. delRender.on('click',function(a,b,c){
  390. myMask.show();
  391. Ext.Ajax.request(
  392. {
  393. waitMsg:'????....',
  394. method:'POST',
  395. params:{op:'items_config_save_ingrid',id:c.data.id,value:c.data[a.dataIndex],field:a.dataIndex},
  396. url:'form_config.php',
  397. success:function(form, action) {
  398. store.reload();
  399. myMask.hide();
  400. },
  401. failure: function(form, action) {
  402. }
  403. }
  404. );
  405. });
  406. var ddrow = new Ext.dd.DropTarget(grid.getView().mainBody, {
  407. ddGroup : 'GridDD',
  408. copy:false,
  409. notifyDrop : function(dd, e, data) {
  410. var sm = grid.getSelectionModel();
  411. var rows = sm.getSelections();
  412. var param =rows[0].data;
  413. //alert(param.id);
  414. var cindex = dd.getDragData(e).rowIndex;
  415. //alert(dd.getDragData(e).selections['id']);
  416. myMask.show();
  417. Ext.Ajax.request(
  418. {
  419. waitMsg:'????....',
  420. method:'POST',
  421. params:{op:'px',nowid:param.id,wz:cindex,lg:'<{$lg}>'},
  422. url:'form_config.php',
  423. success:function(form, action) {
  424. store.reload();
  425. myMask.hide();
  426. },
  427. failure: function(form, action) {
  428. }
  429. }
  430. );
  431. }
  432. });
  433. });
  434. </script>
  435. </head>
  436. <body>
  437. </body>
  438. </html>