PageRenderTime 47ms CodeModel.GetById 18ms app.highlight 23ms RepoModel.GetById 2ms app.codeStats 0ms

/source/gl/mb/form/combo1value.html

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