Commit 560a58a3 authored by Clément Damiens's avatar Clément Damiens

Merged branch master into development

parents 41046bf9 9de7914b
......@@ -965,9 +965,9 @@ var urlCtrl = {
showAjaxPanel( baseUrl+'/'+ moduleId + '/'+hash.replace( "#","" ).replace( /\./g,"/" ), 'KESS KISS PASS in this '+typesLabels[hashT[3]],'rss' );
}
else if(hash.length>2){
hash = hash.replace( "#","" );
hashT=hash.split(".");
else if(hash.length>2 || hash.indexOf("#@") >= 0){
hashT = (hash.indexOf("#@") >= 0) ? hash.replace( "#@","" ) : hash.replace( "#","" );
hashT=hashT.split(".");
if(typeof hashT == "string")
slug=hashT;
else
......
......@@ -1111,8 +1111,12 @@ var directory = {
}
if(typeof params.hash != "undefined")
str += "<br><a href='"+params.hash+"."+onepageKey+"' class='lbh letter-green url elipsis'>"+params.hash+"."+onepageKey+"</a>";
//if(typeof params.hash != "undefined")
//str += "<br><a href='"+params.hash+"."+onepageKey+"' class='lbh letter-green url elipsis'>"+params.hash+"."+onepageKey+"</a>";
if(typeof params.hash != "undefined"){
echoLabel= (typeof params.slug !="undefined") ? "@"+params.slug : params.hash;
str += "<br><a href='"+params.hash+"' class='"+linkAction+" letter-green url elipsis'>"+echoLabel+"</a>";
}
if(typeof params.url != "undefined" && params.url != null && params.url != "")
str += "<br><a href='"+params.url+"' class='lbh text-light url bold elipsis'>"+params.url+"</a>";
......@@ -1162,7 +1166,7 @@ var directory = {
}
var addFollowBtn = ( $.inArray(params.type, ["news", "poi", "ressources", "classified"])>=0 ) ? false : true;
if(typeof params.edit != "undefined")
if(typeof params.edit != "undefined" && notNull(params.edit))
str += this.getAdminToolBar(params);
mylog.log("isFollowed ?", params.isFollowed, params.id, inMyContacts(params.typeSig, params.id),
......@@ -1228,7 +1232,7 @@ var directory = {
var addFollowBtn = ( $.inArray(params.type, ["poi","ressources"])>=0 ) ? false : true;
if(typeof params.edit != "undefined")
if(typeof params.edit != "undefined" && notNull(params.edit))
str += this.getAdminToolBar(params);
if(userId != null && userId != "" && params.id != userId && !inMyContacts(params.typeSig, params.id) && addFollowBtn && location.hash.indexOf("#page") < 0){
......@@ -2133,81 +2137,46 @@ var directory = {
cityPanelHtml : function(params){
mylog.log("-----------cityPanelHtml", params);
var domContainer=(notNull(params.input)) ? params.input+" .scopes-container" : "";
valuesScopes = {
city : params._id.$id,
cityName : params.name,
postalCode : params.postalCode,
country : params.country,
allCP : params.allCP,
uniqueCp : params.uniqueCp,
level1 : params.level1,
level1Name : params.level1Name
}
typeSearchCity="city";
levelSearchCity="city";
if( notEmpty( params.nameCity ) ){
valuesScopes.name = params.nameCity ;
}
if( notEmpty( params.uniqueCp ) ){
valuesScopes.uniqueCp = params.uniqueCp;
}
if( notEmpty( params.level4 ) && valuesScopes.id != params.level4){
valuesScopes.level4 = params.level4 ;
valuesScopes.level4Name = params.level4Name ;
}
if( notEmpty( params.level3 ) && valuesScopes.id != params.level3 ){
valuesScopes.level3 = params.level3 ;
valuesScopes.level3Name = params.level3Name ;
}
if( notEmpty( params.level2 ) && valuesScopes.id != params.level2){
valuesScopes.level2 = params.level2 ;
valuesScopes.level2Name = params.level2Name ;
}
str = "";
str += "<a href='javascript:' class='col-md-12 col-sm-12 col-xs-12 no-padding communecterSearch item-globalscope-checker searchEntity' ";
str += "data-scope-value='" + params._id.$id + "' " +
"data-scope-name='" + params.name + "' " +
"data-scope-level='"+levelSearchCity+"' " +
"data-scope-type='"+typeSearchCity+"' " +
"data-scope-values='"+JSON.stringify(valuesScopes)+"' " +
"data-scope-notsearch='"+true+"' "+
"data-append-container='"+domContainer+"' ";
str += ">";
str += "<div class='col-xs-12 margin-bottom-10 "+params.type+" "+params.elTagsList+" '>";
str += "<div class='padding-10 informations'>";
str += "<div class='entityRight no-padding'>";
// params.hash = ""; //#main-col-search";
// params.onclick = 'setScopeValue($(this))'; //"'+params.name.replace("'", "\'")+'");';
// params.onclickCp = 'setScopeValue($(this));';
// params.target = "";
// params.dataId = params.name;
typeSearchCity='city';
levelSearchCity='city';
var title = "<span> " + params.name + " " + (notEmpty(params.postalCode) ? " - " + params.postalCode : "") +"</span>" ;
var subTitle = "";
str = '';
str += '<a href="javascript:" class="col-md-12 col-sm-12 col-xs-12 no-padding communecterSearch item-globalscope-checker searchEntity" ';
str += 'data-scope-value="' + params._id.$id + '"' +
'data-scope-name="' + params.name + '"' +
'data-scope-level="'+levelSearchCity+'"' +
'data-scope-type="'+typeSearchCity+'"' +
//'data-scope-values="'+JSON.stringify(valuesScopes)+'"' +
'data-scope-notsearch="'+true+'"'+
'data-append-container="'+domContainer+'"';
str += '>';
str += '<div class="col-xs-12 margin-bottom-10 '+params.type+' '+params.elTagsList+' ">';
str += '<div class="padding-10 informations">';
str += '<div class="entityRight no-padding">';
var title = '<span> ' + params.name + ' ' + (notEmpty(params.postalCode) ? ' - ' + params.postalCode : '') +'</span>' ;
var subTitle = '';
if( notEmpty( params.level4Name ) )
subTitle += (subTitle == "" ? "" : ", ") + params.level4Name ;
subTitle += (subTitle == '' ? '' : ', ') + params.level4Name ;
if( notEmpty( params.level3Name ) )
subTitle += (subTitle == "" ? "" : ", ") + params.level3Name ;
subTitle += (subTitle == '' ? '' : ', ') + params.level3Name ;
if( notEmpty( params.level2Name ) )
subTitle += (subTitle == "" ? "" : ", ") + params.level2Name ;
subTitle += (subTitle == '' ? '' : ', ') + params.level2Name ;
subTitle += (subTitle == "" ? "" : ", ") + params.country ;
str += " <span class='entityName letter-red '>"+
//'<span class="col-xs-1">'+
"<i class='fa fa-university'></i>" + title +
"<br/>"+
"<span style='color : grey; font-size : 13px'>"+subTitle+"</span>"+
"</span>";
subTitle += (subTitle == '' ? '' : ', ') + params.country ;
str += ' <span class="entityName letter-red ">'+
'<i class="fa fa-university"></i>' + title +
'<br/>'+
'<span style="color : grey; font-size : 13px">'+subTitle+'</span>'+
'</span>';
str += "</div>";
str += "</div>";
str += "</div>";
str += "</a>";
str += '</div>';
str += '</div>';
str += '</div>';
str += '</a>';
return str;
},
// ********************************
......@@ -2216,96 +2185,74 @@ var directory = {
zonePanelHtml : function(params){
mylog.log("-----------zonePanelHtml", params);
var domContainer=(notNull(params.input)) ? params.input+" .scopes-container" : "";
valuesScopes = {
id : params._id.$id,
name : params.name,
country : params.countryCode,
level : params.level
}
// valuesScopes = {
// id : params._id.$id,
// name : params.name,
// country : params.countryCode,
// level : params.level
// }
if(params.level.indexOf("1") >= 0){
typeSearchCity="level1";
levelSearchCity="1";
valuesScopes.numLevel = 1;
}else if(params.level.indexOf("2") >= 0){
typeSearchCity="level2";
levelSearchCity="2";
valuesScopes.numLevel = 2;
}else if(params.level.indexOf("3") >= 0){
typeSearchCity="level3";
levelSearchCity="3";
valuesScopes.numLevel = 3;
}else if(params.level.indexOf("4") >= 0){
typeSearchCity="level4";
levelSearchCity="4";
valuesScopes.numLevel = 4;
}
if(notNull(typeSearchCity))
valuesScopes.type = typeSearchCity;
mylog.log("valuesScopes test", (valuesScopes.id != params.level1), valuesScopes.id, params.level1);
if( notEmpty( params.level1 ) && valuesScopes.id != params.level1){
mylog.log("valuesScopes test", (valuesScopes.id != params.level1), valuesScopes.id, params.level1);
valuesScopes.level1 = params.level1 ;
valuesScopes.level1Name = params.level1Name ;
}
var subTitle = "";
if( notEmpty( params.level4 ) && valuesScopes.id != params.level4){
valuesScopes.level4 = params.level4 ;
valuesScopes.level4Name = params.level4Name ;
if( notEmpty( params.level4 ) && params.id != params.level4){
subTitle += (subTitle == "" ? "" : ", ") + params.level4Name ;
}
if( notEmpty( params.level3 ) && valuesScopes.id != params.level3 ){
valuesScopes.level3 = params.level3 ;
valuesScopes.level3Name = params.level3Name ;
if( notEmpty( params.level3 ) && params.id != params.level3 ){
subTitle += (subTitle == "" ? "" : ", ") + params.level3Name ;
}
if( notEmpty( params.level2 ) && valuesScopes.id != params.level2){
valuesScopes.level2 = params.level2 ;
valuesScopes.level2Name = params.level2Name ;
if( notEmpty( params.level2 ) && params.id != params.level2){
subTitle += (subTitle == "" ? "" : ", ") + params.level2Name ;
}
str = "";
str += "<a href='javascript:' class='col-md-12 col-sm-12 col-xs-12 no-padding communecterSearch item-globalscope-checker searchEntity' ";
str += "data-scope-value='" + params._id.$id + "' " +
"data-scope-name='" + params.name + "' " +
"data-scope-level='"+levelSearchCity+"' " +
"data-scope-type='"+typeSearchCity+"' " +
"data-scope-values='"+JSON.stringify(valuesScopes)+"' " +
"data-scope-notsearch='"+true+"' "+
"data-append-container='"+domContainer+"' ";
str += ">";
str += "<div class='col-xs-12 margin-bottom-10 "+params.type+" "+params.elTagsList+" '>";
str += "<div class='padding-10 informations'>";
str += "<div class='entityRight no-padding'>";
// params.hash = ""; //#main-col-search";
// params.onclick = 'setScopeValue($(this))'; //"'+params.name.replace("'", "\'")+'");';
// params.onclickCp = 'setScopeValue($(this));';
// params.target = "";
str = '';
str += '<a href="javascript:" class="col-md-12 col-sm-12 col-xs-12 no-padding communecterSearch item-globalscope-checker searchEntity" ';
str += 'data-scope-value="' + params._id.$id + '" ' +
'data-scope-name="' + params.name + '" ' +
'data-scope-level="'+levelSearchCity+'" ' +
'data-scope-type="'+typeSearchCity+'" ' +
//'data-scope-values="'+JSON.stringify(valuesScopes)+'" ' +
'data-scope-notsearch="'+true+'" '+
'data-append-container="'+domContainer+'" ';
str += '>';
str += '<div class="col-xs-12 margin-bottom-10 '+params.type+' '+params.elTagsList+' ">';
str += '<div class="padding-10 informations">';
str += '<div class="entityRight no-padding">';
// params.hash = '; //'main-col-search';
// params.onclick = "setScopeValue($(this))"; //'"+params.name.replace('"', '\"')+"');";
// params.onclickCp = "setScopeValue($(this));";
// params.target = ';
// params.dataId = params.name;
var title = "<span>" + params.name + "</span>" ;
subTitle += (subTitle == "" ? "" : ", ") + params.countryCode;
str += " <span class='entityName letter-red'>"+
//'<span class="col-xs-1">'+
"<i class='fa fa-bullseye bold text-red'></i>"+
"<i class='fa bold text-dark'>"+
var title = '<span>' + params.name + '</span>' ;
subTitle += (subTitle == '' ? '' : ', ') + params.countryCode;
str += ' <span class="entityName letter-red">'+
'<i class="fa fa-bullseye bold text-red"></i>'+
'<i class="fa bold text-dark">'+
levelSearchCity+
"</i> "+
//"</span> "+
'</i> '+
title +
"<br/>"+
"<span style='color : grey; font-size : 13px'>"+subTitle+"</span>"+
"</span>";
str += "</div>";
str += "</div>";
str += "</div>";
str += "</a>";
'<br/>'+
'<span style="color : grey; font-size : 13px">'+subTitle+'</span>'+
'</span>';
str += '</div>';
str += '</div>';
str += '</div>';
str += '</a>';
return str;
},
// ********************************
......@@ -3119,7 +3066,7 @@ var directory = {
params.hash = '#page.type.'+params.type+'.id.' + params.id;
if(typeof params.slug != "undefined" && params.slug != "" && params.slug != null)
params.hash = "#" + params.slug;
params.hash = "#@" + params.slug;
if(typeof networkJson != "undefined" && typeof networkJson.dataSrc != "undefined")
params.hash = params.source;
......
......@@ -579,21 +579,25 @@ function bindAboutPodElement() {
}
},
beforeSave : function(){
mylog.log("beforeSave");
mylog.log("beforeSave", contextData["socialNetwork"]);
//removeFieldUpdateDynForm(contextData.type);
var SNetwork = [ "telegram", "github", "skype", "twitter", "facebook", "gpplus", "instagram", "diaspora", "mastodon"];
$.each(SNetwork, function(key, val){
mylog.log("val", val);
mylog.log("val2", $("#ajaxFormModal #"+val).val(), $("#ajaxFormModal #"+val).length);
if( notNull(contextData["socialNetwork"]) &&
notNull(contextData["socialNetwork"][val]) &&
( $("#ajaxFormModal #"+val).length &&
$("#ajaxFormModal #"+val).val().trim() == contextData["socialNetwork"][val] ) ) {
mylog.log("if", val);
$("#ajaxFormModal #"+val).remove();
} else if ( ( !notNull(contextData["socialNetwork"]) ||
!notNull(contextData["socialNetwork"][val]) ) && $("#ajaxFormModal #"+val).length )
!notNull(contextData["socialNetwork"][val]) ) && $("#ajaxFormModal #"+val).length ){
mylog.log("else", val);
$("#ajaxFormModal #"+val).remove();
}
});
},
afterSave : function(data){
......
......@@ -234,13 +234,103 @@ function autoCompleteSearchGS(search, indexMin, indexMax, input){
str += "</a>";
}else{
mylog.log("Here");
o.input = input;
if(type == "city")
mylog.log("Here",o);
if(type == "city"){
var valuesScopes = {
city : o._id.$id,
cityName : o.name,
postalCode : o.postalCode,
country : o.country,
allCP : o.allCP,
uniqueCp : o.uniqueCp,
level1 : o.level1,
level1Name : o.level1Name
}
if( notEmpty( o.nameCity ) ){
valuesScopes.name = o.nameCity ;
}
if( notEmpty( o.uniqueCp ) ){
valuesScopes.uniqueCp = o.uniqueCp;
}
if( notEmpty( o.level4 ) && valuesScopes.id != o.level4){
valuesScopes.level4 = o.level4 ;
valuesScopes.level4Name = o.level4Name ;
}
if( notEmpty( o.level3 ) && valuesScopes.id != o.level3 ){
valuesScopes.level3 = o.level3 ;
valuesScopes.level3Name = o.level3Name ;
}
if( notEmpty( o.level2 ) && valuesScopes.id != o.level2){
valuesScopes.level2 = o.level2 ;
valuesScopes.level2Name = o.level2Name ;
}
myScopes.search[valuesScopes.city] = valuesScopes;
str += directory.cityPanelHtml(o);
else if(type == "zone")
}
else if(type == "zone"){
valuesScopes = {
id : o._id.$id,
name : o.name,
country : o.countryCode,
level : o.level
}
if(o.level.indexOf("1") >= 0){
typeSearchCity="level1";
levelSearchCity="1";
valuesScopes.numLevel = 1;
}else if(o.level.indexOf("2") >= 0){
typeSearchCity="level2";
levelSearchCity="2";
valuesScopes.numLevel = 2;
}else if(o.level.indexOf("3") >= 0){
typeSearchCity="level3";
levelSearchCity="3";
valuesScopes.numLevel = 3;
}else if(o.level.indexOf("4") >= 0){
typeSearchCity="level4";
levelSearchCity="4";
valuesScopes.numLevel = 4;
}
if(notNull(typeSearchCity))
valuesScopes.type = typeSearchCity;
mylog.log("valuesScopes test", (valuesScopes.id != o.level1), valuesScopes.id, o.level1);
if( notEmpty( o.level1 ) && valuesScopes.id != o.level1){
mylog.log("valuesScopes test", (valuesScopes.id != o.level1), valuesScopes.id, o.level1);
valuesScopes.level1 = o.level1 ;
valuesScopes.level1Name = o.level1Name ;
}
var subTitle = "";
if( notEmpty( o.level4 ) && valuesScopes.id != o.level4){
valuesScopes.level4 = o.level4 ;
valuesScopes.level4Name = o.level4Name ;
subTitle += (subTitle == "" ? "" : ", ") + o.level4Name ;
}
if( notEmpty( o.level3 ) && valuesScopes.id != o.level3 ){
valuesScopes.level3 = o.level3 ;
valuesScopes.level3Name = o.level3Name ;
subTitle += (subTitle == "" ? "" : ", ") + o.level3Name ;
}
if( notEmpty( o.level2 ) && valuesScopes.id != o.level2){
valuesScopes.level2 = o.level2 ;
valuesScopes.level2Name = o.level2Name ;
subTitle += (subTitle == "" ? "" : ", ") + o.level2Name ;
}
myScopes.search[valuesScopes.id] = valuesScopes;
str += directory.zonePanelHtml(o);
}
// var valuesScopes = {};
// if(type == "city"){
// valuesScopes = {
......
......@@ -263,10 +263,74 @@ var Login = function() {
data: params,
success: function(data){
if (data.result) {
alert(data.msg);
window.location.reload();
$('.modal').modal('hide');
$("#modalNewPasswordSuccess").modal("show");
// Hide modal if "Okay" is pressed
$('#modalNewPasswordSuccess .btn-default').click(function() {
$('.modal').modal('hide');
});
} else if (data.errId == "UNKNOWN_ACCOUNT_ID") {
if (confirm(data.msg)) {
toastr.error(data.msg);
$(".forgotBtn").prop("disabled", false).data("loading", false);
forgotBtn.stop();
}
},
error: function(data) {
toastr.error("Something went really bad : contact your administrator !");
},
dataType: "json"
});
return false;
},
invalidHandler : function(event, validator) {//display error alert on form submit
errorHandler2.show();
forgotBtn.stop();
}
});
};
var runEmailValidationValidator = function() {
var form2 = $('.form-email-activation');
var errorHandler2 = $('.errorHandler', form2);
var sendValidateEmailBtn = null;
Ladda.bind('.sendValidateEmailBtn', {
callback: function (instance) {
sendValidateEmailBtn = instance;
}
});
form2.validate({
rules : {
email2 : {
required : true
}
},
submitHandler : function(form) {
errorHandler2.hide();
sendValidateEmailBtn.start();
var params = {
"email" : $("#modalSendActivation #email2").val(),
"type" : "validateEmail"
};
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/person/sendemail",
data: params,
success: function(data){
if (data.result) {
//$("#modalRegisterSuccessContent").html("<h3><i class='fa fa-smile-o fa-4x text-green'></i><br><br> "+data.msg+"</h3>");
$('.modal').modal('hide');
$("#modalSendAgainSuccess").modal("show");
// Hide modal if "Okay" is pressed
$('#modalSendAgainSuccess .btn-default').click(function() {
$('.modal').modal('hide');
//window.location.href = baseUrl+'/#default.live';
//window.location.href = baseUrl+"/"+moduleId;
//window.location.reload();
});
} else if (data.errId == "UNKNOWN_ACCOUNT_ID") {
toastr.error(data.msg);
$(".sendValidateEmailBtn").prop("disabled", false).data("loading", false);
sendValidateEmailBtn.stop();
/*if (confirm(data.msg)) {
$('.box-email').removeClass("animated flipInX").addClass("animated bounceOutRight").on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$(this).hide().removeClass("animated bounceOutRight");
});
......@@ -276,7 +340,7 @@ var Login = function() {
});
} else {
window.location.reload();
}
}*/
}
},
error: function(data) {
......@@ -288,7 +352,7 @@ var Login = function() {
},
invalidHandler : function(event, validator) {//display error alert on form submit
errorHandler2.show();
forgotBtn.stop();
sendValidateEmailBtn.stop();
}
});
};
......@@ -430,6 +494,7 @@ var Login = function() {
runSetDefaultValidation();
runLoginValidator();
runForgotValidator();
runEmailValidationValidator();
runRegisterValidator();
}
};
......
......@@ -130,7 +130,7 @@ function getFloopItem(id, type, value){
'<span class="info-contact">' +
'<span class="name-contact text-dark text-bold" idcontact="'+id+'">' + value.name + '</span>'+
'<br/>'+
'<span class="cp-contact text-light pull-left" idcontact="'+id+'">' + cp + ' </span>'+
'<span class="cp-contact text-light pull-left" idcontact="'+id+'">' + cp + '&nbsp;</span>'+
'<span class="city-contact text-light pull-left" idcontact="'+id+'">' + city + '</span>'+
'</span>' +
'</div>' +
......
This diff is collapsed.
......@@ -273,11 +273,18 @@ function bindScopesInputEvent(news){
localStorage.setItem("myScopes",JSON.stringify(myScopes));
if(search.app=="territorial") searchEngine.initTerritorialSearch();
mylog.log("globalscope-checker", $(this).data("scope-name"), $(this).data("scope-type"));
mylog.log("globalscope-checker values", myScopes.search[$(this).data("scope-value")]);
changeCommunexionScope( $(this).data("scope-value"), $(this).data("scope-name"),
$(this).data("scope-type"), $(this).data("scope-level"),
$(this).data("scope-values"), notSearch, testCo, $(this).data("append-container")) ;
myScopes.search[$(this).data("scope-value")], notSearch, testCo, $(this).data("append-container")) ;
});
}
function countFavoriteScope(){
count=0;
if(notNull(myScopes.multiscopes))
......
......@@ -865,7 +865,7 @@
this.checkListElementMap(thisMap);