diff --git a/o2web/source/x_component_cms_FormDesigner/Module/Checkbox/checkbox.html b/o2web/source/x_component_cms_FormDesigner/Module/Checkbox/checkbox.html index cf5bbf701141d06d7da64ba2f72df55edf7ed395..d9b54178f3f60adfec7ffa5a76480cf1fdcc6536 100644 --- a/o2web/source/x_component_cms_FormDesigner/Module/Checkbox/checkbox.html +++ b/o2web/source/x_component_cms_FormDesigner/Module/Checkbox/checkbox.html @@ -20,6 +20,14 @@ {{$.lp.no}} + + {{$.lp.countPerline}}: + + +
{{$.lp.countPerlineNote}}
+ + + {{$.lp.options}}: diff --git a/o2web/source/x_component_cms_FormDesigner/Module/Radio/radio.html b/o2web/source/x_component_cms_FormDesigner/Module/Radio/radio.html index 69f4f42807f14f80edfa1286a876933590a8775d..c4d23996b58f06ab3dd56f7a320e6ef10161f8c5 100644 --- a/o2web/source/x_component_cms_FormDesigner/Module/Radio/radio.html +++ b/o2web/source/x_component_cms_FormDesigner/Module/Radio/radio.html @@ -20,6 +20,14 @@ {{$.lp.no}} + + {{$.lp.countPerline}}: + + +
{{$.lp.countPerlineNote}}
+ + + {{$.lp.options}}: diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/checkbox.html b/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/checkbox.html index 7d33b0cfbb061df418fbdce1d37d3ffb383e3150..e4de0aece7f5b4842a4800582c218920c8226726 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/checkbox.html +++ b/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/checkbox.html @@ -19,6 +19,14 @@ {{$.lp.yes}} {{$.lp.no}} + + + {{$.lp.countPerline}}: + + +
{{$.lp.countPerlineNote}}
+ + {{$.lp.options}}: diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/template.json b/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/template.json index 434499f90b6de4c4dd988adf21a49a8e6aba4fc6..74623ef6638cfa1972b04a600476e80f2788a0a7 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/template.json +++ b/o2web/source/x_component_portal_PageDesigner/Module/Checkbox/template.json @@ -5,6 +5,7 @@ "description": "", "itemType": "values", "itemValues": [], + "countPerline": "0", "compute": "create", //create, show, save "section": "no", "sectionBy": "person", diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Radio/radio.html b/o2web/source/x_component_portal_PageDesigner/Module/Radio/radio.html index bdec365e457e1f45b60a605e831ec72650c62952..ebb1e582c50ff8beb6b16bcc81bfd2fc5bce918f 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/Radio/radio.html +++ b/o2web/source/x_component_portal_PageDesigner/Module/Radio/radio.html @@ -19,6 +19,14 @@ {{$.lp.yes}} {{$.lp.no}} + + + {{$.lp.countPerline}}: + + +
{{$.lp.countPerlineNote}}
+ + {{$.lp.options}}: diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Radio/template.json b/o2web/source/x_component_portal_PageDesigner/Module/Radio/template.json index fde62168b0b83622ab67a59683a17dfe56492f6a..b15b14c766bd8608e551b83740894a2016ca24c4 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/Radio/template.json +++ b/o2web/source/x_component_portal_PageDesigner/Module/Radio/template.json @@ -5,6 +5,7 @@ "description": "", "itemType": "values", "itemValues": [], + "countPerline": "0", "itemScript": { "code": "", "html": "" diff --git a/o2web/source/x_component_process_FormDesigner/Module/Checkbox/checkbox.html b/o2web/source/x_component_process_FormDesigner/Module/Checkbox/checkbox.html index 6e7aeb315c1a61179505a3f1b47b205471d77f39..1504042b195796fbe984b814aada8e9d349d5e5c 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Checkbox/checkbox.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Checkbox/checkbox.html @@ -20,11 +20,19 @@ {{$.lp.no}} + + + + + + + - {{$.lp.newline}}: + {{$.lp.countPerline}}: - {{$.lp.yes}} - {{$.lp.no}} + +
{{$.lp.countPerlineNote}}
+ diff --git a/o2web/source/x_component_process_FormDesigner/Module/Checkbox/template.json b/o2web/source/x_component_process_FormDesigner/Module/Checkbox/template.json index b73d5b0cf505e4be1cb7c393a13891c6e9094ff8..ad14391ae943f3090b6f5ddeb52e40c6450ff7f0 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Checkbox/template.json +++ b/o2web/source/x_component_process_FormDesigner/Module/Checkbox/template.json @@ -5,6 +5,7 @@ "description": "", "itemType": "values", "itemValues": [], + "countPerline": "0", "compute": "create", //create, show, save "section": "no", "sectionBy": "person", diff --git a/o2web/source/x_component_process_FormDesigner/Module/Radio/radio.html b/o2web/source/x_component_process_FormDesigner/Module/Radio/radio.html index b33b2f1fcc340c27184bf8f0dc429d4b08afa49d..344e3b820f0e32c6b7154134ff786cf59f11a63b 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Radio/radio.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Radio/radio.html @@ -19,6 +19,14 @@ {{$.lp.yes}} {{$.lp.no}} + + + {{$.lp.countPerline}}: + + +
{{$.lp.countPerlineNote}}
+ + {{$.lp.options}}: diff --git a/o2web/source/x_component_process_FormDesigner/Module/Radio/template.json b/o2web/source/x_component_process_FormDesigner/Module/Radio/template.json index 9ef40358b56417f01fb9e4a6e62177cc08e6a47e..152137b476327963bbf99e8a80ec798fb1bf9f7e 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Radio/template.json +++ b/o2web/source/x_component_process_FormDesigner/Module/Radio/template.json @@ -5,6 +5,7 @@ "description": "", "itemType": "values", "itemValues": [], + "countPerline": "0", "itemScript": { "code": "", "html": "" diff --git a/o2web/source/x_component_process_FormDesigner/lp/en.js b/o2web/source/x_component_process_FormDesigner/lp/en.js index 908d160e1272773cb9283cddde7fe76012a4d862..0e1203c4b6d96333e7a50b8f832d34ef638a8513 100644 --- a/o2web/source/x_component_process_FormDesigner/lp/en.js +++ b/o2web/source/x_component_process_FormDesigner/lp/en.js @@ -1254,7 +1254,8 @@ MWF.xApplication.process.FormDesigner.LP = { "menuItem": "Menu Item", "dropdownDefaultText": "Dropdown Menu", "showButton": "Show Button", - "newline": "one line per option", + "countPerline": "Options per line", + "countPerlineNote": "0 means no limit", "wps" : { "config":"Config", diff --git a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js index 0f572e5010a85224f91ec3eb5b9df658c1e43fa0..87461c58488f88a272e1839e7f8d5a626438d72e 100644 --- a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js +++ b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js @@ -1260,7 +1260,8 @@ MWF.xApplication.process.FormDesigner.LP = { "menuItem": "菜单项", "dropdownDefaultText": "下拉菜单", "showButton": "显示按钮", - "newline": "每个选项一行", + "countPerline": "每行选项数", + "countPerlineNote": "0表示不限制", "wps" : { "config":"配置", diff --git a/o2web/source/x_component_process_Xform/Checkbox.js b/o2web/source/x_component_process_Xform/Checkbox.js index 1796b4bdd7d2f9d095ed8d53aad073fe1bfc0dcb..1c9d0390c1fd59467d8dc01662c19789a4177e7e 100644 --- a/o2web/source/x_component_process_Xform/Checkbox.js +++ b/o2web/source/x_component_process_Xform/Checkbox.js @@ -45,7 +45,34 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox = new Class( texts.push(t); } }); - this.node.set("text", texts.join(", ")); + if( !this.isNumber(this.json.countPerline) ) { + if( this.json.newline ){ + texts.each(function(t){ + new Element("div", { "text": t }).inject(this.node) + }.bind(this)) + }else{ + this.node.set("text", texts.join(", ")); + } + }else{ + var div; + var countPerLine = this.json.countPerline.toInt(); + if( countPerLine === 0 ){ + div = new Element("div").inject( this.node ); + div.set("text", texts.join(", ")); + }else{ + var textsPerLine = []; + texts.each(function(t, i){ + if( i % countPerLine === 0){ //如果需要换行了 + if( div && textsPerLine.length )div.set("text", textsPerLine.join(",") +","); + textsPerLine = []; + div = new Element("div").inject( this.node ); + } + textsPerLine.push( t ); + }.bind(this)); + if( div && textsPerLine.length )div.set("text", textsPerLine.join(",")); + } + } + } }, _resetNodeEdit: function(){ @@ -154,23 +181,34 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox = new Class( var optionItems = this.getOptions(); this._setOptions(optionItems); }, - + isNumber : function( d ){ + return parseInt(d).toString() !== "NaN" + }, _setOptions: function(optionItems){ var p = o2.promiseAll(optionItems).then(function(radioValues){ this.moduleSelectAG = null; if (!radioValues) radioValues = []; + var node; if (o2.typeOf(radioValues)==="array"){ var flag = (new MWF.widget.UUID).toString(); - radioValues.each(function(item){ + radioValues.each(function(item, i){ var tmps = item.split("|"); var text = tmps[0]; var value = tmps[1] || text; - var node; - if( this.json.newline ){ - node = new Element("div").inject(this.node); + if( !this.isNumber(this.json.countPerline) ) { + if( this.json.newline ){ + node = new Element("div").inject(this.node); + }else{ + node = this.node; + } }else{ - node = this.node; + var countPerLine = this.json.countPerline.toInt(); + if( countPerLine === 0 && i===0 ){ + node = new Element("div").inject(this.node); + }else if( i % countPerLine === 0){ + node = new Element("div").inject(this.node); + } } var radio = new Element("input", { diff --git a/o2web/source/x_component_process_Xform/Radio.js b/o2web/source/x_component_process_Xform/Radio.js index 0f04017dfff041d08dd2cb25346274c34c6f4861..825a965a1d7f17f38f47f8de69bac064fd58e6eb 100644 --- a/o2web/source/x_component_process_Xform/Radio.js +++ b/o2web/source/x_component_process_Xform/Radio.js @@ -171,32 +171,52 @@ MWF.xApplication.process.Xform.Radio = MWF.APPRadio = new Class( var optionItems = this.getOptions(); this._setOptions(optionItems); }, - + isNumber : function( d ){ + return parseInt(d).toString() !== "NaN" + }, _setOptions: function(optionItems){ var p = o2.promiseAll(optionItems).then(function(radioValues){ this.moduleSelectAG = null; if (!radioValues) radioValues = []; + var node; if (o2.typeOf(radioValues)==="array"){ var flag = (new MWF.widget.UUID).toString(); - radioValues.each(function(item){ + radioValues.each(function(item, i){ var tmps = item.split("|"); var text = tmps[0]; var value = tmps[1] || text; + if( !this.isNumber(this.json.countPerline) ) { + if( this.json.newline ){ + node = new Element("div").inject(this.node); + }else{ + node = this.node; + } + }else{ + var countPerLine = this.json.countPerline.toInt(); + if( countPerLine === 0 && i===0 ){ + node = new Element("div").inject(this.node); + }else if( i % countPerLine === 0){ + node = new Element("div").inject(this.node); + } + } + var radio = new Element("input", { "type": "radio", "name": (this.json.properties && this.json.properties.name) ? this.json.properties.name : flag+this.json.id, "value": value, "showText": text, "styles": this.json.buttonStyles - }).inject(this.node); + }).inject(node); //radio.appendText(text, "after"); + + var textNode = new Element( "span", { "text" : text, "styles" : { "cursor" : "default" } - }).inject(this.node); + }).inject(node); textNode.addEvent("click", function( ev ){ if( this.radio.get("disabled") === true || this.radio.get("disabled") === "true" )return; this.radio.checked = true;