Author: tchemit Date: 2014-03-16 19:59:34 +0100 (Sun, 16 Mar 2014) New Revision: 1147 Url: http://forge.codelutin.com/projects/coser/repository/revisions/1147 Log: fixes #4669 Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp trunk/coser-web/src/main/webapp/js/coser.js Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp =================================================================== --- trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp 2014-03-15 15:11:29 UTC (rev 1146) +++ trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp 2014-03-16 18:59:34 UTC (rev 1147) @@ -24,6 +24,56 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><s:text name="message.search.extract.title" /></title> + <style type="text/css"> + .select { + width:100%; + } + </style> + <script type="text/javascript"> + <s:if test="!selectZones.empty"> + var f = function() { + + var valid = $('#selectZones option:selected').length>0; + if (valid) { + valid = $('#selectTypes option:selected').length >0; + } + if (valid) { + valid = $('#selectSpecies option:selected').length >0; + } + if (valid) { + valid = ($('#selectPopIndicators option:selected').length + + $('#selectComIndicators option:selected').length) >0; + } + var action = $('#submitAction'); + if (valid) { + action.removeAttr('disabled'); + } else { + action.attr('disabled', 'disabled'); + } + }; + $('select').change(f).trigger( "change" ); + f(); + </s:if> + <s:else> + var f = function() { + + var valid = $('#selectZones option:selected').length>0; + if (valid) { + valid = $('#selectTypes option:selected').length >0; + } + var action = $('#nextAction'); + if (valid) { + action.removeAttr('disabled'); + } else { + action.attr('disabled', 'disabled'); + } + }; + </s:else> + $(document).ready(function () { + $('select').change(f).trigger( "change" ); + f(); + }); + </script> </head> <body> @@ -35,7 +85,8 @@ <tr> <td><s:text name="message.common.zones" /> :</td> <td> - <select name="selectZones" multiple="multiple" style="width:100%" id="selectZones"> + <select name="selectZones" multiple="multiple" id="selectZones" + class="select"> <s:iterator value="zones" var="zone"> <option value="<s:property value="key" />" <s:if test="selectZones.contains(#zone.key)"> @@ -56,7 +107,8 @@ <tr> <td><s:text name="message.common.datatypes" /> :</td> <td> - <select name="selectTypes" multiple="multiple" style="width:100%" id="selectTypes"> + <select name="selectTypes" multiple="multiple" id="selectTypes" + class="select"> <s:iterator value="types" var="type"> <option value="<s:property value="key" />" <s:if test="selectTypes.contains(#type.key)"> @@ -97,7 +149,8 @@ title="<s:text name="message.common.selectnone" />" /></td> </tr> <tr> - <td colspan="2"><s:submit value="%{getText('message.search.extract.updatelists')}" /></td> + <td colspan="2"><s:submit id='nextAction' + value="%{getText('message.search.extract.updatelists')}" /></td> </tr> </table> @@ -110,7 +163,8 @@ <td><s:text name="message.common.indicatorsof" /><br /> <s:text name="message.common.community" /> :</td> <td> - <select name="selectComIndicators" multiple="multiple" style="width:100%" size="10" id="selectComIndicators"> + <select name="selectComIndicators" multiple="multiple" + class="select" size="10" id="selectComIndicators"> <s:iterator value="comIndicators" var="comIndicator"> <option value="<s:property value="key" />" <s:if test="selectComIndicators.contains(#comIndicator.key)"> @@ -134,7 +188,8 @@ <td><s:text name="message.common.indicatorsof" /><br /> <s:text name="message.common.population" /> :</td> <td> - <select name="selectPopIndicators" multiple="multiple" style="width:100%" size="10" id="selectPopIndicators"> + <select name="selectPopIndicators" multiple="multiple" + class="select" size="10" id="selectPopIndicators"> <s:iterator value="popIndicators" var="popIndicator"> <option value="<s:property value="key" />" <s:if test="selectPopIndicators.contains(#popIndicator.key)"> @@ -156,7 +211,8 @@ <tr> <td><s:text name="message.common.species" /> :</td> <td> - <select name="selectSpecies" multiple="multiple" style="width:100%" size="10" id="selectSpecies"> + <select name="selectSpecies" multiple="multiple" + class="select" size="10" id="selectSpecies"> <s:iterator value="species" var="specy"> <option value="<s:property value="key" />" <s:if test="selectSpecies.contains(#specy.key)"> @@ -175,7 +231,9 @@ title="<s:text name="message.common.selectnone" />" /></td> </tr> <tr> - <td colspan="2"><s:submit name="submitAction" value="%{getText('message.search.extract.extract')}" /></td> + <td colspan="2"><s:submit name="submitAction" + value="%{getText('message.search.extract.extract')}" + disabled="true"/></td> </tr> </table> </s:if> Modified: trunk/coser-web/src/main/webapp/js/coser.js =================================================================== --- trunk/coser-web/src/main/webapp/js/coser.js 2014-03-15 15:11:29 UTC (rev 1146) +++ trunk/coser-web/src/main/webapp/js/coser.js 2014-03-16 18:59:34 UTC (rev 1147) @@ -29,9 +29,11 @@ // selection tous les elements d'un select function coserSelectAll(select) { $(select).children("option").prop('selected',true); + $(select).change(); } // deselection tous les elements d'un select function coserUnSelectAll(select) { $(select).children("option").prop('selected',false); + $(select).change(); }