Fix naming on Residence regions, make infowindow setting control popup content again

This commit is contained in:
Mike Primm 2011-08-21 15:57:21 -05:00
parent 45369006c3
commit 82b0f2c4cd
2 changed files with 16 additions and 22 deletions

View File

@ -106,30 +106,24 @@ componentconstructors['regions'] = function(dynmap, configuration) {
return a.join(', '); return a.join(', ');
} else if (typeof a === 'string') { } else if (typeof a === 'string') {
return a; return a;
} else {
return "";
} }
return null;
} }
var members = region.members || {}; var members = region.members || {};
var popup = this.infowindow || '<div class="infowindow"><span style="font-size:120%;">%regionname%</span><br /> Owner <span style="font-weight:bold;">%playerowners%</span><br />Flags<br /><span style="font-weight:bold;">%flags%</span></div>';
popup = popup.replace('%regionname%', name);
popup = popup.replace('%playerowners%', join(region.owners.players));
popup = popup.replace('%groupowners%', join(region.owners.groups));
popup = popup.replace('%playermembers%', join(members.players));
popup = popup.replace('%groupmembers%', join(members.groups));
var regionflags = "";
$.each(region.flags, function(name, value) {
regionflags = regionflags + "<span>" + name + ": " + value + "</span><br>";
});
popup = popup.replace('%flags%', regionflags);
return $('<div/>').addClass('regioninfo') return $('<div/>').addClass('regioninfo')
.append($('<span/>').addClass('regionname').text(name)) .append(popup)[0];
.append($('<span/>').addClass('owners')
.append(region.owners.players && $('<span/>').addClass('playerowners').text(join(region.owners.players)))
.append(region.owners.groups && $('<span/>').addClass('groupowners').text(join(region.owners.groups)))
)
.append($('<span/>').addClass('members')
.append(members.players && $('<span/>').addClass('playermembers').text(join(members.players)))
.append(members.groups && $('<span/>').addClass('groupmembers').text(join(members.groups)))
)
.append(region.parent && $('<span/>').addClass('regionparent').text(region.parent))
.append(region.flags && function() {
var regionflags = $('<span/>').addClass('regionflags');
$.each(region.flags, function(name, value) {
regionflags.append($('<span/>').addClass('regionflag').text(name + ': ' + value));
});
return regionflags;
}())
.append($('<span/>').addClass('regionpriority').text(region.priority))
[0];
} }
var self = this; var self = this;

View File

@ -8,7 +8,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) {
var boxLayers = []; var boxLayers = [];
$.each(data, function(name, residence) { $.each(data, function(name, residence) {
if(configuration.worldName == residence.Permissions.World) { if(configuration.worldName == residence.Permissions.World) {
$.each(residence.Areas, function(name, area) { $.each(residence.Areas, function(aname, area) {
var boxLayer = configuration.createBoxLayer(area.X1, area.X2, area.Y1, area.Y2, area.Z1, area.Z2); var boxLayer = configuration.createBoxLayer(area.X1, area.X2, area.Y1, area.Y2, area.Z1, area.Z2);
boxLayer.bindPopup(configuration.createPopupContent(name, $.extend(residence, { boxLayer.bindPopup(configuration.createPopupContent(name, $.extend(residence, {
@ -21,7 +21,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) {
$.each(residence.Subzones, function(szname, subzone) { $.each(residence.Subzones, function(szname, subzone) {
$.each(subzone.Areas, function(name2, area2) { $.each(subzone.Areas, function(name2, area2) {
var subzoneLayer = configuration.createBoxLayer(area2.X1, area2.X2, area2.Y1, area2.Y2, area2.Z1, area2.Z2); var subzoneLayer = configuration.createBoxLayer(area2.X1, area2.X2, area2.Y1, area2.Y2, area2.Z1, area2.Z2);
subzoneLayer.bindPopup(configuration.createPopupContent(name2, $.extend(subzone, { subzoneLayer.bindPopup(configuration.createPopupContent(name + '.' + szname, $.extend(subzone, {
owners: { players: [subzone.Permissions.Owner] }, owners: { players: [subzone.Permissions.Owner] },
flags: subzone.Permissions.AreaFlags flags: subzone.Permissions.AreaFlags
}))); })));