From: <die...@us...> - 2013-06-14 16:09:08
|
Revision: 4263 http://openutils.svn.sourceforge.net/openutils/?rev=4263&view=rev Author: diego_schivo Date: 2013-06-14 16:09:03 +0000 (Fri, 14 Jun 2013) Log Message: ----------- CONTROLS-54 dependentSelectListAndRadioGroup.ftl Modified Paths: -------------- magnoliamodules/trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/samples/SampleRadioOptionsProvider.java magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/dialogs/dependentSelectListAndRadioGroup.ftl magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap-samples/controls/config.modules.controls.dialogs.samples-dependentSelectList.xml Modified: magnoliamodules/trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/samples/SampleRadioOptionsProvider.java =================================================================== --- magnoliamodules/trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/samples/SampleRadioOptionsProvider.java 2013-06-14 15:45:04 UTC (rev 4262) +++ magnoliamodules/trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/samples/SampleRadioOptionsProvider.java 2013-06-14 16:09:03 UTC (rev 4263) @@ -39,8 +39,8 @@ options.setMore(false); try { - Node parent = MgnlContext.getJCRSession("website").getRootNode(); - Iterator<Node> iter = NodeUtil.getNodes(parent, "mgnl:page").iterator(); + Node parent = MgnlContext.getJCRSession("config").getNode("/modules/controls/gridColumnTypes"); + Iterator<Node> iter = NodeUtil.getNodes(parent, "mgnl:contentNode").iterator(); int start = itemsPerPage > 0 ? Math.max(pageNumberStartingFromOne - 1, 0) * itemsPerPage : 0; int i = 0; while (i < start && iter.hasNext()) Modified: magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/dialogs/dependentSelectListAndRadioGroup.ftl =================================================================== --- magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/dialogs/dependentSelectListAndRadioGroup.ftl 2013-06-14 15:45:04 UTC (rev 4262) +++ magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/dialogs/dependentSelectListAndRadioGroup.ftl 2013-06-14 16:09:03 UTC (rev 4263) @@ -1,3 +1,4 @@ +[#assign refresh = request.getParameter("dependentSelectListCK")?has_content] [#list selectOptionsList as options] [#assign paramSelect]${name}Select${options_index}[/#assign] <select style="width:100%;" class="mgnlDialogControlSelect" id="${paramSelect}" name="${paramSelect}"> @@ -7,35 +8,57 @@ [/#list] </select> [/#list] -[#assign refresh = request.getParameter("dependentSelectListCK")?has_content] +<div class="radioGroup"> [#assign found = false] [#list radioOptions.items?keys as key] [#assign checked = (!refresh && key = value!) || (refresh && key = request.getParameter(name)!)] [#assign found = found || checked] -<input type="radio" id="${name}_${key?html!}" name="${name}" value="${key?html!}"[#if checked] checked="checked"[/#if] />${radioOptions.items[key]!}<br /> + <input type="radio" id="${name}_${key?html!}" name="${name}" value="${key?html!}"[#if checked] checked="checked"[/#if] />${radioOptions.items[key]!}<br /> [/#list] [#if radioOptions.more] -<a href="#" id="${name}More">More</a> + <a href="#" id="${name}More">More</a> [/#if] [#if !refresh] [#if !found] -<input type="hidden" name="${name}" value="${value?html}" /> + <input type="hidden" name="${name}" value="${value?html}" /> [/#if] +[/#if] +</div> +[#if !refresh] <script type="text/javascript"> (function($){ + var dialogBoxInput; + var selects; + var page = 1; + function init(){ - var dialogBoxInput = $('label[for="${name}"]').closest("tr").find("td.mgnlDialogBoxInput"); - var selects = dialogBoxInput.find('select[name!="${name}"]'); + dialogBoxInput = $('label[for="${name}"]').closest("tr").find("td.mgnlDialogBoxInput"); + selects = dialogBoxInput.find('select[name!="${name}"]'); selects.change(function(){ var $this = $(this); var data = $("#mgnlPath,#mgnlParagraph,#mgnlRepository,#mgnlLocale,#mgnlRichE,#mgnlRichEPaste").add(selects); $.get($("#mgnlFormMain").attr("action"), data.serialize() + "&dependentSelectListCK=" + new Date().getTime(), function(data){ $(data).find('label[for="${name}"]').closest("tr").find("td.mgnlDialogBoxInput").replaceAll(dialogBoxInput); + page = 1; init(); }); }); + initRadio(); } + function initRadio(){ + var link = $("a#${name}More"); + link.click(function(e){ + e.preventDefault(); + var $this = $(this); + var data = $("#mgnlPath,#mgnlParagraph,#mgnlRepository,#mgnlLocale,#mgnlRichE,#mgnlRichEPaste").add(selects); + $.get($("#mgnlFormMain").attr("action"), data.serialize() + "&radioGroupPage=" + (++page) + "&dependentSelectListCK=" + new Date().getTime(), function(data){ + $(data).find('label[for="${name}"]').closest("tr").find("td.mgnlDialogBoxInput .radioGroup").replaceAll(link); + initRadio(); + }); + }); + } + $(function(){ init(); }); Modified: magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap-samples/controls/config.modules.controls.dialogs.samples-dependentSelectList.xml =================================================================== --- magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap-samples/controls/config.modules.controls.dialogs.samples-dependentSelectList.xml 2013-06-14 15:45:04 UTC (rev 4262) +++ magnoliamodules/trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap-samples/controls/config.modules.controls.dialogs.samples-dependentSelectList.xml 2013-06-14 16:09:03 UTC (rev 4263) @@ -143,7 +143,7 @@ <sv:value>radioGroup</sv:value> </sv:property> <sv:property sv:name="itemsPerPage" sv:type="String"> - <sv:value>5</sv:value> + <sv:value>4</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> @@ -171,7 +171,7 @@ <sv:value>2013-06-14T15:54:03.927+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> - <sv:value>2013-06-14T17:40:38.218+02:00</sv:value> + <sv:value>2013-06-14T17:48:28.855+02:00</sv:value> </sv:property> </sv:node> </sv:node> @@ -189,7 +189,7 @@ <sv:value>dependentSelectListAndRadioGroup</sv:value> </sv:property> <sv:property sv:name="itemsPerPage" sv:type="String"> - <sv:value>5</sv:value> + <sv:value>4</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> @@ -220,7 +220,7 @@ <sv:value>2013-06-14T15:54:03.927+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> - <sv:value>2013-06-14T17:40:48.550+02:00</sv:value> + <sv:value>2013-06-14T17:48:32.429+02:00</sv:value> </sv:property> </sv:node> </sv:node> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |