aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--linden/indra/newview/llfloaterregioninfo.cpp307
1 files changed, 156 insertions, 151 deletions
diff --git a/linden/indra/newview/llfloaterregioninfo.cpp b/linden/indra/newview/llfloaterregioninfo.cpp
index 8043fe0..12834b3 100644
--- a/linden/indra/newview/llfloaterregioninfo.cpp
+++ b/linden/indra/newview/llfloaterregioninfo.cpp
@@ -68,7 +68,7 @@
68#include "llinventory.h" 68#include "llinventory.h"
69#include "lltexturectrl.h" 69#include "lltexturectrl.h"
70#include "llviewercontrol.h" 70#include "llviewercontrol.h"
71#include "llvieweruictrlfactory.h" 71#include "lluictrlfactory.h"
72#include "llviewerimage.h" 72#include "llviewerimage.h"
73#include "llviewerimagelist.h" 73#include "llviewerimagelist.h"
74#include "llviewerregion.h" 74#include "llviewerregion.h"
@@ -85,20 +85,6 @@ const S32 CORNER_COUNT = 4;
85/// Local class declaration 85/// Local class declaration
86///---------------------------------------------------------------------------- 86///----------------------------------------------------------------------------
87 87
88/*
89class LLDispatchSetEstateOwner : public LLDispatchHandler
90{
91public:
92 LLDispatchSetEstateOwner() {}
93 virtual ~LLDispatchSetEstateOwner() {}
94 virtual bool operator()(
95 const LLDispatcher* dispatcher,
96 const std::string& key,
97 const sparam_t& strings,
98 const iparam_t& integers);
99};
100*/
101
102class LLDispatchEstateUpdateInfo : public LLDispatchHandler 88class LLDispatchEstateUpdateInfo : public LLDispatchHandler
103{ 89{
104public: 90public:
@@ -168,43 +154,43 @@ LLUUID LLFloaterRegionInfo::sRequestInvoice;
168 154
169LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) 155LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
170{ 156{
171 gUICtrlFactory->buildFloater(this, "floater_region_info.xml", NULL, FALSE); 157 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE);
172} 158}
173 159
174BOOL LLFloaterRegionInfo::postBuild() 160BOOL LLFloaterRegionInfo::postBuild()
175{ 161{
176 mTab = gUICtrlFactory->getTabContainerByName(this, "region_panels"); 162 mTab = getChild<LLTabContainer>("region_panels");
177 163
178 // contruct the panels 164 // contruct the panels
179 LLPanelRegionInfo* panel; 165 LLPanelRegionInfo* panel;
180 panel = new LLPanelRegionGeneralInfo; 166 panel = new LLPanelRegionGeneralInfo;
181 mInfoPanels.push_back(panel); 167 mInfoPanels.push_back(panel);
182 gUICtrlFactory->buildPanel(panel, "panel_region_general.xml"); 168 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml");
183 mTab->addTabPanel(panel, panel->getLabel(), TRUE); 169 mTab->addTabPanel(panel, panel->getLabel(), TRUE);
184 170
185 panel = new LLPanelRegionDebugInfo; 171 panel = new LLPanelRegionDebugInfo;
186 mInfoPanels.push_back(panel); 172 mInfoPanels.push_back(panel);
187 gUICtrlFactory->buildPanel(panel, "panel_region_debug.xml"); 173 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml");
188 mTab->addTabPanel(panel, panel->getLabel(), FALSE); 174 mTab->addTabPanel(panel, panel->getLabel(), FALSE);
189 175
190 panel = new LLPanelRegionTextureInfo; 176 panel = new LLPanelRegionTextureInfo;
191 mInfoPanels.push_back(panel); 177 mInfoPanels.push_back(panel);
192 gUICtrlFactory->buildPanel(panel, "panel_region_texture.xml"); 178 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml");
193 mTab->addTabPanel(panel, panel->getLabel(), FALSE); 179 mTab->addTabPanel(panel, panel->getLabel(), FALSE);
194 180
195 panel = new LLPanelRegionTerrainInfo; 181 panel = new LLPanelRegionTerrainInfo;
196 mInfoPanels.push_back(panel); 182 mInfoPanels.push_back(panel);
197 gUICtrlFactory->buildPanel(panel, "panel_region_terrain.xml"); 183 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml");
198 mTab->addTabPanel(panel, panel->getLabel(), FALSE); 184 mTab->addTabPanel(panel, panel->getLabel(), FALSE);
199 185
200 panel = new LLPanelEstateInfo; 186 panel = new LLPanelEstateInfo;
201 mInfoPanels.push_back(panel); 187 mInfoPanels.push_back(panel);
202 gUICtrlFactory->buildPanel(panel, "panel_region_estate.xml"); 188 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml");
203 mTab->addTabPanel(panel, panel->getLabel(), FALSE); 189 mTab->addTabPanel(panel, panel->getLabel(), FALSE);
204 190
205 panel = new LLPanelEstateCovenant; 191 panel = new LLPanelEstateCovenant;
206 mInfoPanels.push_back(panel); 192 mInfoPanels.push_back(panel);
207 gUICtrlFactory->buildPanel(panel, "panel_region_covenant.xml"); 193 LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml");
208 mTab->addTabPanel(panel, panel->getLabel(), FALSE); 194 mTab->addTabPanel(panel, panel->getLabel(), FALSE);
209 195
210 gMessageSystem->setHandlerFunc( 196 gMessageSystem->setHandlerFunc(
@@ -225,14 +211,21 @@ void LLFloaterRegionInfo::onOpen()
225 gFloaterView->getNewFloaterPosition(&left, &top); 211 gFloaterView->getNewFloaterPosition(&left, &top);
226 rect.translate(left,top); 212 rect.translate(left,top);
227 213
228 requestRegionInfo();
229 refreshFromRegion(gAgent.getRegion()); 214 refreshFromRegion(gAgent.getRegion());
215 requestRegionInfo();
230 LLFloater::onOpen(); 216 LLFloater::onOpen();
231} 217}
232 218
233// static 219// static
234void LLFloaterRegionInfo::requestRegionInfo() 220void LLFloaterRegionInfo::requestRegionInfo()
235{ 221{
222 LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels");
223
224 tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
225 tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
226 tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
227 tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
228
236 // Must allow anyone to request the RegionInfo data 229 // Must allow anyone to request the RegionInfo data
237 // so non-owners/non-gods can see the values. 230 // so non-owners/non-gods can see the values.
238 // Therefore can't use an EstateOwnerMessage JC 231 // Therefore can't use an EstateOwnerMessage JC
@@ -242,7 +235,6 @@ void LLFloaterRegionInfo::requestRegionInfo()
242 msg->addUUID("AgentID", gAgent.getID()); 235 msg->addUUID("AgentID", gAgent.getID());
243 msg->addUUID("SessionID", gAgent.getSessionID()); 236 msg->addUUID("SessionID", gAgent.getSessionID());
244 gAgent.sendReliableMessage(); 237 gAgent.sendReliableMessage();
245
246} 238}
247 239
248// static 240// static
@@ -259,11 +251,8 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
259 LLPanelEstateInfo::initDispatch(dispatch); 251 LLPanelEstateInfo::initDispatch(dispatch);
260 } 252 }
261 253
262 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); 254 LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels");
263 if (!tab) return; 255 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
264
265 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate");
266 if (!panel) return;
267 256
268 // unpack the message 257 // unpack the message
269 std::string request; 258 std::string request;
@@ -278,6 +267,11 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
278 267
279 //dispatch the message 268 //dispatch the message
280 dispatch.dispatch(request, invoice, strings); 269 dispatch.dispatch(request, invoice, strings);
270
271 LLViewerRegion* region = gAgent.getRegion();
272 BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
273 panel->setCtrlsEnabled(allow_modify);
274
281} 275}
282 276
283 277
@@ -292,8 +286,10 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
292 return; 286 return;
293 } 287 }
294 288
295 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); 289 LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels");
296 if(!tab) return; 290
291 LLViewerRegion* region = gAgent.getRegion();
292 BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
297 293
298 // extract message 294 // extract message
299 char sim_name[MAX_STRING]; /* Flawfinder: ignore*/ 295 char sim_name[MAX_STRING]; /* Flawfinder: ignore*/
@@ -319,8 +315,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
319 msg->getF32("RegionInfo", "SunHour", sun_hour); 315 msg->getF32("RegionInfo", "SunHour", sun_hour);
320 316
321 // GENERAL PANEL 317 // GENERAL PANEL
322 panel = LLUICtrlFactory::getPanelByName(tab, "General"); 318 panel = tab->getChild<LLPanel>("General");
323 if(!panel) return;
324 panel->childSetValue("region_text", LLSD(sim_name)); 319 panel->childSetValue("region_text", LLSD(sim_name));
325 320
326 panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); 321 panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE );
@@ -335,27 +330,26 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
335 panel->childSetValue("access_combo", LLSD(LLViewerRegion::accessToString(sim_access)) ); 330 panel->childSetValue("access_combo", LLSD(LLViewerRegion::accessToString(sim_access)) );
336 331
337 332
338 // detect teen grid for maturity 333 // detect teen grid for maturity
339 LLViewerRegion* region = gAgent.getRegion();
340 334
341 U32 parent_estate_id; 335 U32 parent_estate_id;
342 msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); 336 msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id);
343 BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that 337 BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that
344 panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); 338 panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid));
339 panel->setCtrlsEnabled(allow_modify);
345 340
346 341
347 // DEBUG PANEL 342 // DEBUG PANEL
348 panel = LLUICtrlFactory::getPanelByName(tab, "Debug"); 343 panel = tab->getChild<LLPanel>("Debug");
349 if(!panel) return;
350 344
351 panel->childSetValue("region_text", LLSD(sim_name) ); 345 panel->childSetValue("region_text", LLSD(sim_name) );
352 panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); 346 panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) );
353 panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); 347 panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) );
354 panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); 348 panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) );
349 panel->setCtrlsEnabled(allow_modify);
355 350
356 // TERRAIN PANEL 351 // TERRAIN PANEL
357 panel = LLUICtrlFactory::getPanelByName(tab, "Terrain"); 352 panel = tab->getChild<LLPanel>("Terrain");
358 if(!panel) return;
359 353
360 panel->childSetValue("region_text", LLSD(sim_name)); 354 panel->childSetValue("region_text", LLSD(sim_name));
361 panel->childSetValue("water_height_spin", LLSD(water_height)); 355 panel->childSetValue("water_height_spin", LLSD(water_height));
@@ -363,11 +357,11 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
363 panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit)); 357 panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit));
364 panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun)); 358 panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun));
365 359
366 BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
367 panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); 360 panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED)));
368 panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); 361 panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun);
369 panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); 362 panel->childSetValue("sun_hour_slider", LLSD(sun_hour));
370 panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); 363 panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun);
364 panel->setCtrlsEnabled(allow_modify);
371 365
372 getInstance()->refreshFromRegion( gAgent.getRegion() ); 366 getInstance()->refreshFromRegion( gAgent.getRegion() );
373} 367}
@@ -377,9 +371,8 @@ LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate()
377{ 371{
378 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); 372 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
379 if (!floater) return NULL; 373 if (!floater) return NULL;
380 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); 374 LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
381 if (!tab) return NULL; 375 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
382 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab,"Estate");
383 return panel; 376 return panel;
384} 377}
385 378
@@ -388,9 +381,8 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant()
388{ 381{
389 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); 382 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
390 if (!floater) return NULL; 383 if (!floater) return NULL;
391 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); 384 LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
392 if (!tab) return NULL; 385 LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant");
393 LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)LLUICtrlFactory::getPanelByName(tab, "Covenant");
394 return panel; 386 return panel;
395} 387}
396 388
@@ -584,7 +576,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
584 initCtrl("block_terraform_check"); 576 initCtrl("block_terraform_check");
585 initCtrl("block_fly_check"); 577 initCtrl("block_fly_check");
586 initCtrl("allow_damage_check"); 578 initCtrl("allow_damage_check");
587 initCtrl("allow_land_resell_check"); 579 initCtrl("allow_land_resell_check");
588 initCtrl("allow_parcel_changes_check"); 580 initCtrl("allow_parcel_changes_check");
589 initCtrl("agent_limit_spin"); 581 initCtrl("agent_limit_spin");
590 initCtrl("object_bonus_spin"); 582 initCtrl("object_bonus_spin");
@@ -1027,7 +1019,7 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region)
1027 for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) 1019 for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
1028 { 1020 {
1029 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ 1021 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */
1030 texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); 1022 texture_ctrl = getChild<LLTextureCtrl>(buffer);
1031 if(texture_ctrl) 1023 if(texture_ctrl)
1032 { 1024 {
1033 lldebugs << "Detail Texture " << i << ": " 1025 lldebugs << "Detail Texture " << i << ": "
@@ -1075,14 +1067,6 @@ BOOL LLPanelRegionTextureInfo::postBuild()
1075 return LLPanelRegionInfo::postBuild(); 1067 return LLPanelRegionInfo::postBuild();
1076} 1068}
1077 1069
1078void LLPanelRegionTextureInfo::draw()
1079{
1080 if(getVisible())
1081 {
1082 LLPanel::draw();
1083 }
1084}
1085
1086BOOL LLPanelRegionTextureInfo::sendUpdate() 1070BOOL LLPanelRegionTextureInfo::sendUpdate()
1087{ 1071{
1088 llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; 1072 llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl;
@@ -1105,7 +1089,7 @@ BOOL LLPanelRegionTextureInfo::sendUpdate()
1105 for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) 1089 for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i)
1106 { 1090 {
1107 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ 1091 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */
1108 texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); 1092 texture_ctrl = getChild<LLTextureCtrl>(buffer);
1109 if(texture_ctrl) 1093 if(texture_ctrl)
1110 { 1094 {
1111 LLUUID tmp_id(texture_ctrl->getImageAssetID()); 1095 LLUUID tmp_id(texture_ctrl->getImageAssetID());
@@ -1135,7 +1119,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes()
1135 { 1119 {
1136 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 1120 char buffer[MAX_STRING]; /* Flawfinder: ignore */
1137 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ 1121 snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */
1138 LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); 1122 LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer);
1139 if (!texture_ctrl) continue; 1123 if (!texture_ctrl) continue;
1140 1124
1141 LLUUID image_asset_id = texture_ctrl->getImageAssetID(); 1125 LLUUID image_asset_id = texture_ctrl->getImageAssetID();
@@ -1257,10 +1241,10 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
1257 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); 1241 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
1258 if (!floater) return true; 1242 if (!floater) return true;
1259 1243
1260 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); 1244 LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
1261 if (!tab) return true; 1245 if (!tab) return true;
1262 1246
1263 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate"); 1247 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
1264 if (!panel) return true; 1248 if (!panel) return true;
1265 1249
1266 BOOL estate_global_time = panel->getGlobalTime(); 1250 BOOL estate_global_time = panel->getGlobalTime();
@@ -1690,11 +1674,12 @@ bool LLPanelEstateInfo::isLindenEstate()
1690 return (estate_id <= ESTATE_LAST_LINDEN); 1674 return (estate_id <= ESTATE_LAST_LINDEN);
1691} 1675}
1692 1676
1677typedef std::vector<LLUUID> AgentOrGroupIDsVector;
1693struct LLEstateAccessChangeInfo 1678struct LLEstateAccessChangeInfo
1694{ 1679{
1695 U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. 1680 U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
1696 LLString mDialogName; 1681 LLString mDialogName;
1697 LLUUID mAgentOrGroupID; 1682 AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change
1698}; 1683};
1699 1684
1700// Special case callback for groups, since it has different callback format than names 1685// Special case callback for groups, since it has different callback format than names
@@ -1704,7 +1689,7 @@ void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data)
1704 LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo; 1689 LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo;
1705 change_info->mOperationFlag = ESTATE_ACCESS_ALLOWED_GROUP_ADD; 1690 change_info->mOperationFlag = ESTATE_ACCESS_ALLOWED_GROUP_ADD;
1706 change_info->mDialogName = "EstateAllowedGroupAdd"; 1691 change_info->mDialogName = "EstateAllowedGroupAdd";
1707 change_info->mAgentOrGroupID = id; 1692 change_info->mAgentOrGroupIDs.push_back(id);
1708 1693
1709 if (isLindenEstate()) 1694 if (isLindenEstate())
1710 { 1695 {
@@ -1749,8 +1734,8 @@ void LLPanelEstateInfo::accessAddCore2(S32 option, void* data)
1749 return; 1734 return;
1750 } 1735 }
1751 1736
1752 // avatar picker no multi-select, yes close-on-select 1737 // avatar picker yes multi-select, yes close-on-select
1753 LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, FALSE, TRUE); 1738 LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE);
1754} 1739}
1755 1740
1756// static 1741// static
@@ -1766,21 +1751,44 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, co
1766 return; 1751 return;
1767 } 1752 }
1768 // User did select a name. 1753 // User did select a name.
1769 change_info->mAgentOrGroupID = ids[0]; 1754 change_info->mAgentOrGroupIDs = ids;
1770
1771 // Can't put estate owner on ban list 1755 // Can't put estate owner on ban list
1772 LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); 1756 LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
1773 if (!panel) return; 1757 if (!panel) return;
1774 LLViewerRegion* region = gAgent.getRegion(); 1758 LLViewerRegion* region = gAgent.getRegion();
1775 if (!region) return; 1759 if (!region) return;
1776 1760
1777 if ((change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) 1761 if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD)
1778 && (region->getOwner() == change_info->mAgentOrGroupID))
1779 { 1762 {
1780 gViewerWindow->alertXml("OwnerCanNotBeDenied"); 1763 LLCtrlListInterface *list = panel->childGetListInterface("allowed_avatar_name_list");
1781 delete change_info; 1764 int currentCount = (list ? list->getItemCount() : 0);
1782 change_info = NULL; 1765 if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
1783 return; 1766 {
1767 LLString::format_map_t args;
1768 args["[NUM_ADDED]"] = llformat("%d",ids.size());
1769 args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS);
1770 args["[LIST_TYPE]"] = "Allowed Residents";
1771 args["[NUM_EXCESS]"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS);
1772 gViewerWindow->alertXml("MaxAgentOnRegionBatch", args);
1773 delete change_info;
1774 return;
1775 }
1776 }
1777 if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
1778 {
1779 LLCtrlListInterface *list = panel->childGetListInterface("banned_avatar_name_list");
1780 int currentCount = (list ? list->getItemCount() : 0);
1781 if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS)
1782 {
1783 LLString::format_map_t args;
1784 args["[NUM_ADDED]"] = llformat("%d",ids.size());
1785 args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS);
1786 args["[LIST_TYPE]"] = "Banned Residents";
1787 args["[NUM_EXCESS]"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS);
1788 gViewerWindow->alertXml("MaxAgentOnRegionBatch", args);
1789 delete change_info;
1790 return;
1791 }
1784 } 1792 }
1785 1793
1786 if (isLindenEstate()) 1794 if (isLindenEstate())
@@ -1802,23 +1810,31 @@ void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const char* dialog_
1802{ 1810{
1803 LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); 1811 LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
1804 if (!panel) return; 1812 if (!panel) return;
1805 LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(panel, list_ctrl_name); 1813 LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name);
1806 if (!name_list) return; 1814 if (!name_list) return;
1807 LLScrollListItem* item = name_list->getFirstSelected(); 1815
1808 if (!item) return; 1816 std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected();
1809 LLUUID agent_id = item->getUUID(); 1817 if (list_vector.size() == 0)
1818 return;
1810 1819
1811 LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo; 1820 LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo;
1812 change_info->mAgentOrGroupID = agent_id;
1813 change_info->mOperationFlag = operation_flag; 1821 change_info->mOperationFlag = operation_flag;
1814 change_info->mDialogName = dialog_name; 1822 change_info->mDialogName = dialog_name;
1815 1823
1824 for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
1825 iter != list_vector.end();
1826 iter++)
1827 {
1828 LLScrollListItem *item = (*iter);
1829 change_info->mAgentOrGroupIDs.push_back(item->getUUID());
1830 }
1831
1816 if (isLindenEstate()) 1832 if (isLindenEstate())
1817 { 1833 {
1818 // warn on change linden estate 1834 // warn on change linden estate
1819 gViewerWindow->alertXml("ChangeLindenAccess", 1835 gViewerWindow->alertXml("ChangeLindenAccess",
1820 accessRemoveCore2, 1836 accessRemoveCore2,
1821 (void*)change_info); 1837 (void*)change_info);
1822 } 1838 }
1823 else 1839 else
1824 { 1840 {
@@ -1850,9 +1866,9 @@ void LLPanelEstateInfo::accessRemoveCore2(S32 option, void* data)
1850 LLString::format_map_t args; 1866 LLString::format_map_t args;
1851 args["[ALL_ESTATES]"] = all_estates_text(); 1867 args["[ALL_ESTATES]"] = all_estates_text();
1852 gViewerWindow->alertXml(change_info->mDialogName, 1868 gViewerWindow->alertXml(change_info->mDialogName,
1853 args, 1869 args,
1854 accessCoreConfirm, 1870 accessCoreConfirm,
1855 (void*)change_info); 1871 (void*)change_info);
1856 } 1872 }
1857} 1873}
1858 1874
@@ -1862,35 +1878,54 @@ void LLPanelEstateInfo::accessRemoveCore2(S32 option, void* data)
1862void LLPanelEstateInfo::accessCoreConfirm(S32 option, void* data) 1878void LLPanelEstateInfo::accessCoreConfirm(S32 option, void* data)
1863{ 1879{
1864 LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; 1880 LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
1865 U32 flags = change_info->mOperationFlag; 1881 const U32 originalFlags = change_info->mOperationFlag;
1866 switch(option) 1882 AgentOrGroupIDsVector& ids = change_info->mAgentOrGroupIDs;
1883
1884 LLViewerRegion* region = gAgent.getRegion();
1885
1886 for (AgentOrGroupIDsVector::const_iterator iter = ids.begin();
1887 iter != ids.end();
1888 iter++)
1867 { 1889 {
1868 case 0: 1890 U32 flags = originalFlags;
1869 // This estate 1891 if (iter + 1 != ids.end())
1870 sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); 1892 flags |= ESTATE_ACCESS_NO_REPLY;
1871 break; 1893
1872 case 1: 1894 const LLUUID id = (*iter);
1895 if ((change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
1896 && region && (region->getOwner() == id))
1873 { 1897 {
1874 // All estates, either than I own or manage for this owner. 1898 gViewerWindow->alertXml("OwnerCanNotBeDenied");
1875 // This will be verified on simulator. JC 1899 break;
1876 LLViewerRegion* region = gAgent.getRegion(); 1900 }
1877 if (!region) break; 1901 switch(option)
1878 if (region->getOwner() == gAgent.getID() 1902 {
1879 || gAgent.isGodlike()) 1903 case 0:
1880 { 1904 // This estate
1881 flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES; 1905 sendEstateAccessDelta(flags, id);
1882 sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); 1906 break;
1883 } 1907 case 1:
1884 else if (region->isEstateManager())
1885 { 1908 {
1886 flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; 1909 // All estates, either than I own or manage for this owner.
1887 sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); 1910 // This will be verified on simulator. JC
1911 if (!region) break;
1912 if (region->getOwner() == gAgent.getID()
1913 || gAgent.isGodlike())
1914 {
1915 flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES;
1916 sendEstateAccessDelta(flags, id);
1917 }
1918 else if (region->isEstateManager())
1919 {
1920 flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES;
1921 sendEstateAccessDelta(flags, id);
1922 }
1923 break;
1888 } 1924 }
1889 break; 1925 case 2:
1926 default:
1927 break;
1890 } 1928 }
1891 case 2:
1892 default:
1893 break;
1894 } 1929 }
1895 delete change_info; 1930 delete change_info;
1896 change_info = NULL; 1931 change_info = NULL;
@@ -2041,7 +2076,7 @@ BOOL LLPanelEstateInfo::postBuild()
2041 childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this); 2076 childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this);
2042 2077
2043 childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this); 2078 childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this);
2044 LLNameListCtrl *avatar_name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_avatar_name_list"); 2079 LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
2045 if (avatar_name_list) 2080 if (avatar_name_list)
2046 { 2081 {
2047 avatar_name_list->setCommitOnSelectionChange(TRUE); 2082 avatar_name_list->setCommitOnSelectionChange(TRUE);
@@ -2052,7 +2087,7 @@ BOOL LLPanelEstateInfo::postBuild()
2052 childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this); 2087 childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this);
2053 2088
2054 childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this); 2089 childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this);
2055 LLNameListCtrl* group_name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_group_name_list"); 2090 LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list");
2056 if (group_name_list) 2091 if (group_name_list)
2057 { 2092 {
2058 group_name_list->setCommitOnSelectionChange(TRUE); 2093 group_name_list->setCommitOnSelectionChange(TRUE);
@@ -2063,7 +2098,7 @@ BOOL LLPanelEstateInfo::postBuild()
2063 childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); 2098 childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this);
2064 2099
2065 childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); 2100 childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this);
2066 LLNameListCtrl* banned_name_list = LLViewerUICtrlFactory::getNameListByName(this, "banned_avatar_name_list"); 2101 LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
2067 if (banned_name_list) 2102 if (banned_name_list)
2068 { 2103 {
2069 banned_name_list->setCommitOnSelectionChange(TRUE); 2104 banned_name_list->setCommitOnSelectionChange(TRUE);
@@ -2074,7 +2109,7 @@ BOOL LLPanelEstateInfo::postBuild()
2074 childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this); 2109 childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this);
2075 2110
2076 childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this); 2111 childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this);
2077 LLNameListCtrl* manager_name_list = LLViewerUICtrlFactory::getNameListByName(this, "estate_manager_name_list"); 2112 LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list");
2078 if (manager_name_list) 2113 if (manager_name_list)
2079 { 2114 {
2080 manager_name_list->setCommitOnSelectionChange(TRUE); 2115 manager_name_list->setCommitOnSelectionChange(TRUE);
@@ -2477,13 +2512,13 @@ void LLPanelEstateInfo::callbackCacheName(
2477 2512
2478void LLPanelEstateInfo::clearAccessLists() 2513void LLPanelEstateInfo::clearAccessLists()
2479{ 2514{
2480 LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_avatar_name_list"); 2515 LLNameListCtrl* name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
2481 if (name_list) 2516 if (name_list)
2482 { 2517 {
2483 name_list->deleteAllItems(); 2518 name_list->deleteAllItems();
2484 } 2519 }
2485 2520
2486 name_list = LLViewerUICtrlFactory::getNameListByName(this, "banned_avatar_name_list"); 2521 name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
2487 if (name_list) 2522 if (name_list)
2488 { 2523 {
2489 name_list->deleteAllItems(); 2524 name_list->deleteAllItems();
@@ -2517,7 +2552,7 @@ BOOL LLPanelEstateInfo::checkRemovalButton(std::string name)
2517 } 2552 }
2518 2553
2519 // enable the remove button if something is selected 2554 // enable the remove button if something is selected
2520 LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(this, name); 2555 LLNameListCtrl* name_list = getChild<LLNameListCtrl>(name);
2521 childSetEnabled(btn_name.c_str(), name_list && name_list->getFirstSelected() ? TRUE : FALSE); 2556 childSetEnabled(btn_name.c_str(), name_list && name_list->getFirstSelected() ? TRUE : FALSE);
2522 2557
2523 return (btn_name != ""); 2558 return (btn_name != "");
@@ -2790,10 +2825,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs,
2790 } 2825 }
2791 else 2826 else
2792 { 2827 {
2793 if( gViewerStats ) 2828 LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
2794 {
2795 gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
2796 }
2797 2829
2798 if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || 2830 if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
2799 LL_ERR_FILE_EMPTY == status) 2831 LL_ERR_FILE_EMPTY == status)
@@ -2914,33 +2946,6 @@ void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text)
2914 mEditor->setText(text); 2946 mEditor->setText(text);
2915} 2947}
2916 2948
2917/*
2918// AgentData = agent_id
2919// RequestData = "setowner"
2920// StringData[0] = compressed owner id
2921// IntegerData[0] = serial
2922bool LLDispatchSetEstateOwner::operator()(
2923 const LLDispatcher* dispatcher,
2924 const std::string& key,
2925 const sparam_t& strings,
2926 const iparam_t& integers)
2927{
2928 LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance();
2929 if (!floater) return true;
2930
2931 LLTabContainer* tab = (LLTabContainer*)(floater->getChildByName("region_panels"));
2932 if (!tab) return true;
2933
2934 LLPanelEstateInfo* panel = (LLPanelEstateInfo*)(tab->getChildByName("Estate"));
2935 if (!panel) return true;
2936
2937 // TODO -- check owner, and disable floater if owner
2938 // does not match
2939
2940 return true;
2941}
2942*/
2943
2944// key = "estateupdateinfo" 2949// key = "estateupdateinfo"
2945// strings[0] = estate name 2950// strings[0] = estate name
2946// strings[1] = str(owner_id) 2951// strings[1] = str(owner_id)
@@ -3073,7 +3078,7 @@ bool LLDispatchSetEstateAccess::operator()(
3073 if (access_flags & ESTATE_ACCESS_ALLOWED_AGENTS) 3078 if (access_flags & ESTATE_ACCESS_ALLOWED_AGENTS)
3074 { 3079 {
3075 LLNameListCtrl* allowed_agent_name_list; 3080 LLNameListCtrl* allowed_agent_name_list;
3076 allowed_agent_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "allowed_avatar_name_list"); 3081 allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list");
3077 3082
3078 int totalAllowedAgents = num_allowed_agents; 3083 int totalAllowedAgents = num_allowed_agents;
3079 3084
@@ -3104,7 +3109,7 @@ bool LLDispatchSetEstateAccess::operator()(
3104 if (access_flags & ESTATE_ACCESS_ALLOWED_GROUPS) 3109 if (access_flags & ESTATE_ACCESS_ALLOWED_GROUPS)
3105 { 3110 {
3106 LLNameListCtrl* allowed_group_name_list; 3111 LLNameListCtrl* allowed_group_name_list;
3107 allowed_group_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "allowed_group_name_list"); 3112 allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
3108 3113
3109 std::string msg = llformat("Allowed groups: (%d, max %d)", 3114 std::string msg = llformat("Allowed groups: (%d, max %d)",
3110 num_allowed_groups, 3115 num_allowed_groups,
@@ -3128,7 +3133,7 @@ bool LLDispatchSetEstateAccess::operator()(
3128 if (access_flags & ESTATE_ACCESS_BANNED_AGENTS) 3133 if (access_flags & ESTATE_ACCESS_BANNED_AGENTS)
3129 { 3134 {
3130 LLNameListCtrl* banned_agent_name_list; 3135 LLNameListCtrl* banned_agent_name_list;
3131 banned_agent_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "banned_avatar_name_list"); 3136 banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
3132 3137
3133 int totalBannedAgents = num_banned_agents; 3138 int totalBannedAgents = num_banned_agents;
3134 3139
@@ -3165,7 +3170,7 @@ bool LLDispatchSetEstateAccess::operator()(
3165 panel->childSetValue("estate_manager_label", LLSD(msg)); 3170 panel->childSetValue("estate_manager_label", LLSD(msg));
3166 3171
3167 LLNameListCtrl* estate_manager_name_list = 3172 LLNameListCtrl* estate_manager_name_list =
3168 LLViewerUICtrlFactory::getNameListByName(panel, "estate_manager_name_list"); 3173 panel->getChild<LLNameListCtrl>("estate_manager_name_list");
3169 if (estate_manager_name_list) 3174 if (estate_manager_name_list)
3170 { 3175 {
3171 estate_manager_name_list->deleteAllItems(); // Clear existing entries 3176 estate_manager_name_list->deleteAllItems(); // Clear existing entries