PageRenderTime 31ms CodeModel.GetById 12ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

/source/gl/mb/form/checkboxgroupvalue.html

http://prosporous.googlecode.com/
HTML | 191 lines | 185 code | 6 blank | 0 comment | 0 complexity | b7b3fed130dd6325f56d1a2e41a46f77 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>??????-checkboxgroup</title>
  6<{$showjs}>
  7<link rel="stylesheet" type="text/css" href="/Plug-in/ext/resources/css/xtheme-slate.css" />
  8<link rel="stylesheet" type="text/css" href="/css/main.css" />
  9<script language="javascript">
 10Ext.override(Ext.form.Checkbox, {
 11  setBoxLabel: function(boxLabel,boxvalue){
 12    this.boxLabel = boxLabel;
 13    this.inputValue = boxvalue;
 14    if(this.rendered){
 15      this.wrap.child('.x-form-cb-label').update(boxLabel);
 16    }
 17  }
 18});
 19Ext.onReady(function(){
 20var myMask = new Ext.LoadMask(Ext.getBody(), {
 21                        msg: '???...',
 22                        removeMask: true //?????
 23                    });
 24
 25var tabpanel = new Ext.TabPanel({
 26
 27		activeTab: 0,
 28		height:parent.Ext.get('t<{$fld.id}>').getHeight()-36,
 29		region     : 'center',
 30		title      : false,
 31		border	   : false,
 32		frame	   : true,
 33		defaults:{bodyStyle:'padding:10px'},
 34		items      : [{
 35				title:'??',
 36                layout:'column',
 37                bbar:['->','-',{
 38			            text: '??',
 39			            handler:function(){
 40			            	myMask.show();
 41								var label_ = Ext.getCmp('label').getValue();
 42								var value_ = Ext.getCmp('value').getValue();
 43								var checkbox = new Ext.form.Checkbox({
 44										boxLabel: label_,
 45										name: 'checkbox',
 46										inputValue: value_,
 47										columnWidth:.25,
 48										listeners:{
 49											'check':function(checkbox){
 50												if(checkbox.checked){
 51												var label = checkbox.boxLabel;
 52												var value = checkbox.inputValue;
 53												Ext.getCmp('label').setValue(label);
 54												Ext.getCmp('value').setValue(value);
 55												}
 56											}
 57										}
 58									});
 59								//var x = checkboxgroup;
 60								var checkboxgroup = Ext.getCmp('fieldset');
 61								checkboxgroup.items.add(checkbox);
 62								checkboxgroup.doLayout();
 63							myMask.hide();
 64						}
 65			        },'-',{
 66			            text: '??',
 67			            handler:function(){
 68			            	myMask.show();
 69			            		var label_ = Ext.getCmp('label').getValue();
 70								var value_ = Ext.getCmp('value').getValue();
 71								if(label_!=null&&value_!=null){
 72										Ext.each(Ext.getCmp('fieldset').items.items,function(a,b,c){
 73											if(a.checked){
 74												a.setBoxLabel(label_,value_);
 75											}
 76										});
 77								}else{
 78									Ext.Msg.alert('??','???????');
 79								}
 80							myMask.hide();
 81						}
 82
 83			        },'-',{
 84			            text: '??',
 85			            handler:function(){
 86								Ext.MessageBox.confirm("????","???????????",function(_btn){
 87									if(_btn=="yes"){
 88										Ext.each(Ext.getCmp('fieldset').items.items,function(a,b,c){
 89											if(a.checked){
 90												this.destroy();
 91												this.disable();
 92											}
 93										});
 94									}
 95								});
 96							}
 97			        },'-'],
 98                items:[{
 99                	border:false,
100           			columnWidth:.5,
101           			height:100,
102           			autoHeight: true,
103           			layout:'column',
104           			bodyStyle:'padding:10px',
105                	items:[
106                	{
107                		xtype: 'label',
108                		text: '??',
109                		cls:'x-form-check-group-label',
110                		anchor:'-15'
111                	},{
112						xtype: 'textfield',
113						id:'label',
114                        name: 'label'                    }]
115                },{
116                	border:false,
117           			columnWidth:.5,
118           			height:100,
119           			autoHeight: true,
120           			bodyStyle:'padding:10px',
121           			layout:'column',
122                	items:[{
123                		xtype: 'label',
124                		text: '?',
125                		cls:'x-form-check-group-label',
126                		anchor:'-15'
127                	},{
128						xtype: 'textfield',
129						id:'value',
130                        name: 'value'
131                    }]
132                	},{
133                	id:'fieldset',
134                	xtype:'fieldset',
135                	title:'??',
136           			columnWidth:1,
137           			height:100,
138           			autoHeight: true,
139           			bodyStyle:'padding:10px',
140           			layout:'column'
141					<{$items}>
142                	}]
143
144		}],
145		 buttons: [{
146            text: '??',
147            handler:function(){
148            	var  x = '';
149            	Ext.each(Ext.getCmp('fieldset').items.items,function(a,b,c){
150            	if(!a.disabled){
151            	var check = '';
152            		if(a.checked){
153						check = '#_#1';
154            		}else{
155						check = '#_#0';
156						}
157					x = x  + a.boxLabel+'#_#'+a.inputValue+check+'#=#';
158					}
159            	});
160            	myMask.show();
161            	Ext.Ajax.request({
162			        waitMsg:'????....',
163			        method:'POST',
164			        params:{op:'save',type:'checkboxgroupvalue',param:x,id:'<{$fld.id}>'},
165			        url:'fldcfg.php',
166			        success:function(form, action) {
167			             myMask.hide();
168			             parent.Ext.getCmp('t<{$fld.id}>').close();
169			        },
170			        failure: function(form, action) {
171			        }
172			     });
173            }
174        },{
175            text: '??'
176        }]
177});
178
179var form = new Ext.form.FormPanel({
180		renderTo: Ext.getBody(),
181		items:[
182			tabpanel
183		]
184});
185
186});
187</script>
188</head>
189<body>
190</body>
191</html>