PageRenderTime 47ms CodeModel.GetById 19ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 0ms

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