Commit 39838090 authored by Clément Damiens's avatar Clément Damiens
Browse files

Merge branch 'development'

Conflicts:
	assets/js/default/directory.js
	views/default/directoryjs.php
parents d8831c43 2abe981e
function bindCommunexionScopeEvents(){
$(".btn-decommunecter").click(function(){
$(".btn-decommunecter").off().on('click',function(){
activateGlobalCommunexion(false);
});
$(".item-globalscope-checker").click(function(){
$(".item-globalscope-checker").addClass("inactive");
$(this).removeClass("inactive");
......@@ -34,6 +35,10 @@ function bindCommunexionScopeEvents(){
if(actionOnSetGlobalScope=="filter"){
if(location.hash.indexOf("#live") >= 0){
startNewsSearch(true)
}
else if (location.hash.indexOf("#interoperability") >= 0) {
initTypeSearchInterop();
startSearchInterop(0,30);
}
else{
startSearch(0, indexStepInit);
......@@ -54,8 +59,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 +75,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>';
......@@ -84,6 +90,7 @@ function activateGlobalCommunexion(active, firstLoad){
//rebuildSearchScopeInput();
showTagsScopesMin();
bindCommunexionScopeEvents();
if(actionOnSetGlobalScope=="filter"){
if(location.hash.indexOf("#live") >=0)
startNewsSearch(true);
......@@ -117,7 +124,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 +137,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 +150,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" )
......
......@@ -592,7 +592,7 @@ function connectTo(parentType, parentId, childId, childType, connectType, parent
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/link/connect",
data: formData,
data: formData,
dataType: "json",
success: function(data) {
if(data.result){
......@@ -660,6 +660,7 @@ var urlCtrl = {
"#element" : {title:'DETAIL ENTITY', icon : 'legal'},
"#gallery" : {title:'ACTION ROOMS ', icon : 'photo'},
"#comment" : {title:'DISCUSSION ROOMS ', icon : 'comments'},
"#admin.checkgeocodage" : {title:'CHECKGEOCODAGE ', icon : 'download', useHeader: true},
"#admin.openagenda" : {title:'OPENAGENDA ', icon : 'download', useHeader: true},
"#admin.adddata" : {title:'ADDDATA ', icon : 'download', useHeader: true},
......@@ -676,6 +677,7 @@ var urlCtrl = {
"#adminpublic.index" : {title:'SOURCE ADMIN', icon : 'download', useHeader: true},
"#adminpublic.createfile" : {title:'IMPORT DATA', icon : 'download', useHeader : true},
"#adminpublic.adddata" : {title:'ADDDATA ', icon : 'download', useHeader : true},
"#adminpublic.interopproposed" : {title : 'INTEROP PROPOSED', icon : 'download', useHeader : true},
"#admin.cleantags" : {title : 'CLEAN TAGS', icon : 'download'},
"#default.directory" : {title:'COMMUNECTED DIRECTORY', icon : 'connectdevelop', menuId:"menu-btn-directory"},
"#default.news" : {title:'COMMUNECTED NEWS ', icon : 'rss', menuId:"menu-btn-news" },
......@@ -693,6 +695,10 @@ var urlCtrl = {
"#define." : {title:'TAG MAP ', icon : 'map-marker', action:function( hash ){ showDefinition("explain"+hash.split('.')[1]) } },
"#data.index" : {title:'OPEN DATA FOR ALL', icon : 'fa-folder-open-o'},
"#opendata" : {"alias":"#data.index"},
"#interoperability.copedia" : {title:'COPEDIA', icon : 'fa-folder-open-o','useHeader' : true},
"#interoperability.co-osm" : {title:'COSM', icon : 'fa-folder-open-o','useHeader' : true},
"#chatAction" : {title:'CHAT', icon : 'comments', action:function(){ rcObj.loadChat("","citoyens", true, true) }, removeAfterLoad : true },
},
shortVal : ["p","poi","s","o","e","pr","c","cl"/* "s","v","a", "r",*/],
......@@ -794,7 +800,6 @@ var urlCtrl = {
path = urlCtrl.convertToPath(hash);
pathT = path.split('/');
//open path in a modal (#openModal)
if(pathT[0] == "modal"){
path = path.substring(5);
alert(baseUrl+'/'+moduleId+path);
......@@ -2146,9 +2151,9 @@ function communecterUser(){
}
function updateLocalityEntities(addressesIndex, addressesLocality){
mylog.warn("updateLocalityEntities");
mylog.log("updateLocalityEntities", addressesIndex, addressesLocality);
$("#ajax-modal").modal("hide");
mylog.log("typeof formInMap.initUpdateLocality", typeof formInMap.initUpdateLocality);
if(typeof formInMap.initUpdateLocality != "undefined"){
var address = contextData.address ;
var geo = contextData.geo ;
......
......@@ -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);
......@@ -60,6 +60,8 @@ function startSearch(indexMin, indexMax, callBack){
if(levelCommunexion == 3) locality = inseeCommunexion;
if(levelCommunexion == 4) locality = inseeCommunexion;
if(levelCommunexion == 5) locality = "";
mylog.log("Locality : ", locality);
}
console.log("locality",locality);
autoCompleteSearch(name, locality, indexMin, indexMax, callBack);
......@@ -150,7 +152,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){
if(isMapEnd)
$("#map-loading-data").html("<i class='fa fa-spin fa-circle-o-notch'></i> chargement en cours");
mylog.dir(data);
//alert();
$.ajax({
......@@ -274,24 +276,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();
......@@ -330,7 +333,7 @@ function autoCompleteSearch(name, locality, indexMin, indexMax, callBack){
Sig.showMapElements(Sig.map, mapElements, "search", "Résultats de votre recherche");
if(typeof callBack == "function")
callBack();
callBack();
}
});
......@@ -667,7 +670,7 @@ var directory = {
colPos: "left",
dirLog : false,
defaultPanelHtml : function(params){
mylog.log("----------- defaultPanelHtml",params.type,params.name);
mylog.log("----------- defaultPanelHtml",params, params.type,params.name, params.url);
str = "";
str += "<div class='col-lg-4 col-md-6 col-sm-6 col-xs-12 searchEntityContainer "+params.type+" "+params.elTagsList+" "+params.elRolesList+" '>";
str += "<div class='searchEntity' id='entity"+params.id+"'>";
......@@ -832,7 +835,7 @@ var directory = {
// ********************************
elementPanelHtml : function(params){
if(directory.dirLog) mylog.log("----------- elementPanelHtml",params.type,params.name);
//mylog.log("----------- elementPanelHtml",params.type,params.name, params);
// mylog.log("----------- elementPanelHtml",params.type,params.name, params);
str = "";
var grayscale = ( ( notNull(params.isInviting) && params.isInviting == true) ? "grayscale" : "" ) ;
var tipIsInviting = ( ( notNull(params.isInviting) && params.isInviting == true) ? trad["Wait for confirmation"] : "" ) ;
......@@ -1569,6 +1572,9 @@ var directory = {
//if(directory.dirLog)
mylog.log("-----------proposalPanelHtml", params, key);
var idParentRoom = typeof params.idParentRoom != "undefined" ? params.idParentRoom : "";
if(idParentRoom == "" && params.type == "rooms") idParentRoom = params.id;
mylog.log("-----------idParentRoom", idParentRoom);
var name = (typeof params.title != "undefined" && params.title != "undefined") ? params.title : params.name;
var description = params.description.length > 200 ? params.description.substr(0, 200) + "..." : params.description;
name = escapeHtml(name);
......@@ -1808,11 +1814,23 @@ var directory = {
var str = "";
directory.colPos = "left";
if(typeof data == "object" && data!=null)
$.each(data, function(i, params) {
if(directory.dirLog) mylog.log("params", params, typeof params);
if(params["_id"] != null || params["id"] != null){
mylog.log("params", params, typeof params);
if ((typeof(params.id) == "undefined") && (typeof(params["_id"]) !== "undefined")) {
params['id'] = params['_id'];
} else if (typeof(params.id) == "undefined") {
params['id'] = Math.random();
params['type'] = "poi";
}
mylog.log("params", params["name"] , params.name, params.id, params["id"], typeof params["id"]);
if(notNull(params["_id"]) || notNull(params["id"])){
itemType=(contentType) ? contentType :params.type;
if( itemType ){
......@@ -1823,6 +1841,7 @@ var directory = {
var typeIco = i;
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 :
......@@ -1834,8 +1853,13 @@ var directory = {
if(typeof edit != "undefined" && edit != false)
params.edit = edit;
/*if( dyFInputs.get( itemType ) == null)
itemType="poi";*/
if(typeof( typeObj[itemType] ) == "undefined") {
itemType="poi";
}
if( dyFInputs.get( itemType ) == null)
itemType="poi";
typeIco = itemType;
if(directory.dirLog) mylog.warn("itemType",itemType,"typeIco",typeIco);
......@@ -1895,13 +1919,25 @@ var directory = {
params.urlParent = (notEmpty(params.parentType) && notEmpty(params.parentId)) ?
'#page.type.'+params.parentType+'.id.' + params.parentId : "";
//params.url = '#page.type.'+params.type+'.id.' + params.id;
params.hash = '#page.type.'+params.type+'.id.' + params.id;
/*if(params.type == "poi")
params.hash = '#element.detail.type.poi.id.' + params.id;*/
if( params.type == "poi" && params.source && params.source.insertOrign == "import") {
var interop_type = getTypeInteropData(params.source.key);
params.hash = getUrlForInteropDirectoryElements(interop_type, params.shortDescription, params.url);
params.url = params.hash;
params.color = getIconColorForInteropElements(interop_type);
params.htmlIco = getImageIcoForInteropElements(interop_type);
params.type = "poi.interop."+interop_type;
if (typeof params.tags == "undefined")
params.tags = [];
params.tags.push(interop_type);
} else {
params.onclick = 'urlCtrl.loadByHash("' + params.hash + '");';
params.hash = '#page.type.'+params.type+'.id.' + params.id;
}
params.onclick = 'urlCtrl.loadByHash("' + params.url + '");';
// params.tags = "";
params.elTagsList = "";
var thisTags = "";
if(typeof params.tags != "undefined" && params.tags != null){
......@@ -1961,6 +1997,11 @@ var directory = {
else
str += directory.defaultPanelHtml(params);
}
else if(params.type == "proposals" || params.type == "actions" || params.type == "rooms")
str += directory.coopPanelHtml(params);
else
str += directory.defaultPanelHtml(params);
}
}else{
......
......@@ -108,8 +108,6 @@ var formInMap = {
initUpdateLocality : function(address, geo, type, index){
mylog.log("initUpdateLocality", address, geo, type, index);
showMap(true);
if(address != null && geo != null ){
formInMap.NE_insee = address.codeInsee;
......@@ -234,7 +232,7 @@ var formInMap = {
$("#newElement_btnValidateAddress").click(function(){
$.blockUI();
processingBlockUi();
mylog.log("#newElement_btnValidateAddress");
if(notEmpty(formInMap.saveCities[formInMap.NE_insee])){
var obj = { city : formInMap.saveCities[formInMap.NE_insee] }
......@@ -681,7 +679,8 @@ var formInMap = {
}
},
initDropdown : function(){
initDropdown : function(){
mylog.log("initDropdown");
$("#dropdown-newElement_cp-found").html("<li><a href='javascript:' class='disabled'>"+trad['Currently researching']+"</a></li>");
$("#dropdown-newElement_city-found").html("<li><a href='javascript:' class='disabled'>"+trad['Search a city, a town or a postal code'] +"</a></li>");
},
......@@ -784,6 +783,7 @@ var formInMap = {
},
getLevel : function(){
mylog.log("getLevel");
if(notEmpty(formInMap.NE_localityId) &&
( typeof formInMap.NE_level1 == "undefined" || formInMap.NE_level1 == "" ||
typeof formInMap.NE_level2 == "undefined" || formInMap.NE_level2 == ""||
......
This diff is collapsed.
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['module'], factory);
} else if (typeof exports !== "undefined") {
factory(module);
} else {
var mod = {
exports: {}
};
factory(mod);
global.TimelineChart = mod.exports;
}
})(this, function (module) {
'use strict';
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var TimelineChart = function () {
function TimelineChart(element, data, opts, label_dbpedia, wikidataID) {
_classCallCheck(this, TimelineChart);
var self = this;
element.classList.add('timeline-chart');
var options = this.extendOptions(opts);
var allElements = data.reduce(function (agg, e) {
return agg.concat(e.data);
}, []);
var minDt = d3.min(allElements, this.getPointMinDt);
var maxDt = d3.max(allElements, this.getPointMaxDt);
var elementWidth = options.width || element.clientWidth;
var elementHeight = options.height || element.clientHeight;
var margin = {
top: 0,
right: 0,
bottom: 20,
left: 0
};
var width = elementWidth - margin.left - margin.right;
var height = elementHeight - margin.top - margin.bottom;
var groupWidth = 200;
var x = d3.time.scale().domain([minDt, maxDt]).range([groupWidth, width]);
var xAxis = d3.svg.axis().scale(x).orient('bottom').tickSize(-height);
var zoom = d3.behavior.zoom().x(x).on('zoom', zoomed);
var svg = d3.select(element).append('svg').attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom).append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')').call(zoom);
svg.append('defs').append('clipPath').attr('id', 'chart-content').append('rect').attr('x', groupWidth).attr('y', 0).attr('height', height).attr('width', width - groupWidth);
svg.append('rect').attr('class', 'chart-bounds').attr('x', groupWidth).attr('y', 0).attr('height', height).attr('width', width - groupWidth);
svg.append('g').attr('class', 'x axis').attr('transform', 'translate(0,' + height + ')').call(xAxis);
if (options.enableLiveTimer) {
self.now = svg.append('line').attr('clip-path', 'url(#chart-content)').attr('class', 'vertical-marker now').attr("y1", 0).attr("y2", height);
}
var groupHeight = height / data.length;
var groupSection = svg.selectAll('.group-section').data(data).enter().append('line').attr('class', 'group-section').attr('x1', 0).attr('x2', width).attr('y1', function (d, i) {
return groupHeight * (i + 1);
}).attr('y2', function (d, i) {
return groupHeight * (i + 1);
});
var groupLabels = svg.selectAll('.group-label').data(data).enter().append('text').attr('class', 'group-label').attr('x', 0).attr('y', function (d, i) {
return groupHeight * i + groupHeight / 2 + 5.5;
}).attr('dx', '0.5em').text(function (d) {
return d.label;
});
var lineSection = svg.append('line').attr('x1', groupWidth).attr('x2', groupWidth).attr('y1', 0).attr('y2', height).attr('stroke', 'black');
var groupIntervalItems = svg.selectAll('.group-interval-item').data(data).enter().append('g').attr('clip-path', 'url(#chart-content)').attr('class', 'item').attr('transform', function (d, i) {
return 'translate(0, ' + groupHeight * i + ')';
}).selectAll('.dot').data(function (d) {
return d.data.filter(function (_) {
return _.type === TimelineChart.TYPE.INTERVAL;
});
}).enter();
var intervalBarHeight = 0.8 * groupHeight;
var intervalBarMargin = (groupHeight - intervalBarHeight) / 2;
var intervals = groupIntervalItems.append('rect').attr('class', withCustom('interval')).attr('width', function (d) {
return Math.max(options.intervalMinWidth, x(d.to) - x(d.from));
}).attr('height', intervalBarHeight).attr('y', intervalBarMargin).attr('x', function (d) {
return x(d.from);
});
var intervalTexts = groupIntervalItems.append('text').text(function (d) {
return d.label;
}).attr('fill', 'white').attr('class', withCustom('interval-text')).attr('y', groupHeight / 2 + 5).attr('x', function (d) {
return x(d.from);
});
var groupDotItems = svg.selectAll('.group-dot-item').data(data).enter().append('g').attr('clip-path', 'url(#chart-content)').attr('class', 'item').attr('transform', function (d, i) {
return 'translate(0, ' + groupHeight * i + ')';
}).selectAll('.dot').data(function (d) {
return d.data.filter(function (_) {
return _.type === TimelineChart.TYPE.POINT;
});
}).enter();
var dots = groupDotItems.append('circle').attr('class', withCustom('dot')).attr('cx', function (d) {
return x(d.at);
}).attr('cy', groupHeight / 2).attr('r', 5);
var tip_link = {};
tip_link.label_dbpedia = label_dbpedia;
if (options.tip) {
if (d3.tip) {
var tip = d3.tip().attr('class', 'd3-tip').html(options.tip);
console.log(tip);
svg.call(tip);
dots.on('mouseover', tip.show).on('mouseout', tip.hide);
dots.on('click', function() {
mylog.log('LE FOCUS EST SUR : ', $(".n")[0].innerHTML);
displayDetailModal($(".n")[0].innerHTML);
});
} else {
console.error('Please make sure you have d3.tip included as dependency (https://github.com/Caged/d3-tip)');
}
}
zoomed();
if (options.enableLiveTimer) {
setInterval(updateNowMarker, options.timerTickInterval);
}
function updateNowMarker() {
var nowX = x(new Date());
self.now.attr('x1', nowX).attr('x2