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