Commit fae891f0 authored by Clément Damiens's avatar Clément Damiens

commit full full full coInterface
parent 8e00d312
var CO3_TypeObj = class {
constructor(pRequeteAjax,pPHDB_Obj){
if(this.IsValidRequete(pRequeteAjax)){
this.params=this.MakeRequeteAjax(pRequeteAjax);
} else {
this.params=pPHDB_Obj||null;
}
}
PrepareRequeteAjax(pRequeteAjax){
pRequeteAjax["prepared"]=true;
return pRequeteAjax;
}
MakeRequeteAjax(pRequeteAjax){
if(this.IsValidRequete(pRequeteAjax)){
this.RequeteAjax=this.PrepareRequeteAjax(pRequeteAjax); //Stockage optional ?
let res = null;
//TODO : Requete AJAX
res = this.RequeteAjax["where"];
//renvoie obj
return res;
} else {
return null;
}
}
Count(){
if(this.IsDefined(this.params)){
return Object.keys(this.params).length;
}else{
return 0;
}
}
PreElementRenderHtml(pElementParams){
return this.OldshowResultsDirectoryHtml(pElementParams,null,null,null);
}
ElementRenderHtml(pElementParams){
let str = "";
str+="Objet";
return str;
}
PostElementRenderHtml(pElementStr){
return pElementStr;
}
RenderHtml(){
let str="";
for(let id in this.params){
if(this.IsDefined(this.params[id])){
str+=this.PostElementRenderHtml(this.ElementRenderHtml(this.PreElementRenderHtml(this.params[id])));
}
}
return str;
}
IsDefined(obj){
return ((typeof obj !=="undefined")&&(obj!=null)&&(obj!=""));
}
IsValidRequete(pRequeteAjax){
return this.IsDefined(pRequeteAjax);
}
SetCarousable(){
let first=true;
for(let id in this.params){
if(this.IsDefined(this.params[id])){
this.params[id].carousable=true;
if(first){
this.params[id].carousel_active=true;
first=false;
}
}
}
return this;
}
OldshowResultsDirectoryHtml( params, size, edit, viewMode){ //size == null || min || max
if ((typeof(params.id) == "undefined") && (typeof(params["_id"]) !== "undefined")) {
params.id = params['_id'];
} else if (typeof(params.id) == "undefined" && location.hash.indexOf("#interoperability") >= 0) {
params.id = Math.random();
params.type = "poi";
}
if((params["_id"]!=null) || (params.id!=null)){
params.size = size;
params.id = getObjectId(params);
mylog.log(params.id);
params.name = notEmpty(params.name) ? params.name : "";
params.description = notEmpty(params.shortDescription) ? params.shortDescription :
(notEmpty(params.message)) ? params.message :
(notEmpty(params.description)) ? params.description :
"";
var itemType="article";
//mapElements.push(params);
//alert("TYPE ----------- "+contentType+":"+params.name);
if(typeof edit != "undefined" && edit != false)
params.edit = edit;
if ( params.type && typeof typeObj.classifieds != "undefined" && $.inArray(params.type, typeObj.classifieds.subTypes )>=0 ) {
itemType = "classifieds";
} else if(typeof( typeObj[itemType] ) == "undefined") {
itemType="poi";
}
if( dyFInputs.get( itemType ) == null){
itemType="poi";
}
var typeIco = itemType;
if(directory.dirLog) mylog.warn("itemType",itemType,"typeIco",typeIco);
if(typeof params.typeOrga != "undefined")
typeIco = params.typeOrga;
if(typeof params.typeClassified != "undefined")
typeIco = params.typeClassified;
var obj = (dyFInputs.get(typeIco)) ? dyFInputs.get(typeIco) : typeObj["default"] ;
params.ico = "fa-"+obj.icon;
params.color = obj.color;
if(params.parentType){
if(directory.dirLog) mylog.log("params.parentType",params.parentType);
var parentObj = (dyFInputs.get(params.parentType)) ? dyFInputs.get(params.parentType) : typeObj["default"] ;
params.parentIcon = "fa-"+parentObj.icon;
params.parentColor = parentObj.color;
}
if((typeof searchObject.countType != "undefined" && searchObject.countType.length==1) && params.type == "classifieds" && typeof params.category != "undefined" && typeof modules[params.typeClassified] != "undefined"){
getIcoInModules=modules[params.typeClassified].categories;
params.ico = (typeof getIcoInModules.filters != "undefined" && typeof getIcoInModules.filters[params.category] != "undefined") ?
"fa-" + getIcoInModules.filters[params.category]["icon"] : "fa-bullhorn";
}
if(params.type=="poi"
&& typeof modules.poi != "undefined"
&& typeof modules.poi.categories != "undefined"
&& typeof modules.poi.categories.filters != "undefined"
&& typeof modules.poi.categories.filters[params.typePoi] != "undefined"
&& typeof modules.poi.categories.filters[params.typePoi].icon != "undefined")
params.ico="fa-"+modules.poi.categories.filters[params.typePoi].icon;
params.htmlIco ="<i class='fa "+ params.ico +" fa-2x bg-"+params.color+"'></i>";
params.useMinSize = typeof size != "undefined" && size == "min";
params.imgProfil = "";
if(!params.useMinSize){
params.imgProfil = "<i class='fa fa-image fa-2x'></i>";
params.imgMediumProfil = "<i class='fa fa-image fa-2x'></i>";
params.imgFullProfil = "<i class='fa fa-image fa-2x'></i>";
}
if("undefined" != typeof directory.costum && (directory.costum!=null)
&& typeof directory.costum.results != "undefined"
&& typeof directory.costum.results[params.type] != "undefined"
&& typeof directory.costum.results[params.type].defaultImg != "undefined")
{
params.imgMediumProfil= "<img class='img-responsive' onload='directory.checkImage(this);' src='"+assetPath+directory.costum.results[params.type].defaultImg+"'/>";
params.imgFullProfil= "<img class='img-responsive' onload='directory.checkImage(this);' src='"+assetPath+directory.costum.results[params.type].defaultImg+"'/>";
}
if("undefined" != typeof params.profilImageUrl && params.profilImageUrl != "")
params.imgFullProfil= "<img class='img-responsive' onload='directory.checkImage(this);' src='"+baseUrl+params.profilImageUrl+"'/>";
else if(this.getVideoThumb(params)!="")
params.imgFullProfil= "<img class='img-responsive' src='"+this.getVideoThumb(params)+"'/>";
if("undefined" != typeof params.profilMediumImageUrl && params.profilMediumImageUrl != "")
params.imgMediumProfil= "<img class='img-responsive' onload='directory.checkImage(this);' src='"+baseUrl+params.profilMediumImageUrl+"'/>";
else if(this.getVideoThumb(params)!="")
params.imgMediumProfil= "<img class='img-responsive' src='"+this.getVideoThumb(params)+"'/>";
if("undefined" != typeof params.profilThumbImageUrl && params.profilThumbImageUrl != "")
params.imgProfil= "<img class='shadow2' src='"+baseUrl+params.profilThumbImageUrl+"'/>";
else if(this.getVideoThumb(params)!="")
params.imgProfil= "<img class='shadow2' src='"+this.getVideoThumb(params)+"'/>";
params.imgBanner = "";
if(!params.useMinSize)
params.imgBanner = "<i class='fa fa-image fa-2x'></i>";
if (false && typeof params.addresses != "undefined" && params.addresses != null) {
$.each(params.addresses, function(key, val){
//console.log("second address", val);
var postalCode = val.address.postalCode ? val.address.postalCode : "";
var cityName = val.address.addressLocality ? val.address.addressLocality : "";
params.fullLocality += "<br>"+ postalCode + " " + cityName;
});
}
params.type = dyFInputs.get(itemType).col;
params.urlParent = (notEmpty(params.parentType) && notEmpty(params.parentId)) ?
'#page.type.'+params.parentType+'.id.' + params.parentId : "";
// var urlImg = "/upload/communecter/color.jpg";
// params.profilImageUrl = urlImg;
/*if(dyFInputs.get(itemType) &&
dyFInputs.get(itemType).col == "poi" &&
typeof params.medias != "undefined" && typeof params.medias[0].content.image != "undefined")
params.imgProfil= "<img class='img-responsive' src='"+params.medias[0].content.image+"'/>";
*/
params.insee = params.insee ? params.insee : "";
params.postalCode = "", params.city="",params.cityName="";
if (params.address != null) {
params.city = params.address.addressLocality;
params.postalCode = params.cp ? params.cp : params.address.postalCode ? params.address.postalCode : "";
params.cityName = params.address.addressLocality ? params.address.addressLocality : "";
}
params.fullLocality = params.postalCode + " " + params.cityName;
params.hash = '#page.type.'+params.type+'.id.' + params.id;
if(typeof params.slug != "undefined" && params.slug != "" && params.slug != null)
params.hash = "#@" + params.slug;
if(typeof networkJson != "undefined" && typeof networkJson.dataSrc != "undefined")
params.hash = params.source;
params.onclick = 'urlCtrl.loadByHash("' + params.url + '");';
if(params.type=="circuits")
params.hash = '#circuit.index.id.' + params.id;
params.onclick = 'urlCtrl.loadByHash("' + params.url + '");';
if( params.type == "poi" && params.source && ( (params.source.key!=null) && params.source.key.substring(0,7) == "convert")) {
var interop_type = getTypeInteropData(params.source.key);
params.type = "poi.interop."+interop_type;
}
// params.tags = "";
params.elTagsList = "";
var thisTags = "";
if(typeof params.tags != "undefined" && params.tags != null){
$.each(params.tags, function(key, value){
if(typeof value != "undefined" && value != "" && value != "undefined"){
var tagTrad = typeof tradCategory[value] != "undefined" ? tradCategory[value] : value;
thisTags += "<span class='badge bg-transparent text-red btn-tag tag' data-tag-value='"+slugify(value, true)+"' data-tag-label='"+tagTrad+"'>#" + tagTrad + "</span> ";
// mylog.log("sluggify", value, slugify(value, true));
params.elTagsList += slugify(value, true)+" ";
}
});
params.tagsLbl = thisTags;
}else{
params.tagsLbl = "";
}
params.elRolesList = "";
var thisRoles = "";
params.rolesLbl = "";
if(typeof params.rolesLink != "undefined" && params.rolesLink != null){
thisRoles += "<small class='letter-blue'><b>"+trad.roleroles+" :</b> ";
thisRoles += params.rolesLink.join(", ");
$.each(params.rolesLink, function(key, value){
if(typeof value != "undefined" && value != "" && value != "undefined")
params.elRolesList += slugify(value)+" ";
});
thisRoles += "</small>";
params.rolesLbl = thisRoles;
}
params.updated = (params.updatedLbl!="") ? params.updatedLbl : null;
if((params.tobeactivated!=null) && params.tobeactivated == true){
params.isInviting = true ;
}
}
return params;
}
getVideoThumb(params){
if("undefined" != typeof params.medias && params.medias.length>0){
for(let i=0;i<params.medias.length;i++){
if("undefined" != typeof params.medias[i].content.image && params.medias[i].content.image!="")
return params.medias[i].content.image;
}
}
return "";
}
}
This diff is collapsed.
...@@ -17,7 +17,7 @@ var uiCoop = { ...@@ -17,7 +17,7 @@ var uiCoop = {
// location.hash="#@"+contextData.slug; // location.hash="#@"+contextData.slug;
$("#coop-data-container").html(""); $("#coop-data-container").html("");
}); });
//KScrollTo("#div-reopen-menu-left-container"); //coInterface.scrollTo("#div-reopen-menu-left-container");
//toogleNotif(false); //toogleNotif(false);
...@@ -265,7 +265,7 @@ var uiCoop = { ...@@ -265,7 +265,7 @@ var uiCoop = {
$(".tooltips").tooltip(); $(".tooltips").tooltip();
$("#modal-preview-coop").css("display","block"); $("#modal-preview-coop").css("display","block");
bindLBHLinks(); coInterface.bindLBHLinks();
if(typeof onSuccess == "function") onSuccess(); if(typeof onSuccess == "function") onSuccess();
}, },
......
...@@ -144,7 +144,7 @@ function slugUnique(searchValue){ ...@@ -144,7 +144,7 @@ function slugUnique(searchValue){
"<br><i class='fa fa-times'></i> " + tradDynForm["This URL is already used"]; "<br><i class='fa fa-times'></i> " + tradDynForm["This URL is already used"];
$("#ajaxFormModal #btn-submit-form").attr('disabled','disabled'); $("#ajaxFormModal #btn-submit-form").attr('disabled','disabled');
//bindLBHLinks(); //coInterface.bindLBHLinks();
} else { } else {
//response=true; //response=true;
if(!$("#ajaxFormModal #slug").parent().hasClass("has-success")){ if(!$("#ajaxFormModal #slug").parent().hasClass("has-success")){
...@@ -529,7 +529,7 @@ var dataHelper = { ...@@ -529,7 +529,7 @@ var dataHelper = {
invite = "#element.invite.type."+contextData.type+".id."+contextData.id; invite = "#element.invite.type."+contextData.type+".id."+contextData.id;
$("#mentionResult").html("<h4>Aucun résultat correspond. <br/>"+ $("#mentionResult").html("<h4>Aucun résultat correspond. <br/>"+
"<a href='"+invite+"' class='lbhp'>Invité par mail ?</a></h4>"); "<a href='"+invite+"' class='lbhp'>Invité par mail ?</a></h4>");
bindLBHLinks(); coInterface.bindLBHLinks();
} }
}, },
......
...@@ -133,7 +133,7 @@ function autoCompleteSearch(indexMin, indexMax, callBack){ ...@@ -133,7 +133,7 @@ function autoCompleteSearch(indexMin, indexMax, callBack){
$(".btn-start-search").removeClass("bg-dark"); $(".btn-start-search").removeClass("bg-dark");
if(indexMin==0 || (typeof pageEvent != "undefined" && pageEvent)){ if(indexMin==0 || (typeof pageEvent != "undefined" && pageEvent)){
simpleScroll(scrollH, 400); coInterface.simpleScroll(scrollH, 400);
$("#dropdown_search").html("<div class='col-md-12 col-sm-12 text-center search-loader text-dark'>"+ $("#dropdown_search").html("<div class='col-md-12 col-sm-12 text-center search-loader text-dark'>"+
"<i class='fa fa-spin fa-circle-o-notch'></i> "+trad.currentlyresearching+" ..."+ "<i class='fa fa-spin fa-circle-o-notch'></i> "+trad.currentlyresearching+" ..."+
"</div>"); "</div>");
...@@ -237,7 +237,7 @@ function autoCompleteSearch(indexMin, indexMax, callBack){ ...@@ -237,7 +237,7 @@ function autoCompleteSearch(indexMin, indexMax, callBack){
//remet l'icon "loupe" du bouton search //remet l'icon "loupe" du bouton search
$(".btn-start-search").html("<i class='fa fa-refresh'></i>"); $(".btn-start-search").html("<i class='fa fa-refresh'></i>");
//active les link lbh //active les link lbh
bindLBHLinks(); coInterface.bindLBHLinks();
searchObject.count=false; searchObject.count=false;
$.unblockUI(); $.unblockUI();
$("#map-loading-data").html(""); $("#map-loading-data").html("");
...@@ -448,7 +448,7 @@ function initPageTable(number){ ...@@ -448,7 +448,7 @@ function initPageTable(number){
function initBtnLink(){ mylog.log("initBtnLink"); function initBtnLink(){ mylog.log("initBtnLink");
bindLBHLinks(); coInterface.bindLBHLinks();
$(".followBtn").off().on("click", function(){ $(".followBtn").off().on("click", function(){
mylog.log(".followBtn"); mylog.log(".followBtn");
...@@ -3238,7 +3238,7 @@ var directory = { ...@@ -3238,7 +3238,7 @@ var directory = {
$(domId).html(str); $(domId).html(str);
//setTimeout(function(){ directory.checkImage(results);}, 200); //setTimeout(function(){ directory.checkImage(results);}, 200);
//active les link lbh //active les link lbh
bindLBHLinks(); coInterface.bindLBHLinks();
initBtnAdmin(); initBtnAdmin();
initBtnLink(); initBtnLink();
if(userId != ""){ if(userId != ""){
......
...@@ -293,7 +293,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){ ...@@ -293,7 +293,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){
//remet l'icon "loupe" du bouton search //remet l'icon "loupe" du bouton search
$(".btn-start-search").html("<i class='fa fa-refresh'></i>"); $(".btn-start-search").html("<i class='fa fa-refresh'></i>");
//active les link lbh //active les link lbh
bindLBHLinks(); coInterface.bindLBHLinks();
bindCommunexionScopeEvents() bindCommunexionScopeEvents()
// $(".start-new-communexion").click(function(){ // $(".start-new-communexion").click(function(){
...@@ -439,7 +439,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){ ...@@ -439,7 +439,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){
$(".dirStar").each(function(i,el){ $(".dirStar").each(function(i,el){
collection.applyColor($(el).data('type'),$(el).data('id')); collection.applyColor($(el).data('type'),$(el).data('id'));
}); });
bindLBHLinks(); coInterface.bindLBHLinks();
//parcours tous les boutons link pour vérifier si l'entité est déjà dans mon répertoire //parcours tous les boutons link pour vérifier si l'entité est déjà dans mon répertoire
$.each( $(".followBtn"), function(index, value){ $.each( $(".followBtn"), function(index, value){
var id = $(value).attr("data-id"); var id = $(value).attr("data-id");
......
...@@ -252,7 +252,7 @@ var formInMap = { ...@@ -252,7 +252,7 @@ var formInMap = {
$("#newElement_btnValidateAddress").click(function(){ $("#newElement_btnValidateAddress").click(function(){
formInMap.btnValideDisable(true); formInMap.btnValideDisable(true);
processingBlockUi(); themeObj.blockUi.show();
setTimeout(function(){ setTimeout(function(){
mylog.log("#newElement_btnValidateAddress"); mylog.log("#newElement_btnValidateAddress");
......
...@@ -441,7 +441,7 @@ function autoCompleteSearchGS(search, indexMin, indexMax, input){ ...@@ -441,7 +441,7 @@ function autoCompleteSearchGS(search, indexMin, indexMax, input){
urlCtrl.loadByHash("#search") urlCtrl.loadByHash("#search")
});*/ });*/
bindLBHLinks(); coInterface.bindLBHLinks();
//signal que le chargement est terminé //signal que le chargement est terminé
mylog.log("loadingDataGS false"); mylog.log("loadingDataGS false");
......
...@@ -62,29 +62,6 @@ function startNewCommunexion(country){ ...@@ -62,29 +62,6 @@ function startNewCommunexion(country){
}); });
} }
function resizeInterface()
{
mylog.log("resize");
var height = $("#mapCanvasBg").height() - 55;
$("#ajaxSV").css({"minHeight" : height});
//$("#menu-container").css({"minHeight" : height});
var heightDif = $("#search-contact").height() + $("#floopHeader").height() + 80 /* top */ + 0 /* bottom */;
var menuTopHeight = $("#mainNav").height();// - $(".toolbar").height();
//mylog.log("heightDif", heightDif);
$(".floopScroll").css({"minHeight" : height-heightDif});
$(".floopScroll").css({"maxHeight" : height-heightDif});
height = $("#mapCanvasBg").height() - 200;
$("#scroll-dashboard-dda").css("maxHeight", height);
//$(".my-main-container").css("min-height", $(".sigModuleBg").height()-menuTopHeight);
//$(".my-main-container").css("max-height", $(".sigModuleBg").height()-menuTopHeight);
//$(".my-main-container").css("height", $(".sigModuleBg").height()-menuTopHeight);
//$(".main-col-search").css("min-height", $(".sigModuleBg").height());
//$("ul.notifList").css({"maxHeight" : height-heightDif});
}
function checkScroll(){ function checkScroll(){
$(".main-top-menu").animate({ $(".main-top-menu").animate({
......
...@@ -125,8 +125,8 @@ function showNewsStream(){ ...@@ -125,8 +125,8 @@ function showNewsStream(){
//if(isFirst){ //render HTML for 1st load //if(isFirst){ //render HTML for 1st load
$("#newsstream").html(loading); $("#newsstream").html(loading);
simpleScroll(0, 500); coInterface.simpleScroll(0, 500);
//KScrollTo("#container-scope-filter"); //coInterface.scrollTo("#container-scope-filter");
ajaxPost("#newsstream",baseUrl+"/"+urlCtrl,null, function(news){ spinSearchAddon();}, "html"); ajaxPost("#newsstream",baseUrl+"/"+urlCtrl,null, function(news){ spinSearchAddon();}, "html");
//showTagsScopesMin(".list_tags_scopes"); //showTagsScopesMin(".list_tags_scopes");
/* $(window).bind("scroll",function(){ /* $(window).bind("scroll",function(){
......
...@@ -131,7 +131,7 @@ function loadStream(indexMin, indexMax){ console.log("load stream media"); ...@@ -131,7 +131,7 @@ function loadStream(indexMin, indexMax){ console.log("load stream media");
if(indexMin == 0){ if(indexMin == 0){
$("#timeline-live").html(""); $("#timeline-live").html("");
KScrollTo("#content-media"); coInterface.scrollTo("#content-media");
} }
$.ajax({ $.ajax({
......
...@@ -299,7 +299,7 @@ function buildNotifications(list, element, event, elementType, elementId) ...@@ -299,7 +299,7 @@ function buildNotifications(list, element, event, elementType, elementId)
setTimeout( function(){ setTimeout( function(){
//notifCount(false, element); //notifCount(false, element);
bindNotifEvents(element, event, elementType, elementId); bindNotifEvents(element, event, elementType, elementId);
//bindLBHLinks(); //coInterface.bindLBHLinks();
}, 800); }, 800);
//Usecase of the first load of notification //Usecase of the first load of notification
/*if(event == null){ /*if(event == null){
......
...@@ -148,7 +148,7 @@ function bindButtonMenu(){ ...@@ -148,7 +148,7 @@ function bindButtonMenu(){
mylog.log("open-confidentiality"); mylog.log("open-confidentiality");
toogleNotif(false); toogleNotif(false);
smallMenu.open( dataHelper.markdownToHtml($("#descriptionMarkdown").html())); smallMenu.open( dataHelper.markdownToHtml($("#descriptionMarkdown").html()));
bindLBHLinks(); coInterface.bindLBHLinks();
}); });
$(".open-directory").click(function(){ $(".open-directory").click(function(){
...@@ -214,7 +214,7 @@ function bindButtonMenu(){ ...@@ -214,7 +214,7 @@ function bindButtonMenu(){
responsiveMenuLeft(); responsiveMenuLeft();
location.hash=hashUrlPage+".view.curiculum"; location.hash=hashUrlPage+".view.curiculum";
toogleNotif(false); toogleNotif(false);
KScrollTo("#profil_imgPreview"); coInterface.scrollTo("#profil_imgPreview");
//history.pushState(null, "New Title", hashUrlPage+".view.detail"); //history.pushState(null, "New Title", hashUrlPage+".view.detail");
loadCuriculum(); loadCuriculum();
}); });
...@@ -255,7 +255,7 @@ function bindButtonMenu(){ ...@@ -255,7 +255,7 @@ function bindButtonMenu(){
//$(".central-section").hide(); //$(".central-section").hide();
$("#div-select-create").show(200); $("#div-select-create").show(200);