1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
| var Get_Attributes = function(element, result, txt)
{
// disable button search
Change_Search_Button("disabled");
var poiType = element;
var combo_address1 = document.getElementById(result + "1");
var combo_address2 = document.getElementById(result + "2");
var combo_address3 = document.getElementById(result + "3");
var combo_address4 = document.getElementById(result + "4");
// case foodtype
var combo_foodtype = document.getElementById(result + "11");
var combo_foodtype2 = document.getElementById(result + "21");
var combo_foodtype3 = document.getElementById(result + "31");
var combo_foodtype4 = document.getElementById(result + "41");
// clear all values
var txt_address1 = document.getElementById(txt + "1");
var txt_address2 = document.getElementById(txt + "2");
var txt_address3 = document.getElementById(txt + "3");
var txt_address4 = document.getElementById(txt + "4");
txt_address1.value = "";
txt_address2.value = "";
txt_address3.value = "";
txt_address4.value = "";
// delete all option in the list
combo_address1.length = 0;
combo_address2.length = 0;
combo_address3.length = 0;
combo_address4.length = 0;
if (combo_foodtype != null)
{
combo_foodtype.length = 0;
combo_foodtype.style.visibility = "hidden";
if (txt_address1)
{
txt_address1.style.visibility = "inherit";
}
}
if (combo_foodtype2 != null)
{
combo_foodtype2.length = 0;
combo_foodtype2.style.visibility = "hidden";
if (txt_address2)
{
txt_address2.style.visibility = "inherit";
}
}
if (combo_foodtype3 != null)
{
combo_foodtype3.length = 0;
combo_foodtype3.style.visibility = "hidden";
if (txt_address3)
{
txt_address3.style.visibility = "inherit";
}
}
if (combo_foodtype4 != null)
{
combo_foodtype4.length = 0;
combo_foodtype4.style.visibility = "hidden";
if (txt_address4)
{
txt_address4.style.visibility = "inherit";
}
}
// if no filter
if (poiType.value == "")
{
Change_Search_Button("");
return ;
}
try{
var vRequest = com.ptvag.webcomponent.common.AJAX.createXMLHttpRequest();
if (!vRequest)
alert('request null');
//The callback-Handler for the AJAX-request
var fRequestHandler = function() {
if (vRequest.readyState == 4) {
document.documentElement.style.cursor = "default";
var vJsonResponse = JSON.parse(vRequest.responseText);
if(vJsonResponse.error){
alert("Error: "+vJsonResponse.error);
}else{
//parse the JSON-object and center-zoom map on coordinates
for (var i = 0; i < vJsonResponse.length; i++)
{
//if (attributsExclud.indexOf(vJsonResponse[i],0) < 0)
//{
if (vJsonResponse[i].value != "")
{
insertValue(combo_address1,getOrderPos(combo_address1,vJsonResponse[i].value),vJsonResponse[i].value,vJsonResponse[i].key);
insertValue(combo_address2,getOrderPos(combo_address2,vJsonResponse[i].value),vJsonResponse[i].value,vJsonResponse[i].key);
insertValue(combo_address3,getOrderPos(combo_address3,vJsonResponse[i].value),vJsonResponse[i].value,vJsonResponse[i].key);
insertValue(combo_address4,getOrderPos(combo_address4,vJsonResponse[i].value),vJsonResponse[i].value,vJsonResponse[i].key);
//combo_address1.options[combo_address1.length] = new Option(vJsonResponse[i].value,vJsonResponse[i].key);
//combo_address2.options[getOrderPos(combo_address2,vJsonResponse[i].value)] = new Option(vJsonResponse[i].value,vJsonResponse[i].key);
//combo_address3.options[getOrderPos(combo_address3,vJsonResponse[i].value)] = new Option(vJsonResponse[i].value,vJsonResponse[i].key);
//combo_address4.options[getOrderPos(combo_address4,vJsonResponse[i].value)] = new Option(vJsonResponse[i].value,vJsonResponse[i].key);
}
if (vJsonResponse[i].values != "")
{
for(var j = 0; j < vJsonResponse[i].values.length; j++)
{
combo_foodtype.options[combo_foodtype.length] = new Option(vJsonResponse[i].values[j].value,vJsonResponse[i].values[j].key);
combo_foodtype2.options[combo_foodtype.length] = new Option(vJsonResponse[i].values[j].value,vJsonResponse[i].values[j].key);
combo_foodtype3.options[combo_foodtype.length] = new Option(vJsonResponse[i].values[j].value,vJsonResponse[i].values[j].key);
combo_foodtype4.options[combo_foodtype.length] = new Option(vJsonResponse[i].values[j].value,vJsonResponse[i].values[j].key);
}
}
//}
}
}
Change_Search_Button("");
}
}
alert("POI" + poiType.value);
//Start the ajax-request
vRequest.open("POST", "mppoiadmin;jsessionid=<%=session.getId()%>", true);
vRequest.onreadystatechange = fRequestHandler;
vRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
vRequest.send("PoiType=" + poiType.value + "&lang=" + document.getElementById("Main_lang").value);
}catch(e){
alert("Error in ajax call: "+e);
}
} |