diff options
author | Jacek Antonelli | 2011-03-18 21:05:23 -0500 |
---|---|---|
committer | Jacek Antonelli | 2011-03-18 21:50:25 -0500 |
commit | e67e3f216fdb0868d05c35f105dd83c5358dd3b0 (patch) | |
tree | 4de6be204ab09d635c1e4ca2215abd2c17ae6671 /linden/indra/newview/llfloaterregioninfo.cpp | |
parent | Fix a bug that only occurs when not running in a debugger. (diff) | |
download | meta-impy-e67e3f216fdb0868d05c35f105dd83c5358dd3b0.zip meta-impy-e67e3f216fdb0868d05c35f105dd83c5358dd3b0.tar.gz meta-impy-e67e3f216fdb0868d05c35f105dd83c5358dd3b0.tar.bz2 meta-impy-e67e3f216fdb0868d05c35f105dd83c5358dd3b0.tar.xz |
Fixed bad line endings (CRLF) in many files.
Windows users, please set "autocrlf = input" or "autocrlf = true" in
your .git/config [core] section to avoid this in the future.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterregioninfo.cpp | 6892 |
1 files changed, 3446 insertions, 3446 deletions
diff --git a/linden/indra/newview/llfloaterregioninfo.cpp b/linden/indra/newview/llfloaterregioninfo.cpp index 4880308..3c3625b 100644 --- a/linden/indra/newview/llfloaterregioninfo.cpp +++ b/linden/indra/newview/llfloaterregioninfo.cpp | |||
@@ -1,3446 +1,3446 @@ | |||
1 | /** | 1 | /** |
2 | * @file llfloaterregioninfo.cpp | 2 | * @file llfloaterregioninfo.cpp |
3 | * @author Aaron Brashears | 3 | * @author Aaron Brashears |
4 | * @brief Implementation of the region info and controls floater and panels. | 4 | * @brief Implementation of the region info and controls floater and panels. |
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2004&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2004&license=viewergpl$ |
7 | * | 7 | * |
8 | * Copyright (c) 2004-2009, Linden Research, Inc. | 8 | * Copyright (c) 2004-2009, Linden Research, Inc. |
9 | * | 9 | * |
10 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
11 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
12 | * to you under the terms of the GNU General Public License, version 2.0 | 12 | * to you under the terms of the GNU General Public License, version 2.0 |
13 | * ("GPL"), unless you have obtained a separate licensing agreement | 13 | * ("GPL"), unless you have obtained a separate licensing agreement |
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 14 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | 16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
17 | * | 17 | * |
18 | * There are special exceptions to the terms and conditions of the GPL as | 18 | * There are special exceptions to the terms and conditions of the GPL as |
19 | * it is applied to this Source Code. View the full text of the exception | 19 | * it is applied to this Source Code. View the full text of the exception |
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 20 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
21 | * online at | 21 | * online at |
22 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | 22 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception |
23 | * | 23 | * |
24 | * By copying, modifying or distributing this software, you acknowledge | 24 | * By copying, modifying or distributing this software, you acknowledge |
25 | * that you have read and understood your obligations described above, | 25 | * that you have read and understood your obligations described above, |
26 | * and agree to abide by those obligations. | 26 | * and agree to abide by those obligations. |
27 | * | 27 | * |
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
30 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
31 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "llviewerprecompiledheaders.h" | 34 | #include "llviewerprecompiledheaders.h" |
35 | #include "llfloaterregioninfo.h" | 35 | #include "llfloaterregioninfo.h" |
36 | 36 | ||
37 | #include <algorithm> | 37 | #include <algorithm> |
38 | #include <functional> | 38 | #include <functional> |
39 | 39 | ||
40 | #include "llcachename.h" | 40 | #include "llcachename.h" |
41 | #include "lldir.h" | 41 | #include "lldir.h" |
42 | #include "lldispatcher.h" | 42 | #include "lldispatcher.h" |
43 | #include "llglheaders.h" | 43 | #include "llglheaders.h" |
44 | #include "llregionflags.h" | 44 | #include "llregionflags.h" |
45 | #include "llstl.h" | 45 | #include "llstl.h" |
46 | #include "indra_constants.h" | 46 | #include "indra_constants.h" |
47 | #include "message.h" | 47 | #include "message.h" |
48 | 48 | ||
49 | #include "llagent.h" | 49 | #include "llagent.h" |
50 | #include "llalertdialog.h" | 50 | #include "llalertdialog.h" |
51 | #include "llappviewer.h" | 51 | #include "llappviewer.h" |
52 | #include "llfloateravatarpicker.h" | 52 | #include "llfloateravatarpicker.h" |
53 | #include "llbutton.h" | 53 | #include "llbutton.h" |
54 | #include "llcheckboxctrl.h" | 54 | #include "llcheckboxctrl.h" |
55 | #include "llcombobox.h" | 55 | #include "llcombobox.h" |
56 | #include "llfilepicker.h" | 56 | #include "llfilepicker.h" |
57 | #include "llfloaterdaycycle.h" | 57 | #include "llfloaterdaycycle.h" |
58 | #include "llfloatergodtools.h" // for send_sim_wide_deletes() | 58 | #include "llfloatergodtools.h" // for send_sim_wide_deletes() |
59 | #include "llfloatertopobjects.h" // added to fix SL-32336 | 59 | #include "llfloatertopobjects.h" // added to fix SL-32336 |
60 | #include "llfloatergroups.h" | 60 | #include "llfloatergroups.h" |
61 | #include "llfloatertelehub.h" | 61 | #include "llfloatertelehub.h" |
62 | #include "llfloaterwindlight.h" | 62 | #include "llfloaterwindlight.h" |
63 | #include "llinventorymodel.h" | 63 | #include "llinventorymodel.h" |
64 | #include "lllineeditor.h" | 64 | #include "lllineeditor.h" |
65 | #include "llalertdialog.h" | 65 | #include "llalertdialog.h" |
66 | #include "llnamelistctrl.h" | 66 | #include "llnamelistctrl.h" |
67 | #include "llsliderctrl.h" | 67 | #include "llsliderctrl.h" |
68 | #include "llspinctrl.h" | 68 | #include "llspinctrl.h" |
69 | #include "lltabcontainer.h" | 69 | #include "lltabcontainer.h" |
70 | #include "lltextbox.h" | 70 | #include "lltextbox.h" |
71 | #include "llinventory.h" | 71 | #include "llinventory.h" |
72 | #include "lltexturectrl.h" | 72 | #include "lltexturectrl.h" |
73 | #include "lltrans.h" | 73 | #include "lltrans.h" |
74 | #include "llviewercontrol.h" | 74 | #include "llviewercontrol.h" |
75 | #include "lluictrlfactory.h" | 75 | #include "lluictrlfactory.h" |
76 | #include "llviewerimage.h" | 76 | #include "llviewerimage.h" |
77 | #include "llviewerimagelist.h" | 77 | #include "llviewerimagelist.h" |
78 | #include "llviewerregion.h" | 78 | #include "llviewerregion.h" |
79 | #include "llviewerstats.h" | 79 | #include "llviewerstats.h" |
80 | #include "llviewertexteditor.h" | 80 | #include "llviewertexteditor.h" |
81 | #include "llviewerwindow.h" | 81 | #include "llviewerwindow.h" |
82 | #include "llvlcomposition.h" | 82 | #include "llvlcomposition.h" |
83 | #include "hippolimits.h" | 83 | #include "hippolimits.h" |
84 | 84 | ||
85 | // [RLVa:KB] | 85 | // [RLVa:KB] |
86 | #include "rlvhandler.h" | 86 | #include "rlvhandler.h" |
87 | // [/RLVa:KB] | 87 | // [/RLVa:KB] |
88 | 88 | ||
89 | #define ELAR_ENABLED 0 // Enable when server support is implemented | 89 | #define ELAR_ENABLED 0 // Enable when server support is implemented |
90 | 90 | ||
91 | const S32 TERRAIN_TEXTURE_COUNT = 4; | 91 | const S32 TERRAIN_TEXTURE_COUNT = 4; |
92 | const S32 CORNER_COUNT = 4; | 92 | const S32 CORNER_COUNT = 4; |
93 | 93 | ||
94 | ///---------------------------------------------------------------------------- | 94 | ///---------------------------------------------------------------------------- |
95 | /// Local class declaration | 95 | /// Local class declaration |
96 | ///---------------------------------------------------------------------------- | 96 | ///---------------------------------------------------------------------------- |
97 | 97 | ||
98 | class LLDispatchEstateUpdateInfo : public LLDispatchHandler | 98 | class LLDispatchEstateUpdateInfo : public LLDispatchHandler |
99 | { | 99 | { |
100 | public: | 100 | public: |
101 | LLDispatchEstateUpdateInfo() {} | 101 | LLDispatchEstateUpdateInfo() {} |
102 | virtual ~LLDispatchEstateUpdateInfo() {} | 102 | virtual ~LLDispatchEstateUpdateInfo() {} |
103 | virtual bool operator()( | 103 | virtual bool operator()( |
104 | const LLDispatcher* dispatcher, | 104 | const LLDispatcher* dispatcher, |
105 | const std::string& key, | 105 | const std::string& key, |
106 | const LLUUID& invoice, | 106 | const LLUUID& invoice, |
107 | const sparam_t& strings); | 107 | const sparam_t& strings); |
108 | }; | 108 | }; |
109 | 109 | ||
110 | class LLDispatchSetEstateAccess : public LLDispatchHandler | 110 | class LLDispatchSetEstateAccess : public LLDispatchHandler |
111 | { | 111 | { |
112 | public: | 112 | public: |
113 | LLDispatchSetEstateAccess() {} | 113 | LLDispatchSetEstateAccess() {} |
114 | virtual ~LLDispatchSetEstateAccess() {} | 114 | virtual ~LLDispatchSetEstateAccess() {} |
115 | virtual bool operator()( | 115 | virtual bool operator()( |
116 | const LLDispatcher* dispatcher, | 116 | const LLDispatcher* dispatcher, |
117 | const std::string& key, | 117 | const std::string& key, |
118 | const LLUUID& invoice, | 118 | const LLUUID& invoice, |
119 | const sparam_t& strings); | 119 | const sparam_t& strings); |
120 | }; | 120 | }; |
121 | 121 | ||
122 | 122 | ||
123 | /* | 123 | /* |
124 | void unpack_request_params( | 124 | void unpack_request_params( |
125 | LLMessageSystem* msg, | 125 | LLMessageSystem* msg, |
126 | LLDispatcher::sparam_t& strings, | 126 | LLDispatcher::sparam_t& strings, |
127 | LLDispatcher::iparam_t& integers) | 127 | LLDispatcher::iparam_t& integers) |
128 | { | 128 | { |
129 | char str_buf[MAX_STRING]; | 129 | char str_buf[MAX_STRING]; |
130 | S32 str_count = msg->getNumberOfBlocksFast(_PREHASH_StringData); | 130 | S32 str_count = msg->getNumberOfBlocksFast(_PREHASH_StringData); |
131 | S32 i; | 131 | S32 i; |
132 | for (i = 0; i < str_count; ++i) | 132 | for (i = 0; i < str_count; ++i) |
133 | { | 133 | { |
134 | // we treat the SParam as binary data (since it might be an | 134 | // we treat the SParam as binary data (since it might be an |
135 | // LLUUID in compressed form which may have embedded \0's,) | 135 | // LLUUID in compressed form which may have embedded \0's,) |
136 | str_buf[0] = '\0'; | 136 | str_buf[0] = '\0'; |
137 | S32 data_size = msg->getSizeFast(_PREHASH_StringData, i, _PREHASH_SParam); | 137 | S32 data_size = msg->getSizeFast(_PREHASH_StringData, i, _PREHASH_SParam); |
138 | if (data_size >= 0) | 138 | if (data_size >= 0) |
139 | { | 139 | { |
140 | msg->getBinaryDataFast(_PREHASH_StringData, _PREHASH_SParam, | 140 | msg->getBinaryDataFast(_PREHASH_StringData, _PREHASH_SParam, |
141 | str_buf, data_size, i, MAX_STRING - 1); | 141 | str_buf, data_size, i, MAX_STRING - 1); |
142 | strings.push_back(std::string(str_buf, data_size)); | 142 | strings.push_back(std::string(str_buf, data_size)); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | U32 int_buf; | 146 | U32 int_buf; |
147 | S32 int_count = msg->getNumberOfBlocksFast(_PREHASH_IntegerData); | 147 | S32 int_count = msg->getNumberOfBlocksFast(_PREHASH_IntegerData); |
148 | for (i = 0; i < int_count; ++i) | 148 | for (i = 0; i < int_count; ++i) |
149 | { | 149 | { |
150 | msg->getU32("IntegerData", "IParam", int_buf, i); | 150 | msg->getU32("IntegerData", "IParam", int_buf, i); |
151 | integers.push_back(int_buf); | 151 | integers.push_back(int_buf); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | */ | 154 | */ |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | bool estate_dispatch_initialized = false; | 158 | bool estate_dispatch_initialized = false; |
159 | 159 | ||
160 | 160 | ||
161 | ///---------------------------------------------------------------------------- | 161 | ///---------------------------------------------------------------------------- |
162 | /// LLFloaterRegionInfo | 162 | /// LLFloaterRegionInfo |
163 | ///---------------------------------------------------------------------------- | 163 | ///---------------------------------------------------------------------------- |
164 | 164 | ||
165 | //S32 LLFloaterRegionInfo::sRequestSerial = 0; | 165 | //S32 LLFloaterRegionInfo::sRequestSerial = 0; |
166 | LLUUID LLFloaterRegionInfo::sRequestInvoice; | 166 | LLUUID LLFloaterRegionInfo::sRequestInvoice; |
167 | 167 | ||
168 | LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) | 168 | LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) |
169 | { | 169 | { |
170 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE); | 170 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE); |
171 | } | 171 | } |
172 | 172 | ||
173 | BOOL LLFloaterRegionInfo::postBuild() | 173 | BOOL LLFloaterRegionInfo::postBuild() |
174 | { | 174 | { |
175 | mTab = getChild<LLTabContainer>("region_panels"); | 175 | mTab = getChild<LLTabContainer>("region_panels"); |
176 | 176 | ||
177 | // contruct the panels | 177 | // contruct the panels |
178 | LLPanelRegionInfo* panel; | 178 | LLPanelRegionInfo* panel; |
179 | 179 | ||
180 | panel = new LLPanelRegionGeneralInfo; | 180 | panel = new LLPanelRegionGeneralInfo; |
181 | mInfoPanels.push_back(panel); | 181 | mInfoPanels.push_back(panel); |
182 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml"); | 182 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml"); |
183 | mTab->addTabPanel(panel, panel->getLabel(), TRUE); | 183 | mTab->addTabPanel(panel, panel->getLabel(), TRUE); |
184 | 184 | ||
185 | // We only use this panel on Aurora-based sims -- MC | 185 | // We only use this panel on Aurora-based sims -- MC |
186 | std::string url = gAgent.getRegion()->getCapability("DispatchOpenRegionSettings"); | 186 | std::string url = gAgent.getRegion()->getCapability("DispatchOpenRegionSettings"); |
187 | if (!url.empty()) | 187 | if (!url.empty()) |
188 | { | 188 | { |
189 | panel = new LLPanelRegionOpenSettingsInfo; | 189 | panel = new LLPanelRegionOpenSettingsInfo; |
190 | mInfoPanels.push_back(panel); | 190 | mInfoPanels.push_back(panel); |
191 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_open_region_settings.xml"); | 191 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_open_region_settings.xml"); |
192 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 192 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
193 | } | 193 | } |
194 | 194 | ||
195 | panel = new LLPanelRegionDebugInfo; | 195 | panel = new LLPanelRegionDebugInfo; |
196 | mInfoPanels.push_back(panel); | 196 | mInfoPanels.push_back(panel); |
197 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); | 197 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); |
198 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 198 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
199 | 199 | ||
200 | panel = new LLPanelRegionTextureInfo; | 200 | panel = new LLPanelRegionTextureInfo; |
201 | mInfoPanels.push_back(panel); | 201 | mInfoPanels.push_back(panel); |
202 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); | 202 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); |
203 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 203 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
204 | 204 | ||
205 | panel = new LLPanelRegionTerrainInfo; | 205 | panel = new LLPanelRegionTerrainInfo; |
206 | mInfoPanels.push_back(panel); | 206 | mInfoPanels.push_back(panel); |
207 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); | 207 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); |
208 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 208 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
209 | 209 | ||
210 | panel = new LLPanelEstateInfo; | 210 | panel = new LLPanelEstateInfo; |
211 | mInfoPanels.push_back(panel); | 211 | mInfoPanels.push_back(panel); |
212 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); | 212 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); |
213 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 213 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
214 | 214 | ||
215 | panel = new LLPanelEstateCovenant; | 215 | panel = new LLPanelEstateCovenant; |
216 | mInfoPanels.push_back(panel); | 216 | mInfoPanels.push_back(panel); |
217 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); | 217 | LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); |
218 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); | 218 | mTab->addTabPanel(panel, panel->getLabel(), FALSE); |
219 | 219 | ||
220 | gMessageSystem->setHandlerFunc( | 220 | gMessageSystem->setHandlerFunc( |
221 | "EstateOwnerMessage", | 221 | "EstateOwnerMessage", |
222 | &processEstateOwnerRequest); | 222 | &processEstateOwnerRequest); |
223 | 223 | ||
224 | return TRUE; | 224 | return TRUE; |
225 | } | 225 | } |
226 | 226 | ||
227 | LLFloaterRegionInfo::~LLFloaterRegionInfo() | 227 | LLFloaterRegionInfo::~LLFloaterRegionInfo() |
228 | { | 228 | { |
229 | } | 229 | } |
230 | 230 | ||
231 | void LLFloaterRegionInfo::onOpen() | 231 | void LLFloaterRegionInfo::onOpen() |
232 | { | 232 | { |
233 | LLRect rect = gSavedSettings.getRect("FloaterRegionInfo"); | 233 | LLRect rect = gSavedSettings.getRect("FloaterRegionInfo"); |
234 | S32 left, top; | 234 | S32 left, top; |
235 | gFloaterView->getNewFloaterPosition(&left, &top); | 235 | gFloaterView->getNewFloaterPosition(&left, &top); |
236 | rect.translate(left,top); | 236 | rect.translate(left,top); |
237 | 237 | ||
238 | refreshFromRegion(gAgent.getRegion()); | 238 | refreshFromRegion(gAgent.getRegion()); |
239 | requestRegionInfo(); | 239 | requestRegionInfo(); |
240 | LLFloater::onOpen(); | 240 | LLFloater::onOpen(); |
241 | } | 241 | } |
242 | 242 | ||
243 | // static | 243 | // static |
244 | void LLFloaterRegionInfo::requestRegionInfo() | 244 | void LLFloaterRegionInfo::requestRegionInfo() |
245 | { | 245 | { |
246 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); | 246 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); |
247 | 247 | ||
248 | tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE); | 248 | tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE); |
249 | tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE); | 249 | tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE); |
250 | tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE); | 250 | tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE); |
251 | tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE); | 251 | tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE); |
252 | tab->getChild<LLPanel>("RegionSettings")->setCtrlsEnabled(FALSE); | 252 | tab->getChild<LLPanel>("RegionSettings")->setCtrlsEnabled(FALSE); |
253 | 253 | ||
254 | // Must allow anyone to request the RegionInfo data | 254 | // Must allow anyone to request the RegionInfo data |
255 | // so non-owners/non-gods can see the values. | 255 | // so non-owners/non-gods can see the values. |
256 | // Therefore can't use an EstateOwnerMessage JC | 256 | // Therefore can't use an EstateOwnerMessage JC |
257 | LLMessageSystem* msg = gMessageSystem; | 257 | LLMessageSystem* msg = gMessageSystem; |
258 | msg->newMessage("RequestRegionInfo"); | 258 | msg->newMessage("RequestRegionInfo"); |
259 | msg->nextBlock("AgentData"); | 259 | msg->nextBlock("AgentData"); |
260 | msg->addUUID("AgentID", gAgent.getID()); | 260 | msg->addUUID("AgentID", gAgent.getID()); |
261 | msg->addUUID("SessionID", gAgent.getSessionID()); | 261 | msg->addUUID("SessionID", gAgent.getSessionID()); |
262 | gAgent.sendReliableMessage(); | 262 | gAgent.sendReliableMessage(); |
263 | } | 263 | } |
264 | 264 | ||
265 | // static | 265 | // static |
266 | void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) | 266 | void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) |
267 | { | 267 | { |
268 | static LLDispatcher dispatch; | 268 | static LLDispatcher dispatch; |
269 | if(!findInstance()) | 269 | if(!findInstance()) |
270 | { | 270 | { |
271 | return; | 271 | return; |
272 | } | 272 | } |
273 | 273 | ||
274 | if (!estate_dispatch_initialized) | 274 | if (!estate_dispatch_initialized) |
275 | { | 275 | { |
276 | LLPanelEstateInfo::initDispatch(dispatch); | 276 | LLPanelEstateInfo::initDispatch(dispatch); |
277 | } | 277 | } |
278 | 278 | ||
279 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); | 279 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); |
280 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); | 280 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); |
281 | 281 | ||
282 | // unpack the message | 282 | // unpack the message |
283 | std::string request; | 283 | std::string request; |
284 | LLUUID invoice; | 284 | LLUUID invoice; |
285 | LLDispatcher::sparam_t strings; | 285 | LLDispatcher::sparam_t strings; |
286 | LLDispatcher::unpackMessage(msg, request, invoice, strings); | 286 | LLDispatcher::unpackMessage(msg, request, invoice, strings); |
287 | if(invoice != getLastInvoice()) | 287 | if(invoice != getLastInvoice()) |
288 | { | 288 | { |
289 | llwarns << "Mismatched Estate message: " << request << llendl; | 289 | llwarns << "Mismatched Estate message: " << request << llendl; |
290 | return; | 290 | return; |
291 | } | 291 | } |
292 | 292 | ||
293 | //dispatch the message | 293 | //dispatch the message |
294 | dispatch.dispatch(request, invoice, strings); | 294 | dispatch.dispatch(request, invoice, strings); |
295 | 295 | ||
296 | LLViewerRegion* region = gAgent.getRegion(); | 296 | LLViewerRegion* region = gAgent.getRegion(); |
297 | panel->updateControls(region); | 297 | panel->updateControls(region); |
298 | } | 298 | } |
299 | 299 | ||
300 | 300 | ||
301 | // static | 301 | // static |
302 | void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) | 302 | void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) |
303 | { | 303 | { |
304 | LLPanel* panel; | 304 | LLPanel* panel; |
305 | 305 | ||
306 | llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; | 306 | llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; |
307 | if(!findInstance()) | 307 | if(!findInstance()) |
308 | { | 308 | { |
309 | return; | 309 | return; |
310 | } | 310 | } |
311 | 311 | ||
312 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); | 312 | LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); |
313 | 313 | ||
314 | LLViewerRegion* region = gAgent.getRegion(); | 314 | LLViewerRegion* region = gAgent.getRegion(); |
315 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); | 315 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); |
316 | 316 | ||
317 | // extract message | 317 | // extract message |
318 | std::string sim_name; | 318 | std::string sim_name; |
319 | std::string sim_type = LLTrans::getString("land_type_unknown"); | 319 | std::string sim_type = LLTrans::getString("land_type_unknown"); |
320 | U32 region_flags; | 320 | U32 region_flags; |
321 | U8 agent_limit; | 321 | U8 agent_limit; |
322 | F32 object_bonus_factor; | 322 | F32 object_bonus_factor; |
323 | U8 sim_access; | 323 | U8 sim_access; |
324 | F32 water_height; | 324 | F32 water_height; |
325 | F32 terrain_raise_limit; | 325 | F32 terrain_raise_limit; |
326 | F32 terrain_lower_limit; | 326 | F32 terrain_lower_limit; |
327 | BOOL use_estate_sun; | 327 | BOOL use_estate_sun; |
328 | F32 sun_hour; | 328 | F32 sun_hour; |
329 | msg->getString("RegionInfo", "SimName", sim_name); | 329 | msg->getString("RegionInfo", "SimName", sim_name); |
330 | msg->getU32("RegionInfo", "RegionFlags", region_flags); | 330 | msg->getU32("RegionInfo", "RegionFlags", region_flags); |
331 | msg->getU8("RegionInfo", "MaxAgents", agent_limit); | 331 | msg->getU8("RegionInfo", "MaxAgents", agent_limit); |
332 | msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor); | 332 | msg->getF32("RegionInfo", "ObjectBonusFactor", object_bonus_factor); |
333 | msg->getU8("RegionInfo", "SimAccess", sim_access); | 333 | msg->getU8("RegionInfo", "SimAccess", sim_access); |
334 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height); | 334 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height); |
335 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit); | 335 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit); |
336 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit); | 336 | msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit); |
337 | msg->getBOOL("RegionInfo", "UseEstateSun", use_estate_sun); | 337 | msg->getBOOL("RegionInfo", "UseEstateSun", use_estate_sun); |
338 | // actually the "last set" sun hour, not the current sun hour. JC | 338 | // actually the "last set" sun hour, not the current sun hour. JC |
339 | msg->getF32("RegionInfo", "SunHour", sun_hour); | 339 | msg->getF32("RegionInfo", "SunHour", sun_hour); |
340 | // the only reasonable way to decide if we actually have any data is to | 340 | // the only reasonable way to decide if we actually have any data is to |
341 | // check to see if any of these fields have nonzero sizes | 341 | // check to see if any of these fields have nonzero sizes |
342 | if (msg->getSize("RegionInfo2", "ProductSKU") > 0 || | 342 | if (msg->getSize("RegionInfo2", "ProductSKU") > 0 || |
343 | msg->getSize("RegionInfo2", "ProductName") > 0) | 343 | msg->getSize("RegionInfo2", "ProductName") > 0) |
344 | { | 344 | { |
345 | msg->getString("RegionInfo2", "ProductName", sim_type); | 345 | msg->getString("RegionInfo2", "ProductName", sim_type); |
346 | } | 346 | } |
347 | 347 | ||
348 | // GENERAL PANEL | 348 | // GENERAL PANEL |
349 | panel = tab->getChild<LLPanel>("General"); | 349 | panel = tab->getChild<LLPanel>("General"); |
350 | panel->childSetValue("region_text", LLSD(sim_name)); | 350 | panel->childSetValue("region_text", LLSD(sim_name)); |
351 | panel->childSetValue("region_type", LLSD(sim_type)); | 351 | panel->childSetValue("region_type", LLSD(sim_type)); |
352 | panel->childSetValue("version_channel_text", gLastVersionChannel); | 352 | panel->childSetValue("version_channel_text", gLastVersionChannel); |
353 | 353 | ||
354 | panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); | 354 | panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); |
355 | panel->childSetValue("block_fly_check", (region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE ); | 355 | panel->childSetValue("block_fly_check", (region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE ); |
356 | panel->childSetValue("allow_damage_check", (region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE ); | 356 | panel->childSetValue("allow_damage_check", (region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE ); |
357 | panel->childSetValue("restrict_pushobject", (region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE ); | 357 | panel->childSetValue("restrict_pushobject", (region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE ); |
358 | panel->childSetValue("allow_land_resell_check", (region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE ); | 358 | panel->childSetValue("allow_land_resell_check", (region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE ); |
359 | panel->childSetValue("allow_parcel_changes_check", (region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE ); | 359 | panel->childSetValue("allow_parcel_changes_check", (region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE ); |
360 | panel->childSetValue("block_parcel_search_check", (region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE ); | 360 | panel->childSetValue("block_parcel_search_check", (region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE ); |
361 | panel->childSetValue("agent_limit_spin", LLSD((F32)agent_limit) ); | 361 | panel->childSetValue("agent_limit_spin", LLSD((F32)agent_limit) ); |
362 | panel->childSetValue("object_bonus_spin", LLSD(object_bonus_factor) ); | 362 | panel->childSetValue("object_bonus_spin", LLSD(object_bonus_factor) ); |
363 | panel->childSetValue("access_combo", LLSD(sim_access) ); | 363 | panel->childSetValue("access_combo", LLSD(sim_access) ); |
364 | 364 | ||
365 | 365 | ||
366 | // detect teen grid for maturity | 366 | // detect teen grid for maturity |
367 | 367 | ||
368 | U32 parent_estate_id; | 368 | U32 parent_estate_id; |
369 | msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); | 369 | msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); |
370 | BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that | 370 | BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that |
371 | panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); | 371 | panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); |
372 | panel->setCtrlsEnabled(allow_modify); | 372 | panel->setCtrlsEnabled(allow_modify); |
373 | 373 | ||
374 | // RegionSettings PANEL | 374 | // RegionSettings PANEL |
375 | panel = tab->getChild<LLPanel>("RegionSettings"); | 375 | panel = tab->getChild<LLPanel>("RegionSettings"); |
376 | panel->setCtrlsEnabled(allow_modify); | 376 | panel->setCtrlsEnabled(allow_modify); |
377 | 377 | ||
378 | // DEBUG PANEL | 378 | // DEBUG PANEL |
379 | panel = tab->getChild<LLPanel>("Debug"); | 379 | panel = tab->getChild<LLPanel>("Debug"); |
380 | 380 | ||
381 | panel->childSetValue("region_text", LLSD(sim_name) ); | 381 | panel->childSetValue("region_text", LLSD(sim_name) ); |
382 | panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); | 382 | panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); |
383 | panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); | 383 | panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); |
384 | panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); | 384 | panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); |
385 | panel->setCtrlsEnabled(allow_modify); | 385 | panel->setCtrlsEnabled(allow_modify); |
386 | 386 | ||
387 | // TERRAIN PANEL | 387 | // TERRAIN PANEL |
388 | panel = tab->getChild<LLPanel>("Terrain"); | 388 | panel = tab->getChild<LLPanel>("Terrain"); |
389 | 389 | ||
390 | panel->childSetValue("region_text", LLSD(sim_name)); | 390 | panel->childSetValue("region_text", LLSD(sim_name)); |
391 | panel->childSetValue("water_height_spin", LLSD(water_height)); | 391 | panel->childSetValue("water_height_spin", LLSD(water_height)); |
392 | panel->childSetValue("terrain_raise_spin", LLSD(terrain_raise_limit)); | 392 | panel->childSetValue("terrain_raise_spin", LLSD(terrain_raise_limit)); |
393 | panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit)); | 393 | panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit)); |
394 | panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun)); | 394 | panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun)); |
395 | 395 | ||
396 | panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); | 396 | panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); |
397 | panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); | 397 | panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); |
398 | panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); | 398 | panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); |
399 | panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); | 399 | panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); |
400 | panel->setCtrlsEnabled(allow_modify); | 400 | panel->setCtrlsEnabled(allow_modify); |
401 | 401 | ||
402 | getInstance()->refreshFromRegion( gAgent.getRegion() ); | 402 | getInstance()->refreshFromRegion( gAgent.getRegion() ); |
403 | } | 403 | } |
404 | 404 | ||
405 | // static | 405 | // static |
406 | LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate() | 406 | LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate() |
407 | { | 407 | { |
408 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); | 408 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); |
409 | if (!floater) return NULL; | 409 | if (!floater) return NULL; |
410 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); | 410 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); |
411 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); | 411 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); |
412 | return panel; | 412 | return panel; |
413 | } | 413 | } |
414 | 414 | ||
415 | // static | 415 | // static |
416 | LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() | 416 | LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() |
417 | { | 417 | { |
418 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); | 418 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); |
419 | if (!floater) return NULL; | 419 | if (!floater) return NULL; |
420 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); | 420 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); |
421 | LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant"); | 421 | LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant"); |
422 | return panel; | 422 | return panel; |
423 | } | 423 | } |
424 | 424 | ||
425 | // static | 425 | // static |
426 | LLPanelRegionOpenSettingsInfo* LLFloaterRegionInfo::getPanelOpenSettings() | 426 | LLPanelRegionOpenSettingsInfo* LLFloaterRegionInfo::getPanelOpenSettings() |
427 | { | 427 | { |
428 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); | 428 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); |
429 | if (floater) | 429 | if (floater) |
430 | { | 430 | { |
431 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); | 431 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); |
432 | LLPanelRegionOpenSettingsInfo* panel = (LLPanelRegionOpenSettingsInfo*)tab->getChild<LLPanel>("RegionSettings", FALSE, FALSE); | 432 | LLPanelRegionOpenSettingsInfo* panel = (LLPanelRegionOpenSettingsInfo*)tab->getChild<LLPanel>("RegionSettings", FALSE, FALSE); |
433 | if (panel) | 433 | if (panel) |
434 | { | 434 | { |
435 | return panel; | 435 | return panel; |
436 | } | 436 | } |
437 | } | 437 | } |
438 | return NULL; | 438 | return NULL; |
439 | } | 439 | } |
440 | 440 | ||
441 | void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) | 441 | void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) |
442 | { | 442 | { |
443 | // call refresh from region on all panels | 443 | // call refresh from region on all panels |
444 | std::for_each( | 444 | std::for_each( |
445 | mInfoPanels.begin(), | 445 | mInfoPanels.begin(), |
446 | mInfoPanels.end(), | 446 | mInfoPanels.end(), |
447 | llbind2nd( | 447 | llbind2nd( |
448 | #if LL_WINDOWS | 448 | #if LL_WINDOWS |
449 | std::mem_fun1(&LLPanelRegionInfo::refreshFromRegion), | 449 | std::mem_fun1(&LLPanelRegionInfo::refreshFromRegion), |
450 | #else | 450 | #else |
451 | std::mem_fun(&LLPanelRegionInfo::refreshFromRegion), | 451 | std::mem_fun(&LLPanelRegionInfo::refreshFromRegion), |
452 | #endif | 452 | #endif |
453 | region)); | 453 | region)); |
454 | } | 454 | } |
455 | 455 | ||
456 | // public | 456 | // public |
457 | void LLFloaterRegionInfo::refresh() | 457 | void LLFloaterRegionInfo::refresh() |
458 | { | 458 | { |
459 | for(info_panels_t::iterator iter = mInfoPanels.begin(); | 459 | for(info_panels_t::iterator iter = mInfoPanels.begin(); |
460 | iter != mInfoPanels.end(); ++iter) | 460 | iter != mInfoPanels.end(); ++iter) |
461 | { | 461 | { |
462 | (*iter)->refresh(); | 462 | (*iter)->refresh(); |
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | ///---------------------------------------------------------------------------- | 467 | ///---------------------------------------------------------------------------- |
468 | /// Local class implementation | 468 | /// Local class implementation |
469 | ///---------------------------------------------------------------------------- | 469 | ///---------------------------------------------------------------------------- |
470 | 470 | ||
471 | // | 471 | // |
472 | // LLPanelRegionInfo | 472 | // LLPanelRegionInfo |
473 | // | 473 | // |
474 | 474 | ||
475 | // static | 475 | // static |
476 | void LLPanelRegionInfo::onBtnSet(void* user_data) | 476 | void LLPanelRegionInfo::onBtnSet(void* user_data) |
477 | { | 477 | { |
478 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; | 478 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; |
479 | if(!panel) return; | 479 | if(!panel) return; |
480 | if (panel->sendUpdate()) | 480 | if (panel->sendUpdate()) |
481 | { | 481 | { |
482 | panel->disableButton("apply_btn"); | 482 | panel->disableButton("apply_btn"); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | //static | 486 | //static |
487 | void LLPanelRegionInfo::onChangeChildCtrl(LLUICtrl* ctrl, void* user_data) | 487 | void LLPanelRegionInfo::onChangeChildCtrl(LLUICtrl* ctrl, void* user_data) |
488 | { | 488 | { |
489 | if (ctrl) | 489 | if (ctrl) |
490 | { | 490 | { |
491 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*) ctrl->getParent(); | 491 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*) ctrl->getParent(); |
492 | panel->updateChild(ctrl); | 492 | panel->updateChild(ctrl); |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | // static | 496 | // static |
497 | // Enables the "set" button if it is not already enabled | 497 | // Enables the "set" button if it is not already enabled |
498 | void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) | 498 | void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) |
499 | { | 499 | { |
500 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; | 500 | LLPanelRegionInfo* panel = (LLPanelRegionInfo*)user_data; |
501 | if(panel) | 501 | if(panel) |
502 | { | 502 | { |
503 | panel->enableButton("apply_btn"); | 503 | panel->enableButton("apply_btn"); |
504 | panel->refresh(); | 504 | panel->refresh(); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | // static | 508 | // static |
509 | // Enables set button on change to line editor | 509 | // Enables set button on change to line editor |
510 | void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) | 510 | void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) |
511 | { | 511 | { |
512 | // reuse the previous method | 512 | // reuse the previous method |
513 | onChangeAnything(0, user_data); | 513 | onChangeAnything(0, user_data); |
514 | } | 514 | } |
515 | 515 | ||
516 | 516 | ||
517 | // virtual | 517 | // virtual |
518 | BOOL LLPanelRegionInfo::postBuild() | 518 | BOOL LLPanelRegionInfo::postBuild() |
519 | { | 519 | { |
520 | childSetAction("apply_btn", onBtnSet, this); | 520 | childSetAction("apply_btn", onBtnSet, this); |
521 | childDisable("apply_btn"); | 521 | childDisable("apply_btn"); |
522 | refresh(); | 522 | refresh(); |
523 | return TRUE; | 523 | return TRUE; |
524 | } | 524 | } |
525 | 525 | ||
526 | // virtual | 526 | // virtual |
527 | void LLPanelRegionInfo::updateChild(LLUICtrl* child_ctr) | 527 | void LLPanelRegionInfo::updateChild(LLUICtrl* child_ctr) |
528 | { | 528 | { |
529 | } | 529 | } |
530 | 530 | ||
531 | // virtual | 531 | // virtual |
532 | bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region) | 532 | bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region) |
533 | { | 533 | { |
534 | if (region) mHost = region->getHost(); | 534 | if (region) mHost = region->getHost(); |
535 | return true; | 535 | return true; |
536 | } | 536 | } |
537 | 537 | ||
538 | void LLPanelRegionInfo::sendEstateOwnerMessage( | 538 | void LLPanelRegionInfo::sendEstateOwnerMessage( |
539 | LLMessageSystem* msg, | 539 | LLMessageSystem* msg, |
540 | const std::string& request, | 540 | const std::string& request, |
541 | const LLUUID& invoice, | 541 | const LLUUID& invoice, |
542 | const strings_t& strings) | 542 | const strings_t& strings) |
543 | { | 543 | { |
544 | llinfos << "Sending estate request '" << request << "'" << llendl; | 544 | llinfos << "Sending estate request '" << request << "'" << llendl; |
545 | msg->newMessage("EstateOwnerMessage"); | 545 | msg->newMessage("EstateOwnerMessage"); |
546 | msg->nextBlockFast(_PREHASH_AgentData); | 546 | msg->nextBlockFast(_PREHASH_AgentData); |
547 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 547 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
548 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 548 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
549 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | 549 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used |
550 | msg->nextBlock("MethodData"); | 550 | msg->nextBlock("MethodData"); |
551 | msg->addString("Method", request); | 551 | msg->addString("Method", request); |
552 | msg->addUUID("Invoice", invoice); | 552 | msg->addUUID("Invoice", invoice); |
553 | if(strings.empty()) | 553 | if(strings.empty()) |
554 | { | 554 | { |
555 | msg->nextBlock("ParamList"); | 555 | msg->nextBlock("ParamList"); |
556 | msg->addString("Parameter", NULL); | 556 | msg->addString("Parameter", NULL); |
557 | } | 557 | } |
558 | else | 558 | else |
559 | { | 559 | { |
560 | strings_t::const_iterator it = strings.begin(); | 560 | strings_t::const_iterator it = strings.begin(); |
561 | strings_t::const_iterator end = strings.end(); | 561 | strings_t::const_iterator end = strings.end(); |
562 | for(; it != end; ++it) | 562 | for(; it != end; ++it) |
563 | { | 563 | { |
564 | msg->nextBlock("ParamList"); | 564 | msg->nextBlock("ParamList"); |
565 | msg->addString("Parameter", *it); | 565 | msg->addString("Parameter", *it); |
566 | } | 566 | } |
567 | } | 567 | } |
568 | msg->sendReliable(mHost); | 568 | msg->sendReliable(mHost); |
569 | } | 569 | } |
570 | 570 | ||
571 | void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) | 571 | void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) |
572 | { | 572 | { |
573 | childSetEnabled(btn_name, enable); | 573 | childSetEnabled(btn_name, enable); |
574 | } | 574 | } |
575 | 575 | ||
576 | void LLPanelRegionInfo::disableButton(const std::string& btn_name) | 576 | void LLPanelRegionInfo::disableButton(const std::string& btn_name) |
577 | { | 577 | { |
578 | childDisable(btn_name); | 578 | childDisable(btn_name); |
579 | } | 579 | } |
580 | 580 | ||
581 | void LLPanelRegionInfo::initCtrl(const std::string& name) | 581 | void LLPanelRegionInfo::initCtrl(const std::string& name) |
582 | { | 582 | { |
583 | childSetCommitCallback(name, onChangeAnything, this); | 583 | childSetCommitCallback(name, onChangeAnything, this); |
584 | } | 584 | } |
585 | 585 | ||
586 | void LLPanelRegionInfo::initHelpBtn(const std::string& name, const std::string& xml_alert) | 586 | void LLPanelRegionInfo::initHelpBtn(const std::string& name, const std::string& xml_alert) |
587 | { | 587 | { |
588 | childSetAction(name, onClickHelp, new std::string(xml_alert)); | 588 | childSetAction(name, onClickHelp, new std::string(xml_alert)); |
589 | } | 589 | } |
590 | 590 | ||
591 | // static | 591 | // static |
592 | void LLPanelRegionInfo::onClickHelp(void* data) | 592 | void LLPanelRegionInfo::onClickHelp(void* data) |
593 | { | 593 | { |
594 | std::string* xml_alert = (std::string*)data; | 594 | std::string* xml_alert = (std::string*)data; |
595 | LLNotifications::instance().add(*xml_alert); | 595 | LLNotifications::instance().add(*xml_alert); |
596 | } | 596 | } |
597 | 597 | ||
598 | ///////////////////////////////////////////////////////////////////////////// | 598 | ///////////////////////////////////////////////////////////////////////////// |
599 | // LLPanelRegionGeneralInfo | 599 | // LLPanelRegionGeneralInfo |
600 | // | 600 | // |
601 | bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) | 601 | bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region) |
602 | { | 602 | { |
603 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); | 603 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); |
604 | setCtrlsEnabled(allow_modify); | 604 | setCtrlsEnabled(allow_modify); |
605 | childDisable("apply_btn"); | 605 | childDisable("apply_btn"); |
606 | childSetEnabled("access_text", allow_modify); | 606 | childSetEnabled("access_text", allow_modify); |
607 | // childSetEnabled("access_combo", allow_modify); | 607 | // childSetEnabled("access_combo", allow_modify); |
608 | // now set in processRegionInfo for teen grid detection | 608 | // now set in processRegionInfo for teen grid detection |
609 | childSetEnabled("kick_btn", allow_modify); | 609 | childSetEnabled("kick_btn", allow_modify); |
610 | childSetEnabled("kick_all_btn", allow_modify); | 610 | childSetEnabled("kick_all_btn", allow_modify); |
611 | childSetEnabled("im_btn", allow_modify); | 611 | childSetEnabled("im_btn", allow_modify); |
612 | childSetEnabled("manage_telehub_btn", allow_modify); | 612 | childSetEnabled("manage_telehub_btn", allow_modify); |
613 | 613 | ||
614 | // Data gets filled in by processRegionInfo | 614 | // Data gets filled in by processRegionInfo |
615 | 615 | ||
616 | return LLPanelRegionInfo::refreshFromRegion(region); | 616 | return LLPanelRegionInfo::refreshFromRegion(region); |
617 | } | 617 | } |
618 | 618 | ||
619 | BOOL LLPanelRegionGeneralInfo::postBuild() | 619 | BOOL LLPanelRegionGeneralInfo::postBuild() |
620 | { | 620 | { |
621 | // Enable the "Apply" button if something is changed. JC | 621 | // Enable the "Apply" button if something is changed. JC |
622 | initCtrl("block_terraform_check"); | 622 | initCtrl("block_terraform_check"); |
623 | initCtrl("block_fly_check"); | 623 | initCtrl("block_fly_check"); |
624 | initCtrl("allow_damage_check"); | 624 | initCtrl("allow_damage_check"); |
625 | initCtrl("allow_land_resell_check"); | 625 | initCtrl("allow_land_resell_check"); |
626 | initCtrl("allow_parcel_changes_check"); | 626 | initCtrl("allow_parcel_changes_check"); |
627 | initCtrl("agent_limit_spin"); | 627 | initCtrl("agent_limit_spin"); |
628 | initCtrl("object_bonus_spin"); | 628 | initCtrl("object_bonus_spin"); |
629 | initCtrl("access_combo"); | 629 | initCtrl("access_combo"); |
630 | initCtrl("restrict_pushobject"); | 630 | initCtrl("restrict_pushobject"); |
631 | initCtrl("block_parcel_search_check"); | 631 | initCtrl("block_parcel_search_check"); |
632 | initCtrl("minimum_agent_age"); | 632 | initCtrl("minimum_agent_age"); |
633 | 633 | ||
634 | initHelpBtn("terraform_help", "HelpRegionBlockTerraform"); | 634 | initHelpBtn("terraform_help", "HelpRegionBlockTerraform"); |
635 | initHelpBtn("fly_help", "HelpRegionBlockFly"); | 635 | initHelpBtn("fly_help", "HelpRegionBlockFly"); |
636 | initHelpBtn("damage_help", "HelpRegionAllowDamage"); | 636 | initHelpBtn("damage_help", "HelpRegionAllowDamage"); |
637 | initHelpBtn("agent_limit_help", "HelpRegionAgentLimit"); | 637 | initHelpBtn("agent_limit_help", "HelpRegionAgentLimit"); |
638 | initHelpBtn("object_bonus_help", "HelpRegionObjectBonus"); | 638 | initHelpBtn("object_bonus_help", "HelpRegionObjectBonus"); |
639 | initHelpBtn("access_help", "HelpRegionMaturity"); | 639 | initHelpBtn("access_help", "HelpRegionMaturity"); |
640 | initHelpBtn("restrict_pushobject_help", "HelpRegionRestrictPushObject"); | 640 | initHelpBtn("restrict_pushobject_help", "HelpRegionRestrictPushObject"); |
641 | initHelpBtn("land_resell_help", "HelpRegionLandResell"); | 641 | initHelpBtn("land_resell_help", "HelpRegionLandResell"); |
642 | initHelpBtn("parcel_changes_help", "HelpParcelChanges"); | 642 | initHelpBtn("parcel_changes_help", "HelpParcelChanges"); |
643 | initHelpBtn("parcel_search_help", "HelpRegionSearch"); | 643 | initHelpBtn("parcel_search_help", "HelpRegionSearch"); |
644 | 644 | ||
645 | childSetAction("kick_btn", onClickKick, this); | 645 | childSetAction("kick_btn", onClickKick, this); |
646 | childSetAction("kick_all_btn", onClickKickAll, this); | 646 | childSetAction("kick_all_btn", onClickKickAll, this); |
647 | childSetAction("im_btn", onClickMessage, this); | 647 | childSetAction("im_btn", onClickMessage, this); |
648 | childSetAction("manage_telehub_btn", onClickManageTelehub, this); | 648 | childSetAction("manage_telehub_btn", onClickManageTelehub, this); |
649 | 649 | ||
650 | return LLPanelRegionInfo::postBuild(); | 650 | return LLPanelRegionInfo::postBuild(); |
651 | } | 651 | } |
652 | 652 | ||
653 | // static | 653 | // static |
654 | void LLPanelRegionGeneralInfo::onClickKick(void* userdata) | 654 | void LLPanelRegionGeneralInfo::onClickKick(void* userdata) |
655 | { | 655 | { |
656 | llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl; | 656 | llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl; |
657 | LLPanelRegionGeneralInfo* panelp = (LLPanelRegionGeneralInfo*)userdata; | 657 | LLPanelRegionGeneralInfo* panelp = (LLPanelRegionGeneralInfo*)userdata; |
658 | 658 | ||
659 | // this depends on the grandparent view being a floater | 659 | // this depends on the grandparent view being a floater |
660 | // in order to set up floater dependency | 660 | // in order to set up floater dependency |
661 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); | 661 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); |
662 | LLFloater* child_floater = LLFloaterAvatarPicker::show(onKickCommit, userdata, FALSE, TRUE); | 662 | LLFloater* child_floater = LLFloaterAvatarPicker::show(onKickCommit, userdata, FALSE, TRUE); |
663 | parent_floater->addDependentFloater(child_floater); | 663 | parent_floater->addDependentFloater(child_floater); |
664 | } | 664 | } |
665 | 665 | ||
666 | // static | 666 | // static |
667 | void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | 667 | void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) |
668 | { | 668 | { |
669 | if (names.empty() || ids.empty()) return; | 669 | if (names.empty() || ids.empty()) return; |
670 | if(ids[0].notNull()) | 670 | if(ids[0].notNull()) |
671 | { | 671 | { |
672 | LLPanelRegionGeneralInfo* self = (LLPanelRegionGeneralInfo*)userdata; | 672 | LLPanelRegionGeneralInfo* self = (LLPanelRegionGeneralInfo*)userdata; |
673 | if(!self) return; | 673 | if(!self) return; |
674 | strings_t strings; | 674 | strings_t strings; |
675 | // [0] = our agent id | 675 | // [0] = our agent id |
676 | // [1] = target agent id | 676 | // [1] = target agent id |
677 | std::string buffer; | 677 | std::string buffer; |
678 | gAgent.getID().toString(buffer); | 678 | gAgent.getID().toString(buffer); |
679 | strings.push_back(buffer); | 679 | strings.push_back(buffer); |
680 | 680 | ||
681 | ids[0].toString(buffer); | 681 | ids[0].toString(buffer); |
682 | strings.push_back(strings_t::value_type(buffer)); | 682 | strings.push_back(strings_t::value_type(buffer)); |
683 | 683 | ||
684 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 684 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
685 | self->sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings); | 685 | self->sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings); |
686 | } | 686 | } |
687 | } | 687 | } |
688 | 688 | ||
689 | // static | 689 | // static |
690 | void LLPanelRegionGeneralInfo::onClickKickAll(void* userdata) | 690 | void LLPanelRegionGeneralInfo::onClickKickAll(void* userdata) |
691 | { | 691 | { |
692 | llinfos << "LLPanelRegionGeneralInfo::onClickKickAll" << llendl; | 692 | llinfos << "LLPanelRegionGeneralInfo::onClickKickAll" << llendl; |
693 | LLNotifications::instance().add("KickUsersFromRegion", | 693 | LLNotifications::instance().add("KickUsersFromRegion", |
694 | LLSD(), | 694 | LLSD(), |
695 | LLSD(), | 695 | LLSD(), |
696 | boost::bind(&LLPanelRegionGeneralInfo::onKickAllCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2)); | 696 | boost::bind(&LLPanelRegionGeneralInfo::onKickAllCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2)); |
697 | } | 697 | } |
698 | 698 | ||
699 | bool LLPanelRegionGeneralInfo::onKickAllCommit(const LLSD& notification, const LLSD& response) | 699 | bool LLPanelRegionGeneralInfo::onKickAllCommit(const LLSD& notification, const LLSD& response) |
700 | { | 700 | { |
701 | S32 option = LLNotification::getSelectedOption(notification, response); | 701 | S32 option = LLNotification::getSelectedOption(notification, response); |
702 | if (option == 0) | 702 | if (option == 0) |
703 | { | 703 | { |
704 | strings_t strings; | 704 | strings_t strings; |
705 | // [0] = our agent id | 705 | // [0] = our agent id |
706 | std::string buffer; | 706 | std::string buffer; |
707 | gAgent.getID().toString(buffer); | 707 | gAgent.getID().toString(buffer); |
708 | strings.push_back(buffer); | 708 | strings.push_back(buffer); |
709 | 709 | ||
710 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 710 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
711 | // historical message name | 711 | // historical message name |
712 | sendEstateOwnerMessage(gMessageSystem, "teleporthomeallusers", invoice, strings); | 712 | sendEstateOwnerMessage(gMessageSystem, "teleporthomeallusers", invoice, strings); |
713 | } | 713 | } |
714 | return false; | 714 | return false; |
715 | } | 715 | } |
716 | 716 | ||
717 | // static | 717 | // static |
718 | void LLPanelRegionGeneralInfo::onClickMessage(void* userdata) | 718 | void LLPanelRegionGeneralInfo::onClickMessage(void* userdata) |
719 | { | 719 | { |
720 | llinfos << "LLPanelRegionGeneralInfo::onClickMessage" << llendl; | 720 | llinfos << "LLPanelRegionGeneralInfo::onClickMessage" << llendl; |
721 | LLNotifications::instance().add("MessageRegion", | 721 | LLNotifications::instance().add("MessageRegion", |
722 | LLSD(), | 722 | LLSD(), |
723 | LLSD(), | 723 | LLSD(), |
724 | boost::bind(&LLPanelRegionGeneralInfo::onMessageCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2)); | 724 | boost::bind(&LLPanelRegionGeneralInfo::onMessageCommit, (LLPanelRegionGeneralInfo*)userdata, _1, _2)); |
725 | } | 725 | } |
726 | 726 | ||
727 | // static | 727 | // static |
728 | bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const LLSD& response) | 728 | bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const LLSD& response) |
729 | { | 729 | { |
730 | if(LLNotification::getSelectedOption(notification, response) != 0) return false; | 730 | if(LLNotification::getSelectedOption(notification, response) != 0) return false; |
731 | 731 | ||
732 | std::string text = response["message"].asString(); | 732 | std::string text = response["message"].asString(); |
733 | if (text.empty()) return false; | 733 | if (text.empty()) return false; |
734 | 734 | ||
735 | llinfos << "Message to everyone: " << text << llendl; | 735 | llinfos << "Message to everyone: " << text << llendl; |
736 | strings_t strings; | 736 | strings_t strings; |
737 | // [0] grid_x, unused here | 737 | // [0] grid_x, unused here |
738 | // [1] grid_y, unused here | 738 | // [1] grid_y, unused here |
739 | // [2] agent_id of sender | 739 | // [2] agent_id of sender |
740 | // [3] sender name | 740 | // [3] sender name |
741 | // [4] message | 741 | // [4] message |
742 | strings.push_back("-1"); | 742 | strings.push_back("-1"); |
743 | strings.push_back("-1"); | 743 | strings.push_back("-1"); |
744 | std::string buffer; | 744 | std::string buffer; |
745 | gAgent.getID().toString(buffer); | 745 | gAgent.getID().toString(buffer); |
746 | strings.push_back(buffer); | 746 | strings.push_back(buffer); |
747 | std::string name; | 747 | std::string name; |
748 | gAgent.buildFullname(name); | 748 | gAgent.buildFullname(name); |
749 | strings.push_back(strings_t::value_type(name)); | 749 | strings.push_back(strings_t::value_type(name)); |
750 | strings.push_back(strings_t::value_type(text)); | 750 | strings.push_back(strings_t::value_type(text)); |
751 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 751 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
752 | sendEstateOwnerMessage(gMessageSystem, "simulatormessage", invoice, strings); | 752 | sendEstateOwnerMessage(gMessageSystem, "simulatormessage", invoice, strings); |
753 | return false; | 753 | return false; |
754 | } | 754 | } |
755 | 755 | ||
756 | // static | 756 | // static |
757 | void LLPanelRegionGeneralInfo::onClickManageTelehub(void* data) | 757 | void LLPanelRegionGeneralInfo::onClickManageTelehub(void* data) |
758 | { | 758 | { |
759 | LLFloaterRegionInfo::getInstance()->close(); | 759 | LLFloaterRegionInfo::getInstance()->close(); |
760 | 760 | ||
761 | LLFloaterTelehub::show(); | 761 | LLFloaterTelehub::show(); |
762 | } | 762 | } |
763 | 763 | ||
764 | // setregioninfo | 764 | // setregioninfo |
765 | // strings[0] = 'Y' - block terraform, 'N' - not | 765 | // strings[0] = 'Y' - block terraform, 'N' - not |
766 | // strings[1] = 'Y' - block fly, 'N' - not | 766 | // strings[1] = 'Y' - block fly, 'N' - not |
767 | // strings[2] = 'Y' - allow damage, 'N' - not | 767 | // strings[2] = 'Y' - allow damage, 'N' - not |
768 | // strings[3] = 'Y' - allow land sale, 'N' - not | 768 | // strings[3] = 'Y' - allow land sale, 'N' - not |
769 | // strings[4] = agent limit | 769 | // strings[4] = agent limit |
770 | // strings[5] = object bonus | 770 | // strings[5] = object bonus |
771 | // strings[6] = sim access (0 = unknown, 13 = PG, 21 = Mature, 42 = Adult) | 771 | // strings[6] = sim access (0 = unknown, 13 = PG, 21 = Mature, 42 = Adult) |
772 | // strings[7] = restrict pushobject | 772 | // strings[7] = restrict pushobject |
773 | // strings[8] = 'Y' - allow parcel subdivide, 'N' - not | 773 | // strings[8] = 'Y' - allow parcel subdivide, 'N' - not |
774 | // strings[9] = 'Y' - block parcel search, 'N' - allow | 774 | // strings[9] = 'Y' - block parcel search, 'N' - allow |
775 | BOOL LLPanelRegionGeneralInfo::sendUpdate() | 775 | BOOL LLPanelRegionGeneralInfo::sendUpdate() |
776 | { | 776 | { |
777 | llinfos << "LLPanelRegionGeneralInfo::sendUpdate()" << llendl; | 777 | llinfos << "LLPanelRegionGeneralInfo::sendUpdate()" << llendl; |
778 | 778 | ||
779 | // First try using a Cap. If that fails use the old method. | 779 | // First try using a Cap. If that fails use the old method. |
780 | LLSD body; | 780 | LLSD body; |
781 | std::string url = gAgent.getRegion()->getCapability("DispatchRegionInfo"); | 781 | std::string url = gAgent.getRegion()->getCapability("DispatchRegionInfo"); |
782 | if (!url.empty()) | 782 | if (!url.empty()) |
783 | { | 783 | { |
784 | body["block_terraform"] = childGetValue("block_terraform_check"); | 784 | body["block_terraform"] = childGetValue("block_terraform_check"); |
785 | body["block_fly"] = childGetValue("block_fly_check"); | 785 | body["block_fly"] = childGetValue("block_fly_check"); |
786 | body["allow_damage"] = childGetValue("allow_damage_check"); | 786 | body["allow_damage"] = childGetValue("allow_damage_check"); |
787 | body["allow_land_resell"] = childGetValue("allow_land_resell_check"); | 787 | body["allow_land_resell"] = childGetValue("allow_land_resell_check"); |
788 | body["agent_limit"] = childGetValue("agent_limit_spin"); | 788 | body["agent_limit"] = childGetValue("agent_limit_spin"); |
789 | body["prim_bonus"] = childGetValue("object_bonus_spin"); | 789 | body["prim_bonus"] = childGetValue("object_bonus_spin"); |
790 | body["sim_access"] = childGetValue("access_combo"); | 790 | body["sim_access"] = childGetValue("access_combo"); |
791 | body["restrict_pushobject"] = childGetValue("restrict_pushobject"); | 791 | body["restrict_pushobject"] = childGetValue("restrict_pushobject"); |
792 | body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check"); | 792 | body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check"); |
793 | body["block_parcel_search"] = childGetValue("block_parcel_search_check"); | 793 | body["block_parcel_search"] = childGetValue("block_parcel_search_check"); |
794 | body["minimum_agent_age"] = childGetValue("minimum_agent_age"); | 794 | body["minimum_agent_age"] = childGetValue("minimum_agent_age"); |
795 | 795 | ||
796 | LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); | 796 | LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); |
797 | } | 797 | } |
798 | else | 798 | else |
799 | { | 799 | { |
800 | strings_t strings; | 800 | strings_t strings; |
801 | std::string buffer; | 801 | std::string buffer; |
802 | 802 | ||
803 | buffer = llformat("%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); | 803 | buffer = llformat("%s", (childGetValue("block_terraform_check").asBoolean() ? "Y" : "N")); |
804 | strings.push_back(strings_t::value_type(buffer)); | 804 | strings.push_back(strings_t::value_type(buffer)); |
805 | 805 | ||
806 | buffer = llformat("%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); | 806 | buffer = llformat("%s", (childGetValue("block_fly_check").asBoolean() ? "Y" : "N")); |
807 | strings.push_back(strings_t::value_type(buffer)); | 807 | strings.push_back(strings_t::value_type(buffer)); |
808 | 808 | ||
809 | buffer = llformat("%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); | 809 | buffer = llformat("%s", (childGetValue("allow_damage_check").asBoolean() ? "Y" : "N")); |
810 | strings.push_back(strings_t::value_type(buffer)); | 810 | strings.push_back(strings_t::value_type(buffer)); |
811 | 811 | ||
812 | buffer = llformat("%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); | 812 | buffer = llformat("%s", (childGetValue("allow_land_resell_check").asBoolean() ? "Y" : "N")); |
813 | strings.push_back(strings_t::value_type(buffer)); | 813 | strings.push_back(strings_t::value_type(buffer)); |
814 | 814 | ||
815 | F32 value = (F32)childGetValue("agent_limit_spin").asReal(); | 815 | F32 value = (F32)childGetValue("agent_limit_spin").asReal(); |
816 | buffer = llformat("%f", value); | 816 | buffer = llformat("%f", value); |
817 | strings.push_back(strings_t::value_type(buffer)); | 817 | strings.push_back(strings_t::value_type(buffer)); |
818 | 818 | ||
819 | value = (F32)childGetValue("object_bonus_spin").asReal(); | 819 | value = (F32)childGetValue("object_bonus_spin").asReal(); |
820 | buffer = llformat("%f", value); | 820 | buffer = llformat("%f", value); |
821 | strings.push_back(strings_t::value_type(buffer)); | 821 | strings.push_back(strings_t::value_type(buffer)); |
822 | 822 | ||
823 | buffer = llformat("%d", childGetValue("access_combo").asInteger()); | 823 | buffer = llformat("%d", childGetValue("access_combo").asInteger()); |
824 | strings.push_back(strings_t::value_type(buffer)); | 824 | strings.push_back(strings_t::value_type(buffer)); |
825 | 825 | ||
826 | buffer = llformat("%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); | 826 | buffer = llformat("%s", (childGetValue("restrict_pushobject").asBoolean() ? "Y" : "N")); |
827 | strings.push_back(strings_t::value_type(buffer)); | 827 | strings.push_back(strings_t::value_type(buffer)); |
828 | 828 | ||
829 | buffer = llformat("%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); | 829 | buffer = llformat("%s", (childGetValue("allow_parcel_changes_check").asBoolean() ? "Y" : "N")); |
830 | strings.push_back(strings_t::value_type(buffer)); | 830 | strings.push_back(strings_t::value_type(buffer)); |
831 | 831 | ||
832 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 832 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
833 | sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings); | 833 | sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings); |
834 | } | 834 | } |
835 | 835 | ||
836 | // if we changed access levels, tell user about it | 836 | // if we changed access levels, tell user about it |
837 | LLViewerRegion* region = gAgent.getRegion(); | 837 | LLViewerRegion* region = gAgent.getRegion(); |
838 | if (region && (childGetValue("access_combo").asInteger() != region->getSimAccess()) ) | 838 | if (region && (childGetValue("access_combo").asInteger() != region->getSimAccess()) ) |
839 | { | 839 | { |
840 | LLNotifications::instance().add("RegionMaturityChange"); | 840 | LLNotifications::instance().add("RegionMaturityChange"); |
841 | } | 841 | } |
842 | 842 | ||
843 | return TRUE; | 843 | return TRUE; |
844 | } | 844 | } |
845 | 845 | ||
846 | ///////////////////////////////////////////////////////////////////////////// | 846 | ///////////////////////////////////////////////////////////////////////////// |
847 | // LLPanelRegionOpenSettingsInfo | 847 | // LLPanelRegionOpenSettingsInfo |
848 | // | 848 | // |
849 | bool LLPanelRegionOpenSettingsInfo::refreshFromRegion(LLViewerRegion* region) | 849 | bool LLPanelRegionOpenSettingsInfo::refreshFromRegion(LLViewerRegion* region) |
850 | { | 850 | { |
851 | // Data gets filled in by hippo manager | 851 | // Data gets filled in by hippo manager |
852 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); | 852 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); |
853 | 853 | ||
854 | childSetValue("draw_distance", gAgent.mDrawDistance); | 854 | childSetValue("draw_distance", gAgent.mDrawDistance); |
855 | childSetValue("force_draw_distance", gAgent.mLockedDrawDistance); | 855 | childSetValue("force_draw_distance", gAgent.mLockedDrawDistance); |
856 | childSetValue("allow_minimap", LLSD(gHippoLimits->mAllowMinimap)); | 856 | childSetValue("allow_minimap", LLSD(gHippoLimits->mAllowMinimap)); |
857 | childSetValue("allow_physical_prims", (gHippoLimits->mAllowPhysicalPrims == 1 ? TRUE : FALSE)); | 857 | childSetValue("allow_physical_prims", (gHippoLimits->mAllowPhysicalPrims == 1 ? TRUE : FALSE)); |
858 | childSetValue("max_drag_distance", LLSD(gHippoLimits->mMaxDragDistance)); | 858 | childSetValue("max_drag_distance", LLSD(gHippoLimits->mMaxDragDistance)); |
859 | childSetValue("min_hole_size", LLSD(gHippoLimits->mMinHoleSize)); | 859 | childSetValue("min_hole_size", LLSD(gHippoLimits->mMinHoleSize)); |
860 | childSetValue("max_hollow_size", LLSD(gHippoLimits->mMaxHollow)); | 860 | childSetValue("max_hollow_size", LLSD(gHippoLimits->mMaxHollow)); |
861 | childSetValue("max_inventory_items_transfer", LLSD(gHippoLimits->mMaxInventoryItemsTransfer)); | 861 | childSetValue("max_inventory_items_transfer", LLSD(gHippoLimits->mMaxInventoryItemsTransfer)); |
862 | childSetValue("max_link_count", LLSD(gHippoLimits->mMaxLinkedPrims)); | 862 | childSetValue("max_link_count", LLSD(gHippoLimits->mMaxLinkedPrims)); |
863 | childSetValue("max_link_count_phys", LLSD(gHippoLimits->mMaxPhysLinkedPrims)); | 863 | childSetValue("max_link_count_phys", LLSD(gHippoLimits->mMaxPhysLinkedPrims)); |
864 | childSetValue("max_phys_prim_scale", LLSD(gHippoLimits->mMaxPrimScale));//Todo:Fix | 864 | childSetValue("max_phys_prim_scale", LLSD(gHippoLimits->mMaxPrimScale));//Todo:Fix |
865 | childSetValue("max_prim_scale", LLSD(gHippoLimits->mMaxPrimScale)); | 865 | childSetValue("max_prim_scale", LLSD(gHippoLimits->mMaxPrimScale)); |
866 | childSetValue("min_prim_scale", LLSD(gHippoLimits->mMinPrimScale)); | 866 | childSetValue("min_prim_scale", LLSD(gHippoLimits->mMinPrimScale)); |
867 | childSetValue("render_water", LLSD(gHippoLimits->mRenderWater)); | 867 | childSetValue("render_water", LLSD(gHippoLimits->mRenderWater)); |
868 | childSetValue("show_tags", LLSD(gHippoLimits->mRenderName)); | 868 | childSetValue("show_tags", LLSD(gHippoLimits->mRenderName)); |
869 | childSetValue("max_groups", LLSD(gHippoLimits->mMaxAgentGroups)); | 869 | childSetValue("max_groups", LLSD(gHippoLimits->mMaxAgentGroups)); |
870 | childSetValue("allow_parcel_windlight", LLSD(gHippoLimits->mAllowParcelWindLight)); | 870 | childSetValue("allow_parcel_windlight", LLSD(gHippoLimits->mAllowParcelWindLight)); |
871 | childSetValue("enable_teen_mode", LLSD(gHippoLimits->mEnableTeenMode)); | 871 | childSetValue("enable_teen_mode", LLSD(gHippoLimits->mEnableTeenMode)); |
872 | childSetValue("enforce_max_build", LLSD(gHippoLimits->mEnforceMaxBuild)); | 872 | childSetValue("enforce_max_build", LLSD(gHippoLimits->mEnforceMaxBuild)); |
873 | 873 | ||
874 | setCtrlsEnabled(allow_modify); | 874 | setCtrlsEnabled(allow_modify); |
875 | 875 | ||
876 | return LLPanelRegionInfo::refreshFromRegion(region); | 876 | return LLPanelRegionInfo::refreshFromRegion(region); |
877 | } | 877 | } |
878 | 878 | ||
879 | BOOL LLPanelRegionOpenSettingsInfo::postBuild() | 879 | BOOL LLPanelRegionOpenSettingsInfo::postBuild() |
880 | { | 880 | { |
881 | // Enable the "Apply" button if something is changed. JC | 881 | // Enable the "Apply" button if something is changed. JC |
882 | initCtrl("draw_distance"); | 882 | initCtrl("draw_distance"); |
883 | initCtrl("force_draw_distance"); | 883 | initCtrl("force_draw_distance"); |
884 | initCtrl("max_drag_distance"); | 884 | initCtrl("max_drag_distance"); |
885 | initCtrl("max_prim_scale"); | 885 | initCtrl("max_prim_scale"); |
886 | initCtrl("min_prim_scale"); | 886 | initCtrl("min_prim_scale"); |
887 | initCtrl("max_phys_prim_scale"); | 887 | initCtrl("max_phys_prim_scale"); |
888 | initCtrl("max_hollow_size"); | 888 | initCtrl("max_hollow_size"); |
889 | initCtrl("min_hole_size"); | 889 | initCtrl("min_hole_size"); |
890 | initCtrl("max_link_count"); | 890 | initCtrl("max_link_count"); |
891 | initCtrl("max_link_count_phys"); | 891 | initCtrl("max_link_count_phys"); |
892 | initCtrl("max_inventory_items_transfer"); | 892 | initCtrl("max_inventory_items_transfer"); |
893 | initCtrl("max_groups"); | 893 | initCtrl("max_groups"); |
894 | initCtrl("render_water"); | 894 | initCtrl("render_water"); |
895 | initCtrl("allow_minimap"); | 895 | initCtrl("allow_minimap"); |
896 | initCtrl("allow_physical_prims"); | 896 | initCtrl("allow_physical_prims"); |
897 | initCtrl("enable_teen_mode"); | 897 | initCtrl("enable_teen_mode"); |
898 | initCtrl("show_tags"); | 898 | initCtrl("show_tags"); |
899 | initCtrl("allow_parcel_windlight"); | 899 | initCtrl("allow_parcel_windlight"); |
900 | 900 | ||
901 | initHelpBtn("force_draw_distance_help", "HelpForceDrawDistance"); | 901 | initHelpBtn("force_draw_distance_help", "HelpForceDrawDistance"); |
902 | initHelpBtn("max_inventory_items_transfer_help", "HelpMaxInventoryItemsTransfer"); | 902 | initHelpBtn("max_inventory_items_transfer_help", "HelpMaxInventoryItemsTransfer"); |
903 | initHelpBtn("max_groups_help", "HelpMaxGroups"); | 903 | initHelpBtn("max_groups_help", "HelpMaxGroups"); |
904 | initHelpBtn("render_water_help", "HelpRenderWater"); | 904 | initHelpBtn("render_water_help", "HelpRenderWater"); |
905 | initHelpBtn("allow_minimap_help", "HelpAllowMinimap"); | 905 | initHelpBtn("allow_minimap_help", "HelpAllowMinimap"); |
906 | initHelpBtn("allow_physical_prims_help", "HelpAllowPhysicalPrims"); | 906 | initHelpBtn("allow_physical_prims_help", "HelpAllowPhysicalPrims"); |
907 | initHelpBtn("enable_teen_mode_help", "HelpEnableTeenMode"); | 907 | initHelpBtn("enable_teen_mode_help", "HelpEnableTeenMode"); |
908 | initHelpBtn("show_tags_help", "HelpShowTags"); | 908 | initHelpBtn("show_tags_help", "HelpShowTags"); |
909 | initHelpBtn("allow_parcel_windlight_help", "HelpAllowParcelWindLight"); | 909 | initHelpBtn("allow_parcel_windlight_help", "HelpAllowParcelWindLight"); |
910 | 910 | ||
911 | childSetAction("apply_ors_btn", onClickOrs, this); | 911 | childSetAction("apply_ors_btn", onClickOrs, this); |
912 | 912 | ||
913 | refreshFromRegion(gAgent.getRegion()); | 913 | refreshFromRegion(gAgent.getRegion()); |
914 | 914 | ||
915 | return LLPanelRegionInfo::postBuild(); | 915 | return LLPanelRegionInfo::postBuild(); |
916 | } | 916 | } |
917 | 917 | ||
918 | // setregioninfo | 918 | // setregioninfo |
919 | // strings[0] = 'Y' - block terraform, 'N' - not | 919 | // strings[0] = 'Y' - block terraform, 'N' - not |
920 | // strings[1] = 'Y' - block fly, 'N' - not | 920 | // strings[1] = 'Y' - block fly, 'N' - not |
921 | // strings[2] = 'Y' - allow damage, 'N' - not | 921 | // strings[2] = 'Y' - allow damage, 'N' - not |
922 | // strings[3] = 'Y' - allow land sale, 'N' - not | 922 | // strings[3] = 'Y' - allow land sale, 'N' - not |
923 | // strings[4] = agent limit | 923 | // strings[4] = agent limit |
924 | // strings[5] = object bonus | 924 | // strings[5] = object bonus |
925 | // strings[6] = sim access (0 = unknown, 13 = PG, 21 = Mature, 42 = Adult) | 925 | // strings[6] = sim access (0 = unknown, 13 = PG, 21 = Mature, 42 = Adult) |
926 | // strings[7] = restrict pushobject | 926 | // strings[7] = restrict pushobject |
927 | // strings[8] = 'Y' - allow parcel subdivide, 'N' - not | 927 | // strings[8] = 'Y' - allow parcel subdivide, 'N' - not |
928 | // strings[9] = 'Y' - block parcel search, 'N' - allow | 928 | // strings[9] = 'Y' - block parcel search, 'N' - allow |
929 | void LLPanelRegionOpenSettingsInfo::onClickOrs(void* userdata) | 929 | void LLPanelRegionOpenSettingsInfo::onClickOrs(void* userdata) |
930 | { | 930 | { |
931 | LLPanelRegionOpenSettingsInfo* self; | 931 | LLPanelRegionOpenSettingsInfo* self; |
932 | self = (LLPanelRegionOpenSettingsInfo*)userdata; | 932 | self = (LLPanelRegionOpenSettingsInfo*)userdata; |
933 | 933 | ||
934 | llinfos << "LLPanelRegionOpenSettingsInfo::onClickOrs()" << llendl; | 934 | llinfos << "LLPanelRegionOpenSettingsInfo::onClickOrs()" << llendl; |
935 | 935 | ||
936 | LLSD body; | 936 | LLSD body; |
937 | std::string url = gAgent.getRegion()->getCapability("DispatchOpenRegionSettings"); | 937 | std::string url = gAgent.getRegion()->getCapability("DispatchOpenRegionSettings"); |
938 | if (!url.empty()) | 938 | if (!url.empty()) |
939 | { | 939 | { |
940 | body["draw_distance"] = self->childGetValue("draw_distance"); | 940 | body["draw_distance"] = self->childGetValue("draw_distance"); |
941 | body["force_draw_distance"] = self->childGetValue("force_draw_distance"); | 941 | body["force_draw_distance"] = self->childGetValue("force_draw_distance"); |
942 | body["allow_minimap"] = self->childGetValue("allow_minimap"); | 942 | body["allow_minimap"] = self->childGetValue("allow_minimap"); |
943 | body["allow_physical_prims"] = self->childGetValue("allow_physical_prims"); | 943 | body["allow_physical_prims"] = self->childGetValue("allow_physical_prims"); |
944 | body["max_drag_distance"] = self->childGetValue("max_drag_distance"); | 944 | body["max_drag_distance"] = self->childGetValue("max_drag_distance"); |
945 | body["min_hole_size"] = self->childGetValue("min_hole_size"); | 945 | body["min_hole_size"] = self->childGetValue("min_hole_size"); |
946 | body["max_hollow_size"] = self->childGetValue("max_hollow_size"); | 946 | body["max_hollow_size"] = self->childGetValue("max_hollow_size"); |
947 | body["max_inventory_items_transfer"] = self->childGetValue("max_inventory_items_transfer"); | 947 | body["max_inventory_items_transfer"] = self->childGetValue("max_inventory_items_transfer"); |
948 | body["max_link_count"] = self->childGetValue("max_link_count"); | 948 | body["max_link_count"] = self->childGetValue("max_link_count"); |
949 | body["max_link_count_phys"] = self->childGetValue("max_link_count_phys"); | 949 | body["max_link_count_phys"] = self->childGetValue("max_link_count_phys"); |
950 | body["max_phys_prim_scale"] = self->childGetValue("max_phys_prim_scale"); | 950 | body["max_phys_prim_scale"] = self->childGetValue("max_phys_prim_scale"); |
951 | body["max_prim_scale"] = self->childGetValue("max_prim_scale"); | 951 | body["max_prim_scale"] = self->childGetValue("max_prim_scale"); |
952 | body["min_prim_scale"] = self->childGetValue("min_prim_scale"); | 952 | body["min_prim_scale"] = self->childGetValue("min_prim_scale"); |
953 | body["render_water"] = self->childGetValue("render_water"); | 953 | body["render_water"] = self->childGetValue("render_water"); |
954 | body["show_tags"] = self->childGetValue("show_tags"); | 954 | body["show_tags"] = self->childGetValue("show_tags"); |
955 | body["max_groups"] = self->childGetValue("max_groups"); | 955 | body["max_groups"] = self->childGetValue("max_groups"); |
956 | body["allow_parcel_windlight"] = self->childGetValue("allow_parcel_windlight"); | 956 | body["allow_parcel_windlight"] = self->childGetValue("allow_parcel_windlight"); |
957 | body["enable_teen_mode"] = self->childGetValue("enable_teen_mode"); | 957 | body["enable_teen_mode"] = self->childGetValue("enable_teen_mode"); |
958 | body["enforce_max_build"] = self->childGetValue("enforce_max_build"); | 958 | body["enforce_max_build"] = self->childGetValue("enforce_max_build"); |
959 | 959 | ||
960 | LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); | 960 | LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); |
961 | } | 961 | } |
962 | } | 962 | } |
963 | 963 | ||
964 | ///////////////////////////////////////////////////////////////////////////// | 964 | ///////////////////////////////////////////////////////////////////////////// |
965 | // LLPanelRegionDebugInfo | 965 | // LLPanelRegionDebugInfo |
966 | ///////////////////////////////////////////////////////////////////////////// | 966 | ///////////////////////////////////////////////////////////////////////////// |
967 | BOOL LLPanelRegionDebugInfo::postBuild() | 967 | BOOL LLPanelRegionDebugInfo::postBuild() |
968 | { | 968 | { |
969 | LLPanelRegionInfo::postBuild(); | 969 | LLPanelRegionInfo::postBuild(); |
970 | initCtrl("disable_scripts_check"); | 970 | initCtrl("disable_scripts_check"); |
971 | initCtrl("disable_collisions_check"); | 971 | initCtrl("disable_collisions_check"); |
972 | initCtrl("disable_physics_check"); | 972 | initCtrl("disable_physics_check"); |
973 | 973 | ||
974 | initHelpBtn("disable_scripts_help", "HelpRegionDisableScripts"); | 974 | initHelpBtn("disable_scripts_help", "HelpRegionDisableScripts"); |
975 | initHelpBtn("disable_collisions_help", "HelpRegionDisableCollisions"); | 975 | initHelpBtn("disable_collisions_help", "HelpRegionDisableCollisions"); |
976 | initHelpBtn("disable_physics_help", "HelpRegionDisablePhysics"); | 976 | initHelpBtn("disable_physics_help", "HelpRegionDisablePhysics"); |
977 | initHelpBtn("top_colliders_help", "HelpRegionTopColliders"); | 977 | initHelpBtn("top_colliders_help", "HelpRegionTopColliders"); |
978 | initHelpBtn("top_scripts_help", "HelpRegionTopScripts"); | 978 | initHelpBtn("top_scripts_help", "HelpRegionTopScripts"); |
979 | initHelpBtn("restart_help", "HelpRegionRestart"); | 979 | initHelpBtn("restart_help", "HelpRegionRestart"); |
980 | initHelpBtn("minimum_agent_age_help", "HelpRegionMinimumAge"); | 980 | initHelpBtn("minimum_agent_age_help", "HelpRegionMinimumAge"); |
981 | 981 | ||
982 | 982 | ||
983 | childSetAction("choose_avatar_btn", onClickChooseAvatar, this); | 983 | childSetAction("choose_avatar_btn", onClickChooseAvatar, this); |
984 | childSetAction("return_btn", onClickReturn, this); | 984 | childSetAction("return_btn", onClickReturn, this); |
985 | childSetAction("top_colliders_btn", onClickTopColliders, this); | 985 | childSetAction("top_colliders_btn", onClickTopColliders, this); |
986 | childSetAction("top_scripts_btn", onClickTopScripts, this); | 986 | childSetAction("top_scripts_btn", onClickTopScripts, this); |
987 | childSetAction("restart_btn", onClickRestart, this); | 987 | childSetAction("restart_btn", onClickRestart, this); |
988 | childSetAction("cancel_restart_btn", onClickCancelRestart, this); | 988 | childSetAction("cancel_restart_btn", onClickCancelRestart, this); |
989 | 989 | ||
990 | return TRUE; | 990 | return TRUE; |
991 | } | 991 | } |
992 | 992 | ||
993 | // virtual | 993 | // virtual |
994 | bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) | 994 | bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) |
995 | { | 995 | { |
996 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); | 996 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); |
997 | setCtrlsEnabled(allow_modify); | 997 | setCtrlsEnabled(allow_modify); |
998 | childDisable("apply_btn"); | 998 | childDisable("apply_btn"); |
999 | childDisable("target_avatar_name"); | 999 | childDisable("target_avatar_name"); |
1000 | 1000 | ||
1001 | childSetEnabled("choose_avatar_btn", allow_modify); | 1001 | childSetEnabled("choose_avatar_btn", allow_modify); |
1002 | childSetEnabled("return_scripts", allow_modify && !mTargetAvatar.isNull()); | 1002 | childSetEnabled("return_scripts", allow_modify && !mTargetAvatar.isNull()); |
1003 | childSetEnabled("return_other_land", allow_modify && !mTargetAvatar.isNull()); | 1003 | childSetEnabled("return_other_land", allow_modify && !mTargetAvatar.isNull()); |
1004 | childSetEnabled("return_estate_wide", allow_modify && !mTargetAvatar.isNull()); | 1004 | childSetEnabled("return_estate_wide", allow_modify && !mTargetAvatar.isNull()); |
1005 | childSetEnabled("return_btn", allow_modify && !mTargetAvatar.isNull()); | 1005 | childSetEnabled("return_btn", allow_modify && !mTargetAvatar.isNull()); |
1006 | childSetEnabled("top_colliders_btn", allow_modify); | 1006 | childSetEnabled("top_colliders_btn", allow_modify); |
1007 | childSetEnabled("top_scripts_btn", allow_modify); | 1007 | childSetEnabled("top_scripts_btn", allow_modify); |
1008 | childSetEnabled("restart_btn", allow_modify); | 1008 | childSetEnabled("restart_btn", allow_modify); |
1009 | childSetEnabled("cancel_restart_btn", allow_modify); | 1009 | childSetEnabled("cancel_restart_btn", allow_modify); |
1010 | 1010 | ||
1011 | return LLPanelRegionInfo::refreshFromRegion(region); | 1011 | return LLPanelRegionInfo::refreshFromRegion(region); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | // virtual | 1014 | // virtual |
1015 | BOOL LLPanelRegionDebugInfo::sendUpdate() | 1015 | BOOL LLPanelRegionDebugInfo::sendUpdate() |
1016 | { | 1016 | { |
1017 | llinfos << "LLPanelRegionDebugInfo::sendUpdate" << llendl; | 1017 | llinfos << "LLPanelRegionDebugInfo::sendUpdate" << llendl; |
1018 | strings_t strings; | 1018 | strings_t strings; |
1019 | std::string buffer; | 1019 | std::string buffer; |
1020 | 1020 | ||
1021 | buffer = llformat("%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); | 1021 | buffer = llformat("%s", (childGetValue("disable_scripts_check").asBoolean() ? "Y" : "N")); |
1022 | strings.push_back(buffer); | 1022 | strings.push_back(buffer); |
1023 | 1023 | ||
1024 | buffer = llformat("%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); | 1024 | buffer = llformat("%s", (childGetValue("disable_collisions_check").asBoolean() ? "Y" : "N")); |
1025 | strings.push_back(buffer); | 1025 | strings.push_back(buffer); |
1026 | 1026 | ||
1027 | buffer = llformat("%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); | 1027 | buffer = llformat("%s", (childGetValue("disable_physics_check").asBoolean() ? "Y" : "N")); |
1028 | strings.push_back(buffer); | 1028 | strings.push_back(buffer); |
1029 | 1029 | ||
1030 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1030 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1031 | sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings); | 1031 | sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings); |
1032 | return TRUE; | 1032 | return TRUE; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | void LLPanelRegionDebugInfo::onClickChooseAvatar(void* data) | 1035 | void LLPanelRegionDebugInfo::onClickChooseAvatar(void* data) |
1036 | { | 1036 | { |
1037 | LLFloaterAvatarPicker::show(callbackAvatarID, data, FALSE, TRUE); | 1037 | LLFloaterAvatarPicker::show(callbackAvatarID, data, FALSE, TRUE); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | // static | 1040 | // static |
1041 | void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) | 1041 | void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) |
1042 | { | 1042 | { |
1043 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*) data; | 1043 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*) data; |
1044 | if (ids.empty() || names.empty()) return; | 1044 | if (ids.empty() || names.empty()) return; |
1045 | self->mTargetAvatar = ids[0]; | 1045 | self->mTargetAvatar = ids[0]; |
1046 | self->childSetValue("target_avatar_name", LLSD(names[0])); | 1046 | self->childSetValue("target_avatar_name", LLSD(names[0])); |
1047 | self->refreshFromRegion( gAgent.getRegion() ); | 1047 | self->refreshFromRegion( gAgent.getRegion() ); |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | // static | 1050 | // static |
1051 | void LLPanelRegionDebugInfo::onClickReturn(void* data) | 1051 | void LLPanelRegionDebugInfo::onClickReturn(void* data) |
1052 | { | 1052 | { |
1053 | LLPanelRegionDebugInfo* panelp = (LLPanelRegionDebugInfo*) data; | 1053 | LLPanelRegionDebugInfo* panelp = (LLPanelRegionDebugInfo*) data; |
1054 | if (panelp->mTargetAvatar.isNull()) return; | 1054 | if (panelp->mTargetAvatar.isNull()) return; |
1055 | 1055 | ||
1056 | LLSD args; | 1056 | LLSD args; |
1057 | args["USER_NAME"] = panelp->childGetValue("target_avatar_name").asString(); | 1057 | args["USER_NAME"] = panelp->childGetValue("target_avatar_name").asString(); |
1058 | LLSD payload; | 1058 | LLSD payload; |
1059 | payload["avatar_id"] = panelp->mTargetAvatar; | 1059 | payload["avatar_id"] = panelp->mTargetAvatar; |
1060 | 1060 | ||
1061 | U32 flags = SWD_ALWAYS_RETURN_OBJECTS; | 1061 | U32 flags = SWD_ALWAYS_RETURN_OBJECTS; |
1062 | 1062 | ||
1063 | if (panelp->childGetValue("return_scripts").asBoolean()) | 1063 | if (panelp->childGetValue("return_scripts").asBoolean()) |
1064 | { | 1064 | { |
1065 | flags |= SWD_SCRIPTED_ONLY; | 1065 | flags |= SWD_SCRIPTED_ONLY; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | if (panelp->childGetValue("return_other_land").asBoolean()) | 1068 | if (panelp->childGetValue("return_other_land").asBoolean()) |
1069 | { | 1069 | { |
1070 | flags |= SWD_OTHERS_LAND_ONLY; | 1070 | flags |= SWD_OTHERS_LAND_ONLY; |
1071 | } | 1071 | } |
1072 | payload["flags"] = int(flags); | 1072 | payload["flags"] = int(flags); |
1073 | payload["return_estate_wide"] = panelp->childGetValue("return_estate_wide").asBoolean(); | 1073 | payload["return_estate_wide"] = panelp->childGetValue("return_estate_wide").asBoolean(); |
1074 | LLNotifications::instance().add("EstateObjectReturn", args, payload, | 1074 | LLNotifications::instance().add("EstateObjectReturn", args, payload, |
1075 | boost::bind(&LLPanelRegionDebugInfo::callbackReturn, panelp, _1, _2)); | 1075 | boost::bind(&LLPanelRegionDebugInfo::callbackReturn, panelp, _1, _2)); |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | bool LLPanelRegionDebugInfo::callbackReturn(const LLSD& notification, const LLSD& response) | 1078 | bool LLPanelRegionDebugInfo::callbackReturn(const LLSD& notification, const LLSD& response) |
1079 | { | 1079 | { |
1080 | S32 option = LLNotification::getSelectedOption(notification, response); | 1080 | S32 option = LLNotification::getSelectedOption(notification, response); |
1081 | if (option != 0) return false; | 1081 | if (option != 0) return false; |
1082 | 1082 | ||
1083 | LLUUID target_avatar = notification["payload"]["avatar_id"].asUUID(); | 1083 | LLUUID target_avatar = notification["payload"]["avatar_id"].asUUID(); |
1084 | if (!target_avatar.isNull()) | 1084 | if (!target_avatar.isNull()) |
1085 | { | 1085 | { |
1086 | U32 flags = notification["payload"]["flags"].asInteger(); | 1086 | U32 flags = notification["payload"]["flags"].asInteger(); |
1087 | bool return_estate_wide = notification["payload"]["return_estate_wide"]; | 1087 | bool return_estate_wide = notification["payload"]["return_estate_wide"]; |
1088 | if (return_estate_wide) | 1088 | if (return_estate_wide) |
1089 | { | 1089 | { |
1090 | // send as estate message - routed by spaceserver to all regions in estate | 1090 | // send as estate message - routed by spaceserver to all regions in estate |
1091 | strings_t strings; | 1091 | strings_t strings; |
1092 | strings.push_back(llformat("%d", flags)); | 1092 | strings.push_back(llformat("%d", flags)); |
1093 | strings.push_back(target_avatar.asString()); | 1093 | strings.push_back(target_avatar.asString()); |
1094 | 1094 | ||
1095 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1095 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1096 | 1096 | ||
1097 | sendEstateOwnerMessage(gMessageSystem, "estateobjectreturn", invoice, strings); | 1097 | sendEstateOwnerMessage(gMessageSystem, "estateobjectreturn", invoice, strings); |
1098 | } | 1098 | } |
1099 | else | 1099 | else |
1100 | { | 1100 | { |
1101 | // send to this simulator only | 1101 | // send to this simulator only |
1102 | send_sim_wide_deletes(target_avatar, flags); | 1102 | send_sim_wide_deletes(target_avatar, flags); |
1103 | } | 1103 | } |
1104 | } | 1104 | } |
1105 | return false; | 1105 | return false; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | 1108 | ||
1109 | // static | 1109 | // static |
1110 | void LLPanelRegionDebugInfo::onClickTopColliders(void* data) | 1110 | void LLPanelRegionDebugInfo::onClickTopColliders(void* data) |
1111 | { | 1111 | { |
1112 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; | 1112 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; |
1113 | strings_t strings; | 1113 | strings_t strings; |
1114 | strings.push_back("1"); // one physics step | 1114 | strings.push_back("1"); // one physics step |
1115 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1115 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1116 | LLFloaterTopObjects::show(); | 1116 | LLFloaterTopObjects::show(); |
1117 | LLFloaterTopObjects::clearList(); | 1117 | LLFloaterTopObjects::clearList(); |
1118 | self->sendEstateOwnerMessage(gMessageSystem, "colliders", invoice, strings); | 1118 | self->sendEstateOwnerMessage(gMessageSystem, "colliders", invoice, strings); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | // static | 1121 | // static |
1122 | void LLPanelRegionDebugInfo::onClickTopScripts(void* data) | 1122 | void LLPanelRegionDebugInfo::onClickTopScripts(void* data) |
1123 | { | 1123 | { |
1124 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; | 1124 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; |
1125 | strings_t strings; | 1125 | strings_t strings; |
1126 | strings.push_back("6"); // top 5 scripts | 1126 | strings.push_back("6"); // top 5 scripts |
1127 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1127 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1128 | LLFloaterTopObjects::show(); | 1128 | LLFloaterTopObjects::show(); |
1129 | LLFloaterTopObjects::clearList(); | 1129 | LLFloaterTopObjects::clearList(); |
1130 | self->sendEstateOwnerMessage(gMessageSystem, "scripts", invoice, strings); | 1130 | self->sendEstateOwnerMessage(gMessageSystem, "scripts", invoice, strings); |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | // static | 1133 | // static |
1134 | void LLPanelRegionDebugInfo::onClickRestart(void* data) | 1134 | void LLPanelRegionDebugInfo::onClickRestart(void* data) |
1135 | { | 1135 | { |
1136 | LLNotifications::instance().add("ConfirmRestart", LLSD(), LLSD(), | 1136 | LLNotifications::instance().add("ConfirmRestart", LLSD(), LLSD(), |
1137 | boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2)); | 1137 | boost::bind(&LLPanelRegionDebugInfo::callbackRestart, (LLPanelRegionDebugInfo*)data, _1, _2)); |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | bool LLPanelRegionDebugInfo::callbackRestart(const LLSD& notification, const LLSD& response) | 1140 | bool LLPanelRegionDebugInfo::callbackRestart(const LLSD& notification, const LLSD& response) |
1141 | { | 1141 | { |
1142 | S32 option = LLNotification::getSelectedOption(notification, response); | 1142 | S32 option = LLNotification::getSelectedOption(notification, response); |
1143 | if (option != 0) return false; | 1143 | if (option != 0) return false; |
1144 | 1144 | ||
1145 | strings_t strings; | 1145 | strings_t strings; |
1146 | strings.push_back("120"); | 1146 | strings.push_back("120"); |
1147 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1147 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1148 | sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings); | 1148 | sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings); |
1149 | return false; | 1149 | return false; |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | // static | 1152 | // static |
1153 | void LLPanelRegionDebugInfo::onClickCancelRestart(void* data) | 1153 | void LLPanelRegionDebugInfo::onClickCancelRestart(void* data) |
1154 | { | 1154 | { |
1155 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; | 1155 | LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*)data; |
1156 | strings_t strings; | 1156 | strings_t strings; |
1157 | strings.push_back("-1"); | 1157 | strings.push_back("-1"); |
1158 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1158 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1159 | self->sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings); | 1159 | self->sendEstateOwnerMessage(gMessageSystem, "restart", invoice, strings); |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | ///////////////////////////////////////////////////////////////////////////// | 1163 | ///////////////////////////////////////////////////////////////////////////// |
1164 | // LLPanelRegionTextureInfo | 1164 | // LLPanelRegionTextureInfo |
1165 | // | 1165 | // |
1166 | LLPanelRegionTextureInfo::LLPanelRegionTextureInfo() : LLPanelRegionInfo() | 1166 | LLPanelRegionTextureInfo::LLPanelRegionTextureInfo() : LLPanelRegionInfo() |
1167 | { | 1167 | { |
1168 | // nothing. | 1168 | // nothing. |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) | 1171 | bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) |
1172 | { | 1172 | { |
1173 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); | 1173 | BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); |
1174 | setCtrlsEnabled(allow_modify); | 1174 | setCtrlsEnabled(allow_modify); |
1175 | childDisable("apply_btn"); | 1175 | childDisable("apply_btn"); |
1176 | 1176 | ||
1177 | if (region) | 1177 | if (region) |
1178 | { | 1178 | { |
1179 | childSetValue("region_text", LLSD(region->getName())); | 1179 | childSetValue("region_text", LLSD(region->getName())); |
1180 | } | 1180 | } |
1181 | else | 1181 | else |
1182 | { | 1182 | { |
1183 | childSetValue("region_text", LLSD("")); | 1183 | childSetValue("region_text", LLSD("")); |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | if (!region) return LLPanelRegionInfo::refreshFromRegion(region); | 1186 | if (!region) return LLPanelRegionInfo::refreshFromRegion(region); |
1187 | 1187 | ||
1188 | LLVLComposition* compp = region->getComposition(); | 1188 | LLVLComposition* compp = region->getComposition(); |
1189 | LLTextureCtrl* texture_ctrl; | 1189 | LLTextureCtrl* texture_ctrl; |
1190 | std::string buffer; | 1190 | std::string buffer; |
1191 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) | 1191 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) |
1192 | { | 1192 | { |
1193 | buffer = llformat("texture_detail_%d", i); | 1193 | buffer = llformat("texture_detail_%d", i); |
1194 | texture_ctrl = getChild<LLTextureCtrl>(buffer); | 1194 | texture_ctrl = getChild<LLTextureCtrl>(buffer); |
1195 | if(texture_ctrl) | 1195 | if(texture_ctrl) |
1196 | { | 1196 | { |
1197 | lldebugs << "Detail Texture " << i << ": " | 1197 | lldebugs << "Detail Texture " << i << ": " |
1198 | << compp->getDetailTextureID(i) << llendl; | 1198 | << compp->getDetailTextureID(i) << llendl; |
1199 | LLUUID tmp_id(compp->getDetailTextureID(i)); | 1199 | LLUUID tmp_id(compp->getDetailTextureID(i)); |
1200 | texture_ctrl->setImageAssetID(tmp_id); | 1200 | texture_ctrl->setImageAssetID(tmp_id); |
1201 | } | 1201 | } |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | for(S32 i = 0; i < CORNER_COUNT; ++i) | 1204 | for(S32 i = 0; i < CORNER_COUNT; ++i) |
1205 | { | 1205 | { |
1206 | buffer = llformat("height_start_spin_%d", i); | 1206 | buffer = llformat("height_start_spin_%d", i); |
1207 | childSetValue(buffer, LLSD(compp->getStartHeight(i))); | 1207 | childSetValue(buffer, LLSD(compp->getStartHeight(i))); |
1208 | buffer = llformat("height_range_spin_%d", i); | 1208 | buffer = llformat("height_range_spin_%d", i); |
1209 | childSetValue(buffer, LLSD(compp->getHeightRange(i))); | 1209 | childSetValue(buffer, LLSD(compp->getHeightRange(i))); |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | // Call the parent for common book-keeping | 1212 | // Call the parent for common book-keeping |
1213 | return LLPanelRegionInfo::refreshFromRegion(region); | 1213 | return LLPanelRegionInfo::refreshFromRegion(region); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | 1216 | ||
1217 | BOOL LLPanelRegionTextureInfo::postBuild() | 1217 | BOOL LLPanelRegionTextureInfo::postBuild() |
1218 | { | 1218 | { |
1219 | LLPanelRegionInfo::postBuild(); | 1219 | LLPanelRegionInfo::postBuild(); |
1220 | std::string buffer; | 1220 | std::string buffer; |
1221 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) | 1221 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) |
1222 | { | 1222 | { |
1223 | buffer = llformat("texture_detail_%d", i); | 1223 | buffer = llformat("texture_detail_%d", i); |
1224 | initCtrl(buffer); | 1224 | initCtrl(buffer); |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | for(S32 i = 0; i < CORNER_COUNT; ++i) | 1227 | for(S32 i = 0; i < CORNER_COUNT; ++i) |
1228 | { | 1228 | { |
1229 | buffer = llformat("height_start_spin_%d", i); | 1229 | buffer = llformat("height_start_spin_%d", i); |
1230 | initCtrl(buffer); | 1230 | initCtrl(buffer); |
1231 | buffer = llformat("height_range_spin_%d", i); | 1231 | buffer = llformat("height_range_spin_%d", i); |
1232 | initCtrl(buffer); | 1232 | initCtrl(buffer); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | // LLButton* btn = new LLButton("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); | 1235 | // LLButton* btn = new LLButton("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); |
1236 | // btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); | 1236 | // btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); |
1237 | // addChild(btn); | 1237 | // addChild(btn); |
1238 | 1238 | ||
1239 | return LLPanelRegionInfo::postBuild(); | 1239 | return LLPanelRegionInfo::postBuild(); |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | BOOL LLPanelRegionTextureInfo::sendUpdate() | 1242 | BOOL LLPanelRegionTextureInfo::sendUpdate() |
1243 | { | 1243 | { |
1244 | llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; | 1244 | llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; |
1245 | 1245 | ||
1246 | // Make sure user hasn't chosen wacky textures. | 1246 | // Make sure user hasn't chosen wacky textures. |
1247 | //if (!validateTextureSizes()) | 1247 | //if (!validateTextureSizes()) |
1248 | //{ | 1248 | //{ |
1249 | // return FALSE; | 1249 | // return FALSE; |
1250 | //} | 1250 | //} |
1251 | 1251 | ||
1252 | LLTextureCtrl* texture_ctrl; | 1252 | LLTextureCtrl* texture_ctrl; |
1253 | std::string buffer; | 1253 | std::string buffer; |
1254 | std::string id_str; | 1254 | std::string id_str; |
1255 | LLMessageSystem* msg = gMessageSystem; | 1255 | LLMessageSystem* msg = gMessageSystem; |
1256 | strings_t strings; | 1256 | strings_t strings; |
1257 | 1257 | ||
1258 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1258 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1259 | 1259 | ||
1260 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) | 1260 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) |
1261 | { | 1261 | { |
1262 | buffer = llformat("texture_detail_%d", i); | 1262 | buffer = llformat("texture_detail_%d", i); |
1263 | texture_ctrl = getChild<LLTextureCtrl>(buffer); | 1263 | texture_ctrl = getChild<LLTextureCtrl>(buffer); |
1264 | if(texture_ctrl) | 1264 | if(texture_ctrl) |
1265 | { | 1265 | { |
1266 | LLUUID tmp_id(texture_ctrl->getImageAssetID()); | 1266 | LLUUID tmp_id(texture_ctrl->getImageAssetID()); |
1267 | tmp_id.toString(id_str); | 1267 | tmp_id.toString(id_str); |
1268 | buffer = llformat("%d %s", i, id_str.c_str()); | 1268 | buffer = llformat("%d %s", i, id_str.c_str()); |
1269 | strings.push_back(buffer); | 1269 | strings.push_back(buffer); |
1270 | } | 1270 | } |
1271 | } | 1271 | } |
1272 | sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); | 1272 | sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); |
1273 | strings.clear(); | 1273 | strings.clear(); |
1274 | for(S32 i = 0; i < CORNER_COUNT; ++i) | 1274 | for(S32 i = 0; i < CORNER_COUNT; ++i) |
1275 | { | 1275 | { |
1276 | buffer = llformat("height_start_spin_%d", i); | 1276 | buffer = llformat("height_start_spin_%d", i); |
1277 | std::string buffer2 = llformat("height_range_spin_%d", i); | 1277 | std::string buffer2 = llformat("height_range_spin_%d", i); |
1278 | std::string buffer3 = llformat("%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); | 1278 | std::string buffer3 = llformat("%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); |
1279 | strings.push_back(buffer3); | 1279 | strings.push_back(buffer3); |
1280 | } | 1280 | } |
1281 | sendEstateOwnerMessage(msg, "textureheights", invoice, strings); | 1281 | sendEstateOwnerMessage(msg, "textureheights", invoice, strings); |
1282 | strings.clear(); | 1282 | strings.clear(); |
1283 | sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); | 1283 | sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); |
1284 | return TRUE; | 1284 | return TRUE; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | BOOL LLPanelRegionTextureInfo::validateTextureSizes() | 1287 | BOOL LLPanelRegionTextureInfo::validateTextureSizes() |
1288 | { | 1288 | { |
1289 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) | 1289 | for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) |
1290 | { | 1290 | { |
1291 | std::string buffer; | 1291 | std::string buffer; |
1292 | buffer = llformat("texture_detail_%d", i); | 1292 | buffer = llformat("texture_detail_%d", i); |
1293 | LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer); | 1293 | LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer); |
1294 | if (!texture_ctrl) continue; | 1294 | if (!texture_ctrl) continue; |
1295 | 1295 | ||
1296 | LLUUID image_asset_id = texture_ctrl->getImageAssetID(); | 1296 | LLUUID image_asset_id = texture_ctrl->getImageAssetID(); |
1297 | LLViewerImage* img = gImageList.getImage(image_asset_id); | 1297 | LLViewerImage* img = gImageList.getImage(image_asset_id); |
1298 | S32 components = img->getComponents(); | 1298 | S32 components = img->getComponents(); |
1299 | // Must ask for highest resolution version's width. JC | 1299 | // Must ask for highest resolution version's width. JC |
1300 | S32 width = img->getWidth(0); | 1300 | S32 width = img->getWidth(0); |
1301 | S32 height = img->getHeight(0); | 1301 | S32 height = img->getHeight(0); |
1302 | 1302 | ||
1303 | //llinfos << "texture detail " << i << " is " << width << "x" << height << "x" << components << llendl; | 1303 | //llinfos << "texture detail " << i << " is " << width << "x" << height << "x" << components << llendl; |
1304 | 1304 | ||
1305 | if (components != 3) | 1305 | if (components != 3) |
1306 | { | 1306 | { |
1307 | LLSD args; | 1307 | LLSD args; |
1308 | args["TEXTURE_NUM"] = i+1; | 1308 | args["TEXTURE_NUM"] = i+1; |
1309 | args["TEXTURE_BIT_DEPTH"] = llformat("%d",components * 8); | 1309 | args["TEXTURE_BIT_DEPTH"] = llformat("%d",components * 8); |
1310 | LLNotifications::instance().add("InvalidTerrainBitDepth", args); | 1310 | LLNotifications::instance().add("InvalidTerrainBitDepth", args); |
1311 | return FALSE; | 1311 | return FALSE; |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | if (width > 512 || height > 512) | 1314 | if (width > 512 || height > 512) |
1315 | { | 1315 | { |
1316 | 1316 | ||
1317 | LLSD args; | 1317 | LLSD args; |
1318 | args["TEXTURE_NUM"] = i+1; | 1318 | args["TEXTURE_NUM"] = i+1; |
1319 | args["TEXTURE_SIZE_X"] = width; | 1319 | args["TEXTURE_SIZE_X"] = width; |
1320 | args["TEXTURE_SIZE_Y"] = height; | 1320 | args["TEXTURE_SIZE_Y"] = height; |
1321 | LLNotifications::instance().add("InvalidTerrainSize", args); | 1321 | LLNotifications::instance().add("InvalidTerrainSize", args); |
1322 | return FALSE; | 1322 | return FALSE; |
1323 | 1323 | ||
1324 | } | 1324 | } |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | return TRUE; | 1327 | return TRUE; |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | 1330 | ||
1331 | // static | 1331 | // static |
1332 | void LLPanelRegionTextureInfo::onClickDump(void* data) | 1332 | void LLPanelRegionTextureInfo::onClickDump(void* data) |
1333 | { | 1333 | { |
1334 | llinfos << "LLPanelRegionTextureInfo::onClickDump()" << llendl; | 1334 | llinfos << "LLPanelRegionTextureInfo::onClickDump()" << llendl; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | 1337 | ||
1338 | ///////////////////////////////////////////////////////////////////////////// | 1338 | ///////////////////////////////////////////////////////////////////////////// |
1339 | // LLPanelRegionTerrainInfo | 1339 | // LLPanelRegionTerrainInfo |
1340 | ///////////////////////////////////////////////////////////////////////////// | 1340 | ///////////////////////////////////////////////////////////////////////////// |
1341 | BOOL LLPanelRegionTerrainInfo::postBuild() | 1341 | BOOL LLPanelRegionTerrainInfo::postBuild() |
1342 | { | 1342 | { |
1343 | LLPanelRegionInfo::postBuild(); | 1343 | LLPanelRegionInfo::postBuild(); |
1344 | 1344 | ||
1345 | initHelpBtn("water_height_help", "HelpRegionWaterHeight"); | 1345 | initHelpBtn("water_height_help", "HelpRegionWaterHeight"); |
1346 | initHelpBtn("terrain_raise_help", "HelpRegionTerrainRaise"); | 1346 | initHelpBtn("terrain_raise_help", "HelpRegionTerrainRaise"); |
1347 | initHelpBtn("terrain_lower_help", "HelpRegionTerrainLower"); | 1347 | initHelpBtn("terrain_lower_help", "HelpRegionTerrainLower"); |
1348 | initHelpBtn("upload_raw_help", "HelpRegionUploadRaw"); | 1348 | initHelpBtn("upload_raw_help", "HelpRegionUploadRaw"); |
1349 | initHelpBtn("download_raw_help", "HelpRegionDownloadRaw"); | 1349 | initHelpBtn("download_raw_help", "HelpRegionDownloadRaw"); |
1350 | initHelpBtn("use_estate_sun_help", "HelpRegionUseEstateSun"); | 1350 | initHelpBtn("use_estate_sun_help", "HelpRegionUseEstateSun"); |
1351 | initHelpBtn("fixed_sun_help", "HelpRegionFixedSun"); | 1351 | initHelpBtn("fixed_sun_help", "HelpRegionFixedSun"); |
1352 | initHelpBtn("bake_terrain_help", "HelpRegionBakeTerrain"); | 1352 | initHelpBtn("bake_terrain_help", "HelpRegionBakeTerrain"); |
1353 | 1353 | ||
1354 | initCtrl("water_height_spin"); | 1354 | initCtrl("water_height_spin"); |
1355 | initCtrl("terrain_raise_spin"); | 1355 | initCtrl("terrain_raise_spin"); |
1356 | initCtrl("terrain_lower_spin"); | 1356 | initCtrl("terrain_lower_spin"); |
1357 | 1357 | ||
1358 | initCtrl("fixed_sun_check"); | 1358 | initCtrl("fixed_sun_check"); |
1359 | childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); | 1359 | childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); |
1360 | childSetCommitCallback("use_estate_sun_check", onChangeUseEstateTime, this); | 1360 | childSetCommitCallback("use_estate_sun_check", onChangeUseEstateTime, this); |
1361 | childSetCommitCallback("sun_hour_slider", onChangeSunHour, this); | 1361 | childSetCommitCallback("sun_hour_slider", onChangeSunHour, this); |
1362 | 1362 | ||
1363 | childSetAction("download_raw_btn", onClickDownloadRaw, this); | 1363 | childSetAction("download_raw_btn", onClickDownloadRaw, this); |
1364 | childSetAction("upload_raw_btn", onClickUploadRaw, this); | 1364 | childSetAction("upload_raw_btn", onClickUploadRaw, this); |
1365 | childSetAction("bake_terrain_btn", onClickBakeTerrain, this); | 1365 | childSetAction("bake_terrain_btn", onClickBakeTerrain, this); |
1366 | 1366 | ||
1367 | return TRUE; | 1367 | return TRUE; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | // virtual | 1370 | // virtual |
1371 | bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) | 1371 | bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) |
1372 | { | 1372 | { |
1373 | llinfos << "LLPanelRegionTerrainInfo::refreshFromRegion" << llendl; | 1373 | llinfos << "LLPanelRegionTerrainInfo::refreshFromRegion" << llendl; |
1374 | 1374 | ||
1375 | BOOL owner_or_god = gAgent.isGodlike() | 1375 | BOOL owner_or_god = gAgent.isGodlike() |
1376 | || (region && (region->getOwner() == gAgent.getID())); | 1376 | || (region && (region->getOwner() == gAgent.getID())); |
1377 | BOOL owner_or_god_or_manager = owner_or_god | 1377 | BOOL owner_or_god_or_manager = owner_or_god |
1378 | || (region && region->isEstateManager()); | 1378 | || (region && region->isEstateManager()); |
1379 | setCtrlsEnabled(owner_or_god_or_manager); | 1379 | setCtrlsEnabled(owner_or_god_or_manager); |
1380 | childDisable("apply_btn"); | 1380 | childDisable("apply_btn"); |
1381 | 1381 | ||
1382 | childSetEnabled("download_raw_btn", owner_or_god); | 1382 | childSetEnabled("download_raw_btn", owner_or_god); |
1383 | childSetEnabled("upload_raw_btn", owner_or_god); | 1383 | childSetEnabled("upload_raw_btn", owner_or_god); |
1384 | childSetEnabled("bake_terrain_btn", owner_or_god); | 1384 | childSetEnabled("bake_terrain_btn", owner_or_god); |
1385 | 1385 | ||
1386 | return LLPanelRegionInfo::refreshFromRegion(region); | 1386 | return LLPanelRegionInfo::refreshFromRegion(region); |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | // virtual | 1389 | // virtual |
1390 | BOOL LLPanelRegionTerrainInfo::sendUpdate() | 1390 | BOOL LLPanelRegionTerrainInfo::sendUpdate() |
1391 | { | 1391 | { |
1392 | llinfos << "LLPanelRegionTerrainInfo::sendUpdate" << llendl; | 1392 | llinfos << "LLPanelRegionTerrainInfo::sendUpdate" << llendl; |
1393 | std::string buffer; | 1393 | std::string buffer; |
1394 | strings_t strings; | 1394 | strings_t strings; |
1395 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1395 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1396 | 1396 | ||
1397 | buffer = llformat("%f", (F32)childGetValue("water_height_spin").asReal()); | 1397 | buffer = llformat("%f", (F32)childGetValue("water_height_spin").asReal()); |
1398 | strings.push_back(buffer); | 1398 | strings.push_back(buffer); |
1399 | buffer = llformat("%f", (F32)childGetValue("terrain_raise_spin").asReal()); | 1399 | buffer = llformat("%f", (F32)childGetValue("terrain_raise_spin").asReal()); |
1400 | strings.push_back(buffer); | 1400 | strings.push_back(buffer); |
1401 | buffer = llformat("%f", (F32)childGetValue("terrain_lower_spin").asReal()); | 1401 | buffer = llformat("%f", (F32)childGetValue("terrain_lower_spin").asReal()); |
1402 | strings.push_back(buffer); | 1402 | strings.push_back(buffer); |
1403 | buffer = llformat("%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); | 1403 | buffer = llformat("%s", (childGetValue("use_estate_sun_check").asBoolean() ? "Y" : "N")); |
1404 | strings.push_back(buffer); | 1404 | strings.push_back(buffer); |
1405 | buffer = llformat("%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); | 1405 | buffer = llformat("%s", (childGetValue("fixed_sun_check").asBoolean() ? "Y" : "N")); |
1406 | strings.push_back(buffer); | 1406 | strings.push_back(buffer); |
1407 | buffer = llformat("%f", (F32)childGetValue("sun_hour_slider").asReal() ); | 1407 | buffer = llformat("%f", (F32)childGetValue("sun_hour_slider").asReal() ); |
1408 | strings.push_back(buffer); | 1408 | strings.push_back(buffer); |
1409 | 1409 | ||
1410 | // Grab estate information in case the user decided to set the | 1410 | // Grab estate information in case the user decided to set the |
1411 | // region back to estate time. JC | 1411 | // region back to estate time. JC |
1412 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); | 1412 | LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); |
1413 | if (!floater) return true; | 1413 | if (!floater) return true; |
1414 | 1414 | ||
1415 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); | 1415 | LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); |
1416 | if (!tab) return true; | 1416 | if (!tab) return true; |
1417 | 1417 | ||
1418 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); | 1418 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); |
1419 | if (!panel) return true; | 1419 | if (!panel) return true; |
1420 | 1420 | ||
1421 | BOOL estate_global_time = panel->getGlobalTime(); | 1421 | BOOL estate_global_time = panel->getGlobalTime(); |
1422 | BOOL estate_fixed_sun = panel->getFixedSun(); | 1422 | BOOL estate_fixed_sun = panel->getFixedSun(); |
1423 | F32 estate_sun_hour; | 1423 | F32 estate_sun_hour; |
1424 | if (estate_global_time) | 1424 | if (estate_global_time) |
1425 | { | 1425 | { |
1426 | estate_sun_hour = 0.f; | 1426 | estate_sun_hour = 0.f; |
1427 | } | 1427 | } |
1428 | else | 1428 | else |
1429 | { | 1429 | { |
1430 | estate_sun_hour = panel->getSunHour(); | 1430 | estate_sun_hour = panel->getSunHour(); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); | 1433 | buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); |
1434 | strings.push_back(buffer); | 1434 | strings.push_back(buffer); |
1435 | buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); | 1435 | buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); |
1436 | strings.push_back(buffer); | 1436 | strings.push_back(buffer); |
1437 | buffer = llformat("%f", estate_sun_hour); | 1437 | buffer = llformat("%f", estate_sun_hour); |
1438 | strings.push_back(buffer); | 1438 | strings.push_back(buffer); |
1439 | 1439 | ||
1440 | sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); | 1440 | sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); |
1441 | return TRUE; | 1441 | return TRUE; |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | // static | 1444 | // static |
1445 | void LLPanelRegionTerrainInfo::onChangeUseEstateTime(LLUICtrl* ctrl, void* user_data) | 1445 | void LLPanelRegionTerrainInfo::onChangeUseEstateTime(LLUICtrl* ctrl, void* user_data) |
1446 | { | 1446 | { |
1447 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) user_data; | 1447 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) user_data; |
1448 | if (!panel) return; | 1448 | if (!panel) return; |
1449 | BOOL use_estate_sun = panel->childGetValue("use_estate_sun_check").asBoolean(); | 1449 | BOOL use_estate_sun = panel->childGetValue("use_estate_sun_check").asBoolean(); |
1450 | panel->childSetEnabled("fixed_sun_check", !use_estate_sun); | 1450 | panel->childSetEnabled("fixed_sun_check", !use_estate_sun); |
1451 | panel->childSetEnabled("sun_hour_slider", !use_estate_sun); | 1451 | panel->childSetEnabled("sun_hour_slider", !use_estate_sun); |
1452 | if (use_estate_sun) | 1452 | if (use_estate_sun) |
1453 | { | 1453 | { |
1454 | panel->childSetValue("fixed_sun_check", LLSD(FALSE)); | 1454 | panel->childSetValue("fixed_sun_check", LLSD(FALSE)); |
1455 | panel->childSetValue("sun_hour_slider", LLSD(0.f)); | 1455 | panel->childSetValue("sun_hour_slider", LLSD(0.f)); |
1456 | } | 1456 | } |
1457 | panel->childEnable("apply_btn"); | 1457 | panel->childEnable("apply_btn"); |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | // static | 1460 | // static |
1461 | void LLPanelRegionTerrainInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) | 1461 | void LLPanelRegionTerrainInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) |
1462 | { | 1462 | { |
1463 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) user_data; | 1463 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) user_data; |
1464 | if (!panel) return; | 1464 | if (!panel) return; |
1465 | // Just enable the apply button. We let the sun-hour slider be enabled | 1465 | // Just enable the apply button. We let the sun-hour slider be enabled |
1466 | // for both fixed-sun and non-fixed-sun. JC | 1466 | // for both fixed-sun and non-fixed-sun. JC |
1467 | panel->childEnable("apply_btn"); | 1467 | panel->childEnable("apply_btn"); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | // static | 1470 | // static |
1471 | void LLPanelRegionTerrainInfo::onChangeSunHour(LLUICtrl* ctrl, void*) | 1471 | void LLPanelRegionTerrainInfo::onChangeSunHour(LLUICtrl* ctrl, void*) |
1472 | { | 1472 | { |
1473 | // can't use userdata to get panel, slider uses it internally | 1473 | // can't use userdata to get panel, slider uses it internally |
1474 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) ctrl->getParent(); | 1474 | LLPanelRegionTerrainInfo* panel = (LLPanelRegionTerrainInfo*) ctrl->getParent(); |
1475 | if (!panel) return; | 1475 | if (!panel) return; |
1476 | panel->childEnable("apply_btn"); | 1476 | panel->childEnable("apply_btn"); |
1477 | } | 1477 | } |
1478 | 1478 | ||
1479 | // static | 1479 | // static |
1480 | void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) | 1480 | void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) |
1481 | { | 1481 | { |
1482 | LLFilePicker& picker = LLFilePicker::instance(); | 1482 | LLFilePicker& picker = LLFilePicker::instance(); |
1483 | if (!picker.getSaveFile(LLFilePicker::FFSAVE_RAW, "terrain.raw")) | 1483 | if (!picker.getSaveFile(LLFilePicker::FFSAVE_RAW, "terrain.raw")) |
1484 | { | 1484 | { |
1485 | llwarns << "No file" << llendl; | 1485 | llwarns << "No file" << llendl; |
1486 | return; | 1486 | return; |
1487 | } | 1487 | } |
1488 | std::string filepath = picker.getFirstFile(); | 1488 | std::string filepath = picker.getFirstFile(); |
1489 | gXferManager->expectFileForRequest(filepath); | 1489 | gXferManager->expectFileForRequest(filepath); |
1490 | 1490 | ||
1491 | LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; | 1491 | LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; |
1492 | strings_t strings; | 1492 | strings_t strings; |
1493 | strings.push_back("download filename"); | 1493 | strings.push_back("download filename"); |
1494 | strings.push_back(filepath); | 1494 | strings.push_back(filepath); |
1495 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1495 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1496 | self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); | 1496 | self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | // static | 1499 | // static |
1500 | void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data) | 1500 | void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data) |
1501 | { | 1501 | { |
1502 | LLFilePicker& picker = LLFilePicker::instance(); | 1502 | LLFilePicker& picker = LLFilePicker::instance(); |
1503 | if (!picker.getOpenFile(LLFilePicker::FFLOAD_RAW)) | 1503 | if (!picker.getOpenFile(LLFilePicker::FFLOAD_RAW)) |
1504 | { | 1504 | { |
1505 | llwarns << "No file" << llendl; | 1505 | llwarns << "No file" << llendl; |
1506 | return; | 1506 | return; |
1507 | } | 1507 | } |
1508 | std::string filepath = picker.getFirstFile(); | 1508 | std::string filepath = picker.getFirstFile(); |
1509 | gXferManager->expectFileForTransfer(filepath); | 1509 | gXferManager->expectFileForTransfer(filepath); |
1510 | 1510 | ||
1511 | LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; | 1511 | LLPanelRegionTerrainInfo* self = (LLPanelRegionTerrainInfo*)data; |
1512 | strings_t strings; | 1512 | strings_t strings; |
1513 | strings.push_back("upload filename"); | 1513 | strings.push_back("upload filename"); |
1514 | strings.push_back(filepath); | 1514 | strings.push_back(filepath); |
1515 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1515 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1516 | self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); | 1516 | self->sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); |
1517 | 1517 | ||
1518 | LLNotifications::instance().add("RawUploadStarted"); | 1518 | LLNotifications::instance().add("RawUploadStarted"); |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | // static | 1521 | // static |
1522 | void LLPanelRegionTerrainInfo::onClickBakeTerrain(void* data) | 1522 | void LLPanelRegionTerrainInfo::onClickBakeTerrain(void* data) |
1523 | { | 1523 | { |
1524 | LLNotifications::instance().add( | 1524 | LLNotifications::instance().add( |
1525 | LLNotification::Params("ConfirmBakeTerrain") | 1525 | LLNotification::Params("ConfirmBakeTerrain") |
1526 | .functor(boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2))); | 1526 | .functor(boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2))); |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, const LLSD& response) | 1529 | bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, const LLSD& response) |
1530 | { | 1530 | { |
1531 | S32 option = LLNotification::getSelectedOption(notification, response); | 1531 | S32 option = LLNotification::getSelectedOption(notification, response); |
1532 | if (option != 0) return false; | 1532 | if (option != 0) return false; |
1533 | 1533 | ||
1534 | strings_t strings; | 1534 | strings_t strings; |
1535 | strings.push_back("bake"); | 1535 | strings.push_back("bake"); |
1536 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 1536 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
1537 | sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); | 1537 | sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); |
1538 | return false; | 1538 | return false; |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | ///////////////////////////////////////////////////////////////////////////// | 1541 | ///////////////////////////////////////////////////////////////////////////// |
1542 | // LLPanelEstateInfo | 1542 | // LLPanelEstateInfo |
1543 | // | 1543 | // |
1544 | 1544 | ||
1545 | LLPanelEstateInfo::LLPanelEstateInfo() | 1545 | LLPanelEstateInfo::LLPanelEstateInfo() |
1546 | : LLPanelRegionInfo(), | 1546 | : LLPanelRegionInfo(), |
1547 | mEstateID(0) // invalid | 1547 | mEstateID(0) // invalid |
1548 | { | 1548 | { |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | // static | 1551 | // static |
1552 | void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) | 1552 | void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) |
1553 | { | 1553 | { |
1554 | std::string name; | 1554 | std::string name; |
1555 | 1555 | ||
1556 | // name.assign("setowner"); | 1556 | // name.assign("setowner"); |
1557 | // static LLDispatchSetEstateOwner set_owner; | 1557 | // static LLDispatchSetEstateOwner set_owner; |
1558 | // dispatch.addHandler(name, &set_owner); | 1558 | // dispatch.addHandler(name, &set_owner); |
1559 | 1559 | ||
1560 | name.assign("estateupdateinfo"); | 1560 | name.assign("estateupdateinfo"); |
1561 | static LLDispatchEstateUpdateInfo estate_update_info; | 1561 | static LLDispatchEstateUpdateInfo estate_update_info; |
1562 | dispatch.addHandler(name, &estate_update_info); | 1562 | dispatch.addHandler(name, &estate_update_info); |
1563 | 1563 | ||
1564 | name.assign("setaccess"); | 1564 | name.assign("setaccess"); |
1565 | static LLDispatchSetEstateAccess set_access; | 1565 | static LLDispatchSetEstateAccess set_access; |
1566 | dispatch.addHandler(name, &set_access); | 1566 | dispatch.addHandler(name, &set_access); |
1567 | 1567 | ||
1568 | estate_dispatch_initialized = true; | 1568 | estate_dispatch_initialized = true; |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | // static | 1571 | // static |
1572 | // Disables the sun-hour slider and the use fixed time check if the use global time is check | 1572 | // Disables the sun-hour slider and the use fixed time check if the use global time is check |
1573 | void LLPanelEstateInfo::onChangeUseGlobalTime(LLUICtrl* ctrl, void* user_data) | 1573 | void LLPanelEstateInfo::onChangeUseGlobalTime(LLUICtrl* ctrl, void* user_data) |
1574 | { | 1574 | { |
1575 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; | 1575 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; |
1576 | if (panel) | 1576 | if (panel) |
1577 | { | 1577 | { |
1578 | bool enabled = !panel->childGetValue("use_global_time_check").asBoolean(); | 1578 | bool enabled = !panel->childGetValue("use_global_time_check").asBoolean(); |
1579 | panel->childSetEnabled("sun_hour_slider", enabled); | 1579 | panel->childSetEnabled("sun_hour_slider", enabled); |
1580 | panel->childSetEnabled("fixed_sun_check", enabled); | 1580 | panel->childSetEnabled("fixed_sun_check", enabled); |
1581 | panel->childSetValue("fixed_sun_check", LLSD(FALSE)); | 1581 | panel->childSetValue("fixed_sun_check", LLSD(FALSE)); |
1582 | panel->enableButton("apply_btn"); | 1582 | panel->enableButton("apply_btn"); |
1583 | } | 1583 | } |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | // Enables the sun-hour slider if the fixed-sun checkbox is set | 1586 | // Enables the sun-hour slider if the fixed-sun checkbox is set |
1587 | void LLPanelEstateInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) | 1587 | void LLPanelEstateInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) |
1588 | { | 1588 | { |
1589 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; | 1589 | LLPanelEstateInfo* panel = (LLPanelEstateInfo*) user_data; |
1590 | if (panel) | 1590 | if (panel) |
1591 | { | 1591 | { |
1592 | bool enabled = !panel->childGetValue("fixed_sun_check").asBoolean(); | 1592 | bool enabled = !panel->childGetValue("fixed_sun_check").asBoolean(); |
1593 | panel->childSetEnabled("use_global_time_check", enabled); | 1593 | panel->childSetEnabled("use_global_time_check", enabled); |
1594 | panel->childSetValue("use_global_time_check", LLSD(FALSE)); | 1594 | panel->childSetValue("use_global_time_check", LLSD(FALSE)); |
1595 | panel->enableButton("apply_btn"); | 1595 | panel->enableButton("apply_btn"); |
1596 | } | 1596 | } |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | 1599 | ||
1600 | 1600 | ||
1601 | 1601 | ||
1602 | //--------------------------------------------------------------------------- | 1602 | //--------------------------------------------------------------------------- |
1603 | // Add/Remove estate access button callbacks | 1603 | // Add/Remove estate access button callbacks |
1604 | //--------------------------------------------------------------------------- | 1604 | //--------------------------------------------------------------------------- |
1605 | void LLPanelEstateInfo::onClickEditSky(void* user_data) | 1605 | void LLPanelEstateInfo::onClickEditSky(void* user_data) |
1606 | { | 1606 | { |
1607 | LLFloaterWindLight::show(); | 1607 | LLFloaterWindLight::show(); |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | void LLPanelEstateInfo::onClickEditDayCycle(void* user_data) | 1610 | void LLPanelEstateInfo::onClickEditDayCycle(void* user_data) |
1611 | { | 1611 | { |
1612 | LLFloaterDayCycle::show(); | 1612 | LLFloaterDayCycle::show(); |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | // static | 1615 | // static |
1616 | void LLPanelEstateInfo::onClickAddAllowedAgent(void* user_data) | 1616 | void LLPanelEstateInfo::onClickAddAllowedAgent(void* user_data) |
1617 | { | 1617 | { |
1618 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; | 1618 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; |
1619 | LLCtrlListInterface *list = self->childGetListInterface("allowed_avatar_name_list"); | 1619 | LLCtrlListInterface *list = self->childGetListInterface("allowed_avatar_name_list"); |
1620 | if (!list) return; | 1620 | if (!list) return; |
1621 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) | 1621 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) |
1622 | { | 1622 | { |
1623 | //args | 1623 | //args |
1624 | 1624 | ||
1625 | LLSD args; | 1625 | LLSD args; |
1626 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); | 1626 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); |
1627 | LLNotifications::instance().add("MaxAllowedAgentOnRegion", args); | 1627 | LLNotifications::instance().add("MaxAllowedAgentOnRegion", args); |
1628 | return; | 1628 | return; |
1629 | } | 1629 | } |
1630 | accessAddCore(ESTATE_ACCESS_ALLOWED_AGENT_ADD, "EstateAllowedAgentAdd"); | 1630 | accessAddCore(ESTATE_ACCESS_ALLOWED_AGENT_ADD, "EstateAllowedAgentAdd"); |
1631 | } | 1631 | } |
1632 | 1632 | ||
1633 | // static | 1633 | // static |
1634 | void LLPanelEstateInfo::onClickRemoveAllowedAgent(void* user_data) | 1634 | void LLPanelEstateInfo::onClickRemoveAllowedAgent(void* user_data) |
1635 | { | 1635 | { |
1636 | accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list"); | 1636 | accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list"); |
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | // static | 1639 | // static |
1640 | void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) | 1640 | void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) |
1641 | { | 1641 | { |
1642 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; | 1642 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; |
1643 | LLCtrlListInterface *list = self->childGetListInterface("allowed_group_name_list"); | 1643 | LLCtrlListInterface *list = self->childGetListInterface("allowed_group_name_list"); |
1644 | if (!list) return; | 1644 | if (!list) return; |
1645 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) | 1645 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) |
1646 | { | 1646 | { |
1647 | LLSD args; | 1647 | LLSD args; |
1648 | args["MAX_GROUPS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); | 1648 | args["MAX_GROUPS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); |
1649 | LLNotifications::instance().add("MaxAllowedGroupsOnRegion", args); | 1649 | LLNotifications::instance().add("MaxAllowedGroupsOnRegion", args); |
1650 | return; | 1650 | return; |
1651 | } | 1651 | } |
1652 | 1652 | ||
1653 | LLNotification::Params params("ChangeLindenAccess"); | 1653 | LLNotification::Params params("ChangeLindenAccess"); |
1654 | params.functor(boost::bind(&LLPanelEstateInfo::addAllowedGroup, self, _1, _2)); | 1654 | params.functor(boost::bind(&LLPanelEstateInfo::addAllowedGroup, self, _1, _2)); |
1655 | if (isLindenEstate()) | 1655 | if (isLindenEstate()) |
1656 | { | 1656 | { |
1657 | LLNotifications::instance().add(params); | 1657 | LLNotifications::instance().add(params); |
1658 | } | 1658 | } |
1659 | else | 1659 | else |
1660 | { | 1660 | { |
1661 | LLNotifications::instance().forceResponse(params, 0); | 1661 | LLNotifications::instance().forceResponse(params, 0); |
1662 | } | 1662 | } |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& response) | 1665 | bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& response) |
1666 | { | 1666 | { |
1667 | S32 option = LLNotification::getSelectedOption(notification, response); | 1667 | S32 option = LLNotification::getSelectedOption(notification, response); |
1668 | if (option != 0) return false; | 1668 | if (option != 0) return false; |
1669 | 1669 | ||
1670 | LLFloater* parent_floater = gFloaterView->getParentFloater(this); | 1670 | LLFloater* parent_floater = gFloaterView->getParentFloater(this); |
1671 | 1671 | ||
1672 | LLFloaterGroupPicker* widget; | 1672 | LLFloaterGroupPicker* widget; |
1673 | widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); | 1673 | widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); |
1674 | if (widget) | 1674 | if (widget) |
1675 | { | 1675 | { |
1676 | widget->setSelectCallback(addAllowedGroup2, NULL); | 1676 | widget->setSelectCallback(addAllowedGroup2, NULL); |
1677 | if (parent_floater) | 1677 | if (parent_floater) |
1678 | { | 1678 | { |
1679 | LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget); | 1679 | LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget); |
1680 | widget->setOrigin(new_rect.mLeft, new_rect.mBottom); | 1680 | widget->setOrigin(new_rect.mLeft, new_rect.mBottom); |
1681 | parent_floater->addDependentFloater(widget); | 1681 | parent_floater->addDependentFloater(widget); |
1682 | } | 1682 | } |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | return false; | 1685 | return false; |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | // static | 1688 | // static |
1689 | void LLPanelEstateInfo::onClickRemoveAllowedGroup(void* user_data) | 1689 | void LLPanelEstateInfo::onClickRemoveAllowedGroup(void* user_data) |
1690 | { | 1690 | { |
1691 | accessRemoveCore(ESTATE_ACCESS_ALLOWED_GROUP_REMOVE, "EstateAllowedGroupRemove", "allowed_group_name_list"); | 1691 | accessRemoveCore(ESTATE_ACCESS_ALLOWED_GROUP_REMOVE, "EstateAllowedGroupRemove", "allowed_group_name_list"); |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | // static | 1694 | // static |
1695 | void LLPanelEstateInfo::onClickAddBannedAgent(void* user_data) | 1695 | void LLPanelEstateInfo::onClickAddBannedAgent(void* user_data) |
1696 | { | 1696 | { |
1697 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; | 1697 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; |
1698 | LLCtrlListInterface *list = self->childGetListInterface("banned_avatar_name_list"); | 1698 | LLCtrlListInterface *list = self->childGetListInterface("banned_avatar_name_list"); |
1699 | if (!list) return; | 1699 | if (!list) return; |
1700 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) | 1700 | if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) |
1701 | { | 1701 | { |
1702 | LLSD args; | 1702 | LLSD args; |
1703 | args["MAX_BANNED"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); | 1703 | args["MAX_BANNED"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); |
1704 | LLNotifications::instance().add("MaxBannedAgentsOnRegion", args); | 1704 | LLNotifications::instance().add("MaxBannedAgentsOnRegion", args); |
1705 | return; | 1705 | return; |
1706 | } | 1706 | } |
1707 | accessAddCore(ESTATE_ACCESS_BANNED_AGENT_ADD, "EstateBannedAgentAdd"); | 1707 | accessAddCore(ESTATE_ACCESS_BANNED_AGENT_ADD, "EstateBannedAgentAdd"); |
1708 | } | 1708 | } |
1709 | 1709 | ||
1710 | // static | 1710 | // static |
1711 | void LLPanelEstateInfo::onClickRemoveBannedAgent(void* user_data) | 1711 | void LLPanelEstateInfo::onClickRemoveBannedAgent(void* user_data) |
1712 | { | 1712 | { |
1713 | accessRemoveCore(ESTATE_ACCESS_BANNED_AGENT_REMOVE, "EstateBannedAgentRemove", "banned_avatar_name_list"); | 1713 | accessRemoveCore(ESTATE_ACCESS_BANNED_AGENT_REMOVE, "EstateBannedAgentRemove", "banned_avatar_name_list"); |
1714 | } | 1714 | } |
1715 | 1715 | ||
1716 | // static | 1716 | // static |
1717 | void LLPanelEstateInfo::onClickAddEstateManager(void* user_data) | 1717 | void LLPanelEstateInfo::onClickAddEstateManager(void* user_data) |
1718 | { | 1718 | { |
1719 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; | 1719 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; |
1720 | LLCtrlListInterface *list = self->childGetListInterface("estate_manager_name_list"); | 1720 | LLCtrlListInterface *list = self->childGetListInterface("estate_manager_name_list"); |
1721 | if (!list) return; | 1721 | if (!list) return; |
1722 | if (list->getItemCount() >= ESTATE_MAX_MANAGERS) | 1722 | if (list->getItemCount() >= ESTATE_MAX_MANAGERS) |
1723 | { // Tell user they can't add more managers | 1723 | { // Tell user they can't add more managers |
1724 | LLSD args; | 1724 | LLSD args; |
1725 | args["MAX_MANAGER"] = llformat("%d",ESTATE_MAX_MANAGERS); | 1725 | args["MAX_MANAGER"] = llformat("%d",ESTATE_MAX_MANAGERS); |
1726 | LLNotifications::instance().add("MaxManagersOnRegion", args); | 1726 | LLNotifications::instance().add("MaxManagersOnRegion", args); |
1727 | } | 1727 | } |
1728 | else | 1728 | else |
1729 | { // Go pick managers to add | 1729 | { // Go pick managers to add |
1730 | accessAddCore(ESTATE_ACCESS_MANAGER_ADD, "EstateManagerAdd"); | 1730 | accessAddCore(ESTATE_ACCESS_MANAGER_ADD, "EstateManagerAdd"); |
1731 | } | 1731 | } |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | // static | 1734 | // static |
1735 | void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data) | 1735 | void LLPanelEstateInfo::onClickRemoveEstateManager(void* user_data) |
1736 | { | 1736 | { |
1737 | accessRemoveCore(ESTATE_ACCESS_MANAGER_REMOVE, "EstateManagerRemove", "estate_manager_name_list"); | 1737 | accessRemoveCore(ESTATE_ACCESS_MANAGER_REMOVE, "EstateManagerRemove", "estate_manager_name_list"); |
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | //--------------------------------------------------------------------------- | 1740 | //--------------------------------------------------------------------------- |
1741 | // Kick from estate methods | 1741 | // Kick from estate methods |
1742 | //--------------------------------------------------------------------------- | 1742 | //--------------------------------------------------------------------------- |
1743 | struct LLKickFromEstateInfo | 1743 | struct LLKickFromEstateInfo |
1744 | { | 1744 | { |
1745 | LLPanelEstateInfo *mEstatePanelp; | 1745 | LLPanelEstateInfo *mEstatePanelp; |
1746 | LLUUID mAgentID; | 1746 | LLUUID mAgentID; |
1747 | }; | 1747 | }; |
1748 | 1748 | ||
1749 | void LLPanelEstateInfo::onClickKickUser(void *user_data) | 1749 | void LLPanelEstateInfo::onClickKickUser(void *user_data) |
1750 | { | 1750 | { |
1751 | LLPanelEstateInfo* panelp = (LLPanelEstateInfo*)user_data; | 1751 | LLPanelEstateInfo* panelp = (LLPanelEstateInfo*)user_data; |
1752 | 1752 | ||
1753 | // this depends on the grandparent view being a floater | 1753 | // this depends on the grandparent view being a floater |
1754 | // in order to set up floater dependency | 1754 | // in order to set up floater dependency |
1755 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); | 1755 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); |
1756 | LLFloater* child_floater = LLFloaterAvatarPicker::show(LLPanelEstateInfo::onKickUserCommit, user_data, FALSE, TRUE); | 1756 | LLFloater* child_floater = LLFloaterAvatarPicker::show(LLPanelEstateInfo::onKickUserCommit, user_data, FALSE, TRUE); |
1757 | parent_floater->addDependentFloater(child_floater); | 1757 | parent_floater->addDependentFloater(child_floater); |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | 1760 | void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) |
1761 | { | 1761 | { |
1762 | if (names.empty() || ids.empty()) return; | 1762 | if (names.empty() || ids.empty()) return; |
1763 | 1763 | ||
1764 | //check to make sure there is one valid user and id | 1764 | //check to make sure there is one valid user and id |
1765 | if( (ids[0].isNull()) || | 1765 | if( (ids[0].isNull()) || |
1766 | (names[0].length() == 0) ) | 1766 | (names[0].length() == 0) ) |
1767 | { | 1767 | { |
1768 | return; | 1768 | return; |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)userdata; | 1771 | LLPanelEstateInfo* self = (LLPanelEstateInfo*)userdata; |
1772 | if(!self) return; | 1772 | if(!self) return; |
1773 | 1773 | ||
1774 | //keep track of what user they want to kick and other misc info | 1774 | //keep track of what user they want to kick and other misc info |
1775 | LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo(); | 1775 | LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo(); |
1776 | kick_info->mEstatePanelp = self; | 1776 | kick_info->mEstatePanelp = self; |
1777 | kick_info->mAgentID = ids[0]; | 1777 | kick_info->mAgentID = ids[0]; |
1778 | 1778 | ||
1779 | //Bring up a confirmation dialog | 1779 | //Bring up a confirmation dialog |
1780 | LLSD args; | 1780 | LLSD args; |
1781 | args["EVIL_USER"] = names[0]; | 1781 | args["EVIL_USER"] = names[0]; |
1782 | LLSD payload; | 1782 | LLSD payload; |
1783 | payload["agent_id"] = ids[0]; | 1783 | payload["agent_id"] = ids[0]; |
1784 | LLNotifications::instance().add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, self, _1, _2)); | 1784 | LLNotifications::instance().add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, self, _1, _2)); |
1785 | 1785 | ||
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | bool LLPanelEstateInfo::kickUserConfirm(const LLSD& notification, const LLSD& response) | 1788 | bool LLPanelEstateInfo::kickUserConfirm(const LLSD& notification, const LLSD& response) |
1789 | { | 1789 | { |
1790 | S32 option = LLNotification::getSelectedOption(notification, response); | 1790 | S32 option = LLNotification::getSelectedOption(notification, response); |
1791 | switch(option) | 1791 | switch(option) |
1792 | { | 1792 | { |
1793 | case 0: | 1793 | case 0: |
1794 | { | 1794 | { |
1795 | //Kick User | 1795 | //Kick User |
1796 | strings_t strings; | 1796 | strings_t strings; |
1797 | strings.push_back(notification["payload"]["agent_id"].asString()); | 1797 | strings.push_back(notification["payload"]["agent_id"].asString()); |
1798 | 1798 | ||
1799 | sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings); | 1799 | sendEstateOwnerMessage(gMessageSystem, "kickestate", LLFloaterRegionInfo::getLastInvoice(), strings); |
1800 | break; | 1800 | break; |
1801 | } | 1801 | } |
1802 | default: | 1802 | default: |
1803 | break; | 1803 | break; |
1804 | } | 1804 | } |
1805 | return false; | 1805 | return false; |
1806 | } | 1806 | } |
1807 | 1807 | ||
1808 | //--------------------------------------------------------------------------- | 1808 | //--------------------------------------------------------------------------- |
1809 | // Core Add/Remove estate access methods | 1809 | // Core Add/Remove estate access methods |
1810 | // TODO: INTERNATIONAL: don't build message text here; | 1810 | // TODO: INTERNATIONAL: don't build message text here; |
1811 | // instead, create multiple translatable messages and choose | 1811 | // instead, create multiple translatable messages and choose |
1812 | // one based on the status. | 1812 | // one based on the status. |
1813 | //--------------------------------------------------------------------------- | 1813 | //--------------------------------------------------------------------------- |
1814 | std::string all_estates_text() | 1814 | std::string all_estates_text() |
1815 | { | 1815 | { |
1816 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 1816 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
1817 | if (!panel) return "(error)"; | 1817 | if (!panel) return "(error)"; |
1818 | 1818 | ||
1819 | std::string owner = panel->getOwnerName(); | 1819 | std::string owner = panel->getOwnerName(); |
1820 | 1820 | ||
1821 | LLViewerRegion* region = gAgent.getRegion(); | 1821 | LLViewerRegion* region = gAgent.getRegion(); |
1822 | if (gAgent.isGodlike()) | 1822 | if (gAgent.isGodlike()) |
1823 | { | 1823 | { |
1824 | return llformat("all estates\nowned by %s", owner.c_str()); | 1824 | return llformat("all estates\nowned by %s", owner.c_str()); |
1825 | } | 1825 | } |
1826 | else if (region && region->getOwner() == gAgent.getID()) | 1826 | else if (region && region->getOwner() == gAgent.getID()) |
1827 | { | 1827 | { |
1828 | return "all estates you own"; | 1828 | return "all estates you own"; |
1829 | } | 1829 | } |
1830 | else if (region && region->isEstateManager()) | 1830 | else if (region && region->isEstateManager()) |
1831 | { | 1831 | { |
1832 | return llformat("all estates that\nyou manage for %s", owner.c_str()); | 1832 | return llformat("all estates that\nyou manage for %s", owner.c_str()); |
1833 | } | 1833 | } |
1834 | else | 1834 | else |
1835 | { | 1835 | { |
1836 | return "(error)"; | 1836 | return "(error)"; |
1837 | } | 1837 | } |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | // static | 1840 | // static |
1841 | bool LLPanelEstateInfo::isLindenEstate() | 1841 | bool LLPanelEstateInfo::isLindenEstate() |
1842 | { | 1842 | { |
1843 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 1843 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
1844 | if (!panel) return false; | 1844 | if (!panel) return false; |
1845 | 1845 | ||
1846 | U32 estate_id = panel->getEstateID(); | 1846 | U32 estate_id = panel->getEstateID(); |
1847 | return (estate_id <= ESTATE_LAST_LINDEN); | 1847 | return (estate_id <= ESTATE_LAST_LINDEN); |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | typedef std::vector<LLUUID> AgentOrGroupIDsVector; | 1850 | typedef std::vector<LLUUID> AgentOrGroupIDsVector; |
1851 | struct LLEstateAccessChangeInfo | 1851 | struct LLEstateAccessChangeInfo |
1852 | { | 1852 | { |
1853 | LLEstateAccessChangeInfo(const LLSD& sd) | 1853 | LLEstateAccessChangeInfo(const LLSD& sd) |
1854 | { | 1854 | { |
1855 | mDialogName = sd["dialog_name"].asString(); | 1855 | mDialogName = sd["dialog_name"].asString(); |
1856 | mOperationFlag = (U32)sd["operation"].asInteger(); | 1856 | mOperationFlag = (U32)sd["operation"].asInteger(); |
1857 | LLSD::array_const_iterator end_it = sd["allowed_ids"].endArray(); | 1857 | LLSD::array_const_iterator end_it = sd["allowed_ids"].endArray(); |
1858 | for (LLSD::array_const_iterator id_it = sd["allowed_ids"].beginArray(); | 1858 | for (LLSD::array_const_iterator id_it = sd["allowed_ids"].beginArray(); |
1859 | id_it != end_it; | 1859 | id_it != end_it; |
1860 | ++id_it) | 1860 | ++id_it) |
1861 | { | 1861 | { |
1862 | mAgentOrGroupIDs.push_back(id_it->asUUID()); | 1862 | mAgentOrGroupIDs.push_back(id_it->asUUID()); |
1863 | } | 1863 | } |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | const LLSD asLLSD() const | 1866 | const LLSD asLLSD() const |
1867 | { | 1867 | { |
1868 | LLSD sd; | 1868 | LLSD sd; |
1869 | sd["name"] = mDialogName; | 1869 | sd["name"] = mDialogName; |
1870 | sd["operation"] = (S32)mOperationFlag; | 1870 | sd["operation"] = (S32)mOperationFlag; |
1871 | for (AgentOrGroupIDsVector::const_iterator it = mAgentOrGroupIDs.begin(); | 1871 | for (AgentOrGroupIDsVector::const_iterator it = mAgentOrGroupIDs.begin(); |
1872 | it != mAgentOrGroupIDs.end(); | 1872 | it != mAgentOrGroupIDs.end(); |
1873 | ++it) | 1873 | ++it) |
1874 | { | 1874 | { |
1875 | sd["allowed_ids"].append(*it); | 1875 | sd["allowed_ids"].append(*it); |
1876 | } | 1876 | } |
1877 | return sd; | 1877 | return sd; |
1878 | } | 1878 | } |
1879 | 1879 | ||
1880 | U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. | 1880 | U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. |
1881 | std::string mDialogName; | 1881 | std::string mDialogName; |
1882 | AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change | 1882 | AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change |
1883 | }; | 1883 | }; |
1884 | 1884 | ||
1885 | // Special case callback for groups, since it has different callback format than names | 1885 | // Special case callback for groups, since it has different callback format than names |
1886 | // static | 1886 | // static |
1887 | void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) | 1887 | void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) |
1888 | { | 1888 | { |
1889 | LLSD payload; | 1889 | LLSD payload; |
1890 | payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD; | 1890 | payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD; |
1891 | payload["dialog_name"] = "EstateAllowedGroupAdd"; | 1891 | payload["dialog_name"] = "EstateAllowedGroupAdd"; |
1892 | payload["allowed_ids"].append(id); | 1892 | payload["allowed_ids"].append(id); |
1893 | 1893 | ||
1894 | LLSD args; | 1894 | LLSD args; |
1895 | args["ALL_ESTATES"] = all_estates_text(); | 1895 | args["ALL_ESTATES"] = all_estates_text(); |
1896 | 1896 | ||
1897 | LLNotification::Params params("EstateAllowedGroupAdd"); | 1897 | LLNotification::Params params("EstateAllowedGroupAdd"); |
1898 | params.payload(payload) | 1898 | params.payload(payload) |
1899 | .substitutions(args) | 1899 | .substitutions(args) |
1900 | .functor(accessCoreConfirm); | 1900 | .functor(accessCoreConfirm); |
1901 | if (isLindenEstate()) | 1901 | if (isLindenEstate()) |
1902 | { | 1902 | { |
1903 | LLNotifications::instance().forceResponse(params, 0); | 1903 | LLNotifications::instance().forceResponse(params, 0); |
1904 | } | 1904 | } |
1905 | else | 1905 | else |
1906 | { | 1906 | { |
1907 | LLNotifications::instance().add(params); | 1907 | LLNotifications::instance().add(params); |
1908 | } | 1908 | } |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | // static | 1911 | // static |
1912 | void LLPanelEstateInfo::accessAddCore(U32 operation_flag, const std::string& dialog_name) | 1912 | void LLPanelEstateInfo::accessAddCore(U32 operation_flag, const std::string& dialog_name) |
1913 | { | 1913 | { |
1914 | LLSD payload; | 1914 | LLSD payload; |
1915 | payload["operation"] = (S32)operation_flag; | 1915 | payload["operation"] = (S32)operation_flag; |
1916 | payload["dialog_name"] = dialog_name; | 1916 | payload["dialog_name"] = dialog_name; |
1917 | // agent id filled in after avatar picker | 1917 | // agent id filled in after avatar picker |
1918 | 1918 | ||
1919 | LLNotification::Params params("ChangeLindenAccess"); | 1919 | LLNotification::Params params("ChangeLindenAccess"); |
1920 | params.payload(payload) | 1920 | params.payload(payload) |
1921 | .functor(accessAddCore2); | 1921 | .functor(accessAddCore2); |
1922 | 1922 | ||
1923 | if (isLindenEstate()) | 1923 | if (isLindenEstate()) |
1924 | { | 1924 | { |
1925 | LLNotifications::instance().add(params); | 1925 | LLNotifications::instance().add(params); |
1926 | } | 1926 | } |
1927 | else | 1927 | else |
1928 | { | 1928 | { |
1929 | // same as clicking "OK" | 1929 | // same as clicking "OK" |
1930 | LLNotifications::instance().forceResponse(params, 0); | 1930 | LLNotifications::instance().forceResponse(params, 0); |
1931 | } | 1931 | } |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | // static | 1934 | // static |
1935 | bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& response) | 1935 | bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& response) |
1936 | { | 1936 | { |
1937 | S32 option = LLNotification::getSelectedOption(notification, response); | 1937 | S32 option = LLNotification::getSelectedOption(notification, response); |
1938 | if (option != 0) | 1938 | if (option != 0) |
1939 | { | 1939 | { |
1940 | // abort change | 1940 | // abort change |
1941 | return false; | 1941 | return false; |
1942 | } | 1942 | } |
1943 | 1943 | ||
1944 | LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]); | 1944 | LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]); |
1945 | // avatar picker yes multi-select, yes close-on-select | 1945 | // avatar picker yes multi-select, yes close-on-select |
1946 | LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE); | 1946 | LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE); |
1947 | return false; | 1947 | return false; |
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | // static | 1950 | // static |
1951 | void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) | 1951 | void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) |
1952 | { | 1952 | { |
1953 | LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; | 1953 | LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; |
1954 | if (!change_info) return; | 1954 | if (!change_info) return; |
1955 | if (ids.empty()) | 1955 | if (ids.empty()) |
1956 | { | 1956 | { |
1957 | // User didn't select a name. | 1957 | // User didn't select a name. |
1958 | delete change_info; | 1958 | delete change_info; |
1959 | change_info = NULL; | 1959 | change_info = NULL; |
1960 | return; | 1960 | return; |
1961 | } | 1961 | } |
1962 | // User did select a name. | 1962 | // User did select a name. |
1963 | change_info->mAgentOrGroupIDs = ids; | 1963 | change_info->mAgentOrGroupIDs = ids; |
1964 | // Can't put estate owner on ban list | 1964 | // Can't put estate owner on ban list |
1965 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 1965 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
1966 | if (!panel) return; | 1966 | if (!panel) return; |
1967 | LLViewerRegion* region = gAgent.getRegion(); | 1967 | LLViewerRegion* region = gAgent.getRegion(); |
1968 | if (!region) return; | 1968 | if (!region) return; |
1969 | 1969 | ||
1970 | if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD) | 1970 | if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD) |
1971 | { | 1971 | { |
1972 | LLCtrlListInterface *list = panel->childGetListInterface("allowed_avatar_name_list"); | 1972 | LLCtrlListInterface *list = panel->childGetListInterface("allowed_avatar_name_list"); |
1973 | int currentCount = (list ? list->getItemCount() : 0); | 1973 | int currentCount = (list ? list->getItemCount() : 0); |
1974 | if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) | 1974 | if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) |
1975 | { | 1975 | { |
1976 | LLSD args; | 1976 | LLSD args; |
1977 | args["NUM_ADDED"] = llformat("%d",ids.size()); | 1977 | args["NUM_ADDED"] = llformat("%d",ids.size()); |
1978 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); | 1978 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); |
1979 | args["LIST_TYPE"] = "Allowed Residents"; | 1979 | args["LIST_TYPE"] = "Allowed Residents"; |
1980 | args["NUM_EXCESS"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); | 1980 | args["NUM_EXCESS"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); |
1981 | LLNotifications::instance().add("MaxAgentOnRegionBatch", args); | 1981 | LLNotifications::instance().add("MaxAgentOnRegionBatch", args); |
1982 | delete change_info; | 1982 | delete change_info; |
1983 | return; | 1983 | return; |
1984 | } | 1984 | } |
1985 | } | 1985 | } |
1986 | if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) | 1986 | if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) |
1987 | { | 1987 | { |
1988 | LLCtrlListInterface *list = panel->childGetListInterface("banned_avatar_name_list"); | 1988 | LLCtrlListInterface *list = panel->childGetListInterface("banned_avatar_name_list"); |
1989 | int currentCount = (list ? list->getItemCount() : 0); | 1989 | int currentCount = (list ? list->getItemCount() : 0); |
1990 | if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) | 1990 | if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) |
1991 | { | 1991 | { |
1992 | LLSD args; | 1992 | LLSD args; |
1993 | args["NUM_ADDED"] = llformat("%d",ids.size()); | 1993 | args["NUM_ADDED"] = llformat("%d",ids.size()); |
1994 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); | 1994 | args["MAX_AGENTS"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); |
1995 | args["LIST_TYPE"] = "Banned Residents"; | 1995 | args["LIST_TYPE"] = "Banned Residents"; |
1996 | args["NUM_EXCESS"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); | 1996 | args["NUM_EXCESS"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); |
1997 | LLNotifications::instance().add("MaxAgentOnRegionBatch", args); | 1997 | LLNotifications::instance().add("MaxAgentOnRegionBatch", args); |
1998 | delete change_info; | 1998 | delete change_info; |
1999 | return; | 1999 | return; |
2000 | } | 2000 | } |
2001 | } | 2001 | } |
2002 | 2002 | ||
2003 | LLSD args; | 2003 | LLSD args; |
2004 | args["ALL_ESTATES"] = all_estates_text(); | 2004 | args["ALL_ESTATES"] = all_estates_text(); |
2005 | 2005 | ||
2006 | LLNotification::Params params(change_info->mDialogName); | 2006 | LLNotification::Params params(change_info->mDialogName); |
2007 | params.substitutions(args) | 2007 | params.substitutions(args) |
2008 | .payload(change_info->asLLSD()) | 2008 | .payload(change_info->asLLSD()) |
2009 | .functor(accessCoreConfirm); | 2009 | .functor(accessCoreConfirm); |
2010 | 2010 | ||
2011 | if (isLindenEstate()) | 2011 | if (isLindenEstate()) |
2012 | { | 2012 | { |
2013 | // just apply to this estate | 2013 | // just apply to this estate |
2014 | LLNotifications::instance().forceResponse(params, 0); | 2014 | LLNotifications::instance().forceResponse(params, 0); |
2015 | } | 2015 | } |
2016 | else | 2016 | else |
2017 | { | 2017 | { |
2018 | // ask if this estate or all estates with this owner | 2018 | // ask if this estate or all estates with this owner |
2019 | LLNotifications::instance().add(params); | 2019 | LLNotifications::instance().add(params); |
2020 | } | 2020 | } |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | // static | 2023 | // static |
2024 | void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name) | 2024 | void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name) |
2025 | { | 2025 | { |
2026 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 2026 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
2027 | if (!panel) return; | 2027 | if (!panel) return; |
2028 | LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name); | 2028 | LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name); |
2029 | if (!name_list) return; | 2029 | if (!name_list) return; |
2030 | 2030 | ||
2031 | std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected(); | 2031 | std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected(); |
2032 | if (list_vector.size() == 0) | 2032 | if (list_vector.size() == 0) |
2033 | return; | 2033 | return; |
2034 | 2034 | ||
2035 | LLSD payload; | 2035 | LLSD payload; |
2036 | payload["operation"] = (S32)operation_flag; | 2036 | payload["operation"] = (S32)operation_flag; |
2037 | payload["dialog_name"] = dialog_name; | 2037 | payload["dialog_name"] = dialog_name; |
2038 | 2038 | ||
2039 | for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin(); | 2039 | for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin(); |
2040 | iter != list_vector.end(); | 2040 | iter != list_vector.end(); |
2041 | iter++) | 2041 | iter++) |
2042 | { | 2042 | { |
2043 | LLScrollListItem *item = (*iter); | 2043 | LLScrollListItem *item = (*iter); |
2044 | payload["allowed_ids"].append(item->getUUID()); | 2044 | payload["allowed_ids"].append(item->getUUID()); |
2045 | } | 2045 | } |
2046 | 2046 | ||
2047 | LLNotification::Params params("ChangeLindenAccess"); | 2047 | LLNotification::Params params("ChangeLindenAccess"); |
2048 | params.payload(payload) | 2048 | params.payload(payload) |
2049 | .functor(accessRemoveCore2); | 2049 | .functor(accessRemoveCore2); |
2050 | 2050 | ||
2051 | if (isLindenEstate()) | 2051 | if (isLindenEstate()) |
2052 | { | 2052 | { |
2053 | // warn on change linden estate | 2053 | // warn on change linden estate |
2054 | LLNotifications::instance().add(params); | 2054 | LLNotifications::instance().add(params); |
2055 | } | 2055 | } |
2056 | else | 2056 | else |
2057 | { | 2057 | { |
2058 | // just proceed, as if clicking OK | 2058 | // just proceed, as if clicking OK |
2059 | LLNotifications::instance().forceResponse(params, 0); | 2059 | LLNotifications::instance().forceResponse(params, 0); |
2060 | } | 2060 | } |
2061 | } | 2061 | } |
2062 | 2062 | ||
2063 | // static | 2063 | // static |
2064 | bool LLPanelEstateInfo::accessRemoveCore2(const LLSD& notification, const LLSD& response) | 2064 | bool LLPanelEstateInfo::accessRemoveCore2(const LLSD& notification, const LLSD& response) |
2065 | { | 2065 | { |
2066 | S32 option = LLNotification::getSelectedOption(notification, response); | 2066 | S32 option = LLNotification::getSelectedOption(notification, response); |
2067 | if (option != 0) | 2067 | if (option != 0) |
2068 | { | 2068 | { |
2069 | // abort | 2069 | // abort |
2070 | return false; | 2070 | return false; |
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | // If Linden estate, can only apply to "this" estate, not all estates | 2073 | // If Linden estate, can only apply to "this" estate, not all estates |
2074 | // owned by NULL. | 2074 | // owned by NULL. |
2075 | if (isLindenEstate()) | 2075 | if (isLindenEstate()) |
2076 | { | 2076 | { |
2077 | accessCoreConfirm(notification, response); | 2077 | accessCoreConfirm(notification, response); |
2078 | } | 2078 | } |
2079 | else | 2079 | else |
2080 | { | 2080 | { |
2081 | LLSD args; | 2081 | LLSD args; |
2082 | args["ALL_ESTATES"] = all_estates_text(); | 2082 | args["ALL_ESTATES"] = all_estates_text(); |
2083 | LLNotifications::instance().add(notification["payload"]["dialog_name"], | 2083 | LLNotifications::instance().add(notification["payload"]["dialog_name"], |
2084 | args, | 2084 | args, |
2085 | notification["payload"], | 2085 | notification["payload"], |
2086 | accessCoreConfirm); | 2086 | accessCoreConfirm); |
2087 | } | 2087 | } |
2088 | return false; | 2088 | return false; |
2089 | } | 2089 | } |
2090 | 2090 | ||
2091 | // Used for both access add and remove operations, depending on the mOperationFlag | 2091 | // Used for both access add and remove operations, depending on the mOperationFlag |
2092 | // passed in (ESTATE_ACCESS_BANNED_AGENT_ADD, ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, etc.) | 2092 | // passed in (ESTATE_ACCESS_BANNED_AGENT_ADD, ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, etc.) |
2093 | // static | 2093 | // static |
2094 | bool LLPanelEstateInfo::accessCoreConfirm(const LLSD& notification, const LLSD& response) | 2094 | bool LLPanelEstateInfo::accessCoreConfirm(const LLSD& notification, const LLSD& response) |
2095 | { | 2095 | { |
2096 | S32 option = LLNotification::getSelectedOption(notification, response); | 2096 | S32 option = LLNotification::getSelectedOption(notification, response); |
2097 | const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger(); | 2097 | const U32 originalFlags = (U32)notification["payload"]["operation"].asInteger(); |
2098 | 2098 | ||
2099 | LLViewerRegion* region = gAgent.getRegion(); | 2099 | LLViewerRegion* region = gAgent.getRegion(); |
2100 | 2100 | ||
2101 | LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray(); | 2101 | LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray(); |
2102 | 2102 | ||
2103 | for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray(); | 2103 | for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray(); |
2104 | iter != end_it; | 2104 | iter != end_it; |
2105 | iter++) | 2105 | iter++) |
2106 | { | 2106 | { |
2107 | U32 flags = originalFlags; | 2107 | U32 flags = originalFlags; |
2108 | if (iter + 1 != end_it) | 2108 | if (iter + 1 != end_it) |
2109 | flags |= ESTATE_ACCESS_NO_REPLY; | 2109 | flags |= ESTATE_ACCESS_NO_REPLY; |
2110 | 2110 | ||
2111 | const LLUUID id = iter->asUUID(); | 2111 | const LLUUID id = iter->asUUID(); |
2112 | if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD) | 2112 | if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD) |
2113 | && region && (region->getOwner() == id)) | 2113 | && region && (region->getOwner() == id)) |
2114 | { | 2114 | { |
2115 | LLNotifications::instance().add("OwnerCanNotBeDenied"); | 2115 | LLNotifications::instance().add("OwnerCanNotBeDenied"); |
2116 | break; | 2116 | break; |
2117 | } | 2117 | } |
2118 | switch(option) | 2118 | switch(option) |
2119 | { | 2119 | { |
2120 | case 0: | 2120 | case 0: |
2121 | // This estate | 2121 | // This estate |
2122 | sendEstateAccessDelta(flags, id); | 2122 | sendEstateAccessDelta(flags, id); |
2123 | break; | 2123 | break; |
2124 | case 1: | 2124 | case 1: |
2125 | { | 2125 | { |
2126 | // All estates, either than I own or manage for this owner. | 2126 | // All estates, either than I own or manage for this owner. |
2127 | // This will be verified on simulator. JC | 2127 | // This will be verified on simulator. JC |
2128 | if (!region) break; | 2128 | if (!region) break; |
2129 | if (region->getOwner() == gAgent.getID() | 2129 | if (region->getOwner() == gAgent.getID() |
2130 | || gAgent.isGodlike()) | 2130 | || gAgent.isGodlike()) |
2131 | { | 2131 | { |
2132 | flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES; | 2132 | flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES; |
2133 | sendEstateAccessDelta(flags, id); | 2133 | sendEstateAccessDelta(flags, id); |
2134 | } | 2134 | } |
2135 | else if (region->isEstateManager()) | 2135 | else if (region->isEstateManager()) |
2136 | { | 2136 | { |
2137 | flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; | 2137 | flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; |
2138 | sendEstateAccessDelta(flags, id); | 2138 | sendEstateAccessDelta(flags, id); |
2139 | } | 2139 | } |
2140 | break; | 2140 | break; |
2141 | } | 2141 | } |
2142 | case 2: | 2142 | case 2: |
2143 | default: | 2143 | default: |
2144 | break; | 2144 | break; |
2145 | } | 2145 | } |
2146 | } | 2146 | } |
2147 | return false; | 2147 | return false; |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | // key = "estateaccessdelta" | 2150 | // key = "estateaccessdelta" |
2151 | // str(estate_id) will be added to front of list by forward_EstateOwnerRequest_to_dataserver | 2151 | // str(estate_id) will be added to front of list by forward_EstateOwnerRequest_to_dataserver |
2152 | // str[0] = str(agent_id) requesting the change | 2152 | // str[0] = str(agent_id) requesting the change |
2153 | // str[1] = str(flags) (ESTATE_ACCESS_DELTA_*) | 2153 | // str[1] = str(flags) (ESTATE_ACCESS_DELTA_*) |
2154 | // str[2] = str(agent_id) to add or remove | 2154 | // str[2] = str(agent_id) to add or remove |
2155 | // static | 2155 | // static |
2156 | void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_group_id) | 2156 | void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_group_id) |
2157 | { | 2157 | { |
2158 | LLMessageSystem* msg = gMessageSystem; | 2158 | LLMessageSystem* msg = gMessageSystem; |
2159 | msg->newMessage("EstateOwnerMessage"); | 2159 | msg->newMessage("EstateOwnerMessage"); |
2160 | msg->nextBlockFast(_PREHASH_AgentData); | 2160 | msg->nextBlockFast(_PREHASH_AgentData); |
2161 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 2161 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
2162 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 2162 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
2163 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | 2163 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used |
2164 | 2164 | ||
2165 | msg->nextBlock("MethodData"); | 2165 | msg->nextBlock("MethodData"); |
2166 | msg->addString("Method", "estateaccessdelta"); | 2166 | msg->addString("Method", "estateaccessdelta"); |
2167 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); | 2167 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); |
2168 | 2168 | ||
2169 | std::string buf; | 2169 | std::string buf; |
2170 | gAgent.getID().toString(buf); | 2170 | gAgent.getID().toString(buf); |
2171 | msg->nextBlock("ParamList"); | 2171 | msg->nextBlock("ParamList"); |
2172 | msg->addString("Parameter", buf); | 2172 | msg->addString("Parameter", buf); |
2173 | 2173 | ||
2174 | buf = llformat("%u", flags); | 2174 | buf = llformat("%u", flags); |
2175 | msg->nextBlock("ParamList"); | 2175 | msg->nextBlock("ParamList"); |
2176 | msg->addString("Parameter", buf); | 2176 | msg->addString("Parameter", buf); |
2177 | 2177 | ||
2178 | agent_or_group_id.toString(buf); | 2178 | agent_or_group_id.toString(buf); |
2179 | msg->nextBlock("ParamList"); | 2179 | msg->nextBlock("ParamList"); |
2180 | msg->addString("Parameter", buf); | 2180 | msg->addString("Parameter", buf); |
2181 | 2181 | ||
2182 | 2182 | ||
2183 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 2183 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
2184 | 2184 | ||
2185 | if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | | 2185 | if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | |
2186 | ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE)) | 2186 | ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE)) |
2187 | { | 2187 | { |
2188 | 2188 | ||
2189 | panel->clearAccessLists(); | 2189 | panel->clearAccessLists(); |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | gAgent.sendReliableMessage(); | 2192 | gAgent.sendReliableMessage(); |
2193 | } | 2193 | } |
2194 | 2194 | ||
2195 | void LLPanelEstateInfo::updateControls(LLViewerRegion* region) | 2195 | void LLPanelEstateInfo::updateControls(LLViewerRegion* region) |
2196 | { | 2196 | { |
2197 | BOOL god = gAgent.isGodlike(); | 2197 | BOOL god = gAgent.isGodlike(); |
2198 | BOOL owner = (region && (region->getOwner() == gAgent.getID())); | 2198 | BOOL owner = (region && (region->getOwner() == gAgent.getID())); |
2199 | BOOL manager = (region && region->isEstateManager()); | 2199 | BOOL manager = (region && region->isEstateManager()); |
2200 | setCtrlsEnabled(god || owner || manager); | 2200 | setCtrlsEnabled(god || owner || manager); |
2201 | 2201 | ||
2202 | childDisable("apply_btn"); | 2202 | childDisable("apply_btn"); |
2203 | childSetEnabled("add_allowed_avatar_btn", god || owner || manager); | 2203 | childSetEnabled("add_allowed_avatar_btn", god || owner || manager); |
2204 | childSetEnabled("remove_allowed_avatar_btn", god || owner || manager); | 2204 | childSetEnabled("remove_allowed_avatar_btn", god || owner || manager); |
2205 | childSetEnabled("add_allowed_group_btn", god || owner || manager); | 2205 | childSetEnabled("add_allowed_group_btn", god || owner || manager); |
2206 | childSetEnabled("remove_allowed_group_btn", god || owner || manager); | 2206 | childSetEnabled("remove_allowed_group_btn", god || owner || manager); |
2207 | childSetEnabled("add_banned_avatar_btn", god || owner || manager); | 2207 | childSetEnabled("add_banned_avatar_btn", god || owner || manager); |
2208 | childSetEnabled("remove_banned_avatar_btn", god || owner || manager); | 2208 | childSetEnabled("remove_banned_avatar_btn", god || owner || manager); |
2209 | childSetEnabled("message_estate_btn", god || owner || manager); | 2209 | childSetEnabled("message_estate_btn", god || owner || manager); |
2210 | childSetEnabled("kick_user_from_estate_btn", god || owner || manager); | 2210 | childSetEnabled("kick_user_from_estate_btn", god || owner || manager); |
2211 | childSetEnabled("abuse_email_address", god || owner || manager); | 2211 | childSetEnabled("abuse_email_address", god || owner || manager); |
2212 | 2212 | ||
2213 | // estate managers can't add estate managers | 2213 | // estate managers can't add estate managers |
2214 | childSetEnabled("add_estate_manager_btn", god || owner); | 2214 | childSetEnabled("add_estate_manager_btn", god || owner); |
2215 | childSetEnabled("remove_estate_manager_btn", god || owner); | 2215 | childSetEnabled("remove_estate_manager_btn", god || owner); |
2216 | childSetEnabled("estate_manager_name_list", god || owner); | 2216 | childSetEnabled("estate_manager_name_list", god || owner); |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) | 2219 | bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) |
2220 | { | 2220 | { |
2221 | updateControls(region); | 2221 | updateControls(region); |
2222 | 2222 | ||
2223 | // let the parent class handle the general data collection. | 2223 | // let the parent class handle the general data collection. |
2224 | bool rv = LLPanelRegionInfo::refreshFromRegion(region); | 2224 | bool rv = LLPanelRegionInfo::refreshFromRegion(region); |
2225 | 2225 | ||
2226 | // We want estate info. To make sure it works across region | 2226 | // We want estate info. To make sure it works across region |
2227 | // boundaries and multiple packets, we add a serial number to the | 2227 | // boundaries and multiple packets, we add a serial number to the |
2228 | // integers and track against that on update. | 2228 | // integers and track against that on update. |
2229 | strings_t strings; | 2229 | strings_t strings; |
2230 | //integers_t integers; | 2230 | //integers_t integers; |
2231 | //LLFloaterRegionInfo::incrementSerial(); | 2231 | //LLFloaterRegionInfo::incrementSerial(); |
2232 | LLFloaterRegionInfo::nextInvoice(); | 2232 | LLFloaterRegionInfo::nextInvoice(); |
2233 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 2233 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
2234 | //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate(); | 2234 | //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate(); |
2235 | 2235 | ||
2236 | 2236 | ||
2237 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 2237 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
2238 | panel->clearAccessLists(); | 2238 | panel->clearAccessLists(); |
2239 | 2239 | ||
2240 | 2240 | ||
2241 | sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings); | 2241 | sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings); |
2242 | 2242 | ||
2243 | refresh(); | 2243 | refresh(); |
2244 | 2244 | ||
2245 | return rv; | 2245 | return rv; |
2246 | } | 2246 | } |
2247 | 2247 | ||
2248 | void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) | 2248 | void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) |
2249 | { | 2249 | { |
2250 | if (checkRemovalButton(child_ctrl->getName())) | 2250 | if (checkRemovalButton(child_ctrl->getName())) |
2251 | { | 2251 | { |
2252 | // do nothing | 2252 | // do nothing |
2253 | } | 2253 | } |
2254 | else if (checkSunHourSlider(child_ctrl)) | 2254 | else if (checkSunHourSlider(child_ctrl)) |
2255 | { | 2255 | { |
2256 | // do nothing | 2256 | // do nothing |
2257 | } | 2257 | } |
2258 | } | 2258 | } |
2259 | 2259 | ||
2260 | bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) | 2260 | bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) |
2261 | { | 2261 | { |
2262 | llinfos << "LLPanelEstateInfo::estateUpdate()" << llendl; | 2262 | llinfos << "LLPanelEstateInfo::estateUpdate()" << llendl; |
2263 | return false; | 2263 | return false; |
2264 | } | 2264 | } |
2265 | 2265 | ||
2266 | 2266 | ||
2267 | BOOL LLPanelEstateInfo::postBuild() | 2267 | BOOL LLPanelEstateInfo::postBuild() |
2268 | { | 2268 | { |
2269 | // set up the callbacks for the generic controls | 2269 | // set up the callbacks for the generic controls |
2270 | initCtrl("externally_visible_check"); | 2270 | initCtrl("externally_visible_check"); |
2271 | initCtrl("use_global_time_check"); | 2271 | initCtrl("use_global_time_check"); |
2272 | initCtrl("fixed_sun_check"); | 2272 | initCtrl("fixed_sun_check"); |
2273 | initCtrl("allow_direct_teleport"); | 2273 | initCtrl("allow_direct_teleport"); |
2274 | initCtrl("limit_payment"); | 2274 | initCtrl("limit_payment"); |
2275 | initCtrl("limit_age_verified"); | 2275 | initCtrl("limit_age_verified"); |
2276 | initCtrl("voice_chat_check"); | 2276 | initCtrl("voice_chat_check"); |
2277 | childSetCommitCallback("abuse_email_address", onChangeAnything, this); | 2277 | childSetCommitCallback("abuse_email_address", onChangeAnything, this); |
2278 | childSetKeystrokeCallback("abuse_email_address", onChangeText, this); | 2278 | childSetKeystrokeCallback("abuse_email_address", onChangeText, this); |
2279 | 2279 | ||
2280 | initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); | 2280 | initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); |
2281 | initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime"); | 2281 | initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime"); |
2282 | initHelpBtn("fixed_sun_help", "HelpEstateFixedSun"); | 2282 | initHelpBtn("fixed_sun_help", "HelpEstateFixedSun"); |
2283 | initHelpBtn("WLEditSkyHelp", "HelpEditSky"); | 2283 | initHelpBtn("WLEditSkyHelp", "HelpEditSky"); |
2284 | initHelpBtn("WLEditDayCycleHelp", "HelpEditDayCycle"); | 2284 | initHelpBtn("WLEditDayCycleHelp", "HelpEditDayCycle"); |
2285 | 2285 | ||
2286 | initHelpBtn("externally_visible_help", "HelpEstateExternallyVisible"); | 2286 | initHelpBtn("externally_visible_help", "HelpEstateExternallyVisible"); |
2287 | initHelpBtn("allow_direct_teleport_help", "HelpEstateAllowDirectTeleport"); | 2287 | initHelpBtn("allow_direct_teleport_help", "HelpEstateAllowDirectTeleport"); |
2288 | initHelpBtn("allow_resident_help", "HelpEstateAllowResident"); | 2288 | initHelpBtn("allow_resident_help", "HelpEstateAllowResident"); |
2289 | initHelpBtn("allow_group_help", "HelpEstateAllowGroup"); | 2289 | initHelpBtn("allow_group_help", "HelpEstateAllowGroup"); |
2290 | initHelpBtn("ban_resident_help", "HelpEstateBanResident"); | 2290 | initHelpBtn("ban_resident_help", "HelpEstateBanResident"); |
2291 | initHelpBtn("abuse_email_address_help", "HelpEstateAbuseEmailAddress"); | 2291 | initHelpBtn("abuse_email_address_help", "HelpEstateAbuseEmailAddress"); |
2292 | initHelpBtn("voice_chat_help", "HelpEstateVoiceChat"); | 2292 | initHelpBtn("voice_chat_help", "HelpEstateVoiceChat"); |
2293 | 2293 | ||
2294 | // set up the use global time checkbox | 2294 | // set up the use global time checkbox |
2295 | childSetCommitCallback("use_global_time_check", onChangeUseGlobalTime, this); | 2295 | childSetCommitCallback("use_global_time_check", onChangeUseGlobalTime, this); |
2296 | childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); | 2296 | childSetCommitCallback("fixed_sun_check", onChangeFixedSun, this); |
2297 | childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this); | 2297 | childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this); |
2298 | 2298 | ||
2299 | childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this); | 2299 | childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this); |
2300 | LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); | 2300 | LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); |
2301 | if (avatar_name_list) | 2301 | if (avatar_name_list) |
2302 | { | 2302 | { |
2303 | avatar_name_list->setCommitOnSelectionChange(TRUE); | 2303 | avatar_name_list->setCommitOnSelectionChange(TRUE); |
2304 | avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); | 2304 | avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); |
2305 | } | 2305 | } |
2306 | 2306 | ||
2307 | childSetAction("add_allowed_avatar_btn", onClickAddAllowedAgent, this); | 2307 | childSetAction("add_allowed_avatar_btn", onClickAddAllowedAgent, this); |
2308 | childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this); | 2308 | childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this); |
2309 | 2309 | ||
2310 | childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this); | 2310 | childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this); |
2311 | LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list"); | 2311 | LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list"); |
2312 | if (group_name_list) | 2312 | if (group_name_list) |
2313 | { | 2313 | { |
2314 | group_name_list->setCommitOnSelectionChange(TRUE); | 2314 | group_name_list->setCommitOnSelectionChange(TRUE); |
2315 | group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); | 2315 | group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | childSetAction("add_allowed_group_btn", onClickAddAllowedGroup, this); | 2318 | childSetAction("add_allowed_group_btn", onClickAddAllowedGroup, this); |
2319 | childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); | 2319 | childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); |
2320 | 2320 | ||
2321 | childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); | 2321 | childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); |
2322 | LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); | 2322 | LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); |
2323 | if (banned_name_list) | 2323 | if (banned_name_list) |
2324 | { | 2324 | { |
2325 | banned_name_list->setCommitOnSelectionChange(TRUE); | 2325 | banned_name_list->setCommitOnSelectionChange(TRUE); |
2326 | banned_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); | 2326 | banned_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); |
2327 | } | 2327 | } |
2328 | 2328 | ||
2329 | childSetAction("add_banned_avatar_btn", onClickAddBannedAgent, this); | 2329 | childSetAction("add_banned_avatar_btn", onClickAddBannedAgent, this); |
2330 | childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this); | 2330 | childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this); |
2331 | 2331 | ||
2332 | childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this); | 2332 | childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this); |
2333 | LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list"); | 2333 | LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list"); |
2334 | if (manager_name_list) | 2334 | if (manager_name_list) |
2335 | { | 2335 | { |
2336 | manager_name_list->setCommitOnSelectionChange(TRUE); | 2336 | manager_name_list->setCommitOnSelectionChange(TRUE); |
2337 | manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue | 2337 | manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue |
2338 | } | 2338 | } |
2339 | 2339 | ||
2340 | childSetAction("add_estate_manager_btn", onClickAddEstateManager, this); | 2340 | childSetAction("add_estate_manager_btn", onClickAddEstateManager, this); |
2341 | childSetAction("remove_estate_manager_btn", onClickRemoveEstateManager, this); | 2341 | childSetAction("remove_estate_manager_btn", onClickRemoveEstateManager, this); |
2342 | childSetAction("message_estate_btn", onClickMessageEstate, this); | 2342 | childSetAction("message_estate_btn", onClickMessageEstate, this); |
2343 | childSetAction("kick_user_from_estate_btn", onClickKickUser, this); | 2343 | childSetAction("kick_user_from_estate_btn", onClickKickUser, this); |
2344 | 2344 | ||
2345 | childSetAction("WLEditSky", onClickEditSky, this); | 2345 | childSetAction("WLEditSky", onClickEditSky, this); |
2346 | childSetAction("WLEditDayCycle", onClickEditDayCycle, this); | 2346 | childSetAction("WLEditDayCycle", onClickEditDayCycle, this); |
2347 | 2347 | ||
2348 | return LLPanelRegionInfo::postBuild(); | 2348 | return LLPanelRegionInfo::postBuild(); |
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | void LLPanelEstateInfo::refresh() | 2351 | void LLPanelEstateInfo::refresh() |
2352 | { | 2352 | { |
2353 | bool public_access = childGetValue("externally_visible_check").asBoolean(); | 2353 | bool public_access = childGetValue("externally_visible_check").asBoolean(); |
2354 | childSetEnabled("Only Allow", public_access); | 2354 | childSetEnabled("Only Allow", public_access); |
2355 | childSetEnabled("limit_payment", public_access); | 2355 | childSetEnabled("limit_payment", public_access); |
2356 | childSetEnabled("limit_age_verified", public_access); | 2356 | childSetEnabled("limit_age_verified", public_access); |
2357 | // if this is set to false, then the limit fields are meaningless and should be turned off | 2357 | // if this is set to false, then the limit fields are meaningless and should be turned off |
2358 | if (public_access == false) | 2358 | if (public_access == false) |
2359 | { | 2359 | { |
2360 | childSetValue("limit_payment", false); | 2360 | childSetValue("limit_payment", false); |
2361 | childSetValue("limit_age_verified", false); | 2361 | childSetValue("limit_age_verified", false); |
2362 | } | 2362 | } |
2363 | } | 2363 | } |
2364 | 2364 | ||
2365 | BOOL LLPanelEstateInfo::sendUpdate() | 2365 | BOOL LLPanelEstateInfo::sendUpdate() |
2366 | { | 2366 | { |
2367 | llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl; | 2367 | llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl; |
2368 | 2368 | ||
2369 | LLNotification::Params params("ChangeLindenEstate"); | 2369 | LLNotification::Params params("ChangeLindenEstate"); |
2370 | params.functor(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); | 2370 | params.functor(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); |
2371 | 2371 | ||
2372 | if (getEstateID() <= ESTATE_LAST_LINDEN) | 2372 | if (getEstateID() <= ESTATE_LAST_LINDEN) |
2373 | { | 2373 | { |
2374 | // trying to change reserved estate, warn | 2374 | // trying to change reserved estate, warn |
2375 | LLNotifications::instance().add(params); | 2375 | LLNotifications::instance().add(params); |
2376 | } | 2376 | } |
2377 | else | 2377 | else |
2378 | { | 2378 | { |
2379 | // for normal estates, just make the change | 2379 | // for normal estates, just make the change |
2380 | LLNotifications::instance().forceResponse(params, 0); | 2380 | LLNotifications::instance().forceResponse(params, 0); |
2381 | } | 2381 | } |
2382 | return TRUE; | 2382 | return TRUE; |
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, const LLSD& response) | 2385 | bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, const LLSD& response) |
2386 | { | 2386 | { |
2387 | S32 option = LLNotification::getSelectedOption(notification, response); | 2387 | S32 option = LLNotification::getSelectedOption(notification, response); |
2388 | switch(option) | 2388 | switch(option) |
2389 | { | 2389 | { |
2390 | case 0: | 2390 | case 0: |
2391 | // send the update | 2391 | // send the update |
2392 | if (!commitEstateInfoCaps()) | 2392 | if (!commitEstateInfoCaps()) |
2393 | { | 2393 | { |
2394 | // the caps method failed, try the old way | 2394 | // the caps method failed, try the old way |
2395 | LLFloaterRegionInfo::nextInvoice(); | 2395 | LLFloaterRegionInfo::nextInvoice(); |
2396 | commitEstateInfoDataserver(); | 2396 | commitEstateInfoDataserver(); |
2397 | } | 2397 | } |
2398 | // we don't want to do this because we'll get it automatically from the sim | 2398 | // we don't want to do this because we'll get it automatically from the sim |
2399 | // after the spaceserver processes it | 2399 | // after the spaceserver processes it |
2400 | // else | 2400 | // else |
2401 | // { | 2401 | // { |
2402 | // // caps method does not automatically send this info | 2402 | // // caps method does not automatically send this info |
2403 | // LLFloaterRegionInfo::requestRegionInfo(); | 2403 | // LLFloaterRegionInfo::requestRegionInfo(); |
2404 | // } | 2404 | // } |
2405 | break; | 2405 | break; |
2406 | case 1: | 2406 | case 1: |
2407 | default: | 2407 | default: |
2408 | // do nothing | 2408 | // do nothing |
2409 | break; | 2409 | break; |
2410 | } | 2410 | } |
2411 | return false; | 2411 | return false; |
2412 | } | 2412 | } |
2413 | 2413 | ||
2414 | 2414 | ||
2415 | /* | 2415 | /* |
2416 | // Request = "getowner" | 2416 | // Request = "getowner" |
2417 | // SParam[0] = "" (empty string) | 2417 | // SParam[0] = "" (empty string) |
2418 | // IParam[0] = serial | 2418 | // IParam[0] = serial |
2419 | void LLPanelEstateInfo::getEstateOwner() | 2419 | void LLPanelEstateInfo::getEstateOwner() |
2420 | { | 2420 | { |
2421 | // TODO -- disable the panel | 2421 | // TODO -- disable the panel |
2422 | // and call this function whenever we cross a region boundary | 2422 | // and call this function whenever we cross a region boundary |
2423 | // re-enable when owner matches, and get new estate info | 2423 | // re-enable when owner matches, and get new estate info |
2424 | LLMessageSystem* msg = gMessageSystem; | 2424 | LLMessageSystem* msg = gMessageSystem; |
2425 | msg->newMessageFast(_PREHASH_EstateOwnerRequest); | 2425 | msg->newMessageFast(_PREHASH_EstateOwnerRequest); |
2426 | msg->nextBlockFast(_PREHASH_AgentData); | 2426 | msg->nextBlockFast(_PREHASH_AgentData); |
2427 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 2427 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
2428 | 2428 | ||
2429 | msg->nextBlockFast(_PREHASH_RequestData); | 2429 | msg->nextBlockFast(_PREHASH_RequestData); |
2430 | msg->addStringFast(_PREHASH_Request, "getowner"); | 2430 | msg->addStringFast(_PREHASH_Request, "getowner"); |
2431 | 2431 | ||
2432 | // we send an empty string so that the variable block is not empty | 2432 | // we send an empty string so that the variable block is not empty |
2433 | msg->nextBlockFast(_PREHASH_StringData); | 2433 | msg->nextBlockFast(_PREHASH_StringData); |
2434 | msg->addStringFast(_PREHASH_SParam, ""); | 2434 | msg->addStringFast(_PREHASH_SParam, ""); |
2435 | 2435 | ||
2436 | msg->nextBlockFast(_PREHASH_IntegerData); | 2436 | msg->nextBlockFast(_PREHASH_IntegerData); |
2437 | msg->addS32Fast(_PREHASH_IParam, LLFloaterRegionInfo::getSerial()); | 2437 | msg->addS32Fast(_PREHASH_IParam, LLFloaterRegionInfo::getSerial()); |
2438 | 2438 | ||
2439 | gAgent.sendMessage(); | 2439 | gAgent.sendMessage(); |
2440 | } | 2440 | } |
2441 | */ | 2441 | */ |
2442 | 2442 | ||
2443 | class LLEstateChangeInfoResponder : public LLHTTPClient::Responder | 2443 | class LLEstateChangeInfoResponder : public LLHTTPClient::Responder |
2444 | { | 2444 | { |
2445 | public: | 2445 | public: |
2446 | LLEstateChangeInfoResponder(void* userdata) : mpPanel((LLPanelEstateInfo*)userdata) {}; | 2446 | LLEstateChangeInfoResponder(void* userdata) : mpPanel((LLPanelEstateInfo*)userdata) {}; |
2447 | 2447 | ||
2448 | // if we get a normal response, handle it here | 2448 | // if we get a normal response, handle it here |
2449 | virtual void result(const LLSD& content) | 2449 | virtual void result(const LLSD& content) |
2450 | { | 2450 | { |
2451 | // refresh the panel from the database | 2451 | // refresh the panel from the database |
2452 | mpPanel->refresh(); | 2452 | mpPanel->refresh(); |
2453 | } | 2453 | } |
2454 | 2454 | ||
2455 | // if we get an error response | 2455 | // if we get an error response |
2456 | virtual void error(U32 status, const std::string& reason) | 2456 | virtual void error(U32 status, const std::string& reason) |
2457 | { | 2457 | { |
2458 | llinfos << "LLEstateChangeInfoResponder::error " | 2458 | llinfos << "LLEstateChangeInfoResponder::error " |
2459 | << status << ": " << reason << llendl; | 2459 | << status << ": " << reason << llendl; |
2460 | } | 2460 | } |
2461 | private: | 2461 | private: |
2462 | LLPanelEstateInfo* mpPanel; | 2462 | LLPanelEstateInfo* mpPanel; |
2463 | }; | 2463 | }; |
2464 | 2464 | ||
2465 | // tries to send estate info using a cap; returns true if it succeeded | 2465 | // tries to send estate info using a cap; returns true if it succeeded |
2466 | bool LLPanelEstateInfo::commitEstateInfoCaps() | 2466 | bool LLPanelEstateInfo::commitEstateInfoCaps() |
2467 | { | 2467 | { |
2468 | std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); | 2468 | std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); |
2469 | 2469 | ||
2470 | if (url.empty()) | 2470 | if (url.empty()) |
2471 | { | 2471 | { |
2472 | // whoops, couldn't find the cap, so bail out | 2472 | // whoops, couldn't find the cap, so bail out |
2473 | return false; | 2473 | return false; |
2474 | } | 2474 | } |
2475 | 2475 | ||
2476 | LLSD body; | 2476 | LLSD body; |
2477 | body["estate_name"] = getEstateName(); | 2477 | body["estate_name"] = getEstateName(); |
2478 | 2478 | ||
2479 | body["is_externally_visible"] = childGetValue("externally_visible_check").asBoolean(); | 2479 | body["is_externally_visible"] = childGetValue("externally_visible_check").asBoolean(); |
2480 | body["allow_direct_teleport"] = childGetValue("allow_direct_teleport").asBoolean(); | 2480 | body["allow_direct_teleport"] = childGetValue("allow_direct_teleport").asBoolean(); |
2481 | body["is_sun_fixed" ] = childGetValue("fixed_sun_check").asBoolean(); | 2481 | body["is_sun_fixed" ] = childGetValue("fixed_sun_check").asBoolean(); |
2482 | body["deny_anonymous" ] = childGetValue("limit_payment").asBoolean(); | 2482 | body["deny_anonymous" ] = childGetValue("limit_payment").asBoolean(); |
2483 | body["deny_age_unverified" ] = childGetValue("limit_age_verified").asBoolean(); | 2483 | body["deny_age_unverified" ] = childGetValue("limit_age_verified").asBoolean(); |
2484 | body["allow_voice_chat" ] = childGetValue("voice_chat_check").asBoolean(); | 2484 | body["allow_voice_chat" ] = childGetValue("voice_chat_check").asBoolean(); |
2485 | body["invoice" ] = LLFloaterRegionInfo::getLastInvoice(); | 2485 | body["invoice" ] = LLFloaterRegionInfo::getLastInvoice(); |
2486 | 2486 | ||
2487 | // block fly is in estate database but not in estate UI, so we're not supporting it | 2487 | // block fly is in estate database but not in estate UI, so we're not supporting it |
2488 | //body["block_fly" ] = childGetValue("").asBoolean(); | 2488 | //body["block_fly" ] = childGetValue("").asBoolean(); |
2489 | 2489 | ||
2490 | F32 sun_hour = getSunHour(); | 2490 | F32 sun_hour = getSunHour(); |
2491 | if (childGetValue("use_global_time_check").asBoolean()) | 2491 | if (childGetValue("use_global_time_check").asBoolean()) |
2492 | { | 2492 | { |
2493 | sun_hour = 0.f; // 0 = global time | 2493 | sun_hour = 0.f; // 0 = global time |
2494 | } | 2494 | } |
2495 | body["sun_hour"] = sun_hour; | 2495 | body["sun_hour"] = sun_hour; |
2496 | 2496 | ||
2497 | body["owner_abuse_email"] = childGetValue("abuse_email_address").asString(); | 2497 | body["owner_abuse_email"] = childGetValue("abuse_email_address").asString(); |
2498 | 2498 | ||
2499 | // we use a responder so that we can re-get the data after committing to the database | 2499 | // we use a responder so that we can re-get the data after committing to the database |
2500 | LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder((void*)this)); | 2500 | LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder((void*)this)); |
2501 | return true; | 2501 | return true; |
2502 | } | 2502 | } |
2503 | 2503 | ||
2504 | /* This is the old way of doing things, is deprecated, and should be | 2504 | /* This is the old way of doing things, is deprecated, and should be |
2505 | deleted when the dataserver model can be removed */ | 2505 | deleted when the dataserver model can be removed */ |
2506 | // key = "estatechangeinfo" | 2506 | // key = "estatechangeinfo" |
2507 | // strings[0] = str(estate_id) (added by simulator before relay - not here) | 2507 | // strings[0] = str(estate_id) (added by simulator before relay - not here) |
2508 | // strings[1] = estate_name | 2508 | // strings[1] = estate_name |
2509 | // strings[2] = str(estate_flags) | 2509 | // strings[2] = str(estate_flags) |
2510 | // strings[3] = str((S32)(sun_hour * 1024.f)) | 2510 | // strings[3] = str((S32)(sun_hour * 1024.f)) |
2511 | void LLPanelEstateInfo::commitEstateInfoDataserver() | 2511 | void LLPanelEstateInfo::commitEstateInfoDataserver() |
2512 | { | 2512 | { |
2513 | LLMessageSystem* msg = gMessageSystem; | 2513 | LLMessageSystem* msg = gMessageSystem; |
2514 | msg->newMessage("EstateOwnerMessage"); | 2514 | msg->newMessage("EstateOwnerMessage"); |
2515 | msg->nextBlockFast(_PREHASH_AgentData); | 2515 | msg->nextBlockFast(_PREHASH_AgentData); |
2516 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 2516 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
2517 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 2517 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
2518 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | 2518 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used |
2519 | 2519 | ||
2520 | msg->nextBlock("MethodData"); | 2520 | msg->nextBlock("MethodData"); |
2521 | msg->addString("Method", "estatechangeinfo"); | 2521 | msg->addString("Method", "estatechangeinfo"); |
2522 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); | 2522 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); |
2523 | 2523 | ||
2524 | msg->nextBlock("ParamList"); | 2524 | msg->nextBlock("ParamList"); |
2525 | msg->addString("Parameter", getEstateName()); | 2525 | msg->addString("Parameter", getEstateName()); |
2526 | 2526 | ||
2527 | std::string buffer; | 2527 | std::string buffer; |
2528 | buffer = llformat("%u", computeEstateFlags()); | 2528 | buffer = llformat("%u", computeEstateFlags()); |
2529 | msg->nextBlock("ParamList"); | 2529 | msg->nextBlock("ParamList"); |
2530 | msg->addString("Parameter", buffer); | 2530 | msg->addString("Parameter", buffer); |
2531 | 2531 | ||
2532 | F32 sun_hour = getSunHour(); | 2532 | F32 sun_hour = getSunHour(); |
2533 | if (childGetValue("use_global_time_check").asBoolean()) | 2533 | if (childGetValue("use_global_time_check").asBoolean()) |
2534 | { | 2534 | { |
2535 | sun_hour = 0.f; // 0 = global time | 2535 | sun_hour = 0.f; // 0 = global time |
2536 | } | 2536 | } |
2537 | 2537 | ||
2538 | buffer = llformat("%d", (S32)(sun_hour*1024.0f)); | 2538 | buffer = llformat("%d", (S32)(sun_hour*1024.0f)); |
2539 | msg->nextBlock("ParamList"); | 2539 | msg->nextBlock("ParamList"); |
2540 | msg->addString("Parameter", buffer); | 2540 | msg->addString("Parameter", buffer); |
2541 | 2541 | ||
2542 | gAgent.sendMessage(); | 2542 | gAgent.sendMessage(); |
2543 | } | 2543 | } |
2544 | 2544 | ||
2545 | void LLPanelEstateInfo::setEstateFlags(U32 flags) | 2545 | void LLPanelEstateInfo::setEstateFlags(U32 flags) |
2546 | { | 2546 | { |
2547 | childSetValue("externally_visible_check", LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) ); | 2547 | childSetValue("externally_visible_check", LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) ); |
2548 | childSetValue("fixed_sun_check", LLSD(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE) ); | 2548 | childSetValue("fixed_sun_check", LLSD(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE) ); |
2549 | childSetValue( | 2549 | childSetValue( |
2550 | "voice_chat_check", | 2550 | "voice_chat_check", |
2551 | LLSD(flags & REGION_FLAGS_ALLOW_VOICE ? TRUE : FALSE)); | 2551 | LLSD(flags & REGION_FLAGS_ALLOW_VOICE ? TRUE : FALSE)); |
2552 | childSetValue("allow_direct_teleport", LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) ); | 2552 | childSetValue("allow_direct_teleport", LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) ); |
2553 | childSetValue("limit_payment", LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); | 2553 | childSetValue("limit_payment", LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); |
2554 | childSetValue("limit_age_verified", LLSD(flags & REGION_FLAGS_DENY_AGEUNVERIFIED ? TRUE : FALSE) ); | 2554 | childSetValue("limit_age_verified", LLSD(flags & REGION_FLAGS_DENY_AGEUNVERIFIED ? TRUE : FALSE) ); |
2555 | 2555 | ||
2556 | refresh(); | 2556 | refresh(); |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | U32 LLPanelEstateInfo::computeEstateFlags() | 2559 | U32 LLPanelEstateInfo::computeEstateFlags() |
2560 | { | 2560 | { |
2561 | U32 flags = 0; | 2561 | U32 flags = 0; |
2562 | 2562 | ||
2563 | if (childGetValue("externally_visible_check").asBoolean()) | 2563 | if (childGetValue("externally_visible_check").asBoolean()) |
2564 | { | 2564 | { |
2565 | flags |= REGION_FLAGS_EXTERNALLY_VISIBLE; | 2565 | flags |= REGION_FLAGS_EXTERNALLY_VISIBLE; |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | if ( childGetValue("voice_chat_check").asBoolean() ) | 2568 | if ( childGetValue("voice_chat_check").asBoolean() ) |
2569 | { | 2569 | { |
2570 | flags |= REGION_FLAGS_ALLOW_VOICE; | 2570 | flags |= REGION_FLAGS_ALLOW_VOICE; |
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | if (childGetValue("allow_direct_teleport").asBoolean()) | 2573 | if (childGetValue("allow_direct_teleport").asBoolean()) |
2574 | { | 2574 | { |
2575 | flags |= REGION_FLAGS_ALLOW_DIRECT_TELEPORT; | 2575 | flags |= REGION_FLAGS_ALLOW_DIRECT_TELEPORT; |
2576 | } | 2576 | } |
2577 | 2577 | ||
2578 | if (childGetValue("fixed_sun_check").asBoolean()) | 2578 | if (childGetValue("fixed_sun_check").asBoolean()) |
2579 | { | 2579 | { |
2580 | flags |= REGION_FLAGS_SUN_FIXED; | 2580 | flags |= REGION_FLAGS_SUN_FIXED; |
2581 | } | 2581 | } |
2582 | 2582 | ||
2583 | if (childGetValue("limit_payment").asBoolean()) | 2583 | if (childGetValue("limit_payment").asBoolean()) |
2584 | { | 2584 | { |
2585 | flags |= REGION_FLAGS_DENY_ANONYMOUS; | 2585 | flags |= REGION_FLAGS_DENY_ANONYMOUS; |
2586 | } | 2586 | } |
2587 | 2587 | ||
2588 | if (childGetValue("limit_age_verified").asBoolean()) | 2588 | if (childGetValue("limit_age_verified").asBoolean()) |
2589 | { | 2589 | { |
2590 | flags |= REGION_FLAGS_DENY_AGEUNVERIFIED; | 2590 | flags |= REGION_FLAGS_DENY_AGEUNVERIFIED; |
2591 | } | 2591 | } |
2592 | 2592 | ||
2593 | 2593 | ||
2594 | return flags; | 2594 | return flags; |
2595 | } | 2595 | } |
2596 | 2596 | ||
2597 | BOOL LLPanelEstateInfo::getGlobalTime() | 2597 | BOOL LLPanelEstateInfo::getGlobalTime() |
2598 | { | 2598 | { |
2599 | return childGetValue("use_global_time_check").asBoolean(); | 2599 | return childGetValue("use_global_time_check").asBoolean(); |
2600 | } | 2600 | } |
2601 | 2601 | ||
2602 | void LLPanelEstateInfo::setGlobalTime(bool b) | 2602 | void LLPanelEstateInfo::setGlobalTime(bool b) |
2603 | { | 2603 | { |
2604 | childSetValue("use_global_time_check", LLSD(b)); | 2604 | childSetValue("use_global_time_check", LLSD(b)); |
2605 | childSetEnabled("fixed_sun_check", LLSD(!b)); | 2605 | childSetEnabled("fixed_sun_check", LLSD(!b)); |
2606 | childSetEnabled("sun_hour_slider", LLSD(!b)); | 2606 | childSetEnabled("sun_hour_slider", LLSD(!b)); |
2607 | if (b) | 2607 | if (b) |
2608 | { | 2608 | { |
2609 | childSetValue("sun_hour_slider", LLSD(0.f)); | 2609 | childSetValue("sun_hour_slider", LLSD(0.f)); |
2610 | } | 2610 | } |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | 2613 | ||
2614 | BOOL LLPanelEstateInfo::getFixedSun() | 2614 | BOOL LLPanelEstateInfo::getFixedSun() |
2615 | { | 2615 | { |
2616 | return childGetValue("fixed_sun_check").asBoolean(); | 2616 | return childGetValue("fixed_sun_check").asBoolean(); |
2617 | } | 2617 | } |
2618 | 2618 | ||
2619 | void LLPanelEstateInfo::setSunHour(F32 sun_hour) | 2619 | void LLPanelEstateInfo::setSunHour(F32 sun_hour) |
2620 | { | 2620 | { |
2621 | if(sun_hour < 6.0f) | 2621 | if(sun_hour < 6.0f) |
2622 | { | 2622 | { |
2623 | sun_hour = 24.0f + sun_hour; | 2623 | sun_hour = 24.0f + sun_hour; |
2624 | } | 2624 | } |
2625 | childSetValue("sun_hour_slider", LLSD(sun_hour)); | 2625 | childSetValue("sun_hour_slider", LLSD(sun_hour)); |
2626 | } | 2626 | } |
2627 | 2627 | ||
2628 | F32 LLPanelEstateInfo::getSunHour() | 2628 | F32 LLPanelEstateInfo::getSunHour() |
2629 | { | 2629 | { |
2630 | if (childIsEnabled("sun_hour_slider")) | 2630 | if (childIsEnabled("sun_hour_slider")) |
2631 | { | 2631 | { |
2632 | return (F32)childGetValue("sun_hour_slider").asReal(); | 2632 | return (F32)childGetValue("sun_hour_slider").asReal(); |
2633 | } | 2633 | } |
2634 | return 0.f; | 2634 | return 0.f; |
2635 | } | 2635 | } |
2636 | 2636 | ||
2637 | const std::string LLPanelEstateInfo::getEstateName() const | 2637 | const std::string LLPanelEstateInfo::getEstateName() const |
2638 | { | 2638 | { |
2639 | return childGetValue("estate_name").asString(); | 2639 | return childGetValue("estate_name").asString(); |
2640 | } | 2640 | } |
2641 | 2641 | ||
2642 | void LLPanelEstateInfo::setEstateName(const std::string& name) | 2642 | void LLPanelEstateInfo::setEstateName(const std::string& name) |
2643 | { | 2643 | { |
2644 | childSetValue("estate_name", LLSD(name)); | 2644 | childSetValue("estate_name", LLSD(name)); |
2645 | } | 2645 | } |
2646 | 2646 | ||
2647 | const std::string LLPanelEstateInfo::getOwnerName() const | 2647 | const std::string LLPanelEstateInfo::getOwnerName() const |
2648 | { | 2648 | { |
2649 | return childGetValue("estate_owner").asString(); | 2649 | return childGetValue("estate_owner").asString(); |
2650 | } | 2650 | } |
2651 | 2651 | ||
2652 | void LLPanelEstateInfo::setOwnerName(const std::string& name) | 2652 | void LLPanelEstateInfo::setOwnerName(const std::string& name) |
2653 | { | 2653 | { |
2654 | childSetValue("estate_owner", LLSD(name)); | 2654 | childSetValue("estate_owner", LLSD(name)); |
2655 | } | 2655 | } |
2656 | 2656 | ||
2657 | const std::string LLPanelEstateInfo::getAbuseEmailAddress() const | 2657 | const std::string LLPanelEstateInfo::getAbuseEmailAddress() const |
2658 | { | 2658 | { |
2659 | return childGetValue("abuse_email_address").asString(); | 2659 | return childGetValue("abuse_email_address").asString(); |
2660 | } | 2660 | } |
2661 | 2661 | ||
2662 | void LLPanelEstateInfo::setAbuseEmailAddress(const std::string& address) | 2662 | void LLPanelEstateInfo::setAbuseEmailAddress(const std::string& address) |
2663 | { | 2663 | { |
2664 | childSetValue("abuse_email_address", LLSD(address)); | 2664 | childSetValue("abuse_email_address", LLSD(address)); |
2665 | } | 2665 | } |
2666 | 2666 | ||
2667 | void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, | 2667 | void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, |
2668 | bool enable_group, | 2668 | bool enable_group, |
2669 | bool enable_ban) | 2669 | bool enable_ban) |
2670 | { | 2670 | { |
2671 | childSetEnabled("allow_resident_label", enable_agent); | 2671 | childSetEnabled("allow_resident_label", enable_agent); |
2672 | childSetEnabled("allowed_avatar_name_list", enable_agent); | 2672 | childSetEnabled("allowed_avatar_name_list", enable_agent); |
2673 | childSetVisible("allowed_avatar_name_list", enable_agent); | 2673 | childSetVisible("allowed_avatar_name_list", enable_agent); |
2674 | childSetEnabled("add_allowed_avatar_btn", enable_agent); | 2674 | childSetEnabled("add_allowed_avatar_btn", enable_agent); |
2675 | childSetEnabled("remove_allowed_avatar_btn", enable_agent); | 2675 | childSetEnabled("remove_allowed_avatar_btn", enable_agent); |
2676 | 2676 | ||
2677 | // Groups | 2677 | // Groups |
2678 | childSetEnabled("allow_group_label", enable_group); | 2678 | childSetEnabled("allow_group_label", enable_group); |
2679 | childSetEnabled("allowed_group_name_list", enable_group); | 2679 | childSetEnabled("allowed_group_name_list", enable_group); |
2680 | childSetVisible("allowed_group_name_list", enable_group); | 2680 | childSetVisible("allowed_group_name_list", enable_group); |
2681 | childSetEnabled("add_allowed_group_btn", enable_group); | 2681 | childSetEnabled("add_allowed_group_btn", enable_group); |
2682 | childSetEnabled("remove_allowed_group_btn", enable_group); | 2682 | childSetEnabled("remove_allowed_group_btn", enable_group); |
2683 | 2683 | ||
2684 | // Ban | 2684 | // Ban |
2685 | childSetEnabled("ban_resident_label", enable_ban); | 2685 | childSetEnabled("ban_resident_label", enable_ban); |
2686 | childSetEnabled("banned_avatar_name_list", enable_ban); | 2686 | childSetEnabled("banned_avatar_name_list", enable_ban); |
2687 | childSetVisible("banned_avatar_name_list", enable_ban); | 2687 | childSetVisible("banned_avatar_name_list", enable_ban); |
2688 | childSetEnabled("add_banned_avatar_btn", enable_ban); | 2688 | childSetEnabled("add_banned_avatar_btn", enable_ban); |
2689 | childSetEnabled("remove_banned_avatar_btn", enable_ban); | 2689 | childSetEnabled("remove_banned_avatar_btn", enable_ban); |
2690 | 2690 | ||
2691 | // Update removal buttons if needed | 2691 | // Update removal buttons if needed |
2692 | if (enable_agent) | 2692 | if (enable_agent) |
2693 | { | 2693 | { |
2694 | checkRemovalButton("allowed_avatar_name_list"); | 2694 | checkRemovalButton("allowed_avatar_name_list"); |
2695 | } | 2695 | } |
2696 | 2696 | ||
2697 | if (enable_group) | 2697 | if (enable_group) |
2698 | { | 2698 | { |
2699 | checkRemovalButton("allowed_group_name_list"); | 2699 | checkRemovalButton("allowed_group_name_list"); |
2700 | } | 2700 | } |
2701 | 2701 | ||
2702 | if (enable_ban) | 2702 | if (enable_ban) |
2703 | { | 2703 | { |
2704 | checkRemovalButton("banned_avatar_name_list"); | 2704 | checkRemovalButton("banned_avatar_name_list"); |
2705 | } | 2705 | } |
2706 | } | 2706 | } |
2707 | 2707 | ||
2708 | // static | 2708 | // static |
2709 | void LLPanelEstateInfo::callbackCacheName( | 2709 | void LLPanelEstateInfo::callbackCacheName( |
2710 | const LLUUID& id, | 2710 | const LLUUID& id, |
2711 | const std::string& first, | 2711 | const std::string& first, |
2712 | const std::string& last, | 2712 | const std::string& last, |
2713 | BOOL is_group, | 2713 | BOOL is_group, |
2714 | void*) | 2714 | void*) |
2715 | { | 2715 | { |
2716 | LLPanelEstateInfo* self = LLFloaterRegionInfo::getPanelEstate(); | 2716 | LLPanelEstateInfo* self = LLFloaterRegionInfo::getPanelEstate(); |
2717 | if (!self) return; | 2717 | if (!self) return; |
2718 | 2718 | ||
2719 | std::string name; | 2719 | std::string name; |
2720 | 2720 | ||
2721 | if (id.isNull()) | 2721 | if (id.isNull()) |
2722 | { | 2722 | { |
2723 | name = "(none)"; | 2723 | name = "(none)"; |
2724 | } | 2724 | } |
2725 | else | 2725 | else |
2726 | { | 2726 | { |
2727 | name = first + " " + last; | 2727 | name = first + " " + last; |
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | self->setOwnerName(name); | 2730 | self->setOwnerName(name); |
2731 | } | 2731 | } |
2732 | 2732 | ||
2733 | void LLPanelEstateInfo::clearAccessLists() | 2733 | void LLPanelEstateInfo::clearAccessLists() |
2734 | { | 2734 | { |
2735 | LLNameListCtrl* name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); | 2735 | LLNameListCtrl* name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); |
2736 | if (name_list) | 2736 | if (name_list) |
2737 | { | 2737 | { |
2738 | name_list->deleteAllItems(); | 2738 | name_list->deleteAllItems(); |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); | 2741 | name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); |
2742 | if (name_list) | 2742 | if (name_list) |
2743 | { | 2743 | { |
2744 | name_list->deleteAllItems(); | 2744 | name_list->deleteAllItems(); |
2745 | } | 2745 | } |
2746 | } | 2746 | } |
2747 | 2747 | ||
2748 | // enables/disables the "remove" button for the various allow/ban lists | 2748 | // enables/disables the "remove" button for the various allow/ban lists |
2749 | BOOL LLPanelEstateInfo::checkRemovalButton(std::string name) | 2749 | BOOL LLPanelEstateInfo::checkRemovalButton(std::string name) |
2750 | { | 2750 | { |
2751 | std::string btn_name = ""; | 2751 | std::string btn_name = ""; |
2752 | if (name == "allowed_avatar_name_list") | 2752 | if (name == "allowed_avatar_name_list") |
2753 | { | 2753 | { |
2754 | btn_name = "remove_allowed_avatar_btn"; | 2754 | btn_name = "remove_allowed_avatar_btn"; |
2755 | } | 2755 | } |
2756 | else if (name == "allowed_group_name_list") | 2756 | else if (name == "allowed_group_name_list") |
2757 | { | 2757 | { |
2758 | btn_name = "remove_allowed_group_btn"; | 2758 | btn_name = "remove_allowed_group_btn"; |
2759 | } | 2759 | } |
2760 | else if (name == "banned_avatar_name_list") | 2760 | else if (name == "banned_avatar_name_list") |
2761 | { | 2761 | { |
2762 | btn_name = "remove_banned_avatar_btn"; | 2762 | btn_name = "remove_banned_avatar_btn"; |
2763 | } | 2763 | } |
2764 | else if (name == "estate_manager_name_list") | 2764 | else if (name == "estate_manager_name_list") |
2765 | { | 2765 | { |
2766 | //ONLY OWNER CAN ADD /DELET ESTATE MANAGER | 2766 | //ONLY OWNER CAN ADD /DELET ESTATE MANAGER |
2767 | LLViewerRegion* region = gAgent.getRegion(); | 2767 | LLViewerRegion* region = gAgent.getRegion(); |
2768 | if (region && (region->getOwner() == gAgent.getID())) | 2768 | if (region && (region->getOwner() == gAgent.getID())) |
2769 | { | 2769 | { |
2770 | btn_name = "remove_estate_manager_btn"; | 2770 | btn_name = "remove_estate_manager_btn"; |
2771 | } | 2771 | } |
2772 | } | 2772 | } |
2773 | 2773 | ||
2774 | // enable the remove button if something is selected | 2774 | // enable the remove button if something is selected |
2775 | LLNameListCtrl* name_list = getChild<LLNameListCtrl>(name); | 2775 | LLNameListCtrl* name_list = getChild<LLNameListCtrl>(name); |
2776 | childSetEnabled(btn_name, name_list && name_list->getFirstSelected() ? TRUE : FALSE); | 2776 | childSetEnabled(btn_name, name_list && name_list->getFirstSelected() ? TRUE : FALSE); |
2777 | 2777 | ||
2778 | return (btn_name != ""); | 2778 | return (btn_name != ""); |
2779 | } | 2779 | } |
2780 | 2780 | ||
2781 | BOOL LLPanelEstateInfo::checkSunHourSlider(LLUICtrl* child_ctrl) | 2781 | BOOL LLPanelEstateInfo::checkSunHourSlider(LLUICtrl* child_ctrl) |
2782 | { | 2782 | { |
2783 | BOOL found_child_ctrl = FALSE; | 2783 | BOOL found_child_ctrl = FALSE; |
2784 | if (child_ctrl->getName() == "sun_hour_slider") | 2784 | if (child_ctrl->getName() == "sun_hour_slider") |
2785 | { | 2785 | { |
2786 | enableButton("apply_btn"); | 2786 | enableButton("apply_btn"); |
2787 | found_child_ctrl = TRUE; | 2787 | found_child_ctrl = TRUE; |
2788 | } | 2788 | } |
2789 | return found_child_ctrl; | 2789 | return found_child_ctrl; |
2790 | } | 2790 | } |
2791 | 2791 | ||
2792 | // static | 2792 | // static |
2793 | void LLPanelEstateInfo::onClickMessageEstate(void* userdata) | 2793 | void LLPanelEstateInfo::onClickMessageEstate(void* userdata) |
2794 | { | 2794 | { |
2795 | llinfos << "LLPanelEstateInfo::onClickMessageEstate" << llendl; | 2795 | llinfos << "LLPanelEstateInfo::onClickMessageEstate" << llendl; |
2796 | LLNotifications::instance().add("MessageEstate", LLSD(), LLSD(), boost::bind(&LLPanelEstateInfo::onMessageCommit, (LLPanelEstateInfo*)userdata, _1, _2)); | 2796 | LLNotifications::instance().add("MessageEstate", LLSD(), LLSD(), boost::bind(&LLPanelEstateInfo::onMessageCommit, (LLPanelEstateInfo*)userdata, _1, _2)); |
2797 | } | 2797 | } |
2798 | 2798 | ||
2799 | bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& response) | 2799 | bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& response) |
2800 | { | 2800 | { |
2801 | S32 option = LLNotification::getSelectedOption(notification, response); | 2801 | S32 option = LLNotification::getSelectedOption(notification, response); |
2802 | std::string text = response["message"].asString(); | 2802 | std::string text = response["message"].asString(); |
2803 | if(option != 0) return false; | 2803 | if(option != 0) return false; |
2804 | if(text.empty()) return false; | 2804 | if(text.empty()) return false; |
2805 | llinfos << "Message to everyone: " << text << llendl; | 2805 | llinfos << "Message to everyone: " << text << llendl; |
2806 | strings_t strings; | 2806 | strings_t strings; |
2807 | //integers_t integers; | 2807 | //integers_t integers; |
2808 | std::string name; | 2808 | std::string name; |
2809 | gAgent.buildFullname(name); | 2809 | gAgent.buildFullname(name); |
2810 | strings.push_back(strings_t::value_type(name)); | 2810 | strings.push_back(strings_t::value_type(name)); |
2811 | strings.push_back(strings_t::value_type(text)); | 2811 | strings.push_back(strings_t::value_type(text)); |
2812 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); | 2812 | LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); |
2813 | sendEstateOwnerMessage(gMessageSystem, "instantmessage", invoice, strings); | 2813 | sendEstateOwnerMessage(gMessageSystem, "instantmessage", invoice, strings); |
2814 | return false; | 2814 | return false; |
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | LLPanelEstateCovenant::LLPanelEstateCovenant() | 2817 | LLPanelEstateCovenant::LLPanelEstateCovenant() |
2818 | : mCovenantID(LLUUID::null) | 2818 | : mCovenantID(LLUUID::null) |
2819 | { | 2819 | { |
2820 | } | 2820 | } |
2821 | 2821 | ||
2822 | // virtual | 2822 | // virtual |
2823 | bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) | 2823 | bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) |
2824 | { | 2824 | { |
2825 | LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); | 2825 | LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); |
2826 | if (region_name) | 2826 | if (region_name) |
2827 | { | 2827 | { |
2828 | region_name->setText(region->getName()); | 2828 | region_name->setText(region->getName()); |
2829 | } | 2829 | } |
2830 | 2830 | ||
2831 | LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); | 2831 | LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); |
2832 | if (resellable_clause) | 2832 | if (resellable_clause) |
2833 | { | 2833 | { |
2834 | if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) | 2834 | if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) |
2835 | { | 2835 | { |
2836 | resellable_clause->setText(getString("can_not_resell")); | 2836 | resellable_clause->setText(getString("can_not_resell")); |
2837 | } | 2837 | } |
2838 | else | 2838 | else |
2839 | { | 2839 | { |
2840 | resellable_clause->setText(getString("can_resell")); | 2840 | resellable_clause->setText(getString("can_resell")); |
2841 | } | 2841 | } |
2842 | } | 2842 | } |
2843 | 2843 | ||
2844 | LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); | 2844 | LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); |
2845 | if (changeable_clause) | 2845 | if (changeable_clause) |
2846 | { | 2846 | { |
2847 | if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) | 2847 | if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) |
2848 | { | 2848 | { |
2849 | changeable_clause->setText(getString("can_change")); | 2849 | changeable_clause->setText(getString("can_change")); |
2850 | } | 2850 | } |
2851 | else | 2851 | else |
2852 | { | 2852 | { |
2853 | changeable_clause->setText(getString("can_not_change")); | 2853 | changeable_clause->setText(getString("can_not_change")); |
2854 | } | 2854 | } |
2855 | } | 2855 | } |
2856 | 2856 | ||
2857 | LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text"); | 2857 | LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text"); |
2858 | if (region_maturity) | 2858 | if (region_maturity) |
2859 | { | 2859 | { |
2860 | region_maturity->setText(region->getSimAccessString()); | 2860 | region_maturity->setText(region->getSimAccessString()); |
2861 | } | 2861 | } |
2862 | 2862 | ||
2863 | LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text"); | 2863 | LLTextBox* region_landtype = getChild<LLTextBox>("region_landtype_text"); |
2864 | if (region_landtype) | 2864 | if (region_landtype) |
2865 | { | 2865 | { |
2866 | region_landtype->setText(region->getSimProductName()); | 2866 | region_landtype->setText(region->getSimProductName()); |
2867 | } | 2867 | } |
2868 | 2868 | ||
2869 | 2869 | ||
2870 | // let the parent class handle the general data collection. | 2870 | // let the parent class handle the general data collection. |
2871 | bool rv = LLPanelRegionInfo::refreshFromRegion(region); | 2871 | bool rv = LLPanelRegionInfo::refreshFromRegion(region); |
2872 | LLMessageSystem *msg = gMessageSystem; | 2872 | LLMessageSystem *msg = gMessageSystem; |
2873 | msg->newMessage("EstateCovenantRequest"); | 2873 | msg->newMessage("EstateCovenantRequest"); |
2874 | msg->nextBlockFast(_PREHASH_AgentData); | 2874 | msg->nextBlockFast(_PREHASH_AgentData); |
2875 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 2875 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
2876 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); | 2876 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); |
2877 | msg->sendReliable(region->getHost()); | 2877 | msg->sendReliable(region->getHost()); |
2878 | return rv; | 2878 | return rv; |
2879 | } | 2879 | } |
2880 | 2880 | ||
2881 | // virtual | 2881 | // virtual |
2882 | bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg) | 2882 | bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg) |
2883 | { | 2883 | { |
2884 | llinfos << "LLPanelEstateCovenant::estateUpdate()" << llendl; | 2884 | llinfos << "LLPanelEstateCovenant::estateUpdate()" << llendl; |
2885 | return true; | 2885 | return true; |
2886 | } | 2886 | } |
2887 | 2887 | ||
2888 | // virtual | 2888 | // virtual |
2889 | BOOL LLPanelEstateCovenant::postBuild() | 2889 | BOOL LLPanelEstateCovenant::postBuild() |
2890 | { | 2890 | { |
2891 | initHelpBtn("covenant_help", "HelpEstateCovenant"); | 2891 | initHelpBtn("covenant_help", "HelpEstateCovenant"); |
2892 | mEstateNameText = getChild<LLTextBox>("estate_name_text"); | 2892 | mEstateNameText = getChild<LLTextBox>("estate_name_text"); |
2893 | mEstateOwnerText = getChild<LLTextBox>("estate_owner_text"); | 2893 | mEstateOwnerText = getChild<LLTextBox>("estate_owner_text"); |
2894 | mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text"); | 2894 | mLastModifiedText = getChild<LLTextBox>("covenant_timestamp_text"); |
2895 | mEditor = getChild<LLViewerTextEditor>("covenant_editor"); | 2895 | mEditor = getChild<LLViewerTextEditor>("covenant_editor"); |
2896 | if (mEditor) mEditor->setHandleEditKeysDirectly(TRUE); | 2896 | if (mEditor) mEditor->setHandleEditKeysDirectly(TRUE); |
2897 | LLButton* reset_button = getChild<LLButton>("reset_covenant"); | 2897 | LLButton* reset_button = getChild<LLButton>("reset_covenant"); |
2898 | reset_button->setEnabled(gAgent.canManageEstate()); | 2898 | reset_button->setEnabled(gAgent.canManageEstate()); |
2899 | reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL); | 2899 | reset_button->setClickedCallback(LLPanelEstateCovenant::resetCovenantID, NULL); |
2900 | 2900 | ||
2901 | return LLPanelRegionInfo::postBuild(); | 2901 | return LLPanelRegionInfo::postBuild(); |
2902 | } | 2902 | } |
2903 | 2903 | ||
2904 | // virtual | 2904 | // virtual |
2905 | void LLPanelEstateCovenant::updateChild(LLUICtrl* child_ctrl) | 2905 | void LLPanelEstateCovenant::updateChild(LLUICtrl* child_ctrl) |
2906 | { | 2906 | { |
2907 | } | 2907 | } |
2908 | 2908 | ||
2909 | // virtual | 2909 | // virtual |
2910 | BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | 2910 | BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, |
2911 | EDragAndDropType cargo_type, | 2911 | EDragAndDropType cargo_type, |
2912 | void* cargo_data, | 2912 | void* cargo_data, |
2913 | EAcceptance* accept, | 2913 | EAcceptance* accept, |
2914 | std::string& tooltip_msg) | 2914 | std::string& tooltip_msg) |
2915 | { | 2915 | { |
2916 | LLInventoryItem* item = (LLInventoryItem*)cargo_data; | 2916 | LLInventoryItem* item = (LLInventoryItem*)cargo_data; |
2917 | 2917 | ||
2918 | if (!gAgent.canManageEstate()) | 2918 | if (!gAgent.canManageEstate()) |
2919 | { | 2919 | { |
2920 | *accept = ACCEPT_NO; | 2920 | *accept = ACCEPT_NO; |
2921 | return TRUE; | 2921 | return TRUE; |
2922 | } | 2922 | } |
2923 | 2923 | ||
2924 | switch(cargo_type) | 2924 | switch(cargo_type) |
2925 | { | 2925 | { |
2926 | case DAD_NOTECARD: | 2926 | case DAD_NOTECARD: |
2927 | *accept = ACCEPT_YES_COPY_SINGLE; | 2927 | *accept = ACCEPT_YES_COPY_SINGLE; |
2928 | if (item && drop) | 2928 | if (item && drop) |
2929 | { | 2929 | { |
2930 | LLSD payload; | 2930 | LLSD payload; |
2931 | payload["item_id"] = item->getUUID(); | 2931 | payload["item_id"] = item->getUUID(); |
2932 | LLNotifications::instance().add("EstateChangeCovenant", LLSD(), payload, | 2932 | LLNotifications::instance().add("EstateChangeCovenant", LLSD(), payload, |
2933 | LLPanelEstateCovenant::confirmChangeCovenantCallback); | 2933 | LLPanelEstateCovenant::confirmChangeCovenantCallback); |
2934 | } | 2934 | } |
2935 | break; | 2935 | break; |
2936 | default: | 2936 | default: |
2937 | *accept = ACCEPT_NO; | 2937 | *accept = ACCEPT_NO; |
2938 | break; | 2938 | break; |
2939 | } | 2939 | } |
2940 | 2940 | ||
2941 | return TRUE; | 2941 | return TRUE; |
2942 | } | 2942 | } |
2943 | 2943 | ||
2944 | // static | 2944 | // static |
2945 | bool LLPanelEstateCovenant::confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response) | 2945 | bool LLPanelEstateCovenant::confirmChangeCovenantCallback(const LLSD& notification, const LLSD& response) |
2946 | { | 2946 | { |
2947 | S32 option = LLNotification::getSelectedOption(notification, response); | 2947 | S32 option = LLNotification::getSelectedOption(notification, response); |
2948 | LLInventoryItem* item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); | 2948 | LLInventoryItem* item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); |
2949 | LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant(); | 2949 | LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant(); |
2950 | 2950 | ||
2951 | if (!item || !self) return false; | 2951 | if (!item || !self) return false; |
2952 | 2952 | ||
2953 | switch(option) | 2953 | switch(option) |
2954 | { | 2954 | { |
2955 | case 0: | 2955 | case 0: |
2956 | self->loadInvItem(item); | 2956 | self->loadInvItem(item); |
2957 | break; | 2957 | break; |
2958 | default: | 2958 | default: |
2959 | break; | 2959 | break; |
2960 | } | 2960 | } |
2961 | return false; | 2961 | return false; |
2962 | } | 2962 | } |
2963 | 2963 | ||
2964 | // static | 2964 | // static |
2965 | void LLPanelEstateCovenant::resetCovenantID(void* userdata) | 2965 | void LLPanelEstateCovenant::resetCovenantID(void* userdata) |
2966 | { | 2966 | { |
2967 | LLNotifications::instance().add("EstateChangeCovenant", LLSD(), LLSD(), confirmResetCovenantCallback); | 2967 | LLNotifications::instance().add("EstateChangeCovenant", LLSD(), LLSD(), confirmResetCovenantCallback); |
2968 | } | 2968 | } |
2969 | 2969 | ||
2970 | // static | 2970 | // static |
2971 | bool LLPanelEstateCovenant::confirmResetCovenantCallback(const LLSD& notification, const LLSD& response) | 2971 | bool LLPanelEstateCovenant::confirmResetCovenantCallback(const LLSD& notification, const LLSD& response) |
2972 | { | 2972 | { |
2973 | LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant(); | 2973 | LLPanelEstateCovenant* self = LLFloaterRegionInfo::getPanelCovenant(); |
2974 | if (!self) return false; | 2974 | if (!self) return false; |
2975 | 2975 | ||
2976 | S32 option = LLNotification::getSelectedOption(notification, response); | 2976 | S32 option = LLNotification::getSelectedOption(notification, response); |
2977 | switch(option) | 2977 | switch(option) |
2978 | { | 2978 | { |
2979 | case 0: | 2979 | case 0: |
2980 | self->loadInvItem(NULL); | 2980 | self->loadInvItem(NULL); |
2981 | break; | 2981 | break; |
2982 | default: | 2982 | default: |
2983 | break; | 2983 | break; |
2984 | } | 2984 | } |
2985 | return false; | 2985 | return false; |
2986 | } | 2986 | } |
2987 | 2987 | ||
2988 | void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp) | 2988 | void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp) |
2989 | { | 2989 | { |
2990 | const BOOL high_priority = TRUE; | 2990 | const BOOL high_priority = TRUE; |
2991 | if (itemp) | 2991 | if (itemp) |
2992 | { | 2992 | { |
2993 | gAssetStorage->getInvItemAsset(gAgent.getRegionHost(), | 2993 | gAssetStorage->getInvItemAsset(gAgent.getRegionHost(), |
2994 | gAgent.getID(), | 2994 | gAgent.getID(), |
2995 | gAgent.getSessionID(), | 2995 | gAgent.getSessionID(), |
2996 | itemp->getPermissions().getOwner(), | 2996 | itemp->getPermissions().getOwner(), |
2997 | LLUUID::null, | 2997 | LLUUID::null, |
2998 | itemp->getUUID(), | 2998 | itemp->getUUID(), |
2999 | itemp->getAssetUUID(), | 2999 | itemp->getAssetUUID(), |
3000 | itemp->getType(), | 3000 | itemp->getType(), |
3001 | onLoadComplete, | 3001 | onLoadComplete, |
3002 | (void*)this, | 3002 | (void*)this, |
3003 | high_priority); | 3003 | high_priority); |
3004 | mAssetStatus = ASSET_LOADING; | 3004 | mAssetStatus = ASSET_LOADING; |
3005 | } | 3005 | } |
3006 | else | 3006 | else |
3007 | { | 3007 | { |
3008 | mAssetStatus = ASSET_LOADED; | 3008 | mAssetStatus = ASSET_LOADED; |
3009 | setCovenantTextEditor("There is no Covenant provided for this Estate."); | 3009 | setCovenantTextEditor("There is no Covenant provided for this Estate."); |
3010 | sendChangeCovenantID(LLUUID::null); | 3010 | sendChangeCovenantID(LLUUID::null); |
3011 | } | 3011 | } |
3012 | } | 3012 | } |
3013 | 3013 | ||
3014 | // static | 3014 | // static |
3015 | void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, | 3015 | void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, |
3016 | const LLUUID& asset_uuid, | 3016 | const LLUUID& asset_uuid, |
3017 | LLAssetType::EType type, | 3017 | LLAssetType::EType type, |
3018 | void* user_data, S32 status, LLExtStat ext_status) | 3018 | void* user_data, S32 status, LLExtStat ext_status) |
3019 | { | 3019 | { |
3020 | llinfos << "LLPanelEstateCovenant::onLoadComplete()" << llendl; | 3020 | llinfos << "LLPanelEstateCovenant::onLoadComplete()" << llendl; |
3021 | LLPanelEstateCovenant* panelp = (LLPanelEstateCovenant*)user_data; | 3021 | LLPanelEstateCovenant* panelp = (LLPanelEstateCovenant*)user_data; |
3022 | if( panelp ) | 3022 | if( panelp ) |
3023 | { | 3023 | { |
3024 | if(0 == status) | 3024 | if(0 == status) |
3025 | { | 3025 | { |
3026 | LLVFile file(vfs, asset_uuid, type, LLVFile::READ); | 3026 | LLVFile file(vfs, asset_uuid, type, LLVFile::READ); |
3027 | 3027 | ||
3028 | S32 file_length = file.getSize(); | 3028 | S32 file_length = file.getSize(); |
3029 | 3029 | ||
3030 | char* buffer = new char[file_length+1]; | 3030 | char* buffer = new char[file_length+1]; |
3031 | if (buffer == NULL) | 3031 | if (buffer == NULL) |
3032 | { | 3032 | { |
3033 | llerrs << "Memory Allocation Failed" << llendl; | 3033 | llerrs << "Memory Allocation Failed" << llendl; |
3034 | return; | 3034 | return; |
3035 | } | 3035 | } |
3036 | 3036 | ||
3037 | file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ | 3037 | file.read((U8*)buffer, file_length); /* Flawfinder: ignore */ |
3038 | // put a EOS at the end | 3038 | // put a EOS at the end |
3039 | buffer[file_length] = 0; | 3039 | buffer[file_length] = 0; |
3040 | 3040 | ||
3041 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) | 3041 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) |
3042 | { | 3042 | { |
3043 | if( !panelp->mEditor->importBuffer( buffer, file_length+1 ) ) | 3043 | if( !panelp->mEditor->importBuffer( buffer, file_length+1 ) ) |
3044 | { | 3044 | { |
3045 | llwarns << "Problem importing estate covenant." << llendl; | 3045 | llwarns << "Problem importing estate covenant." << llendl; |
3046 | LLNotifications::instance().add("ProblemImportingEstateCovenant"); | 3046 | LLNotifications::instance().add("ProblemImportingEstateCovenant"); |
3047 | } | 3047 | } |
3048 | else | 3048 | else |
3049 | { | 3049 | { |
3050 | panelp->sendChangeCovenantID(asset_uuid); | 3050 | panelp->sendChangeCovenantID(asset_uuid); |
3051 | } | 3051 | } |
3052 | } | 3052 | } |
3053 | else | 3053 | else |
3054 | { | 3054 | { |
3055 | // Version 0 (just text, doesn't include version number) | 3055 | // Version 0 (just text, doesn't include version number) |
3056 | panelp->sendChangeCovenantID(asset_uuid); | 3056 | panelp->sendChangeCovenantID(asset_uuid); |
3057 | } | 3057 | } |
3058 | delete[] buffer; | 3058 | delete[] buffer; |
3059 | } | 3059 | } |
3060 | else | 3060 | else |
3061 | { | 3061 | { |
3062 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); | 3062 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); |
3063 | 3063 | ||
3064 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || | 3064 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || |
3065 | LL_ERR_FILE_EMPTY == status) | 3065 | LL_ERR_FILE_EMPTY == status) |
3066 | { | 3066 | { |
3067 | LLNotifications::instance().add("MissingNotecardAssetID"); | 3067 | LLNotifications::instance().add("MissingNotecardAssetID"); |
3068 | } | 3068 | } |
3069 | else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) | 3069 | else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) |
3070 | { | 3070 | { |
3071 | LLNotifications::instance().add("NotAllowedToViewNotecard"); | 3071 | LLNotifications::instance().add("NotAllowedToViewNotecard"); |
3072 | } | 3072 | } |
3073 | else | 3073 | else |
3074 | { | 3074 | { |
3075 | LLNotifications::instance().add("UnableToLoadNotecardAsset"); | 3075 | LLNotifications::instance().add("UnableToLoadNotecardAsset"); |
3076 | } | 3076 | } |
3077 | 3077 | ||
3078 | llwarns << "Problem loading notecard: " << status << llendl; | 3078 | llwarns << "Problem loading notecard: " << status << llendl; |
3079 | } | 3079 | } |
3080 | panelp->mAssetStatus = ASSET_LOADED; | 3080 | panelp->mAssetStatus = ASSET_LOADED; |
3081 | panelp->setCovenantID(asset_uuid); | 3081 | panelp->setCovenantID(asset_uuid); |
3082 | } | 3082 | } |
3083 | } | 3083 | } |
3084 | 3084 | ||
3085 | // key = "estatechangecovenantid" | 3085 | // key = "estatechangecovenantid" |
3086 | // strings[0] = str(estate_id) (added by simulator before relay - not here) | 3086 | // strings[0] = str(estate_id) (added by simulator before relay - not here) |
3087 | // strings[1] = str(covenant_id) | 3087 | // strings[1] = str(covenant_id) |
3088 | void LLPanelEstateCovenant::sendChangeCovenantID(const LLUUID &asset_id) | 3088 | void LLPanelEstateCovenant::sendChangeCovenantID(const LLUUID &asset_id) |
3089 | { | 3089 | { |
3090 | if (asset_id != getCovenantID()) | 3090 | if (asset_id != getCovenantID()) |
3091 | { | 3091 | { |
3092 | setCovenantID(asset_id); | 3092 | setCovenantID(asset_id); |
3093 | 3093 | ||
3094 | LLMessageSystem* msg = gMessageSystem; | 3094 | LLMessageSystem* msg = gMessageSystem; |
3095 | msg->newMessage("EstateOwnerMessage"); | 3095 | msg->newMessage("EstateOwnerMessage"); |
3096 | msg->nextBlockFast(_PREHASH_AgentData); | 3096 | msg->nextBlockFast(_PREHASH_AgentData); |
3097 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 3097 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
3098 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 3098 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
3099 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | 3099 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used |
3100 | 3100 | ||
3101 | msg->nextBlock("MethodData"); | 3101 | msg->nextBlock("MethodData"); |
3102 | msg->addString("Method", "estatechangecovenantid"); | 3102 | msg->addString("Method", "estatechangecovenantid"); |
3103 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); | 3103 | msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); |
3104 | 3104 | ||
3105 | msg->nextBlock("ParamList"); | 3105 | msg->nextBlock("ParamList"); |
3106 | msg->addString("Parameter", getCovenantID().asString()); | 3106 | msg->addString("Parameter", getCovenantID().asString()); |
3107 | gAgent.sendReliableMessage(); | 3107 | gAgent.sendReliableMessage(); |
3108 | } | 3108 | } |
3109 | } | 3109 | } |
3110 | 3110 | ||
3111 | // virtual | 3111 | // virtual |
3112 | BOOL LLPanelEstateCovenant::sendUpdate() | 3112 | BOOL LLPanelEstateCovenant::sendUpdate() |
3113 | { | 3113 | { |
3114 | return TRUE; | 3114 | return TRUE; |
3115 | } | 3115 | } |
3116 | 3116 | ||
3117 | const std::string& LLPanelEstateCovenant::getEstateName() const | 3117 | const std::string& LLPanelEstateCovenant::getEstateName() const |
3118 | { | 3118 | { |
3119 | return mEstateNameText->getText(); | 3119 | return mEstateNameText->getText(); |
3120 | } | 3120 | } |
3121 | 3121 | ||
3122 | void LLPanelEstateCovenant::setEstateName(const std::string& name) | 3122 | void LLPanelEstateCovenant::setEstateName(const std::string& name) |
3123 | { | 3123 | { |
3124 | mEstateNameText->setText(name); | 3124 | mEstateNameText->setText(name); |
3125 | } | 3125 | } |
3126 | 3126 | ||
3127 | // static | 3127 | // static |
3128 | void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id) | 3128 | void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id) |
3129 | { | 3129 | { |
3130 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); | 3130 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); |
3131 | if( panelp ) | 3131 | if( panelp ) |
3132 | { | 3132 | { |
3133 | panelp->mEditor->setText(string); | 3133 | panelp->mEditor->setText(string); |
3134 | panelp->setCovenantID(asset_id); | 3134 | panelp->setCovenantID(asset_id); |
3135 | } | 3135 | } |
3136 | } | 3136 | } |
3137 | 3137 | ||
3138 | // static | 3138 | // static |
3139 | void LLPanelEstateCovenant::updateEstateName(const std::string& name) | 3139 | void LLPanelEstateCovenant::updateEstateName(const std::string& name) |
3140 | { | 3140 | { |
3141 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); | 3141 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); |
3142 | if( panelp ) | 3142 | if( panelp ) |
3143 | { | 3143 | { |
3144 | panelp->mEstateNameText->setText(name); | 3144 | panelp->mEstateNameText->setText(name); |
3145 | } | 3145 | } |
3146 | } | 3146 | } |
3147 | 3147 | ||
3148 | // static | 3148 | // static |
3149 | void LLPanelEstateCovenant::updateLastModified(const std::string& text) | 3149 | void LLPanelEstateCovenant::updateLastModified(const std::string& text) |
3150 | { | 3150 | { |
3151 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); | 3151 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); |
3152 | if( panelp ) | 3152 | if( panelp ) |
3153 | { | 3153 | { |
3154 | panelp->mLastModifiedText->setText(text); | 3154 | panelp->mLastModifiedText->setText(text); |
3155 | } | 3155 | } |
3156 | } | 3156 | } |
3157 | 3157 | ||
3158 | // static | 3158 | // static |
3159 | void LLPanelEstateCovenant::updateEstateOwnerName(const std::string& name) | 3159 | void LLPanelEstateCovenant::updateEstateOwnerName(const std::string& name) |
3160 | { | 3160 | { |
3161 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); | 3161 | LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); |
3162 | if( panelp ) | 3162 | if( panelp ) |
3163 | { | 3163 | { |
3164 | panelp->mEstateOwnerText->setText(name); | 3164 | panelp->mEstateOwnerText->setText(name); |
3165 | } | 3165 | } |
3166 | } | 3166 | } |
3167 | 3167 | ||
3168 | const std::string& LLPanelEstateCovenant::getOwnerName() const | 3168 | const std::string& LLPanelEstateCovenant::getOwnerName() const |
3169 | { | 3169 | { |
3170 | return mEstateOwnerText->getText(); | 3170 | return mEstateOwnerText->getText(); |
3171 | } | 3171 | } |
3172 | 3172 | ||
3173 | void LLPanelEstateCovenant::setOwnerName(const std::string& name) | 3173 | void LLPanelEstateCovenant::setOwnerName(const std::string& name) |
3174 | { | 3174 | { |
3175 | mEstateOwnerText->setText(name); | 3175 | mEstateOwnerText->setText(name); |
3176 | } | 3176 | } |
3177 | 3177 | ||
3178 | void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text) | 3178 | void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text) |
3179 | { | 3179 | { |
3180 | mEditor->setText(text); | 3180 | mEditor->setText(text); |
3181 | } | 3181 | } |
3182 | 3182 | ||
3183 | // key = "estateupdateinfo" | 3183 | // key = "estateupdateinfo" |
3184 | // strings[0] = estate name | 3184 | // strings[0] = estate name |
3185 | // strings[1] = str(owner_id) | 3185 | // strings[1] = str(owner_id) |
3186 | // strings[2] = str(estate_id) | 3186 | // strings[2] = str(estate_id) |
3187 | // strings[3] = str(estate_flags) | 3187 | // strings[3] = str(estate_flags) |
3188 | // strings[4] = str((S32)(sun_hour * 1024)) | 3188 | // strings[4] = str((S32)(sun_hour * 1024)) |
3189 | // strings[5] = str(parent_estate_id) | 3189 | // strings[5] = str(parent_estate_id) |
3190 | // strings[6] = str(covenant_id) | 3190 | // strings[6] = str(covenant_id) |
3191 | // strings[7] = str(covenant_timestamp) | 3191 | // strings[7] = str(covenant_timestamp) |
3192 | // strings[8] = str(send_to_agent_only) | 3192 | // strings[8] = str(send_to_agent_only) |
3193 | // strings[9] = str(abuse_email_addr) | 3193 | // strings[9] = str(abuse_email_addr) |
3194 | bool LLDispatchEstateUpdateInfo::operator()( | 3194 | bool LLDispatchEstateUpdateInfo::operator()( |
3195 | const LLDispatcher* dispatcher, | 3195 | const LLDispatcher* dispatcher, |
3196 | const std::string& key, | 3196 | const std::string& key, |
3197 | const LLUUID& invoice, | 3197 | const LLUUID& invoice, |
3198 | const sparam_t& strings) | 3198 | const sparam_t& strings) |
3199 | { | 3199 | { |
3200 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 3200 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
3201 | if (!panel) return true; | 3201 | if (!panel) return true; |
3202 | 3202 | ||
3203 | // NOTE: LLDispatcher extracts strings with an extra \0 at the | 3203 | // NOTE: LLDispatcher extracts strings with an extra \0 at the |
3204 | // end. If we pass the std::string direct to the UI/renderer | 3204 | // end. If we pass the std::string direct to the UI/renderer |
3205 | // it draws with a weird character at the end of the string. | 3205 | // it draws with a weird character at the end of the string. |
3206 | std::string estate_name = strings[0].c_str(); // preserve c_str() call! | 3206 | std::string estate_name = strings[0].c_str(); // preserve c_str() call! |
3207 | panel->setEstateName(estate_name); | 3207 | panel->setEstateName(estate_name); |
3208 | 3208 | ||
3209 | if (strings.size() > 3) | 3209 | if (strings.size() > 3) |
3210 | { | 3210 | { |
3211 | std::string abuse_email = strings[9].c_str(); // preserve c_str() call! | 3211 | std::string abuse_email = strings[9].c_str(); // preserve c_str() call! |
3212 | panel->setAbuseEmailAddress(abuse_email); | 3212 | panel->setAbuseEmailAddress(abuse_email); |
3213 | } | 3213 | } |
3214 | else | 3214 | else |
3215 | { | 3215 | { |
3216 | panel->setAbuseEmailAddress(panel->getString("email_unsupported")); | 3216 | panel->setAbuseEmailAddress(panel->getString("email_unsupported")); |
3217 | } | 3217 | } |
3218 | 3218 | ||
3219 | LLViewerRegion* regionp = gAgent.getRegion(); | 3219 | LLViewerRegion* regionp = gAgent.getRegion(); |
3220 | 3220 | ||
3221 | LLUUID owner_id(strings[1]); | 3221 | LLUUID owner_id(strings[1]); |
3222 | regionp->setOwner(owner_id); | 3222 | regionp->setOwner(owner_id); |
3223 | // Update estate owner name in UI | 3223 | // Update estate owner name in UI |
3224 | const BOOL is_group = FALSE; | 3224 | const BOOL is_group = FALSE; |
3225 | gCacheName->get(owner_id, is_group, LLPanelEstateInfo::callbackCacheName); | 3225 | gCacheName->get(owner_id, is_group, LLPanelEstateInfo::callbackCacheName); |
3226 | 3226 | ||
3227 | U32 estate_id = strtoul(strings[2].c_str(), NULL, 10); | 3227 | U32 estate_id = strtoul(strings[2].c_str(), NULL, 10); |
3228 | panel->setEstateID(estate_id); | 3228 | panel->setEstateID(estate_id); |
3229 | 3229 | ||
3230 | U32 flags = strtoul(strings[3].c_str(), NULL, 10); | 3230 | U32 flags = strtoul(strings[3].c_str(), NULL, 10); |
3231 | panel->setEstateFlags(flags); | 3231 | panel->setEstateFlags(flags); |
3232 | 3232 | ||
3233 | F32 sun_hour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; | 3233 | F32 sun_hour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; |
3234 | if(sun_hour == 0 && (flags & REGION_FLAGS_SUN_FIXED ? FALSE : TRUE)) | 3234 | if(sun_hour == 0 && (flags & REGION_FLAGS_SUN_FIXED ? FALSE : TRUE)) |
3235 | { | 3235 | { |
3236 | panel->setGlobalTime(TRUE); | 3236 | panel->setGlobalTime(TRUE); |
3237 | } | 3237 | } |
3238 | else | 3238 | else |
3239 | { | 3239 | { |
3240 | panel->setGlobalTime(FALSE); | 3240 | panel->setGlobalTime(FALSE); |
3241 | panel->setSunHour(sun_hour); | 3241 | panel->setSunHour(sun_hour); |
3242 | } | 3242 | } |
3243 | 3243 | ||
3244 | bool visible_from_mainland = (bool)(flags & REGION_FLAGS_EXTERNALLY_VISIBLE); | 3244 | bool visible_from_mainland = (bool)(flags & REGION_FLAGS_EXTERNALLY_VISIBLE); |
3245 | bool god = gAgent.isGodlike(); | 3245 | bool god = gAgent.isGodlike(); |
3246 | bool linden_estate = (estate_id <= ESTATE_LAST_LINDEN); | 3246 | bool linden_estate = (estate_id <= ESTATE_LAST_LINDEN); |
3247 | 3247 | ||
3248 | // If visible from mainland, disable the access allowed | 3248 | // If visible from mainland, disable the access allowed |
3249 | // UI, as anyone can teleport there. | 3249 | // UI, as anyone can teleport there. |
3250 | // However, gods need to be able to edit the access list for | 3250 | // However, gods need to be able to edit the access list for |
3251 | // linden estates, regardless of visibility, to allow object | 3251 | // linden estates, regardless of visibility, to allow object |
3252 | // and L$ transfers. | 3252 | // and L$ transfers. |
3253 | bool enable_agent = (!visible_from_mainland || (god && linden_estate)); | 3253 | bool enable_agent = (!visible_from_mainland || (god && linden_estate)); |
3254 | bool enable_group = enable_agent; | 3254 | bool enable_group = enable_agent; |
3255 | bool enable_ban = !linden_estate; | 3255 | bool enable_ban = !linden_estate; |
3256 | panel->setAccessAllowedEnabled(enable_agent, enable_group, enable_ban); | 3256 | panel->setAccessAllowedEnabled(enable_agent, enable_group, enable_ban); |
3257 | 3257 | ||
3258 | return true; | 3258 | return true; |
3259 | } | 3259 | } |
3260 | 3260 | ||
3261 | 3261 | ||
3262 | // key = "setaccess" | 3262 | // key = "setaccess" |
3263 | // strings[0] = str(estate_id) | 3263 | // strings[0] = str(estate_id) |
3264 | // strings[1] = str(packed_access_lists) | 3264 | // strings[1] = str(packed_access_lists) |
3265 | // strings[2] = str(num allowed agent ids) | 3265 | // strings[2] = str(num allowed agent ids) |
3266 | // strings[3] = str(num allowed group ids) | 3266 | // strings[3] = str(num allowed group ids) |
3267 | // strings[4] = str(num banned agent ids) | 3267 | // strings[4] = str(num banned agent ids) |
3268 | // strings[5] = str(num estate manager agent ids) | 3268 | // strings[5] = str(num estate manager agent ids) |
3269 | // strings[6] = bin(uuid) | 3269 | // strings[6] = bin(uuid) |
3270 | // strings[7] = bin(uuid) | 3270 | // strings[7] = bin(uuid) |
3271 | // strings[8] = bin(uuid) | 3271 | // strings[8] = bin(uuid) |
3272 | // ... | 3272 | // ... |
3273 | bool LLDispatchSetEstateAccess::operator()( | 3273 | bool LLDispatchSetEstateAccess::operator()( |
3274 | const LLDispatcher* dispatcher, | 3274 | const LLDispatcher* dispatcher, |
3275 | const std::string& key, | 3275 | const std::string& key, |
3276 | const LLUUID& invoice, | 3276 | const LLUUID& invoice, |
3277 | const sparam_t& strings) | 3277 | const sparam_t& strings) |
3278 | { | 3278 | { |
3279 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); | 3279 | LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); |
3280 | if (!panel) return true; | 3280 | if (!panel) return true; |
3281 | 3281 | ||
3282 | S32 index = 1; // skip estate_id | 3282 | S32 index = 1; // skip estate_id |
3283 | U32 access_flags = strtoul(strings[index++].c_str(), NULL,10); | 3283 | U32 access_flags = strtoul(strings[index++].c_str(), NULL,10); |
3284 | S32 num_allowed_agents = strtol(strings[index++].c_str(), NULL, 10); | 3284 | S32 num_allowed_agents = strtol(strings[index++].c_str(), NULL, 10); |
3285 | S32 num_allowed_groups = strtol(strings[index++].c_str(), NULL, 10); | 3285 | S32 num_allowed_groups = strtol(strings[index++].c_str(), NULL, 10); |
3286 | S32 num_banned_agents = strtol(strings[index++].c_str(), NULL, 10); | 3286 | S32 num_banned_agents = strtol(strings[index++].c_str(), NULL, 10); |
3287 | S32 num_estate_managers = strtol(strings[index++].c_str(), NULL, 10); | 3287 | S32 num_estate_managers = strtol(strings[index++].c_str(), NULL, 10); |
3288 | 3288 | ||
3289 | // sanity ckecks | 3289 | // sanity ckecks |
3290 | if (num_allowed_agents > 0 | 3290 | if (num_allowed_agents > 0 |
3291 | && !(access_flags & ESTATE_ACCESS_ALLOWED_AGENTS)) | 3291 | && !(access_flags & ESTATE_ACCESS_ALLOWED_AGENTS)) |
3292 | { | 3292 | { |
3293 | llwarns << "non-zero count for allowed agents, but no corresponding flag" << llendl; | 3293 | llwarns << "non-zero count for allowed agents, but no corresponding flag" << llendl; |
3294 | } | 3294 | } |
3295 | if (num_allowed_groups > 0 | 3295 | if (num_allowed_groups > 0 |
3296 | && !(access_flags & ESTATE_ACCESS_ALLOWED_GROUPS)) | 3296 | && !(access_flags & ESTATE_ACCESS_ALLOWED_GROUPS)) |
3297 | { | 3297 | { |
3298 | llwarns << "non-zero count for allowed groups, but no corresponding flag" << llendl; | 3298 | llwarns << "non-zero count for allowed groups, but no corresponding flag" << llendl; |
3299 | } | 3299 | } |
3300 | if (num_banned_agents > 0 | 3300 | if (num_banned_agents > 0 |
3301 | && !(access_flags & ESTATE_ACCESS_BANNED_AGENTS)) | 3301 | && !(access_flags & ESTATE_ACCESS_BANNED_AGENTS)) |
3302 | { | 3302 | { |
3303 | llwarns << "non-zero count for banned agents, but no corresponding flag" << llendl; | 3303 | llwarns << "non-zero count for banned agents, but no corresponding flag" << llendl; |
3304 | } | 3304 | } |
3305 | if (num_estate_managers > 0 | 3305 | if (num_estate_managers > 0 |
3306 | && !(access_flags & ESTATE_ACCESS_MANAGERS)) | 3306 | && !(access_flags & ESTATE_ACCESS_MANAGERS)) |
3307 | { | 3307 | { |
3308 | llwarns << "non-zero count for managers, but no corresponding flag" << llendl; | 3308 | llwarns << "non-zero count for managers, but no corresponding flag" << llendl; |
3309 | } | 3309 | } |
3310 | 3310 | ||
3311 | // grab the UUID's out of the string fields | 3311 | // grab the UUID's out of the string fields |
3312 | if (access_flags & ESTATE_ACCESS_ALLOWED_AGENTS) | 3312 | if (access_flags & ESTATE_ACCESS_ALLOWED_AGENTS) |
3313 | { | 3313 | { |
3314 | LLNameListCtrl* allowed_agent_name_list; | 3314 | LLNameListCtrl* allowed_agent_name_list; |
3315 | allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list"); | 3315 | allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list"); |
3316 | 3316 | ||
3317 | int totalAllowedAgents = num_allowed_agents; | 3317 | int totalAllowedAgents = num_allowed_agents; |
3318 | 3318 | ||
3319 | if (allowed_agent_name_list) | 3319 | if (allowed_agent_name_list) |
3320 | { | 3320 | { |
3321 | totalAllowedAgents += allowed_agent_name_list->getItemCount(); | 3321 | totalAllowedAgents += allowed_agent_name_list->getItemCount(); |
3322 | } | 3322 | } |
3323 | 3323 | ||
3324 | std::string msg = llformat("Allowed residents: (%d, max %d)", | 3324 | std::string msg = llformat("Allowed residents: (%d, max %d)", |
3325 | totalAllowedAgents, | 3325 | totalAllowedAgents, |
3326 | ESTATE_MAX_ACCESS_IDS); | 3326 | ESTATE_MAX_ACCESS_IDS); |
3327 | panel->childSetValue("allow_resident_label", LLSD(msg)); | 3327 | panel->childSetValue("allow_resident_label", LLSD(msg)); |
3328 | 3328 | ||
3329 | if (allowed_agent_name_list) | 3329 | if (allowed_agent_name_list) |
3330 | { | 3330 | { |
3331 | //allowed_agent_name_list->deleteAllItems(); | 3331 | //allowed_agent_name_list->deleteAllItems(); |
3332 | for (S32 i = 0; i < num_allowed_agents && i < ESTATE_MAX_ACCESS_IDS; i++) | 3332 | for (S32 i = 0; i < num_allowed_agents && i < ESTATE_MAX_ACCESS_IDS; i++) |
3333 | { | 3333 | { |
3334 | LLUUID id; | 3334 | LLUUID id; |
3335 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ | 3335 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ |
3336 | allowed_agent_name_list->addNameItem(id); | 3336 | allowed_agent_name_list->addNameItem(id); |
3337 | } | 3337 | } |
3338 | panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE); | 3338 | panel->childSetEnabled("remove_allowed_avatar_btn", allowed_agent_name_list->getFirstSelected() ? TRUE : FALSE); |
3339 | allowed_agent_name_list->sortByColumnIndex(0, TRUE); | 3339 | allowed_agent_name_list->sortByColumnIndex(0, TRUE); |
3340 | } | 3340 | } |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | if (access_flags & ESTATE_ACCESS_ALLOWED_GROUPS) | 3343 | if (access_flags & ESTATE_ACCESS_ALLOWED_GROUPS) |
3344 | { | 3344 | { |
3345 | LLNameListCtrl* allowed_group_name_list; | 3345 | LLNameListCtrl* allowed_group_name_list; |
3346 | allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list"); | 3346 | allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list"); |
3347 | 3347 | ||
3348 | std::string msg = llformat("Allowed groups: (%d, max %d)", | 3348 | std::string msg = llformat("Allowed groups: (%d, max %d)", |
3349 | num_allowed_groups, | 3349 | num_allowed_groups, |
3350 | (S32) ESTATE_MAX_GROUP_IDS); | 3350 | (S32) ESTATE_MAX_GROUP_IDS); |
3351 | panel->childSetValue("allow_group_label", LLSD(msg)); | 3351 | panel->childSetValue("allow_group_label", LLSD(msg)); |
3352 | 3352 | ||
3353 | if (allowed_group_name_list) | 3353 | if (allowed_group_name_list) |
3354 | { | 3354 | { |
3355 | allowed_group_name_list->deleteAllItems(); | 3355 | allowed_group_name_list->deleteAllItems(); |
3356 | for (S32 i = 0; i < num_allowed_groups && i < ESTATE_MAX_GROUP_IDS; i++) | 3356 | for (S32 i = 0; i < num_allowed_groups && i < ESTATE_MAX_GROUP_IDS; i++) |
3357 | { | 3357 | { |
3358 | LLUUID id; | 3358 | LLUUID id; |
3359 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ | 3359 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ |
3360 | allowed_group_name_list->addGroupNameItem(id); | 3360 | allowed_group_name_list->addGroupNameItem(id); |
3361 | } | 3361 | } |
3362 | panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE); | 3362 | panel->childSetEnabled("remove_allowed_group_btn", allowed_group_name_list->getFirstSelected() ? TRUE : FALSE); |
3363 | allowed_group_name_list->sortByColumnIndex(0, TRUE); | 3363 | allowed_group_name_list->sortByColumnIndex(0, TRUE); |
3364 | } | 3364 | } |
3365 | } | 3365 | } |
3366 | 3366 | ||
3367 | if (access_flags & ESTATE_ACCESS_BANNED_AGENTS) | 3367 | if (access_flags & ESTATE_ACCESS_BANNED_AGENTS) |
3368 | { | 3368 | { |
3369 | LLNameListCtrl* banned_agent_name_list; | 3369 | LLNameListCtrl* banned_agent_name_list; |
3370 | banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list"); | 3370 | banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list"); |
3371 | 3371 | ||
3372 | int totalBannedAgents = num_banned_agents; | 3372 | int totalBannedAgents = num_banned_agents; |
3373 | 3373 | ||
3374 | if (banned_agent_name_list) | 3374 | if (banned_agent_name_list) |
3375 | { | 3375 | { |
3376 | totalBannedAgents += banned_agent_name_list->getItemCount(); | 3376 | totalBannedAgents += banned_agent_name_list->getItemCount(); |
3377 | } | 3377 | } |
3378 | 3378 | ||
3379 | 3379 | ||
3380 | std::string msg = llformat("Banned residents: (%d, max %d)", | 3380 | std::string msg = llformat("Banned residents: (%d, max %d)", |
3381 | totalBannedAgents, | 3381 | totalBannedAgents, |
3382 | ESTATE_MAX_ACCESS_IDS); | 3382 | ESTATE_MAX_ACCESS_IDS); |
3383 | panel->childSetValue("ban_resident_label", LLSD(msg)); | 3383 | panel->childSetValue("ban_resident_label", LLSD(msg)); |
3384 | 3384 | ||
3385 | if (banned_agent_name_list) | 3385 | if (banned_agent_name_list) |
3386 | { | 3386 | { |
3387 | //banned_agent_name_list->deleteAllItems(); | 3387 | //banned_agent_name_list->deleteAllItems(); |
3388 | for (S32 i = 0; i < num_banned_agents && i < ESTATE_MAX_ACCESS_IDS; i++) | 3388 | for (S32 i = 0; i < num_banned_agents && i < ESTATE_MAX_ACCESS_IDS; i++) |
3389 | { | 3389 | { |
3390 | LLUUID id; | 3390 | LLUUID id; |
3391 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ | 3391 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ |
3392 | banned_agent_name_list->addNameItem(id); | 3392 | banned_agent_name_list->addNameItem(id); |
3393 | } | 3393 | } |
3394 | panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE); | 3394 | panel->childSetEnabled("remove_banned_avatar_btn", banned_agent_name_list->getFirstSelected() ? TRUE : FALSE); |
3395 | banned_agent_name_list->sortByColumnIndex(0, TRUE); | 3395 | banned_agent_name_list->sortByColumnIndex(0, TRUE); |
3396 | } | 3396 | } |
3397 | } | 3397 | } |
3398 | 3398 | ||
3399 | if (access_flags & ESTATE_ACCESS_MANAGERS) | 3399 | if (access_flags & ESTATE_ACCESS_MANAGERS) |
3400 | { | 3400 | { |
3401 | std::string msg = llformat("Estate Managers: (%d, max %d)", | 3401 | std::string msg = llformat("Estate Managers: (%d, max %d)", |
3402 | num_estate_managers, | 3402 | num_estate_managers, |
3403 | ESTATE_MAX_MANAGERS); | 3403 | ESTATE_MAX_MANAGERS); |
3404 | panel->childSetValue("estate_manager_label", LLSD(msg)); | 3404 | panel->childSetValue("estate_manager_label", LLSD(msg)); |
3405 | 3405 | ||
3406 | LLNameListCtrl* estate_manager_name_list = | 3406 | LLNameListCtrl* estate_manager_name_list = |
3407 | panel->getChild<LLNameListCtrl>("estate_manager_name_list"); | 3407 | panel->getChild<LLNameListCtrl>("estate_manager_name_list"); |
3408 | if (estate_manager_name_list) | 3408 | if (estate_manager_name_list) |
3409 | { | 3409 | { |
3410 | estate_manager_name_list->deleteAllItems(); // Clear existing entries | 3410 | estate_manager_name_list->deleteAllItems(); // Clear existing entries |
3411 | 3411 | ||
3412 | // There should be only ESTATE_MAX_MANAGERS people in the list, but if the database gets more (SL-46107) don't | 3412 | // There should be only ESTATE_MAX_MANAGERS people in the list, but if the database gets more (SL-46107) don't |
3413 | // truncate the list unless it's really big. Go ahead and show the extras so the user doesn't get confused, | 3413 | // truncate the list unless it's really big. Go ahead and show the extras so the user doesn't get confused, |
3414 | // and they can still remove them. | 3414 | // and they can still remove them. |
3415 | for (S32 i = 0; i < num_estate_managers && i < (ESTATE_MAX_MANAGERS * 4); i++) | 3415 | for (S32 i = 0; i < num_estate_managers && i < (ESTATE_MAX_MANAGERS * 4); i++) |
3416 | { | 3416 | { |
3417 | LLUUID id; | 3417 | LLUUID id; |
3418 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ | 3418 | memcpy(id.mData, strings[index++].data(), UUID_BYTES); /* Flawfinder: ignore */ |
3419 | estate_manager_name_list->addNameItem(id); | 3419 | estate_manager_name_list->addNameItem(id); |
3420 | } | 3420 | } |
3421 | panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE); | 3421 | panel->childSetEnabled("remove_estate_manager_btn", estate_manager_name_list->getFirstSelected() ? TRUE : FALSE); |
3422 | estate_manager_name_list->sortByColumnIndex(0, TRUE); | 3422 | estate_manager_name_list->sortByColumnIndex(0, TRUE); |
3423 | } | 3423 | } |
3424 | } | 3424 | } |
3425 | 3425 | ||
3426 | return true; | 3426 | return true; |
3427 | } | 3427 | } |
3428 | 3428 | ||
3429 | // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | 3429 | // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) |
3430 | void LLFloaterRegionInfo::open() | 3430 | void LLFloaterRegionInfo::open() |
3431 | { | 3431 | { |
3432 | // We'll allow access to the estate tools for estate managers (and for the sim owner) | 3432 | // We'll allow access to the estate tools for estate managers (and for the sim owner) |
3433 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) | 3433 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) |
3434 | { | 3434 | { |
3435 | LLViewerRegion* pRegion = gAgent.getRegion(); | 3435 | LLViewerRegion* pRegion = gAgent.getRegion(); |
3436 | if (!pRegion) | 3436 | if (!pRegion) |
3437 | return; | 3437 | return; |
3438 | 3438 | ||
3439 | // Should be able to call LLRegion::canManageEstate() but then we can fake god like | 3439 | // Should be able to call LLRegion::canManageEstate() but then we can fake god like |
3440 | if ( (!pRegion->isEstateManager()) && (pRegion->getOwner() != gAgent.getID()) ) | 3440 | if ( (!pRegion->isEstateManager()) && (pRegion->getOwner() != gAgent.getID()) ) |
3441 | return; | 3441 | return; |
3442 | } | 3442 | } |
3443 | 3443 | ||
3444 | LLFloater::open(); | 3444 | LLFloater::open(); |
3445 | } | 3445 | } |
3446 | // [/RLVa:KB] | 3446 | // [/RLVa:KB] |