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(', ');
} else if (typeof a === 'string') {
return a;
} else {
return "";
}
return null;
}
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')
.append($('<span/>').addClass('regionname').text(name))
.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];
.append(popup)[0];
}
var self = this;

View File

@ -8,7 +8,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) {
var boxLayers = [];
$.each(data, function(name, residence) {
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);
boxLayer.bindPopup(configuration.createPopupContent(name, $.extend(residence, {
@ -21,7 +21,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) {
$.each(residence.Subzones, function(szname, subzone) {
$.each(subzone.Areas, function(name2, area2) {
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] },
flags: subzone.Permissions.AreaFlags
})));