Commit 252ef609 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

clean up co.js with url Object

parent 7ed99565
This diff is collapsed.
......@@ -174,7 +174,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax){
type = typeObj[o.type].ctrl;
//if(type=="citoyen") type = "person";
var url = "javascript:"; //baseUrl+'/'+moduleId+ "/default/simple#" + o.type + ".detail.id." + id;
var onclick = 'loadByHash("#' + type + '.detail.id.' + id + '");';
var onclick = 'url.loadByHash("#' + type + '.detail.id.' + id + '");';
var onclickCp = "";
var target = " target='_blank'";
var dataId = "";
......
......@@ -520,7 +520,7 @@ var directory = {
//if(type=="citoyen") type = "person";
var onclick = 'loadByHash("' + url + '");';
var onclick = 'url.loadByHash("' + url + '");';
var onclickCp = "";
var target = " target='_blank'";
......
......@@ -10,7 +10,7 @@ function bindAboutPodElement() {
$("#changePasswordBtn").click(function () {
mylog.log("changePasswordbuttton");
loadByHash('#person.changepassword.id.'+userId+'.mode.initSV', false);
url.loadByHash('#person.changepassword.id.'+userId+'.mode.initSV', false);
});
$("#downloadProfil").click(function () {
......@@ -810,7 +810,7 @@ function bindAboutPodElement() {
success: function(data){
if(data.result){
toastr.success(data.msg);
loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
url.loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
}
}
});
......@@ -855,7 +855,7 @@ function bindAboutPodElement() {
success: function(data){
if(data.result){
toastr.success(data.msg);
loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
url.loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
} else {
toastr.error(data.msg);
}
......
......@@ -886,7 +886,7 @@ function updateLocalityElement(){
}
Sig.restartMap();
Sig.showMapElements(Sig.map, contextMap);
loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
url.loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
}else{
changeMenuCommunextion(locality);
......@@ -898,18 +898,18 @@ function updateLocalityElement(){
var url = window.location.href ;
$('.showIfCommucted').removeClass("hidden");
if(url.indexOf("#person.detail.id."+userId) == -1) {
loadByHash("#person.detail.id."+userId);
url.loadByHash("#person.detail.id."+userId);
}else{
Sig.restartMap();
Sig.showMapElements(Sig.map, contextMap);
loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
url.loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
}
}
}else{
initData();
toastr.success(data.msg);
loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
url.loadByHash("#"+contextData.controller+".detail.id."+contextData.id);
}
}else{
......
......@@ -144,14 +144,14 @@ function autoCompleteSearchGS(search, indexMin, indexMax){
var url = (notEmpty(o.type) && notEmpty(id)) ?
'#co2.page.type.'+o.type+'.id.' + id : "";
//var onclick = 'loadByHash("#' + type + '.detail.id.' + id + '");';
//var onclick = 'url.loadByHash("#' + type + '.detail.id.' + id + '");';
var onclickCp = "";
var target = " target='_blank'";
var dataId = "";
if(type == "city"){
//url = "javascript:"; //#main-col-search";
url = '#co2.city.insee.' + insee + '.postalCode.'+postalCode; //"'+o.name.replace("'", "\'")+'");';
//onclickCp = 'loadByHash("#city.detail.insee.' + insee + '.postalCode.'+postalCode+'";';
//onclickCp = 'url.loadByHash("#city.detail.insee.' + insee + '.postalCode.'+postalCode+'";';
//target = "";
dataId = o.name; //.replace("'", "\'");
}
......@@ -253,7 +253,7 @@ function autoCompleteSearchGS(search, indexMin, indexMax){
Sig.showMapElements(Sig.map, mapElementsGS);
}
//$("#footerDropdownGS").append("<br><a class='btn btn-default' href='javascript:' onclick='loadByHash("+'"#default.directory"'+")'><i class='fa fa-plus'></i></a>");
//$("#footerDropdownGS").append("<br><a class='btn btn-default' href='javascript:' onclick='url.loadByHash("+'"#default.directory"'+")'><i class='fa fa-plus'></i></a>");
}
});
......
......@@ -245,7 +245,7 @@ function setScopeValue(btn){ mylog.log("setScopeValue");
$("#btn-geoloc-auto-menu .fa-crosshairs").attr("data-original-title", cityNameCommunexion);
$("#btn-geoloc-auto-menu .fa-crosshairs").attr("title", cityNameCommunexion);
$("#btn-geoloc-auto-menu").off(); //click(function(){ loadByHash("#city.detail.insee." + inseeCommunexion+"."+"postalCode."+cpCommunexion) });
$("#btn-geoloc-auto-menu").off(); //click(function(){ url.loadByHash("#city.detail.insee." + inseeCommunexion+"."+"postalCode."+cpCommunexion) });
$("#btn-geoloc-auto-menu").attr("href", '#city.detail.insee.' + inseeCommunexion+'.'+'postalCode.'+cpCommunexion);
$("#btn-geoloc-auto-menu").data("hash", "#city.detail.insee." + inseeCommunexion+"."+"postalCode."+cpCommunexion);
//mylog.log("HASHHHHHHHHHHHHHHHHHHHH", $("#btn-geoloc-auto-menu").data("hash"));
......@@ -268,14 +268,14 @@ function setScopeValue(btn){ mylog.log("setScopeValue");
if(!userId)
$(".btn-geoloc-auto").attr("onclick",
"loadByHash('#rooms.index.type.cities.id.' + countryCommunexion + '_'+ inseeCommunexion + '-'+ cpCommunexion)");
"url.loadByHash('#rooms.index.type.cities.id.' + countryCommunexion + '_'+ inseeCommunexion + '-'+ cpCommunexion)");
Sig.clearMap();
mylog.log("hash city ? ", location.hash.indexOf("#default.city"));
if(location.hash == "#default.home"){
//showLocalActorsCityCommunexion();
loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
url.loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
}else
if(location.hash == "#default.directory"){
startSearch();
......@@ -290,7 +290,7 @@ function setScopeValue(btn){ mylog.log("setScopeValue");
if(location.hash.indexOf("#city.detail") >= 0) {
//showLocalActorsCityCommunexion();
if(location.hash != "#city.detail.insee." + inseeCommunexion+"."+"postalCode."+cpCommunexion){
loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
url.loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
}else{
$("#btn-communecter").html("<i class='fa fa-check'></i> COMMUNECTÉ");
$("#btn-communecter").attr("onclick", "");
......@@ -309,14 +309,14 @@ function setScopeValue(btn){ mylog.log("setScopeValue");
showTwoStep("load-conf-communexion");
setCookies();
$(".btn-param-postal-code").attr("data-original-title", cityNameCommunexion + " en détail");
//$(".btn-param-postal-code").attr("onclick", "loadByHash('#city.detail.insee."+inseeCommunexion+"')");
//$(".btn-param-postal-code").attr("onclick", "url.loadByHash('#city.detail.insee."+inseeCommunexion+"')");
$(".search-loader").html("<i class='fa fa-check'></i> Vous êtes communecté : " + cityNameCommunexion + ', ' + cpCommunexion);
$(".lbl-btn-menu-name-city .lbl-btn-menu").html(cityNameCommunexion);
setTimeout(function(){ achiveTSRAddress(); /*showTwoStep("street");*/ }, 2000);
//showMap(false);
}else{
//showLocalActorsCityCommunexion();
loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
url.loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
}
}
......@@ -325,7 +325,7 @@ function setScopeValue(btn){ mylog.log("setScopeValue");
function showLocalActorsCityCommunexion(){
loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
url.loadByHash("#city.detail.insee."+inseeCommunexion+".postalCode."+cpCommunexion);
return;
mylog.log("showLocalActorsCityCommunexion");
......
......@@ -125,7 +125,7 @@ var Login = function() {
var url = requestedUrl;
//mylog.warn(url,", has #"+url.indexOf("#"),"count / : ",url.split("/").length - 1 );
if(backUrl != null){
loadByHash(backUrl);
url.loadByHash(backUrl);
backUrl = null;
} else if(url && url.indexOf("#") >= 0 ) {
//mylog.log("login 1",url);
......@@ -325,7 +325,7 @@ var Login = function() {
window.location.href = baseUrl+'/#default.live';
window.location.reload();
});
//loadByHash("#default.directory");
//url.loadByHash("#default.directory");
}
else {
$('.registerResult').html(data.msg);
......
......@@ -76,15 +76,15 @@ function bindEventMenu(){
$('.btn-menu0').click( function(e){
if(location.hash != "#default.twostepregister")
loadByHash("#default.home");
url.loadByHash("#default.home");
else
loadByHash("#default.twostepregister");
url.loadByHash("#default.twostepregister");
} );
$('.btn-menu2')
.click(function(e){
if(location.hash != "#default.directory" || isMapEnd == false)
loadByHash("#default.directory");
url.loadByHash("#default.directory");
else showMap(false);
})
.mouseenter(function(e){
......@@ -97,7 +97,7 @@ function bindEventMenu(){
$('.btn-menu3')
.click(function(e){
if(location.hash != "#default.agenda" || isMapEnd == false)
loadByHash("#default.agenda");
url.loadByHash("#default.agenda");
else showMap(false);
})
.mouseenter(function(e){
......@@ -110,7 +110,7 @@ function bindEventMenu(){
$('.btn-menu4')
.click(function(e){
if(location.hash != "#default.news" || isMapEnd == false)
loadByHash("#default.news");
url.loadByHash("#default.news");
else showMap(false);
})
.mouseenter(function(e){
......@@ -122,8 +122,8 @@ function bindEventMenu(){
// $('.btn-menu3').click(function(e){ loadByHash("#default.agenda"); }).mouseenter(function(e){ toggle(".explainAgenda",".explain")});
//$('.btn-menu4').click(function(e){ loadByHash("#default.news"); }).mouseenter(function(e){ toggle(".explainNews",".explain")} );
// $('.btn-menu3').click(function(e){ url.loadByHash("#default.agenda"); }).mouseenter(function(e){ toggle(".explainAgenda",".explain")});
//$('.btn-menu4').click(function(e){ url.loadByHash("#default.news"); }).mouseenter(function(e){ toggle(".explainNews",".explain")} );
$('.btn-menu5').click(function(e){
showFloopDrawer(true);
})
......@@ -207,7 +207,7 @@ function bindEventMenu(){
$(".btn-geoloc-auto").click(function(e){
//mylog.log("cookie", $.cookie('inseeCommunexion'));
if($.cookie('inseeCommunexion')){
//loadByHash("#city.detail.insee." + $.cookie('inseeCommunexion')+ ".postalCode." + $.cookie('cpCommunexion'));
//url.loadByHash("#city.detail.insee." + $.cookie('inseeCommunexion')+ ".postalCode." + $.cookie('cpCommunexion'));
}else{
if(geolocHTML5Done == false){
//$(".search-loader").html("<i class='fa fa-spin fa-circle-o-notch'></i> Géolocalisation en cours ...");
......
......@@ -171,7 +171,7 @@
$.each(allDayEvents, function(key, dayEvents){
if (typeof dayEvents === "object") {
var action = 'loadByHash("#event.detail.id.'+dayEvents.id+'");';
var action = 'url.loadByHash("#event.detail.id.'+dayEvents.id+'");';
var item = "<li>";
var imgProfil = "<i class='badge bg-orange fa fa-calendar'></i>";
if (typeof dayEvents.thumb_url != "undefined" && dayEvents.thumb_url != "") {
......
......@@ -14,7 +14,7 @@ dynForm = {
},
afterSave : function(){
elementLib.closeForm();
loadByHash(location.hash);
url.loadByHash(location.hash);
},
properties : {
info : {
......
......@@ -46,7 +46,7 @@ dynForm = {
$('.fine-uploader-manual-trigger').fineUploader('uploadStoredFiles');
else {
elementLib.closeForm();
loadByHash( location.hash );
url.loadByHash( location.hash );
}
},
beforeSave : function(){
......
......@@ -15,7 +15,7 @@ dynForm = {
$('.fine-uploader-manual-trigger').fineUploader('uploadStoredFiles');
else {
elementLib.closeForm();
loadByHash( location.hash );
url.loadByHash( location.hash );
}
},
properties : {
......
......@@ -30,7 +30,7 @@ dynForm = {
$('.fine-uploader-manual-trigger').fineUploader('uploadStoredFiles');
else {
elementLib.closeForm();
loadByHash( location.hash );
url.loadByHash( location.hash );
}
},
properties : {
......
......@@ -19,7 +19,7 @@ dynForm = {
$('.fine-uploader-manual-trigger').fineUploader('uploadStoredFiles');
else {
elementLib.closeForm();
loadByHash( location.hash );
url.loadByHash( location.hash );
}
},
beforeSave : function(){
......
......@@ -13,7 +13,7 @@ dynForm = {
}
},
afterSave : function(){
loadByHash(location.hash);
url.loadByHash(location.hash);
},
properties : {
info : {
......
......@@ -119,7 +119,7 @@ function runEventFormValidation(el) {
$("#newEventId").val(data.id["$id"]);
mylog.log(data);
addFloopEntity(data.id["$id"], "events", data.event);
loadByHash("#event.detail.id."+data.id["$id"]);
url.loadByHash("#event.detail.id."+data.id["$id"]);
} else {
toastr.error(data.msg);
......@@ -231,7 +231,7 @@ function runProjectFormValidation(el) {
$.unblockUI();
//mylog.dir(data);
addFloopEntity(data.id.$id, "projects", newProject);
loadByHash("#project.detail.id."+data.id.$id);
url.loadByHash("#project.detail.id."+data.id.$id);
} else {
$.unblockUI();
toastr.error(data.msg);
......
......@@ -31,7 +31,7 @@ function saveMultiScope(){ mylog.log("saveMultiScope() try - userId = ",userId);
function saveCookieMultiscope(){ //mylog.log("saveCookieMultiscope", typeof myMultiScopes);
$.cookie('multiscopes', JSON.stringify(myMultiScopes), { expires: 365, path: "/" });
/*if(location.hash.indexOf("#city.detail")==0)
loadByHash("#default.live");*/
url.loadByHash("#default.live");*/
}
function autocompleteMultiScope(){
......
......@@ -1029,7 +1029,7 @@ function saveNews(){
//if we need a month space to insert the news
if ( !$( "#"+'month'+monthSection.getMonth()+''+monthSection.getFullYear()).length ) {
loadByHash(location.hash);
url.loadByHash(location.hash);
}
}
......@@ -1139,7 +1139,7 @@ function initFormImages(){
}
function addMoreSpace(){
bootbox.dialog({
message: "You have attempt the limit of 20Mo of images for this "+contextParentType+"<br/>Please choose one of those two solutions beyond:<br/>Delete images in the <a href='javascript:;' onclick='bootbox.hideAll();loadByHash(\"#gallery.index.id."+contextParentId+".type."+contextParentType+"\")'>photo gallery</a> <br/><br/>OR<br/><br/> Subscribe 12€ to the NGO Open Atlas which takes in charge communecter.org on <a href='https://www.helloasso.com/associations/open-atlas' target='_blank'>helloAsso</a> for 20Mo more. <br/><br/>Effectively, stocking images represents a cost for us and donate to the NGO will demonstrate your contribution the project and to the common we built together",
message: "You have attempt the limit of 20Mo of images for this "+contextParentType+"<br/>Please choose one of those two solutions beyond:<br/>Delete images in the <a href='javascript:;' onclick='bootbox.hideAll();url.loadByHash(\"#gallery.index.id."+contextParentId+".type."+contextParentType+"\")'>photo gallery</a> <br/><br/>OR<br/><br/> Subscribe 12€ to the NGO Open Atlas which takes in charge communecter.org on <a href='https://www.helloasso.com/associations/open-atlas' target='_blank'>helloAsso</a> for 20Mo more. <br/><br/>Effectively, stocking images represents a cost for us and donate to the NGO will demonstrate your contribution the project and to the common we built together",
title: "Limit of <color class='red'>20 Mo</color> overhead"
});
}
......
......@@ -338,7 +338,7 @@ function buildLineHTML(newsObj,idSession,update)
authorId=newsObj.author.id;
else
authorId=newsObj.author._id.$id;
urlTarget = 'href="#person.detail.id.'+authorId+'" onclick="loadByHash(\'#person.detail.id.'+authorId+'\')"';
urlTarget = 'href="#person.detail.id.'+authorId+'" onclick="url.loadByHash(\'#person.detail.id.'+authorId+'\')"';
if (newsObj.author.name.length > 25)
nameAuthor = newsObj.author.name.substr(0,25)+"...";
else
......@@ -527,7 +527,7 @@ function buildHtmlUrlAndActionObject(obj){
titleAction = "a créé un besoin";
}
url = 'href="#'+redirectTypeUrl+'.detail.id.'+id+'" onclick="loadByHash(\'#'+redirectTypeUrl+'.detail.id.'+id+'\')"';
url = 'href="#'+redirectTypeUrl+'.detail.id.'+id+'" onclick="url.loadByHash(\'#'+redirectTypeUrl+'.detail.id.'+id+'\')"';
}
object=new Object;
object.url= url,
......@@ -933,7 +933,7 @@ function addMentionInText(textNews,mentions){
else
controler = "person";
textNews=array[0]+
"<span onclick='loadByHash(\"#"+controler+".detail.id."+value.id+"\")' onmouseover='$(this).addClass(\"text-blue\");this.style.cursor=\"pointer\";' onmouseout='$(this).removeClass(\"text-blue\");' style='color: #719FAB;'>"+
"<span onclick='url.loadByHash(\"#"+controler+".detail.id."+value.id+"\")' onmouseover='$(this).addClass(\"text-blue\");this.style.cursor=\"pointer\";' onmouseout='$(this).removeClass(\"text-blue\");' style='color: #719FAB;'>"+
value.name+
"</span>"+
array[1];
......
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