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