Changeset 1879

Show
Ignore:
Timestamp:
25-05-11 15:53:55 (3 years ago)
Author:
work@…
Message:

- fixed issue with the advanced query button not being enabled

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/advancedQuery/index.gsp

    r1800 r1879  
    44        <meta name="layout" content="main"/> 
    55        <title>Query database</title> 
     6        <g:if env="development"> 
    67        <link rel="stylesheet" href="<g:resource dir="css" file="advancedQuery.css" />" type="text/css"/> 
    78        <link rel="stylesheet" href="<g:resource dir="css" file="buttons.css" />" type="text/css"/> 
    89        <g:javascript src="advancedQuery.js" /> 
     10        </g:if><g:else> 
     11        <link rel="stylesheet" href="<g:resource dir="css" file="advancedQuery.min.css" />" type="text/css"/> 
     12        <link rel="stylesheet" href="<g:resource dir="css" file="buttons.min.css" />" type="text/css"/> 
     13        <g:javascript src="advancedQuery.min.js" /> 
     14        </g:else> 
    915        <script type="text/javascript"> 
    1016                // Make a list of fields to search in 
  • trunk/web-app/js/advancedQuery.js

    r1780 r1879  
    9393function toggleSearchButton() { 
    9494        if( $( "#criteria li:not(.newCriterion):not(.titlerow)" ).length == 0 && $( "#queryField" ).val() == "" ) { 
    95                 $( '.submitcriteria' ).attr( 'disabled', 'disabled' ); 
     95                $( '.submitcriteria' ).attr( 'disabled', true ); 
    9696        } else { 
    97                 $( '.submitcriteria' ).attr( 'disabled', '' ); 
     97                $( '.submitcriteria' ).removeAttr("disabled"); 
    9898        } 
    9999         
  • trunk/web-app/js/advancedQuery.min.js

    r1810 r1879  
    1 $(function(){$("#queryFieldSelect").after($('<input type="text" class="text" id="queryFieldText">'));$("#queryFieldText").after($('<input type="hidden" name="criteria.0.entityfield" id="queryField"></span>'));$("#queryFieldSelect").remove();$("#queryFieldText").autocomplete({minLength:0,source:queryableFields,focus:function(a,b){$("#queryFieldText").val(b.item.show);return false},select:function(a,b){selectQueryableFieldItem(b.item);return false},change:function(c,d){if($("#queryFieldText").val().trim()==""){selectQueryableFieldItem(null)}else{if(d.item==null){var b=$("#queryFieldText").autocomplete().data("autocomplete");var a=$.ui.autocomplete.filter(queryableFields,$("#queryFieldText").val());if(a&&a.length>0){selectQueryableFieldItem(a[0])}else{selectQueryableFieldItem(null)}}}}}).data("autocomplete")._renderItem=function(a,b){return $("<li></li>").data("item.autocomplete",b).append("<a>"+b.show+" <span class='entity'>"+b.entity+"</span></a>").appendTo(a)}});function selectQueryableFieldItem(b){var a="";var c="";if(b!=null){a=b.show;c=b.value;$("#queryFieldText").val(a)}$("#queryField").val(c);if(c==""){$("#queryFieldText").css("background-color","#FDD");$(".newCriterion .addButton a").addClass("disabled")}else{$("#queryFieldText").css("background-color","white");$(".newCriterion .addButton a").removeClass("disabled")}toggleSearchButton()}function toggleSearchButton(){if($("#criteria li:not(.newCriterion):not(.titlerow)").length==0&&$("#queryField").val()==""){$(".submitcriteria").attr("disabled","disabled")}else{$(".submitcriteria").attr("disabled","")}}var criteriumId=1;function addCriterion(){var c=$("#searchForm #queryField").val();var b=$("#searchForm input#value").val();var a=$("#searchForm select#operator").val();if(c==""){alert("Please select a field to search in.");return}showCriterium(c,b,a);toggleSearchMode();$("#searchForm #queryFieldText").val("");$("#searchForm #queryField").val("");$("#searchForm select#operator").val("equals");$("#searchForm input#value").val("");$("#searchForm .newCriterion .addButton a").addClass("disabled")}function removeCriterium(a){a.remove();toggleSearchMode();toggleSearchButton()}function toggleSearchMode(){if($("#criteria li:not(.newCriterion):not(.titlerow)").length==0){$("#searchMode").hide()}else{$("#searchMode").show()}}function showCriterium(e,g,a){var d=createCriteriumElement("entityfield",e);var c=createCriteriumElement("operator",a);var b;if(a=="in"){b=createInSearchElement("value",g)}else{b=createCriteriumElement("value",g)}var f=$('<a href="#" onClick="return false;"><img src="../plugins/famfamfam-1.0.1/images/icons/delete.png" border="0"></a>');f.bind("click",function(){if(confirm("Are you sure you want to remove this criterium?")){removeCriterium($(this).closest("li"));return false}});var h=$("<span></span>");h.append("\n").append(f);criteriumId++;var i=$("<li></li>");i.append(d).append("\n").append(c).append("\n").append(b).append("\n").append(h);$("#criteria .newCriterion").before(i)}function createCriteriumElement(c,b){var d=$('<span class="'+c+'"></span>');d.text(b);var a=$('<input type="hidden" name="criteria.'+criteriumId+"."+c+'" />');a.val(b);d.append(a);return d}function createInSearchElement(e,d){var c=$('<a class="'+e+'" href="'+baseUrl+"/advancedQuery/show/"+d+'"></a>');c.text("Search "+d);var b=$('<input type="hidden" name="criteria.'+criteriumId+"."+e+'" />');b.val(d);c.append(b);c.bind("click",function(){location.href=c.attr("href");return false});return c}; 
     1$(function(){$("#queryFieldSelect").after($('<input type="text" class="text" id="queryFieldText">'));$("#queryFieldText").after($('<input type="hidden" name="criteria.0.entityfield" id="queryField"></span>'));$("#queryFieldSelect").remove();$("#queryFieldText").autocomplete({minLength:0,source:queryableFields,focus:function(a,b){$("#queryFieldText").val(b.item.show);return false},select:function(a,b){selectQueryableFieldItem(b.item);return false},change:function(c,d){if($("#queryFieldText").val().trim()==""){selectQueryableFieldItem(null)}else{if(d.item==null){var b=$("#queryFieldText").autocomplete().data("autocomplete");var a=$.ui.autocomplete.filter(queryableFields,$("#queryFieldText").val());if(a&&a.length>0){selectQueryableFieldItem(a[0])}else{selectQueryableFieldItem(null)}}}}}).data("autocomplete")._renderItem=function(a,b){return $("<li></li>").data("item.autocomplete",b).append("<a>"+b.show+" <span class='entity'>"+b.entity+"</span></a>").appendTo(a)}});function selectQueryableFieldItem(b){var a="";var c="";if(b!=null){a=b.show;c=b.value;$("#queryFieldText").val(a)}$("#queryField").val(c);if(c==""){$("#queryFieldText").css("background-color","#FDD");$(".newCriterion .addButton a").addClass("disabled")}else{$("#queryFieldText").css("background-color","white");$(".newCriterion .addButton a").removeClass("disabled")}toggleSearchButton()}function toggleSearchButton(){if($("#criteria li:not(.newCriterion):not(.titlerow)").length==0&&$("#queryField").val()==""){$(".submitcriteria").attr("disabled",true)}else{$(".submitcriteria").removeAttr("disabled")}}var criteriumId=1;function addCriterion(){var c=$("#searchForm #queryField").val();var b=$("#searchForm input#value").val();var a=$("#searchForm select#operator").val();if(c==""){alert("Please select a field to search in.");return}showCriterium(c,b,a);toggleSearchMode();$("#searchForm #queryFieldText").val("");$("#searchForm #queryField").val("");$("#searchForm select#operator").val("equals");$("#searchForm input#value").val("");$("#searchForm .newCriterion .addButton a").addClass("disabled")}function removeCriterium(a){a.remove();toggleSearchMode();toggleSearchButton()}function toggleSearchMode(){if($("#criteria li:not(.newCriterion):not(.titlerow)").length==0){$("#searchMode").hide()}else{$("#searchMode").show()}}function showCriterium(e,g,a){var d=createCriteriumElement("entityfield",e);var c=createCriteriumElement("operator",a);var b;if(a=="in"){b=createInSearchElement("value",g)}else{b=createCriteriumElement("value",g)}var f=$('<a href="#" onClick="return false;"><img src="../plugins/famfamfam-1.0.1/images/icons/delete.png" border="0"></a>');f.bind("click",function(){if(confirm("Are you sure you want to remove this criterium?")){removeCriterium($(this).closest("li"));return false}});var h=$("<span></span>");h.append("\n").append(f);criteriumId++;var i=$("<li></li>");i.append(d).append("\n").append(c).append("\n").append(b).append("\n").append(h);$("#criteria .newCriterion").before(i)}function createCriteriumElement(c,b){var d=$('<span class="'+c+'"></span>');d.text(b);var a=$('<input type="hidden" name="criteria.'+criteriumId+"."+c+'" />');a.val(b);d.append(a);return d}function createInSearchElement(e,d){var c=$('<a class="'+e+'" href="'+baseUrl+"/advancedQuery/show/"+d+'"></a>');c.text("Search "+d);var b=$('<input type="hidden" name="criteria.'+criteriumId+"."+e+'" />');b.val(d);c.append(b);c.bind("click",function(){location.href=c.attr("href");return false});return c};