Commit 32d141bf authored by Clément Damiens's avatar Clément Damiens

Back in the Iive search
parent 822b190e
......@@ -103,108 +103,7 @@ function removeSearchType(type){
//$(".search_"+type).addClass("fa-circle-o");
}
}
function constructSearchObjectAndGetParams(){
onchangeClick=false;
getStatus="";//location.hash+"?";
var searchConstruct={};
if(searchObject.text != ""){
searchConstruct.name=searchObject.text;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="text="+searchObject.text;
}
if(typeof searchObject.types != "undefined" && searchObject.types.length==1 && searchObject.initType=="all"){
searchConstruct.searchType=searchObject.types;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="types="+searchObject.types.join(",");
}else{
searchConstruct.searchType=searchObject.types;
}
if(searchObject.tags != ""){
searchConstruct.searchTags=searchObject.tags;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="tags="+searchObject.tags.join(",");
}
if(typeof searchObject.page != "undefined" && searchObject.page>0){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="page="+(searchObject.page+1);
}
if(typeof searchObject.searchSType != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="searchSType="+searchObject.searchSType;
searchConstruct.searchSType = searchObject.searchSType;
}
if(typeof searchObject.section != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="section="+searchObject.section;
searchConstruct.section = searchObject.section;
}
if(typeof searchObject.subType != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="subType="+searchObject.subType;
searchConstruct.subType = searchObject.subType;
}
if(typeof searchObject.startDate != "undefined"){
if(searchObject.text==""){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="startDate="+searchObject.startDate;
searchConstruct.startDate = searchObject.startDate;
$(".calendar").show(700);
}else
$(".calendar").hide(700);
}
if(typeof searchObject.endDate != "undefined"){
if(searchObject.text==""){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="endDate="+searchObject.endDate;
searchConstruct.endDate = searchObject.endDate;
}
}
if(typeof searchObject.indexMin != "undefined" && notNull(searchObject.indexMin)){
searchConstruct.indexMin=searchObject.indexMin;
}
if(typeof searchObject.initType != "undefined")
searchConstruct.initType=searchObject.initType;
if(typeof searchObject.count != "undefined" && searchObject.count)
searchConstruct.count=searchObject.count;
if(typeof searchObject.ranges != "undefined")
searchConstruct.ranges=searchObject.ranges;
if(typeof searchObject.countType != "undefined")
searchConstruct.countType=searchObject.countType;
if(typeof $("#priceMin").val() != "undefined" && $("#priceMin").val()!=""){
searchObject.priceMin=$("#priceMin").val();
searchConstruct.priceMin = searchObject.priceMin;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="priceMin="+searchObject.priceMin;
}else if(typeof searchObject.priceMin != "undefined")
delete searchObject.priceMin;
if(typeof $("#priceMax").val() != "undefined" && $("#priceMax").val()!=""){
searchObject.priceMax=$("#priceMax").val();
searchConstruct.priceMax = searchObject.priceMax;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="priceMax="+searchObject.priceMax;
}else if(typeof searchObject.priceMax != "undefined")
delete searchObject.priceMax;
if(typeof $("#devise").val() != "undefined" && $("#devise").val()!="" && $("#devise").val()!=""){
searchObject.devise=$("#devise").val();
searchConstruct.devise = searchObject.devise;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="devise="+searchObject.devise;
}else if(typeof searchObject.devise != "undefined")
delete searchObject.devise;
// Locality
getStatus=getUrlSearchLocality(getStatus);
searchConstruct.locality = getSearchLocalityObject();
//Construct url with all necessar params
hashT=location.hash.split("?");
if(getStatus != "")
location.hash=hashT[0].substring(0)+"?"+getStatus;
else
location.hash=hashT[0];
return searchConstruct;
}
function autoCompleteSearch(indexMin, indexMax, callBack){
mylog.log("START -------- autoCompleteSearch! ", typeof callBack, callBack);
var data=constructSearchObjectAndGetParams();
......
......@@ -112,15 +112,16 @@ function showNewsStream(isFirst){ mylog.log("showNewsStream freedom");
thisType = "city";
urlCtrl = "/news/index/type/city/isLive/true";
}
var searchLocality = getSearchLocalityObject();
mylog.log("searchLocality", searchLocality);
var dataSearch = {
var dataSearch=constructSearchObjectAndGetParams();
//var searchLocality = getSearchLocalityObject();
//mylog.log("searchLocality", searchLocality);
/*var dataSearch = {
//"name" : name,
"localities" : searchLocality,
"searchType" : searchType,
"textSearch" : $('#main-search-bar').val(),
"textSearch" : searchObject.text,
"searchTag" : ($('#searchTags').length ) ? $('#searchTags').val().split(',') : [] ,
};
};*/
var loading = "<div class='loader bold letter-blue shadow2 text-center'>"+
"<i class='fa fa-spin fa-circle-o-notch'></i> "+
"<span>"+trad.currentlyloading+" ...</span>" +
......
......@@ -389,6 +389,108 @@ END CLASSIFIED
/* ----------------------------
SEARCH ENGINE
-------------------------------*/
function constructSearchObjectAndGetParams(){
onchangeClick=false;
getStatus="";//location.hash+"?";
var searchConstruct={};
if(searchObject.text != ""){
searchConstruct.name=searchObject.text;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="text="+searchObject.text;
}
if(typeof searchObject.types != "undefined" && searchObject.types.length==1 && searchObject.initType=="all"){
searchConstruct.searchType=searchObject.types;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="types="+searchObject.types.join(",");
}else{
searchConstruct.searchType=searchObject.types;
}
if(searchObject.tags != ""){
searchConstruct.searchTags=searchObject.tags;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="tags="+searchObject.tags.join(",");
}
if(typeof searchObject.page != "undefined" && searchObject.page>0){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="page="+(searchObject.page+1);
}
if(typeof searchObject.searchSType != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="searchSType="+searchObject.searchSType;
searchConstruct.searchSType = searchObject.searchSType;
}
if(typeof searchObject.section != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="section="+searchObject.section;
searchConstruct.section = searchObject.section;
}
if(typeof searchObject.subType != "undefined"){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="subType="+searchObject.subType;
searchConstruct.subType = searchObject.subType;
}
if(typeof searchObject.startDate != "undefined"){
if(searchObject.text==""){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="startDate="+searchObject.startDate;
searchConstruct.startDate = searchObject.startDate;
$(".calendar").show(700);
}else
$(".calendar").hide(700);
}
if(typeof searchObject.endDate != "undefined"){
if(searchObject.text==""){
getStatus+=(getStatus!="") ? "&":"";
getStatus+="endDate="+searchObject.endDate;
searchConstruct.endDate = searchObject.endDate;
}
}
if(typeof searchObject.indexMin != "undefined" && notNull(searchObject.indexMin)){
searchConstruct.indexMin=searchObject.indexMin;
}
if(typeof searchObject.initType != "undefined")
searchConstruct.initType=searchObject.initType;
if(typeof searchObject.count != "undefined" && searchObject.count)
searchConstruct.count=searchObject.count;
if(typeof searchObject.ranges != "undefined")
searchConstruct.ranges=searchObject.ranges;
if(typeof searchObject.countType != "undefined")
searchConstruct.countType=searchObject.countType;
if(typeof $("#priceMin").val() != "undefined" && $("#priceMin").val()!=""){
searchObject.priceMin=$("#priceMin").val();
searchConstruct.priceMin = searchObject.priceMin;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="priceMin="+searchObject.priceMin;
}else if(typeof searchObject.priceMin != "undefined")
delete searchObject.priceMin;
if(typeof $("#priceMax").val() != "undefined" && $("#priceMax").val()!=""){
searchObject.priceMax=$("#priceMax").val();
searchConstruct.priceMax = searchObject.priceMax;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="priceMax="+searchObject.priceMax;
}else if(typeof searchObject.priceMax != "undefined")
delete searchObject.priceMax;
if(typeof $("#devise").val() != "undefined" && $("#devise").val()!="" && $("#devise").val()!=""){
searchObject.devise=$("#devise").val();
searchConstruct.devise = searchObject.devise;
getStatus+=(getStatus!="") ? "&":"";
getStatus+="devise="+searchObject.devise;
}else if(typeof searchObject.devise != "undefined")
delete searchObject.devise;
// Locality
getStatus=getUrlSearchLocality(getStatus);
searchConstruct.locality = getSearchLocalityObject();
//Construct url with all necessar params
hashT=location.hash.split("?");
if(getStatus != "")
location.hash=hashT[0].substring(0)+"?"+getStatus;
else
location.hash=hashT[0];
return searchConstruct;
}
function initSearchObject(){
if(location.hash.indexOf("?") > -1){
getParamsUrls=location.hash.split("?");
......
......@@ -186,7 +186,6 @@ function checkMyScopeObject(initScopeResearch, paramsGet){
}
if(v.type=="cp")
keyActive=v.id;
alert(keyActive);
myScopes[initScopeResearch.key][e].active=($.inArray(keyActive, initScopeResearch.ids) > -1) ? true : false;
});
}
......
......@@ -14,6 +14,7 @@
'/js/news/autosize.js',
'/js/news/newsHtml.js',
'/js/default/live.js',
'/js/default/search.js',
);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, $this->module->assetsUrl);
......@@ -214,6 +215,7 @@ jQuery(document).ready(function() {
searchPage = true;
initSearchObject();
startNewsSearch(true);
$(".titleNowEvents .btnhidden").hide();
......@@ -246,11 +248,12 @@ jQuery(document).ready(function() {
searchObject.count=true;
if(typeof searchObject.ranges != "undefined") searchAllEngine.initSearch();
startSearch(0, indexStepInit, searchCallback);
startNewsSearch(0, indexStepInit, searchCallback);
});
$("#main-search-bar").keyup(function(e){
$("#second-search-bar").val($(this).val());
$("#input-search-map").val($(this).val());
searchObject.text=$(this).val();
if(e.keyCode == 13 || $(this).val() == ""){
startNewsSearch(true);
KScrollTo("#content-social");
......@@ -263,6 +266,7 @@ jQuery(document).ready(function() {
$("#second-search-bar").keyup(function(e){
$("#main-search-bar").val($(this).val());
$("#input-search-map").val($(this).val());
searchObject.text=$(this).val();
if(e.keyCode == 13 || $(this).val() == ""){
startNewsSearch(true);
KScrollTo("#content-social");
......@@ -272,6 +276,7 @@ jQuery(document).ready(function() {
$("#input-search-map").keyup(function(e){
$("#second-search-bar").val($("#input-search-map").val());
$("#main-search-bar").val($("#input-search-map").val());
searchObject.text=$(this).val();
if(e.keyCode == 13){
startNewsSearch(true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment