diff -r dc6c3ac62efa -r fdf808d7d374 hdalab/js/gomina.js --- a/hdalab/js/gomina.js Thu Feb 02 12:03:07 2012 +0100 +++ b/hdalab/js/gomina.js Mon Feb 06 18:50:19 2012 +0100 @@ -9,6 +9,7 @@ tlGamma: 6, heatGamma: 4, displayedDates: [-5000,0,500,1000,1200,1400,1600,1700,1750,1800,1850,1900,1950,2010], + mappingLibrary: 'leaflet', } function yearToPx(year) { @@ -42,9 +43,9 @@ + '" />'; } if (data.abstract) { - _html += '

' + _(data.abstract).escape() + '

'; + _html += '

' + _(data.abstract).escape().replace(/(^.{0,240})([\s]|$)(.*)/,'$1…') + '

'; } - if (data.links) { +/* if (data.links) { var _lC = data.requested_label.toLowerCase(); var _t = data.links.map(function(d) { return (d.subject.toLowerCase() == _lC) ? d.object : d.subject; @@ -58,26 +59,27 @@ + ''; }).join('') + ''; - } + } */ $("#tagdata").html(_html); }); - filterTag(_taglabel); + addFilter('tag', _taglabel); $("#showlist").removeClass("actif"); } -function filterTag(_tagLabel) { +function addFilter(_type, _label) { var _curView = gomNs.sessiondata.views[gomNs.sessiondata.view]; if (_curView.type == 'filter') { - _curView.tag.push(_tagLabel); + _curView[_type].push(_label); + console.log(_curView[_type]); updateFilters(); debouncedSaveChanges(); } } -function removeFilter(_index) { +function removeFilter(_type, _index) { var _curView = gomNs.sessiondata.views[gomNs.sessiondata.view]; if (_curView.type == 'filter') { - _curView.tag.splice(_index,1); + _curView[_type].splice(_index,1); updateFilters(); debouncedSaveChanges(); } @@ -93,6 +95,9 @@ if (_curView.tag.length) { _params.label = _curView.tag.join(','); } + if (_curView.country.length) { + _params.country = _curView.country.join(','); + } $.getJSON("filter.php", _params, updateDisplay); } } @@ -141,12 +146,13 @@ return; } var _htmFilters = '', - _fl = _curView.tag.length; - if (!_curView.period && !_fl) { + _fl = _curView.tag.length, + _cl = _curView.country.length; + if (!_curView.period && !_fl && !_cl) { _htmFilters = '
  • Aucun filtre
  • '; } if (_curView.period) { - _htmFilters += '
  • ' + _htmFilters += '
  • Période : ' + _curView.period[0] + ' à ' + _curView.period[1] @@ -166,11 +172,20 @@ "margin-left" : "0" }); } + if (_cl) { + _htmFilters += _(_curView.country).map(function(_t, _i) { + return '
  • Pays : ' + + ( gomNs.countryLabels[_t] || _t ) + + '[x]
  • '; + }).join(""); + } if (_fl) { _htmFilters += _(_curView.tag).map(function(_t, _i) { - return '
  • ' + return '
  • Tag : ' + _t - + '[x]
  • '; }).join(""); @@ -183,14 +198,26 @@ if (contentdata && contentdata.length) { var _htmlCl = '