Revision: 4134 Author: hans URL: http://bknr.net/trac/changeset/4134
Popups for sponsor markers.
U trunk/projects/bos/payment-website/static/poi-ms/poi-ms.css U trunk/projects/bos/payment-website/static/poi-ms/poi-ms.js
Modified: trunk/projects/bos/payment-website/static/poi-ms/poi-ms.css =================================================================== --- trunk/projects/bos/payment-website/static/poi-ms/poi-ms.css 2008-12-14 09:09:05 UTC (rev 4133) +++ trunk/projects/bos/payment-website/static/poi-ms/poi-ms.css 2008-12-14 13:58:07 UTC (rev 4134) @@ -146,3 +146,6 @@ width: 505px; height: 200px; } + +table.sponsor-info-popup th { text-align: left } +table.sponsor-info-popup td { max-width: 15em } \ No newline at end of file
Modified: trunk/projects/bos/payment-website/static/poi-ms/poi-ms.js =================================================================== --- trunk/projects/bos/payment-website/static/poi-ms/poi-ms.js 2008-12-14 09:09:05 UTC (rev 4133) +++ trunk/projects/bos/payment-website/static/poi-ms/poi-ms.js 2008-12-14 13:58:07 UTC (rev 4134) @@ -351,36 +351,43 @@
this.sponsorMarkers = [];
+ function makeTable(rows) { + return TABLE({ 'class': 'sponsor-info-popup' }, + TBODY(null, + map(function (row) { + return TR(null, + TH(null, NLS(row[0])), + TD(null, row[1])); + }, rows))); + } + this.setSponsorMarker = function (sponsor) { var position = pointToLatLng(sponsor.contracts[0].centerX, sponsor.contracts[0].centerY); var sponsorMarker = new GMarker(position); + log('sponsor: ' + serializeJSON(sponsor)); + var info = [ + [ "Name", sponsor.name || NLS("[anonym]") ], + [ "Country", sponsor.country ], + [ "Anzahl m²", sponsor.contracts[0].count ] + ]; + if (sponsor.infoText && !sponsor.infoText.match(/^ *$/)) { + info.push([ "Info", sponsor.infoText ]); + } + sponsorMarker.bindInfoWindow(makeTable(info)); this.map.addOverlay(sponsorMarker); this.sponsorMarkers.push(sponsorMarker); }
this.removeSponsorMarkers = function () { - try { - map(bind(this.map.removeOverlay, this.map), this.sponsorMarkers); - this.sponsorMarkers = []; - } - catch (e) { - log('error removing sponsor markers: ' + e); - } + map(bind(this.map.removeOverlay, this.map), this.sponsorMarkers); + this.sponsorMarkers = []; }
- this.startMapMovedChecker = function () { - } - this.putSponsorPlacemarks = function(data) { log('got ' + data.sponsors.length + ' sponsors to display'); this.removeSponsorMarkers(); - try { - map(bind(this.setSponsorMarker, this), data.sponsors); - this.checkMapMoved(); - } - catch (e) { - log('error removing sponsor markers: ' + e); - } + map(bind(this.setSponsorMarker, this), data.sponsors); + this.checkMapMoved(); }
this.checkMapMoved = function() {