1 AJAX.registerTeardown("tbl_select.js",function(){$("#togglesearchformlink").unbind("click");$("#tbl_search_form.ajax").die("submit");$("select.geom_func").unbind("change");$("span.open_search_gis_editor").die("click")});AJAX.registerOnload("tbl_select.js",function(){$('<div id="togglesearchformdiv"><a id="togglesearchformlink"></a></div>').insertAfter("#tbl_search_form").hide();$("#togglesearchformlink").html(PMA_messages.strShowSearchCriteria).bind("click",function(){var a=$(this);$("#tbl_search_form").slideToggle();if(a.text()==PMA_messages.strHideSearchCriteria){a.text(PMA_messages.strShowSearchCriteria)}else{a.text(PMA_messages.strHideSearchCriteria)}return false});$("#tbl_search_form.ajax").live("submit",function(d){var g=["IS NULL","IS NOT NULL","= ''","!= ''"];$search_form=$(this);d.preventDefault();$("#sqlqueryresults").empty();var f=PMA_ajaxShowMessage(PMA_messages.strSearching,false);PMA_prepareForAjaxRequest($search_form);var c={};$search_form.find(":input").each(function(){var a=$(this);if(a.attr("type")=="checkbox"||a.attr("type")=="radio"){if(a.is(":checked")){c[this.name]=a.val()}}else{c[this.name]=a.val()}});var e=$('select[name="columnsToDisplay[]"] option').length;for(var b=0;b<e;b++){if($.inArray(c["criteriaColumnOperators["+b+"]"],g)>=0){continue}if(c["criteriaValues["+b+"]"]==""||c["criteriaValues["+b+"]"]==null){delete c["criteriaValues["+b+"]"];delete c["criteriaColumnOperators["+b+"]"];delete c["criteriaColumnNames["+b+"]"];delete c["criteriaColumnTypes["+b+"]"];delete c["criteriaColumnCollations["+b+"]"]}}if(c["columnsToDisplay[]"]!=null){if(c["columnsToDisplay[]"].length==e){delete c["columnsToDisplay[]"];c.displayAllColumns=true}}else{c.displayAllColumns=true}$.post($search_form.attr("action"),c,function(a){PMA_ajaxRemoveMessage(f);if(a.success==true){if(a.sql_query!=null){$("#sqlqueryresults").html(a.sql_query)}else{$("#sqlqueryresults").html(a.message);$("#sqlqueryresults").trigger("makegrid")}$("#tbl_search_form").slideToggle().hide();$("#togglesearchformlink").text(PMA_messages.strShowSearchCriteria);$("#togglesearchformdiv").show();PMA_init_slider()}else{$("#sqlqueryresults").html(a.error)}})});$("span.open_search_gis_editor").hide();$("select.geom_func").bind("change",function(){var b=$(this);var c=["Contains","Crosses","Disjoint","Equals","Intersects","Overlaps","Touches","Within","MBRContains","MBRDisjoint","MBREquals","MBRIntersects","MBROverlaps","MBRTouches","MBRWithin","ST_Contains","ST_Crosses","ST_Disjoint","ST_Equals","ST_Intersects","ST_Overlaps","ST_Touches","ST_Within"];var e=["Envelope","EndPoint","StartPoint","ExteriorRing","Centroid","PointOnSurface"];var d=c.concat(e);var a=b.parents("tr").find("td:nth-child(5)").find("select");if($.inArray(b.val(),c)>=0){a.prop("readonly",true)}else{a.prop("readonly",false)}var f=b.parents("tr").find("span.open_search_gis_editor");if($.inArray(b.val(),d)>=0){f.show()}else{f.hide()}});$("span.open_search_gis_editor").live("click",function(e){e.preventDefault();var a=$(this);var f=a.parent("td").children("input[type='text']").val();var g="Parameter";var b=a.parents("tr").find(".geom_func").val();if(b=="Envelope"){var d="polygon"}else{if(b=="ExteriorRing"){var d="linestring"}else{var d="point"}}var h=a.parent("td").children("input[type='text']").attr("name");var c=$("input[name='token']").val();openGISEditor();if(!gisEditorLoaded){loadJSAndGISEditor(f,g,d,h,c)}else{loadGISEditor(f,g,d,h,c)}})});