Commit 51a2729c authored by Raph El's avatar Raph El
Browse files

Hotfix inter

parent f01c3a97
......@@ -3,6 +3,7 @@ function bindCommunexionScopeEvents(){
$(".btn-decommunecter").click(function(){
activateGlobalCommunexion(false);
});
$(".item-globalscope-checker").click(function(){
$(".item-globalscope-checker").addClass("inactive");
$(this).removeClass("inactive");
......@@ -54,8 +55,9 @@ function bindCommunexionScopeEvents(){
checkScopeMax();
});
$(".start-new-communexion").click(function(){
if (typeof $.cookie('communexionName') !== 'undefined'){
$(".start-new-communexion").click(function(){
mylog.log("start-new-communexion", typeof communexion.currentName);
if (typeof communexion.currentName !== 'undefined'){
activateGlobalCommunexion(true);
if(actionOnSetGlobalScope=="save")
$(".item-globalscope-checker").attr('disabled', true);
......@@ -69,14 +71,14 @@ function activateGlobalCommunexion(active, firstLoad){
$.cookie('communexionActivated', active, { expires: 365, path: "/" });
globalCommunexion=active;
if(active){
headerHtml='<i class="fa fa-university"></i> ' + $.cookie('communexionName') + "<small class='text-dark'>.CO</small>"
//setGlobalScope($.cookie('communexionValue'), $.cookie('communexionName'), $.cookie('communexionType'), $.cookie('communexionLevel'));
headerHtml='<i class="fa fa-university"></i> ' + communexion.currentName + "<small class='text-dark'>.CO</small>"
//setGlobalScope($.cookie('communexionValue'), communexion.currentName, $.cookie('communexionType'), $.cookie('communexionLevel'));
$("#container-scope-filter").html(getBreadcrumCommunexion());
if(actionOnSetGlobalScope=="save")
$("#scopeListContainerForm").html(getBreadcrumCommunexion());
startSearch(0, indexStepInit,searchCallback);
bindCommunexionScopeEvents();
}
else{
}else{
headerHtml='<a href="#" class="menu-btn-back-category" data-target="#modalMainMenu" data-toggle="modal">'+
'<img src="'+themeUrl+'/assets/img/LOGOS/'+domainName+'/logo-head-search.png" height="60" class="inline margin-bottom-15">'+
'</a>';
......@@ -117,7 +119,7 @@ function getBreadcrumCommunexion(){
htmlCommunexion+= '<i class="fa fa-university fa-2x text-red"></i>'+
'<div class="getFormLive" style="display:inline-block;">';
if(communexion.values.level2){
if(communexion.values && communexion.values.level2){
htmlCommunexion+= '<button data-toggle="dropdown" data-target="dropdown-multi-scope" '+
'class="btn btn-link text-red item-globalscope-checker homestead ';
if( communexion.currentLevel != "level2" )
......@@ -130,7 +132,7 @@ function getBreadcrumCommunexion(){
'</button>';
}
if(communexion.values.level3){
if(communexion.values && communexion.values.level3){
htmlCommunexion+= '<button data-toggle="dropdown" data-target="dropdown-multi-scope" '+
'class="btn btn-link text-red item-globalscope-checker homestead ';
if( communexion.currentLevel != "level3" )
......@@ -143,7 +145,7 @@ function getBreadcrumCommunexion(){
'</button>';
}
if(communexion.values.level4){
if(communexion.values && communexion.values.level4){
htmlCommunexion+= '<button data-toggle="dropdown" data-target="dropdown-multi-scope" '+
'class="btn btn-link text-red item-globalscope-checker homestead ';
if( communexion.currentLevel != "level4" )
......
......@@ -9,7 +9,7 @@ var totalData = 0;
var timeout = null;
function startSearch(indexMin, indexMax){
mylog.log("startSearch", indexMin, indexMax, indexStep);
console.log("startSearch agenda.js", indexMin, indexMax, indexStep);
mylog.log("loadingData", loadingData);
if(loadingData) return;
......
......@@ -18,7 +18,7 @@ var translate = {"organizations":"Organisations",
"followers":"Ils nous suivent"};
function startSearch(indexMin, indexMax, callBack){
console.log("startSearch 1", typeof callBack, callBack, loadingData);
console.log("startSearch directory.js", typeof callBack, callBack, loadingData);
if(loadingData) return;
loadingData = true;
showIsLoading(true);
......@@ -274,24 +274,25 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){
//active les link lbh
bindLBHLinks();
$(".start-new-communexion").click(function(){
$("#main-search-bar, #second-search-bar, #input-search-map").val("");
setGlobalScope( $(this).data("scope-value"), $(this).data("scope-name"), $(this).data("scope-type"), "city",
$(this).data("insee-communexion"), $(this).data("name-communexion"), $(this).data("cp-communexion"),
$(this).data("region-communexion"), $(this).data("dep-communexion"), $(this).data("country-communexion") ) ;
// $(".start-new-communexion").click(function(){
// mylog.log("start-new-communexion directory.js");
// $("#main-search-bar, #second-search-bar, #input-search-map").val("");
// setGlobalScope( $(this).data("scope-value"), $(this).data("scope-name"), $(this).data("scope-type"), "city",
// $(this).data("insee-communexion"), $(this).data("name-communexion"), $(this).data("cp-communexion"),
// $(this).data("region-communexion"), $(this).data("dep-communexion"), $(this).data("country-communexion") ) ;
//only on homepage
if($("#communexionNameHome").length){
$("#communexionNameHome").html('Vous êtes <span class="text-dark">communecté à <span class="text-red">'+$(this).data("name-communexion")+'</span></span>');
$("#liveNowCoName").html("<span class='text-red'> à "+$(this).data("name-communexion")+"</span>");
$("#main-search-bar").val("");
$(".info_co, .input_co").addClass("hidden");
$("#change_co").removeClass("hidden");
$("#dropdown_search").html("");
}else{
startSearch(0, indexStepInit, searchCallback);
}
});
// //only on homepage
// if($("#communexionNameHome").length){
// $("#communexionNameHome").html('Vous êtes <span class="text-dark">communecté à <span class="text-red">'+$(this).data("name-communexion")+'</span></span>');
// $("#liveNowCoName").html("<span class='text-red'> à "+$(this).data("name-communexion")+"</span>");
// $("#main-search-bar").val("");
// $(".info_co, .input_co").addClass("hidden");
// $("#change_co").removeClass("hidden");
// $("#dropdown_search").html("");
// }else{
// startSearch(0, indexStepInit, searchCallback);
// }
// });
$.unblockUI();
......
......@@ -10,14 +10,13 @@
scopeHtml="";
//if(typeof userConnected != "undefined" && userConnected != null ){
if( typeof $.cookie('communexionName') !== "undefined" && $.cookie('communexionName') != "false" &&
typeof communexion != "undefined" && communexion.state){
if( typeof communexion != "undefined" && communexion.state){
scopeHtml='<button class="pull-left btn btn-link bg-white text-red tooltips item-globalscope-checker start-new-communexion" '+
'data-toggle="tooltip" data-placement="top" title="'+trad["communectwith"]+' '+$.cookie('communexionName')+'" '+
'data-scope-value="'+$.cookie('communexionValue')+'" '+
'data-scope-name="'+$.cookie('communexionName')+'" '+
'data-scope-level="'+$.cookie('communexionLevel')+'" '+
'data-scope-type="'+$.cookie('communexionType')+'" '+
'data-toggle="tooltip" data-placement="top" title="'+trad["communectwith"]+' '+communexion.currentName+'" '+
'data-scope-value="'+communexion.currentValue+'" '+
'data-scope-name="'+communexion.currentName+'" '+
'data-scope-level="'+communexion.currentLevel+'" '+
'data-scope-type="'+communexion.communexionType+'" '+
'id="btn-my-co">'+
'<i class="fa fa-university"></i>'+
'</button>';
......@@ -74,11 +73,11 @@
$(htmlId).html(html);
if(actionOnSetGlobalScope=="save"){
scopeHtml='<a class="pull-left btn btn-link bg-white text-red tooltips item-globalscope-checker start-new-communexion" '+
'data-toggle="tooltip" data-placement="top" title="Communecter avec '+$.cookie('communexionName')+'" '+
'data-scope-value="'+$.cookie('communexionValue')+'" '+
'data-scope-name="'+$.cookie('communexionName')+'" '+
'data-scope-level="'+$.cookie('communexionLevel')+'" '+
'data-scope-type="'+$.cookie('communexionType')+'" '+
'data-toggle="tooltip" data-placement="top" title="Communecter avec '+communexion.currentName+'" '+
'data-scope-value="'+communexion.currentValue+'" '+
'data-scope-name="'+communexion.currentName+'" '+
'data-scope-level="'+communexion.currentLevel+'" '+
'data-scope-type="'+communexion.communexionType+'" '+
'id="btn-my-co">'+
'<i class="fa fa-university"></i>'+
'</a>'+
......
......@@ -253,8 +253,10 @@ function toogleScopeMultiscope(scopeValue){ mylog.log("toogleScopeMultiscope(sco
function getMultiScopeList(){ return myMultiScopes; }
function getLocalityForSearch(){
if($.cookie('communexionActivated') == "true" ){
function getLocalityForSearch(){
mylog.log("getLocalityForSearch", $.cookie('communexionActivated'), globalCommunexion);
if(globalCommunexion == true ){
var searchLocality = {}
searchLocality[communexion.currentValue] = { type : communexion.currentLevel,
name : communexion.currentName,
......@@ -406,39 +408,41 @@ function setGlobalScope(scopeValue, scopeName, scopeType, scopeLevel,
$("#main-scope-name").html('<i class="fa fa-university"></i> ' + scopeName + "<small class='text-dark'>.CO</small>");
$.removeCookie('communexionType', { path: '/' });
$.removeCookie('communexionValue', { path: '/' });
$.removeCookie('communexionName', { path: '/' });
$.removeCookie('communexionLevel', { path: '/' });
// $.removeCookie('communexionType', { path: '/' });
// $.removeCookie('communexionValue', { path: '/' });
// $.removeCookie('communexionName', { path: '/' });
// $.removeCookie('communexionLevel', { path: '/' });
$.cookie('communexionType', scopeType, { expires: 365, path: "/" });
$.cookie('communexionValue', scopeValue, { expires: 365, path: "/" });
$.cookie('communexionName', scopeName, { expires: 365, path: "/" });
// $.cookie('communexionType', scopeType, { expires: 365, path: "/" });
// $.cookie('communexionValue', scopeValue, { expires: 365, path: "/" });
// $.cookie('communexionName', scopeName, { expires: 365, path: "/" });
//$.cookie('communexionLevel', scopeLevel, { expires: 365, path: "/" });
//$.cookie('currentLevel', scopeType, { expires: 365, path: "/" });
communexion.currentLevel = scopeLevel;
communexion.currentName = scopeName;
communexion.currentValue = scopeValue;
$.cookie('communexion', communexion, { expires: 365, path: "/" });
if(inseeCommunexion != null){
$.removeCookie('inseeCommunexion', { path: '/' });
$.removeCookie('cityNameCommunexion', { path: '/' });
$.removeCookie('cpCommunexion', { path: '/' });
// if(inseeCommunexion != null){
// $.removeCookie('inseeCommunexion', { path: '/' });
// $.removeCookie('cityNameCommunexion', { path: '/' });
// $.removeCookie('cpCommunexion', { path: '/' });
$.cookie('inseeCommunexion', inseeCommunexion, { expires: 365, path: "/" });
$.cookie('cityNameCommunexion', cityNameCommunexion, { expires: 365, path: "/" });
$.cookie('cpCommunexion', cpCommunexion, { expires: 365, path: "/" });
}else{
console.log("communexion hash:", location.hash);
if(actionOnSetGlobalScope == "filter"){
if(location.hash.indexOf("#live") >= 0)
startNewsSearch(true);
else if(location.hash != "")
startSearch(0, indexStepInit, searchCallback);
//else loadLiveNow();
}
}
// $.cookie('inseeCommunexion', inseeCommunexion, { expires: 365, path: "/" });
// $.cookie('cityNameCommunexion', cityNameCommunexion, { expires: 365, path: "/" });
// $.cookie('cpCommunexion', cpCommunexion, { expires: 365, path: "/" });
// }else{
// console.log("communexion hash:", location.hash);
// if(actionOnSetGlobalScope == "filter"){
// if(location.hash.indexOf("#live") >= 0)
// startNewsSearch(true);
// else if(location.hash != "")
// startSearch(0, indexStepInit, searchCallback);
// //else loadLiveNow();
// }
//}
/*if(typeof communexion != "undefined" && typeof inseeCommunexion != "undefined"){
......
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