diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloaterland.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterland.cpp | 3233 |
1 files changed, 3233 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterland.cpp b/linden/indra/newview/llfloaterland.cpp new file mode 100644 index 0000000..22686fb --- /dev/null +++ b/linden/indra/newview/llfloaterland.cpp | |||
@@ -0,0 +1,3233 @@ | |||
1 | /** | ||
2 | * @file llfloaterland.cpp | ||
3 | * @brief "About Land" floater, allowing display and editing of land parcel properties. | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include <sstream> | ||
31 | #include <time.h> | ||
32 | |||
33 | #include "llfloaterland.h" | ||
34 | |||
35 | #include "llcachename.h" | ||
36 | #include "llfocusmgr.h" | ||
37 | #include "llparcel.h" | ||
38 | #include "message.h" | ||
39 | |||
40 | #include "llagent.h" | ||
41 | #include "llfloateravatarpicker.h" | ||
42 | #include "llbutton.h" | ||
43 | #include "llcheckboxctrl.h" | ||
44 | #include "llcombobox.h" | ||
45 | #include "llfloaterauction.h" | ||
46 | #include "llfloateravatarinfo.h" | ||
47 | #include "llfloatergroups.h" | ||
48 | #include "llfloatergroupinfo.h" | ||
49 | #include "lllineeditor.h" | ||
50 | #include "llnamelistctrl.h" | ||
51 | #include "llnotify.h" | ||
52 | #include "llradiogroup.h" | ||
53 | #include "llscrolllistctrl.h" | ||
54 | #include "llselectmgr.h" | ||
55 | #include "llspinctrl.h" | ||
56 | #include "lltabcontainer.h" | ||
57 | #include "lltextbox.h" | ||
58 | #include "lltexturectrl.h" | ||
59 | #include "lluiconstants.h" | ||
60 | #include "llvieweruictrlfactory.h" | ||
61 | #include "llviewermessage.h" | ||
62 | #include "llviewerparcelmgr.h" | ||
63 | #include "llviewerregion.h" | ||
64 | #include "llviewerstats.h" | ||
65 | #include "llviewertexteditor.h" | ||
66 | #include "llviewerwindow.h" | ||
67 | #include "llmediaengine.h" | ||
68 | #include "llviewercontrol.h" | ||
69 | #include "roles_constants.h" | ||
70 | |||
71 | static const S32 EDIT_HEIGHT = 16; | ||
72 | static const S32 LEFT = HPAD; | ||
73 | static const S32 BOTTOM = VPAD; | ||
74 | static const S32 RULER0 = LEFT; | ||
75 | static const S32 RULER05 = RULER0 + 24; | ||
76 | static const S32 RULER1 = RULER05 + 16; | ||
77 | static const S32 RULER15 = RULER1 + 20; | ||
78 | static const S32 RULER2 = RULER1 + 32; | ||
79 | static const S32 RULER205= RULER2 + 32; | ||
80 | static const S32 RULER20 = RULER2 + 64; | ||
81 | static const S32 RULER21 = RULER20 + 16; | ||
82 | static const S32 RULER22 = RULER21 + 32; | ||
83 | static const S32 RULER225 = RULER20 + 64; | ||
84 | static const S32 RULER23 = RULER22 + 64; | ||
85 | static const S32 RULER24 = RULER23 + 26; | ||
86 | static const S32 RULER3 = RULER2 + 102; | ||
87 | static const S32 RULER4 = RULER3 + 8; | ||
88 | static const S32 RULER5 = RULER4 + 50; | ||
89 | static const S32 RULER6 = RULER5 + 52; | ||
90 | static const S32 RULER7 = RULER6 + 24; | ||
91 | static const S32 RIGHT = LEFT + 278; | ||
92 | static const S32 FAR_RIGHT = LEFT + 324 + 40; | ||
93 | |||
94 | static const char PRICE[] = "Price:"; | ||
95 | static const char NO_PRICE[] = ""; | ||
96 | static const char AREA[] = "Area:"; | ||
97 | |||
98 | static const char OWNER_ONLINE[] = "0"; | ||
99 | static const char OWNER_OFFLINE[] = "1"; | ||
100 | static const char OWNER_GROUP[] = "2"; | ||
101 | |||
102 | static const char NEED_TIER_TO_MODIFY_STRING[] = "You must approve your purchase to modify this land."; | ||
103 | |||
104 | static const char WEB_PAGE[] = "Web page"; | ||
105 | static const char QUICKTIME_MOVIE[] = "QuickTime movie"; | ||
106 | static const char RAW_HTML[] = "Raw HTML"; | ||
107 | |||
108 | // constants used in callbacks below - syntactic sugar. | ||
109 | static const BOOL BUY_GROUP_LAND = TRUE; | ||
110 | static const BOOL BUY_PERSONAL_LAND = FALSE; | ||
111 | |||
112 | // Statics | ||
113 | LLFloaterLand* LLFloaterLand::sInstance = NULL; | ||
114 | LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL; | ||
115 | S32 LLFloaterLand::sLastTab = 0; | ||
116 | BOOL LLFloaterLand::sRequestReplyOnUpdate = TRUE; | ||
117 | LLViewHandle LLPanelLandGeneral::sBuyPassDialogHandle; | ||
118 | |||
119 | // Local classes | ||
120 | class LLParcelSelectionObserver : public LLParcelObserver | ||
121 | { | ||
122 | public: | ||
123 | virtual void changed() { LLFloaterLand::refreshAll(); } | ||
124 | }; | ||
125 | |||
126 | //--------------------------------------------------------------------------- | ||
127 | // LLFloaterLand | ||
128 | //--------------------------------------------------------------------------- | ||
129 | |||
130 | void send_parcel_select_objects(S32 parcel_local_id, S32 return_type, | ||
131 | uuid_list_t* return_ids = NULL) | ||
132 | { | ||
133 | LLMessageSystem *msg = gMessageSystem; | ||
134 | |||
135 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
136 | if (!region) return; | ||
137 | |||
138 | // Since new highlight will be coming in, drop any highlights | ||
139 | // that exist right now. | ||
140 | gSelectMgr->unhighlightAll(); | ||
141 | |||
142 | msg->newMessageFast(_PREHASH_ParcelSelectObjects); | ||
143 | msg->nextBlockFast(_PREHASH_AgentData); | ||
144 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
145 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); | ||
146 | msg->nextBlockFast(_PREHASH_ParcelData); | ||
147 | msg->addS32Fast(_PREHASH_LocalID, parcel_local_id); | ||
148 | msg->addS32Fast(_PREHASH_ReturnType, return_type); | ||
149 | |||
150 | // Throw all return ids into the packet. | ||
151 | // TODO: Check for too many ids. | ||
152 | if (return_ids) | ||
153 | { | ||
154 | uuid_list_t::iterator end = return_ids->end(); | ||
155 | for (uuid_list_t::iterator it = return_ids->begin(); | ||
156 | it != end; | ||
157 | ++it) | ||
158 | { | ||
159 | msg->nextBlockFast(_PREHASH_ReturnIDs); | ||
160 | msg->addUUIDFast(_PREHASH_ReturnID, (*it)); | ||
161 | } | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | // Put in a null key so that the message is complete. | ||
166 | msg->nextBlockFast(_PREHASH_ReturnIDs); | ||
167 | msg->addUUIDFast(_PREHASH_ReturnID, LLUUID::null); | ||
168 | } | ||
169 | |||
170 | msg->sendReliable(region->getHost()); | ||
171 | } | ||
172 | |||
173 | |||
174 | // static | ||
175 | void LLFloaterLand::show() | ||
176 | { | ||
177 | if (!sInstance) | ||
178 | { | ||
179 | sInstance = new LLFloaterLand(); | ||
180 | |||
181 | // Select tab from last view | ||
182 | sInstance->mTabLand->selectTab(sLastTab); | ||
183 | |||
184 | sObserver = new LLParcelSelectionObserver(); | ||
185 | gParcelMgr->addObserver( sObserver ); | ||
186 | } | ||
187 | |||
188 | sInstance->open(); | ||
189 | |||
190 | // Done automatically when the selected parcel's properties arrive | ||
191 | // (and hence we have the local id). | ||
192 | // gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER); | ||
193 | |||
194 | // If we've already got the parcel data, fill the | ||
195 | // floater with it. | ||
196 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
197 | if (parcel) | ||
198 | { | ||
199 | sInstance->refresh(); | ||
200 | } | ||
201 | |||
202 | sRequestReplyOnUpdate = TRUE; | ||
203 | } | ||
204 | |||
205 | //static | ||
206 | LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects() | ||
207 | { | ||
208 | if (!sInstance) | ||
209 | { | ||
210 | return NULL; | ||
211 | } | ||
212 | |||
213 | return sInstance->mPanelObjects; | ||
214 | } | ||
215 | |||
216 | //static | ||
217 | LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant() | ||
218 | { | ||
219 | if (!sInstance) | ||
220 | { | ||
221 | return NULL; | ||
222 | } | ||
223 | |||
224 | return sInstance->mPanelCovenant; | ||
225 | } | ||
226 | |||
227 | // static | ||
228 | void LLFloaterLand::refreshAll() | ||
229 | { | ||
230 | if (sInstance) | ||
231 | { | ||
232 | sInstance->refresh(); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | |||
237 | // virtual | ||
238 | BOOL LLFloaterLand::canClose() | ||
239 | { | ||
240 | // canClose is checked as the first step of attempting to close | ||
241 | // the window, before focus is released from controls. Since we're | ||
242 | // closing the window and deselecting the land, we | ||
243 | // don't want replies to the upstream messages that get sent | ||
244 | // (because the reply will cause the land to be selected again). | ||
245 | sRequestReplyOnUpdate = FALSE; | ||
246 | return TRUE; | ||
247 | } | ||
248 | |||
249 | // virtual | ||
250 | void LLFloaterLand::onClose(bool app_quitting) | ||
251 | { | ||
252 | gParcelMgr->removeObserver( sObserver ); | ||
253 | delete sObserver; | ||
254 | sObserver = NULL; | ||
255 | |||
256 | // Must do this after removing observer, otherwise | ||
257 | // infinite loops notifying and closing. | ||
258 | gParcelMgr->deselectLand(); | ||
259 | |||
260 | // Might have been showing owned objects | ||
261 | gSelectMgr->unhighlightAll(); | ||
262 | |||
263 | // Save which panel we had open | ||
264 | sLastTab = mTabLand->getCurrentPanelIndex(); | ||
265 | |||
266 | destroy(); | ||
267 | } | ||
268 | |||
269 | |||
270 | LLFloaterLand::LLFloaterLand() | ||
271 | : LLFloater("floaterland", "FloaterLandRect5", "About Land") | ||
272 | { | ||
273 | |||
274 | |||
275 | std::map<LLString, LLCallbackMap> factory_map; | ||
276 | factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); | ||
277 | |||
278 | |||
279 | factory_map["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); | ||
280 | factory_map["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); | ||
281 | factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); | ||
282 | factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); | ||
283 | factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); | ||
284 | factory_map["land_ban_panel"] = LLCallbackMap(createPanelLandBan, this); | ||
285 | |||
286 | gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); | ||
287 | |||
288 | |||
289 | LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab"); | ||
290 | |||
291 | mTabLand = (LLTabContainer*) tab; | ||
292 | |||
293 | |||
294 | if (tab) | ||
295 | { | ||
296 | tab->selectTab(sLastTab); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | |||
301 | // virtual | ||
302 | LLFloaterLand::~LLFloaterLand() | ||
303 | { | ||
304 | sInstance = NULL; | ||
305 | } | ||
306 | |||
307 | |||
308 | // public | ||
309 | void LLFloaterLand::refresh() | ||
310 | { | ||
311 | mPanelGeneral->refresh(); | ||
312 | mPanelObjects->refresh(); | ||
313 | mPanelOptions->refresh(); | ||
314 | mPanelMedia->refresh(); | ||
315 | mPanelAccess->refresh(); | ||
316 | mPanelBan->refresh(); | ||
317 | } | ||
318 | |||
319 | |||
320 | |||
321 | void* LLFloaterLand::createPanelLandGeneral(void* data) | ||
322 | { | ||
323 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
324 | self->mPanelGeneral = new LLPanelLandGeneral(); | ||
325 | return self->mPanelGeneral; | ||
326 | } | ||
327 | |||
328 | // static | ||
329 | |||
330 | |||
331 | void* LLFloaterLand::createPanelLandCovenant(void* data) | ||
332 | { | ||
333 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
334 | self->mPanelCovenant = new LLPanelLandCovenant(); | ||
335 | return self->mPanelCovenant; | ||
336 | } | ||
337 | |||
338 | |||
339 | // static | ||
340 | void* LLFloaterLand::createPanelLandObjects(void* data) | ||
341 | { | ||
342 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
343 | self->mPanelObjects = new LLPanelLandObjects(); | ||
344 | return self->mPanelObjects; | ||
345 | } | ||
346 | |||
347 | // static | ||
348 | void* LLFloaterLand::createPanelLandOptions(void* data) | ||
349 | { | ||
350 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
351 | self->mPanelOptions = new LLPanelLandOptions(); | ||
352 | return self->mPanelOptions; | ||
353 | } | ||
354 | |||
355 | // static | ||
356 | void* LLFloaterLand::createPanelLandMedia(void* data) | ||
357 | { | ||
358 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
359 | self->mPanelMedia = new LLPanelLandMedia(); | ||
360 | return self->mPanelMedia; | ||
361 | } | ||
362 | |||
363 | // static | ||
364 | void* LLFloaterLand::createPanelLandAccess(void* data) | ||
365 | { | ||
366 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
367 | self->mPanelAccess = new LLPanelLandAccess(); | ||
368 | return self->mPanelAccess; | ||
369 | } | ||
370 | |||
371 | // static | ||
372 | void* LLFloaterLand::createPanelLandBan(void* data) | ||
373 | { | ||
374 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
375 | self->mPanelBan = new LLPanelLandBan(); | ||
376 | return self->mPanelBan; | ||
377 | } | ||
378 | |||
379 | |||
380 | //--------------------------------------------------------------------------- | ||
381 | // LLPanelLandGeneral | ||
382 | //--------------------------------------------------------------------------- | ||
383 | |||
384 | |||
385 | LLPanelLandGeneral::LLPanelLandGeneral() | ||
386 | : LLPanel("land_general_panel"), | ||
387 | mUncheckedSell(FALSE) | ||
388 | { | ||
389 | } | ||
390 | |||
391 | BOOL LLPanelLandGeneral::postBuild() | ||
392 | { | ||
393 | |||
394 | mEditName = LLUICtrlFactory::getLineEditorByName(this, "Name"); | ||
395 | mEditName->setCommitCallback(onCommitAny); | ||
396 | childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe); | ||
397 | childSetUserData("Name", this); | ||
398 | |||
399 | |||
400 | mEditDesc = LLUICtrlFactory::getLineEditorByName(this, "Description"); | ||
401 | mEditDesc->setCommitCallback(onCommitAny); | ||
402 | childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe); | ||
403 | childSetUserData("Description", this); | ||
404 | |||
405 | |||
406 | mTextSalePending = LLUICtrlFactory::getTextBoxByName(this, "SalePending"); | ||
407 | mTextOwnerLabel = LLUICtrlFactory::getTextBoxByName(this, "Owner:"); | ||
408 | mTextOwner = LLUICtrlFactory::getTextBoxByName(this, "OwnerText"); | ||
409 | |||
410 | |||
411 | mBtnProfile = LLUICtrlFactory::getButtonByName(this, "Profile..."); | ||
412 | mBtnProfile->setClickedCallback(onClickProfile, this); | ||
413 | |||
414 | |||
415 | mTextGroupLabel = LLUICtrlFactory::getTextBoxByName(this, "Group:"); | ||
416 | mTextGroup = LLUICtrlFactory::getTextBoxByName(this, "GroupText"); | ||
417 | |||
418 | |||
419 | mBtnSetGroup = LLUICtrlFactory::getButtonByName(this, "Set..."); | ||
420 | mBtnSetGroup->setClickedCallback(onClickSetGroup, this); | ||
421 | |||
422 | |||
423 | |||
424 | mCheckDeedToGroup = LLUICtrlFactory::getCheckBoxByName(this, "check deed"); | ||
425 | childSetCommitCallback("check deed", onCommitAny, this); | ||
426 | |||
427 | |||
428 | mBtnDeedToGroup = LLUICtrlFactory::getButtonByName(this, "Deed..."); | ||
429 | mBtnDeedToGroup->setClickedCallback(onClickDeed, this); | ||
430 | |||
431 | |||
432 | mCheckContributeWithDeed = LLUICtrlFactory::getCheckBoxByName(this, "check contib"); | ||
433 | childSetCommitCallback("check contib", onCommitAny, this); | ||
434 | |||
435 | |||
436 | |||
437 | mSaleInfoNotForSale = LLUICtrlFactory::getTextBoxByName(this, "Not for sale."); | ||
438 | |||
439 | mSaleInfoForSale1 = LLUICtrlFactory::getTextBoxByName(this, "For Sale: Price L$[PRICE]."); | ||
440 | |||
441 | |||
442 | mBtnSellLand = LLUICtrlFactory::getButtonByName(this, "Sell Land..."); | ||
443 | mBtnSellLand->setClickedCallback(onClickSellLand, this); | ||
444 | |||
445 | mSaleInfoForSale2 = LLUICtrlFactory::getTextBoxByName(this, "For sale to"); | ||
446 | |||
447 | mSaleInfoForSaleObjects = LLUICtrlFactory::getTextBoxByName(this, "Sell with landowners objects in parcel."); | ||
448 | |||
449 | mSaleInfoForSaleNoObjects = LLUICtrlFactory::getTextBoxByName(this, "Selling with no objects in parcel."); | ||
450 | |||
451 | |||
452 | mBtnStopSellLand = LLUICtrlFactory::getButtonByName(this, "Cancel Land Sale"); | ||
453 | mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this); | ||
454 | |||
455 | |||
456 | mTextClaimDateLabel = LLUICtrlFactory::getTextBoxByName(this, "Claimed:"); | ||
457 | mTextClaimDate = LLUICtrlFactory::getTextBoxByName(this, "DateClaimText"); | ||
458 | |||
459 | |||
460 | mTextPriceLabel = LLUICtrlFactory::getTextBoxByName(this, "PriceLabel"); | ||
461 | mTextPrice = LLUICtrlFactory::getTextBoxByName(this, "PriceText"); | ||
462 | |||
463 | |||
464 | mTextDwell = LLUICtrlFactory::getTextBoxByName(this, "DwellText"); | ||
465 | |||
466 | |||
467 | mBtnBuyLand = LLUICtrlFactory::getButtonByName(this, "Buy Land..."); | ||
468 | mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND); | ||
469 | |||
470 | mBtnBuyGroupLand = LLUICtrlFactory::getButtonByName(this, "Buy For Group..."); | ||
471 | mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND); | ||
472 | |||
473 | |||
474 | static BOOL deselect_when_done = FALSE; | ||
475 | mBtnBuyPass = LLUICtrlFactory::getButtonByName(this, "Buy Pass..."); | ||
476 | mBtnBuyPass->setClickedCallback(onClickBuyPass, &deselect_when_done); | ||
477 | |||
478 | mBtnReleaseLand = LLUICtrlFactory::getButtonByName(this, "Abandon Land..."); | ||
479 | mBtnReleaseLand->setClickedCallback(onClickRelease, NULL); | ||
480 | |||
481 | mBtnReclaimLand = LLUICtrlFactory::getButtonByName(this, "Reclaim Land..."); | ||
482 | mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL); | ||
483 | |||
484 | mBtnStartAuction = LLUICtrlFactory::getButtonByName(this, "Linden Sale..."); | ||
485 | mBtnStartAuction->setClickedCallback(onClickStartAuction, NULL); | ||
486 | |||
487 | return TRUE; | ||
488 | } | ||
489 | |||
490 | |||
491 | // virtual | ||
492 | LLPanelLandGeneral::~LLPanelLandGeneral() | ||
493 | { } | ||
494 | |||
495 | |||
496 | // public | ||
497 | void LLPanelLandGeneral::refresh() | ||
498 | { | ||
499 | mBtnStartAuction->setVisible(gAgent.isGodlike()); | ||
500 | |||
501 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
502 | bool region_owner = false; | ||
503 | LLViewerRegion* regionp = gParcelMgr->getSelectionRegion(); | ||
504 | if(regionp && (regionp->getOwner() == gAgent.getID())) | ||
505 | { | ||
506 | region_owner = true; | ||
507 | mBtnReleaseLand->setVisible(FALSE); | ||
508 | mBtnReclaimLand->setVisible(TRUE); | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | mBtnReleaseLand->setVisible(TRUE); | ||
513 | mBtnReclaimLand->setVisible(FALSE); | ||
514 | } | ||
515 | if (!parcel) | ||
516 | { | ||
517 | // nothing selected, disable panel | ||
518 | mEditName->setEnabled(FALSE); | ||
519 | mEditName->setText(""); | ||
520 | |||
521 | mEditDesc->setEnabled(FALSE); | ||
522 | mEditDesc->setText(""); | ||
523 | |||
524 | mTextSalePending->setText(""); | ||
525 | mTextSalePending->setEnabled(FALSE); | ||
526 | |||
527 | mBtnDeedToGroup->setEnabled(FALSE); | ||
528 | mBtnSetGroup->setEnabled(FALSE); | ||
529 | mBtnStartAuction->setEnabled(FALSE); | ||
530 | |||
531 | mCheckDeedToGroup ->set(FALSE); | ||
532 | mCheckDeedToGroup ->setEnabled(FALSE); | ||
533 | mCheckContributeWithDeed->set(FALSE); | ||
534 | mCheckContributeWithDeed->setEnabled(FALSE); | ||
535 | |||
536 | mTextOwner->setText(""); | ||
537 | mBtnProfile->setLabelSelected("Profile..."); | ||
538 | mBtnProfile->setLabelUnselected("Profile..."); | ||
539 | mBtnProfile->setEnabled(FALSE); | ||
540 | |||
541 | mTextClaimDate->setText(""); | ||
542 | mTextGroup->setText(""); | ||
543 | mTextPrice->setText(""); | ||
544 | |||
545 | mSaleInfoForSale1->setVisible(FALSE); | ||
546 | mSaleInfoForSale2->setVisible(FALSE); | ||
547 | mSaleInfoForSaleObjects->setVisible(FALSE); | ||
548 | mSaleInfoForSaleNoObjects->setVisible(FALSE); | ||
549 | mSaleInfoNotForSale->setVisible(FALSE); | ||
550 | mBtnSellLand->setVisible(FALSE); | ||
551 | mBtnStopSellLand->setVisible(FALSE); | ||
552 | |||
553 | mTextPriceLabel->setText(NO_PRICE); | ||
554 | mTextDwell->setText(""); | ||
555 | |||
556 | mBtnBuyLand->setEnabled(FALSE); | ||
557 | mBtnBuyGroupLand->setEnabled(FALSE); | ||
558 | mBtnReleaseLand->setEnabled(FALSE); | ||
559 | mBtnReclaimLand->setEnabled(FALSE); | ||
560 | mBtnBuyPass->setEnabled(FALSE); | ||
561 | } | ||
562 | else | ||
563 | { | ||
564 | // something selected, hooray! | ||
565 | BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus()); | ||
566 | BOOL region_xfer = FALSE; | ||
567 | if(regionp | ||
568 | && !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)) | ||
569 | { | ||
570 | region_xfer = TRUE; | ||
571 | } | ||
572 | |||
573 | // estate owner/manager cannot edit other parts of the parcel | ||
574 | BOOL estate_manager_sellable = !parcel->getAuctionID() | ||
575 | && gAgent.canManageEstate() | ||
576 | // estate manager/owner can only sell parcels owned by estate owner | ||
577 | && regionp | ||
578 | && (parcel->getOwnerID() == regionp->getOwner()); | ||
579 | BOOL owner_sellable = region_xfer && !parcel->getAuctionID() | ||
580 | && LLViewerParcelMgr::isParcelModifiableByAgent( | ||
581 | parcel, GP_LAND_SET_SALE_INFO); | ||
582 | BOOL can_be_sold = owner_sellable || estate_manager_sellable; | ||
583 | |||
584 | const LLUUID &owner_id = parcel->getOwnerID(); | ||
585 | BOOL is_public = parcel->isPublic(); | ||
586 | |||
587 | // Is it owned? | ||
588 | if (is_public) | ||
589 | { | ||
590 | mTextSalePending->setText(""); | ||
591 | mTextSalePending->setEnabled(FALSE); | ||
592 | mTextOwner->setText("(public)"); | ||
593 | mTextOwner->setEnabled(FALSE); | ||
594 | mBtnProfile->setEnabled(FALSE); | ||
595 | mTextClaimDate->setText(""); | ||
596 | mTextClaimDate->setEnabled(FALSE); | ||
597 | mTextGroup->setText("(none)"); | ||
598 | mTextGroup->setEnabled(FALSE); | ||
599 | mBtnStartAuction->setEnabled(FALSE); | ||
600 | } | ||
601 | else | ||
602 | { | ||
603 | if(!is_leased && (owner_id == gAgent.getID())) | ||
604 | { | ||
605 | mTextSalePending->setText(NEED_TIER_TO_MODIFY_STRING); | ||
606 | mTextSalePending->setEnabled(TRUE); | ||
607 | } | ||
608 | else if(parcel->getAuctionID()) | ||
609 | { | ||
610 | char auction_str[MAX_STRING]; | ||
611 | sprintf(auction_str, "Auction ID: %u", parcel->getAuctionID()); | ||
612 | mTextSalePending->setText(auction_str); | ||
613 | mTextSalePending->setEnabled(TRUE); | ||
614 | } | ||
615 | else | ||
616 | { | ||
617 | // not the owner, or it is leased | ||
618 | mTextSalePending->setText(""); | ||
619 | mTextSalePending->setEnabled(FALSE); | ||
620 | } | ||
621 | //refreshNames(); | ||
622 | mTextOwner->setEnabled(TRUE); | ||
623 | |||
624 | // We support both group and personal profiles | ||
625 | mBtnProfile->setEnabled(TRUE); | ||
626 | |||
627 | if (parcel->getGroupID().isNull()) | ||
628 | { | ||
629 | // Not group owned, so "Profile" | ||
630 | mBtnProfile->setLabelSelected("Profile..."); | ||
631 | mBtnProfile->setLabelUnselected("Profile..."); | ||
632 | |||
633 | mTextGroup->setText("(none)"); | ||
634 | mTextGroup->setEnabled(FALSE); | ||
635 | } | ||
636 | else | ||
637 | { | ||
638 | // Group owned, so "Info" | ||
639 | mBtnProfile->setLabelSelected("Info..."); | ||
640 | mBtnProfile->setLabelUnselected("Info..."); | ||
641 | |||
642 | //mTextGroup->setText("HIPPOS!");//parcel->getGroupName()); | ||
643 | mTextGroup->setEnabled(TRUE); | ||
644 | } | ||
645 | |||
646 | // Display claim date | ||
647 | time_t claim_date = parcel->getClaimDate(); | ||
648 | char time_buf[TIME_STR_LENGTH]; | ||
649 | mTextClaimDate->setText(formatted_time(claim_date, time_buf)); | ||
650 | mTextClaimDate->setEnabled(is_leased); | ||
651 | |||
652 | BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON) | ||
653 | && (owner_id == GOVERNOR_LINDEN_ID) | ||
654 | && (parcel->getAuctionID() == 0); | ||
655 | mBtnStartAuction->setEnabled(enable_auction); | ||
656 | } | ||
657 | |||
658 | // Display options | ||
659 | BOOL can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY); | ||
660 | mEditName->setEnabled(can_edit_identity); | ||
661 | mEditDesc->setEnabled(can_edit_identity); | ||
662 | |||
663 | BOOL can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS); | ||
664 | mBtnSetGroup->setEnabled(can_edit_agent_only && !parcel->getIsGroupOwned()); | ||
665 | |||
666 | const LLUUID& group_id = parcel->getGroupID(); | ||
667 | |||
668 | // Can only allow deeding if you own it and it's got a group. | ||
669 | BOOL enable_deed = (owner_id == gAgent.getID() | ||
670 | && group_id.notNull() | ||
671 | && gAgent.isInGroup(group_id)); | ||
672 | // You don't need special powers to allow your object to | ||
673 | // be deeded to the group. | ||
674 | mCheckDeedToGroup->setEnabled(enable_deed); | ||
675 | mCheckDeedToGroup->set( parcel->getAllowDeedToGroup() ); | ||
676 | mCheckContributeWithDeed->setEnabled(enable_deed && parcel->getAllowDeedToGroup()); | ||
677 | mCheckContributeWithDeed->set(parcel->getContributeWithDeed()); | ||
678 | |||
679 | // Actually doing the deeding requires you to have GP_LAND_DEED | ||
680 | // powers in the group. | ||
681 | BOOL can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED); | ||
682 | mBtnDeedToGroup->setEnabled( parcel->getAllowDeedToGroup() | ||
683 | && group_id.notNull() | ||
684 | && can_deed | ||
685 | && !parcel->getIsGroupOwned() | ||
686 | ); | ||
687 | |||
688 | mEditName->setText( parcel->getName() ); | ||
689 | mEditDesc->setText( parcel->getDesc() ); | ||
690 | |||
691 | BOOL for_sale = parcel->getForSale(); | ||
692 | |||
693 | mBtnSellLand->setVisible(FALSE); | ||
694 | mBtnStopSellLand->setVisible(FALSE); | ||
695 | |||
696 | if (for_sale) | ||
697 | { | ||
698 | mSaleInfoForSale1->setVisible(TRUE); | ||
699 | mSaleInfoForSale2->setVisible(TRUE); | ||
700 | if (parcel->getSellWithObjects()) | ||
701 | { | ||
702 | mSaleInfoForSaleObjects->setVisible(TRUE); | ||
703 | mSaleInfoForSaleNoObjects->setVisible(FALSE); | ||
704 | } | ||
705 | else | ||
706 | { | ||
707 | mSaleInfoForSaleObjects->setVisible(FALSE); | ||
708 | mSaleInfoForSaleNoObjects->setVisible(TRUE); | ||
709 | } | ||
710 | mSaleInfoNotForSale->setVisible(FALSE); | ||
711 | mSaleInfoForSale1->setTextArg("[PRICE]", llformat("%d", parcel->getSalePrice())); | ||
712 | if (can_be_sold) | ||
713 | { | ||
714 | mBtnStopSellLand->setVisible(TRUE); | ||
715 | } | ||
716 | } | ||
717 | else | ||
718 | { | ||
719 | mSaleInfoForSale1->setVisible(FALSE); | ||
720 | mSaleInfoForSale2->setVisible(FALSE); | ||
721 | mSaleInfoForSaleObjects->setVisible(FALSE); | ||
722 | mSaleInfoForSaleNoObjects->setVisible(FALSE); | ||
723 | mSaleInfoNotForSale->setVisible(TRUE); | ||
724 | if (can_be_sold) | ||
725 | { | ||
726 | mBtnSellLand->setVisible(TRUE); | ||
727 | } | ||
728 | } | ||
729 | |||
730 | refreshNames(); | ||
731 | |||
732 | mBtnBuyLand->setEnabled( | ||
733 | gParcelMgr->canAgentBuyParcel(parcel, false)); | ||
734 | mBtnBuyGroupLand->setEnabled( | ||
735 | gParcelMgr->canAgentBuyParcel(parcel, true)); | ||
736 | |||
737 | // show pricing information | ||
738 | char price[64]; | ||
739 | const char* label = NULL; | ||
740 | S32 area; | ||
741 | S32 claim_price; | ||
742 | S32 rent_price; | ||
743 | F32 dwell; | ||
744 | gParcelMgr->getDisplayInfo(&area, | ||
745 | &claim_price, | ||
746 | &rent_price, | ||
747 | &for_sale, | ||
748 | &dwell); | ||
749 | |||
750 | // Area | ||
751 | sprintf(price, "%d sq. m.", area); | ||
752 | label = AREA; | ||
753 | |||
754 | mTextPriceLabel->setText(label); | ||
755 | mTextPrice->setText(price); | ||
756 | |||
757 | sprintf(price, "%.0f", dwell); | ||
758 | mTextDwell->setText(price); | ||
759 | |||
760 | if(region_owner) | ||
761 | { | ||
762 | mBtnReclaimLand->setEnabled( | ||
763 | !is_public && (parcel->getOwnerID() != gAgent.getID())); | ||
764 | } | ||
765 | else | ||
766 | { | ||
767 | BOOL is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); | ||
768 | BOOL is_manager_release = (gAgent.canManageEstate() && | ||
769 | regionp && | ||
770 | (parcel->getOwnerID() != regionp->getOwner())); | ||
771 | BOOL can_release = is_owner_release || is_manager_release; | ||
772 | mBtnReleaseLand->setEnabled( can_release ); | ||
773 | } | ||
774 | |||
775 | BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST) && !gParcelMgr->isCollisionBanned();; | ||
776 | mBtnBuyPass->setEnabled(use_pass); | ||
777 | } | ||
778 | } | ||
779 | |||
780 | // public | ||
781 | void LLPanelLandGeneral::refreshNames() | ||
782 | { | ||
783 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
784 | if (!parcel) | ||
785 | { | ||
786 | mTextOwner->setText(""); | ||
787 | return; | ||
788 | } | ||
789 | |||
790 | char buffer[MAX_STRING]; | ||
791 | if (parcel->getIsGroupOwned()) | ||
792 | { | ||
793 | buffer[0] = '\0'; | ||
794 | strcat(buffer, "(Group Owned)"); | ||
795 | } | ||
796 | else | ||
797 | { | ||
798 | // Figure out the owner's name | ||
799 | char owner_first[MAX_STRING]; | ||
800 | char owner_last[MAX_STRING]; | ||
801 | gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last); | ||
802 | sprintf(buffer, "%s %s", owner_first, owner_last); | ||
803 | } | ||
804 | |||
805 | if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) | ||
806 | { | ||
807 | strcat(buffer, " (Sale Pending)"); | ||
808 | } | ||
809 | mTextOwner->setText(buffer); | ||
810 | |||
811 | if(!parcel->getGroupID().isNull()) | ||
812 | { | ||
813 | gCacheName->getGroupName(parcel->getGroupID(), buffer); | ||
814 | } | ||
815 | else | ||
816 | { | ||
817 | buffer[0] = '\0'; | ||
818 | } | ||
819 | mTextGroup->setText(buffer); | ||
820 | |||
821 | const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); | ||
822 | if(auth_buyer_id.notNull()) | ||
823 | { | ||
824 | LLString name; | ||
825 | char firstname[MAX_STRING]; | ||
826 | char lastname[MAX_STRING]; | ||
827 | gCacheName->getName(auth_buyer_id, firstname, lastname); | ||
828 | name.assign(firstname); | ||
829 | name.append(" "); | ||
830 | name.append(lastname); | ||
831 | |||
832 | mSaleInfoForSale2->setTextArg("[BUYER]", name); | ||
833 | } | ||
834 | else if(parcel->getReservedForNewbie()) | ||
835 | { | ||
836 | mSaleInfoForSale2->setTextArg("[BUYER]", childGetText("new users only")); | ||
837 | } | ||
838 | else | ||
839 | { | ||
840 | mSaleInfoForSale2->setTextArg("[BUYER]", childGetText("anyone")); | ||
841 | } | ||
842 | } | ||
843 | |||
844 | |||
845 | // virtual | ||
846 | void LLPanelLandGeneral::draw() | ||
847 | { | ||
848 | refreshNames(); | ||
849 | LLPanel::draw(); | ||
850 | } | ||
851 | |||
852 | // static | ||
853 | void LLPanelLandGeneral::onClickSetGroup(void* userdata) | ||
854 | { | ||
855 | LLFloaterGroups* fg; | ||
856 | fg = LLFloaterGroups::show(gAgent.getID(), LLFloaterGroups::CHOOSE_ONE); | ||
857 | fg->setOkCallback( cbGroupID, userdata ); | ||
858 | } | ||
859 | |||
860 | // static | ||
861 | void LLPanelLandGeneral::onClickProfile(void* data) | ||
862 | { | ||
863 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
864 | if (!parcel) return; | ||
865 | |||
866 | if (parcel->getIsGroupOwned()) | ||
867 | { | ||
868 | const LLUUID& group_id = parcel->getGroupID(); | ||
869 | LLFloaterGroupInfo::showFromUUID(group_id); | ||
870 | } | ||
871 | else | ||
872 | { | ||
873 | const LLUUID& avatar_id = parcel->getOwnerID(); | ||
874 | LLFloaterAvatarInfo::showFromObject(avatar_id); | ||
875 | } | ||
876 | } | ||
877 | |||
878 | // static | ||
879 | void LLPanelLandGeneral::cbGroupID(LLUUID group_id, void* userdata) | ||
880 | { | ||
881 | LLPanelLandGeneral* self = (LLPanelLandGeneral*)userdata; | ||
882 | self->setGroup(group_id); | ||
883 | } | ||
884 | |||
885 | // public | ||
886 | void LLPanelLandGeneral::setGroup(const LLUUID& group_id) | ||
887 | { | ||
888 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
889 | if (!parcel) return; | ||
890 | |||
891 | // Set parcel properties and send message | ||
892 | parcel->setGroupID(group_id); | ||
893 | //parcel->setGroupName(group_name); | ||
894 | //mTextGroup->setText(group_name); | ||
895 | |||
896 | // Send update | ||
897 | gParcelMgr->sendParcelPropertiesUpdate(parcel, LLFloaterLand::sRequestReplyOnUpdate); | ||
898 | |||
899 | // Update UI | ||
900 | refresh(); | ||
901 | } | ||
902 | |||
903 | // static | ||
904 | void LLPanelLandGeneral::onClickBuyLand(void* data) | ||
905 | { | ||
906 | BOOL* for_group = (BOOL*)data; | ||
907 | gParcelMgr->startBuyLand(*for_group); | ||
908 | } | ||
909 | |||
910 | BOOL LLPanelLandGeneral::enableDeedToGroup(void*) | ||
911 | { | ||
912 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
913 | return (parcel != NULL) && (parcel->getParcelFlag(PF_ALLOW_DEED_TO_GROUP)); | ||
914 | } | ||
915 | |||
916 | // static | ||
917 | void LLPanelLandGeneral::onClickDeed(void*) | ||
918 | { | ||
919 | //LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
920 | //if (parcel) | ||
921 | //{ | ||
922 | gParcelMgr->startDeedLandToGroup(); | ||
923 | //} | ||
924 | } | ||
925 | |||
926 | // static | ||
927 | void LLPanelLandGeneral::onClickRelease(void*) | ||
928 | { | ||
929 | gParcelMgr->startReleaseLand(); | ||
930 | } | ||
931 | |||
932 | // static | ||
933 | void LLPanelLandGeneral::onClickReclaim(void*) | ||
934 | { | ||
935 | lldebugs << "LLPanelLandGeneral::onClickReclaim()" << llendl; | ||
936 | gParcelMgr->reclaimParcel(); | ||
937 | } | ||
938 | |||
939 | // static | ||
940 | BOOL LLPanelLandGeneral::enableBuyPass(void*) | ||
941 | { | ||
942 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
943 | return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !gParcelMgr->isCollisionBanned()); | ||
944 | } | ||
945 | |||
946 | |||
947 | // static | ||
948 | void LLPanelLandGeneral::onClickBuyPass(void* deselect_when_done) | ||
949 | { | ||
950 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
951 | if (!parcel) return; | ||
952 | |||
953 | S32 pass_price = parcel->getPassPrice(); | ||
954 | const char* parcel_name = parcel->getName(); | ||
955 | F32 pass_hours = parcel->getPassHours(); | ||
956 | |||
957 | char cost[256], time[256]; | ||
958 | sprintf(cost, "%d", pass_price); | ||
959 | sprintf(time, "%.2f", pass_hours); | ||
960 | |||
961 | LLStringBase<char>::format_map_t args; | ||
962 | args["[COST]"] = cost; | ||
963 | args["[PARCEL_NAME]"] = parcel_name; | ||
964 | args["[TIME]"] = time; | ||
965 | |||
966 | sBuyPassDialogHandle = gViewerWindow->alertXml("LandBuyPass", args, cbBuyPass, deselect_when_done)->getHandle(); | ||
967 | } | ||
968 | |||
969 | // static | ||
970 | void LLPanelLandGeneral::onClickStartAuction(void*) | ||
971 | { | ||
972 | LLParcel* parcelp = gParcelMgr->getSelectedParcel(); | ||
973 | if(parcelp) | ||
974 | { | ||
975 | if(parcelp->getForSale()) | ||
976 | { | ||
977 | gViewerWindow->alertXml("CannotStartAuctionAlreadForSale"); | ||
978 | } | ||
979 | else | ||
980 | { | ||
981 | LLFloaterAuction::show(); | ||
982 | } | ||
983 | } | ||
984 | } | ||
985 | |||
986 | // static | ||
987 | void LLPanelLandGeneral::cbBuyPass(S32 option, void* data) | ||
988 | { | ||
989 | BOOL deselect_when_done = (BOOL)(intptr_t)data; | ||
990 | |||
991 | if (0 == option) | ||
992 | { | ||
993 | // User clicked OK | ||
994 | gParcelMgr->buyPass(); | ||
995 | } | ||
996 | |||
997 | if (deselect_when_done) | ||
998 | { | ||
999 | gParcelMgr->deselectLand(); | ||
1000 | } | ||
1001 | } | ||
1002 | |||
1003 | //static | ||
1004 | BOOL LLPanelLandGeneral::buyPassDialogVisible() | ||
1005 | { | ||
1006 | return LLFloater::getFloaterByHandle(sBuyPassDialogHandle) != NULL; | ||
1007 | } | ||
1008 | |||
1009 | // static | ||
1010 | void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata) | ||
1011 | { | ||
1012 | LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)userdata; | ||
1013 | |||
1014 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1015 | if (!parcel) | ||
1016 | { | ||
1017 | return; | ||
1018 | } | ||
1019 | |||
1020 | // Extract data from UI | ||
1021 | std::string name = panelp->mEditName->getText(); | ||
1022 | std::string desc = panelp->mEditDesc->getText(); | ||
1023 | |||
1024 | // Valid data from UI | ||
1025 | |||
1026 | // Stuff data into selected parcel | ||
1027 | parcel->setName(name.c_str()); | ||
1028 | parcel->setDesc(desc.c_str()); | ||
1029 | |||
1030 | BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get(); | ||
1031 | BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get(); | ||
1032 | |||
1033 | parcel->setParcelFlag(PF_ALLOW_DEED_TO_GROUP, allow_deed_to_group); | ||
1034 | parcel->setContributeWithDeed(contribute_with_deed); | ||
1035 | |||
1036 | // Send update to server | ||
1037 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
1038 | |||
1039 | // Might have changed properties, so let's redraw! | ||
1040 | panelp->refresh(); | ||
1041 | } | ||
1042 | |||
1043 | // static | ||
1044 | void LLPanelLandGeneral::onClickSellLand(void* data) | ||
1045 | { | ||
1046 | gParcelMgr->startSellLand(); | ||
1047 | } | ||
1048 | |||
1049 | // static | ||
1050 | void LLPanelLandGeneral::onClickStopSellLand(void* data) | ||
1051 | { | ||
1052 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1053 | |||
1054 | parcel->setParcelFlag(PF_FOR_SALE, FALSE); | ||
1055 | parcel->setSalePrice(0); | ||
1056 | parcel->setAuthorizedBuyerID(LLUUID::null); | ||
1057 | |||
1058 | gParcelMgr->sendParcelPropertiesUpdate(parcel, LLFloaterLand::sRequestReplyOnUpdate); | ||
1059 | } | ||
1060 | |||
1061 | //--------------------------------------------------------------------------- | ||
1062 | // LLPanelLandObjects | ||
1063 | //--------------------------------------------------------------------------- | ||
1064 | LLPanelLandObjects::LLPanelLandObjects() | ||
1065 | : LLPanel("land_objects_panel") | ||
1066 | { | ||
1067 | } | ||
1068 | |||
1069 | |||
1070 | |||
1071 | BOOL LLPanelLandObjects::postBuild() | ||
1072 | { | ||
1073 | |||
1074 | mFirstReply = TRUE; | ||
1075 | mParcelObjectBonus = LLUICtrlFactory::getTextBoxByName(this, "Simulator Primitive Bonus Factor: 1.00"); | ||
1076 | |||
1077 | mSWTotalObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Simulator primitive usage:"); | ||
1078 | mSWTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "0 out of 0 available"); | ||
1079 | |||
1080 | mObjectContributionLabel = LLUICtrlFactory::getTextBoxByName(this, "Primitives parcel supports:"); | ||
1081 | mObjectContribution = LLUICtrlFactory::getTextBoxByName(this, "object_contrib_text"); | ||
1082 | |||
1083 | |||
1084 | mTotalObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Primitives on parcel:"); | ||
1085 | mTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "total_objects_text"); | ||
1086 | |||
1087 | |||
1088 | mOwnerObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Owned by parcel owner:"); | ||
1089 | mOwnerObjects = LLUICtrlFactory::getTextBoxByName(this, "owner_objects_text"); | ||
1090 | |||
1091 | |||
1092 | mBtnShowOwnerObjects = LLUICtrlFactory::getButtonByName(this, "ShowOwner"); | ||
1093 | mBtnShowOwnerObjects->setClickedCallback(onClickShowOwnerObjects, this); | ||
1094 | |||
1095 | mBtnReturnOwnerObjects = LLUICtrlFactory::getButtonByName(this, "ReturnOwner..."); | ||
1096 | mBtnReturnOwnerObjects->setClickedCallback(onClickReturnOwnerObjects, this); | ||
1097 | |||
1098 | |||
1099 | mGroupObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Set to group:"); | ||
1100 | mGroupObjects = LLUICtrlFactory::getTextBoxByName(this, "group_objects_text"); | ||
1101 | |||
1102 | |||
1103 | mBtnShowGroupObjects = LLUICtrlFactory::getButtonByName(this, "ShowGroup"); | ||
1104 | mBtnShowGroupObjects->setClickedCallback(onClickShowGroupObjects, this); | ||
1105 | |||
1106 | mBtnReturnGroupObjects = LLUICtrlFactory::getButtonByName(this, "ReturnGroup..."); | ||
1107 | mBtnReturnGroupObjects->setClickedCallback(onClickReturnGroupObjects, this); | ||
1108 | |||
1109 | |||
1110 | mOtherObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Owned by others:"); | ||
1111 | mOtherObjects = LLUICtrlFactory::getTextBoxByName(this, "other_objects_text"); | ||
1112 | |||
1113 | mBtnShowOtherObjects = LLUICtrlFactory::getButtonByName(this, "ShowOther"); | ||
1114 | mBtnShowOtherObjects->setClickedCallback(onClickShowOtherObjects, this); | ||
1115 | |||
1116 | mBtnReturnOtherObjects = LLUICtrlFactory::getButtonByName(this, "ReturnOther..."); | ||
1117 | mBtnReturnOtherObjects->setClickedCallback(onClickReturnOtherObjects, this); | ||
1118 | |||
1119 | mSelectedObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Selected / sat upon:"); | ||
1120 | mSelectedObjects = LLUICtrlFactory::getTextBoxByName(this, "selected_objects_text"); | ||
1121 | |||
1122 | mCleanOtherObjectsLabel = LLUICtrlFactory::getTextBoxByName(this, "Autoreturn other resident's objects (minutes, 0 for off):"); | ||
1123 | |||
1124 | mCleanOtherObjectsTime = LLUICtrlFactory::getLineEditorByName(this, "clean other time"); | ||
1125 | mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus); | ||
1126 | childSetPrevalidate("clean other time", LLLineEditor::prevalidatePrintableNotPipe); | ||
1127 | childSetUserData("clean other time", this); | ||
1128 | |||
1129 | mOwnerListText = LLUICtrlFactory::getTextBoxByName(this, "Object Owners:"); | ||
1130 | |||
1131 | |||
1132 | mBtnRefresh = LLUICtrlFactory::getButtonByName(this, "Refresh List"); | ||
1133 | mBtnRefresh->setClickedCallback(onClickRefresh, this); | ||
1134 | |||
1135 | |||
1136 | mBtnReturnOwnerList = LLUICtrlFactory::getButtonByName(this, "Return objects..."); | ||
1137 | mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this); | ||
1138 | |||
1139 | LLUUID image_id; | ||
1140 | |||
1141 | image_id.set( gViewerArt.getString("icon_avatar_online.tga") ); | ||
1142 | mIconAvatarOnline = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); | ||
1143 | |||
1144 | image_id.set( gViewerArt.getString("icon_avatar_offline.tga") ); | ||
1145 | mIconAvatarOffline = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); | ||
1146 | |||
1147 | image_id.set( gViewerArt.getString("icon_group.tga") ); | ||
1148 | mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); | ||
1149 | |||
1150 | mCurrentSortColumn = 3; // sort by number of objects by default. | ||
1151 | mCurrentSortAscending = FALSE; | ||
1152 | |||
1153 | // Column widths for various columns | ||
1154 | const S32 SORTER_WIDTH = 308; | ||
1155 | const S32 DESC_BTN_WIDTH = 64; | ||
1156 | const S32 ICON_WIDTH = 24; | ||
1157 | mColWidth[0] = ICON_WIDTH; // type icon | ||
1158 | mColWidth[1] = -1; // hidden type code | ||
1159 | mColWidth[2] = SORTER_WIDTH - mColWidth[0] - DESC_BTN_WIDTH; | ||
1160 | mColWidth[3] = DESC_BTN_WIDTH; // info | ||
1161 | mColWidth[4] = -1; // type data 1 | ||
1162 | mColWidth[5] = -1; | ||
1163 | mColWidth[6] = -1; // type data 3 | ||
1164 | mColWidth[7] = -1; // type data 4 | ||
1165 | mColWidth[8] = -1; // type data 5 | ||
1166 | |||
1167 | // Adjust description for other widths | ||
1168 | S32 sum = 0; | ||
1169 | for (S32 i = 0; i < 8; i++) | ||
1170 | { | ||
1171 | if (mColWidth[i] > 0) | ||
1172 | { | ||
1173 | sum += mColWidth[i]; | ||
1174 | } | ||
1175 | } | ||
1176 | mColWidth[8] = mRect.getWidth() - HPAD - sum - HPAD - HPAD; | ||
1177 | |||
1178 | mBtnType = LLUICtrlFactory::getButtonByName(this, "Type"); | ||
1179 | mBtnType->setClickedCallback(onClickType, this); | ||
1180 | |||
1181 | mBtnName = LLUICtrlFactory::getButtonByName(this, "Name"); | ||
1182 | mBtnName->setClickedCallback(onClickName, this); | ||
1183 | |||
1184 | mBtnDescription = LLUICtrlFactory::getButtonByName(this, "Count"); | ||
1185 | mBtnDescription->setClickedCallback(onClickDesc, this); | ||
1186 | |||
1187 | mOwnerList = LLUICtrlFactory::getNameListByName(this, "owner list"); | ||
1188 | childSetCommitCallback("owner list", onCommitList, this); | ||
1189 | mOwnerList->setDoubleClickCallback(onDoubleClickOwner); | ||
1190 | |||
1191 | return TRUE; | ||
1192 | } | ||
1193 | |||
1194 | |||
1195 | |||
1196 | |||
1197 | // virtual | ||
1198 | LLPanelLandObjects::~LLPanelLandObjects() | ||
1199 | { } | ||
1200 | |||
1201 | // static | ||
1202 | void LLPanelLandObjects::onDoubleClickOwner(void *userdata) | ||
1203 | { | ||
1204 | LLPanelLandObjects *self = (LLPanelLandObjects *)userdata; | ||
1205 | |||
1206 | LLScrollListItem* item = self->mOwnerList->getFirstSelected(); | ||
1207 | if (item) | ||
1208 | { | ||
1209 | LLUUID owner_id = item->getUUID(); | ||
1210 | // Look up the selected name, for future dialog box use. | ||
1211 | const LLScrollListCell* cell; | ||
1212 | cell = item->getColumn(1); | ||
1213 | if (!cell) | ||
1214 | { | ||
1215 | return; | ||
1216 | } | ||
1217 | // Is this a group? | ||
1218 | BOOL is_group = cell->getText() == OWNER_GROUP; | ||
1219 | if (is_group) | ||
1220 | { | ||
1221 | LLFloaterGroupInfo::showFromUUID(owner_id); | ||
1222 | } | ||
1223 | else | ||
1224 | { | ||
1225 | LLFloaterAvatarInfo::showFromDirectory(owner_id); | ||
1226 | } | ||
1227 | } | ||
1228 | } | ||
1229 | |||
1230 | // public | ||
1231 | void LLPanelLandObjects::refresh() | ||
1232 | { | ||
1233 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1234 | |||
1235 | mBtnShowOwnerObjects->setEnabled(FALSE); | ||
1236 | mBtnShowGroupObjects->setEnabled(FALSE); | ||
1237 | mBtnShowOtherObjects->setEnabled(FALSE); | ||
1238 | mBtnReturnOwnerObjects->setEnabled(FALSE); | ||
1239 | mBtnReturnGroupObjects->setEnabled(FALSE); | ||
1240 | mBtnReturnOtherObjects->setEnabled(FALSE); | ||
1241 | mCleanOtherObjectsTime->setEnabled(FALSE); | ||
1242 | mBtnRefresh-> setEnabled(FALSE); | ||
1243 | mBtnReturnOwnerList-> setEnabled(FALSE); | ||
1244 | |||
1245 | mSelectedOwners.clear(); | ||
1246 | mOwnerList->deleteAllItems(); | ||
1247 | mOwnerList->setEnabled(FALSE); | ||
1248 | |||
1249 | if (!parcel) | ||
1250 | { | ||
1251 | mSWTotalObjects->setText("0 out of 0 available"); | ||
1252 | mObjectContribution->setText("0"); | ||
1253 | mTotalObjects->setText("0"); | ||
1254 | mOwnerObjects->setText("0"); | ||
1255 | mGroupObjects->setText("0"); | ||
1256 | mOtherObjects->setText("0"); | ||
1257 | mSelectedObjects->setText("0"); | ||
1258 | } | ||
1259 | else | ||
1260 | { | ||
1261 | char count[MAX_STRING]; | ||
1262 | S32 sw_max; | ||
1263 | S32 sw_total; | ||
1264 | S32 max; | ||
1265 | S32 total; | ||
1266 | S32 owned; | ||
1267 | S32 group; | ||
1268 | S32 other; | ||
1269 | S32 selected; | ||
1270 | F32 parcel_object_bonus; | ||
1271 | |||
1272 | gParcelMgr->getPrimInfo(sw_max, sw_total, | ||
1273 | max, total, owned, group, other, selected, | ||
1274 | parcel_object_bonus, mOtherTime); | ||
1275 | |||
1276 | // Can't have more than region max tasks, regardless of parcel | ||
1277 | // object bonus factor. | ||
1278 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
1279 | if (region) | ||
1280 | { | ||
1281 | S32 max_tasks_per_region = (S32)region->getMaxTasks(); | ||
1282 | sw_max = llmin(sw_max, max_tasks_per_region); | ||
1283 | max = llmin(max, max_tasks_per_region); | ||
1284 | } | ||
1285 | |||
1286 | if (parcel_object_bonus != 1.0f) | ||
1287 | { | ||
1288 | sprintf(count, "Region Object Bonus Factor: %.2f", | ||
1289 | parcel_object_bonus); | ||
1290 | mParcelObjectBonus->setText(count); | ||
1291 | } | ||
1292 | else | ||
1293 | { | ||
1294 | mParcelObjectBonus->setText(""); | ||
1295 | } | ||
1296 | |||
1297 | if (sw_total > sw_max) | ||
1298 | { | ||
1299 | sprintf(count, "%d out of %d (%d will be deleted)", | ||
1300 | sw_total, sw_max, sw_total - sw_max); | ||
1301 | } | ||
1302 | else | ||
1303 | { | ||
1304 | sprintf(count, "%d out of %d (%d available)", | ||
1305 | sw_total, sw_max, sw_max - sw_total); | ||
1306 | } | ||
1307 | mSWTotalObjects->setText(count); | ||
1308 | |||
1309 | sprintf(count, "%d", max); | ||
1310 | mObjectContribution->setText(count); | ||
1311 | |||
1312 | sprintf(count, "%d", total); | ||
1313 | mTotalObjects->setText(count); | ||
1314 | |||
1315 | sprintf(count, "%d", owned); | ||
1316 | mOwnerObjects->setText(count); | ||
1317 | |||
1318 | sprintf(count, "%d", group); | ||
1319 | mGroupObjects->setText(count); | ||
1320 | |||
1321 | sprintf(count, "%d", other); | ||
1322 | mOtherObjects->setText(count); | ||
1323 | |||
1324 | sprintf(count, "%d", selected); | ||
1325 | mSelectedObjects->setText(count); | ||
1326 | |||
1327 | sprintf(count, "%d", mOtherTime); | ||
1328 | mCleanOtherObjectsTime->setText(count); | ||
1329 | |||
1330 | BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED); | ||
1331 | BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET); | ||
1332 | BOOL can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP); | ||
1333 | |||
1334 | if (can_return_owned || can_return_group_set || can_return_other) | ||
1335 | { | ||
1336 | if (owned && can_return_owned) | ||
1337 | { | ||
1338 | mBtnShowOwnerObjects->setEnabled(TRUE); | ||
1339 | mBtnReturnOwnerObjects->setEnabled(TRUE); | ||
1340 | } | ||
1341 | if (group && can_return_group_set) | ||
1342 | { | ||
1343 | mBtnShowGroupObjects->setEnabled(TRUE); | ||
1344 | mBtnReturnGroupObjects->setEnabled(TRUE); | ||
1345 | } | ||
1346 | if (other && can_return_other) | ||
1347 | { | ||
1348 | mBtnShowOtherObjects->setEnabled(TRUE); | ||
1349 | mBtnReturnOtherObjects->setEnabled(TRUE); | ||
1350 | } | ||
1351 | |||
1352 | mCleanOtherObjectsTime->setEnabled(TRUE); | ||
1353 | mBtnRefresh->setEnabled(TRUE); | ||
1354 | } | ||
1355 | } | ||
1356 | } | ||
1357 | |||
1358 | // virtual | ||
1359 | void LLPanelLandObjects::draw() | ||
1360 | { | ||
1361 | LLPanel::draw(); | ||
1362 | } | ||
1363 | |||
1364 | void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time) | ||
1365 | { | ||
1366 | LLMessageSystem *msg = gMessageSystem; | ||
1367 | |||
1368 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
1369 | if (!region) return; | ||
1370 | |||
1371 | msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime); | ||
1372 | msg->nextBlockFast(_PREHASH_AgentData); | ||
1373 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1374 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); | ||
1375 | msg->nextBlockFast(_PREHASH_ParcelData); | ||
1376 | msg->addS32Fast(_PREHASH_LocalID, parcel_local_id); | ||
1377 | msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time); | ||
1378 | |||
1379 | msg->sendReliable(region->getHost()); | ||
1380 | } | ||
1381 | |||
1382 | void send_return_objects_message(S32 parcel_local_id, S32 return_type, | ||
1383 | uuid_list_t* owner_ids = NULL) | ||
1384 | { | ||
1385 | LLMessageSystem *msg = gMessageSystem; | ||
1386 | |||
1387 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
1388 | if (!region) return; | ||
1389 | |||
1390 | msg->newMessageFast(_PREHASH_ParcelReturnObjects); | ||
1391 | msg->nextBlockFast(_PREHASH_AgentData); | ||
1392 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1393 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); | ||
1394 | msg->nextBlockFast(_PREHASH_ParcelData); | ||
1395 | msg->addS32Fast(_PREHASH_LocalID, parcel_local_id); | ||
1396 | msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type); | ||
1397 | |||
1398 | // Dummy task id, not used | ||
1399 | msg->nextBlock("TaskIDs"); | ||
1400 | msg->addUUID("TaskID", LLUUID::null); | ||
1401 | |||
1402 | // Throw all return ids into the packet. | ||
1403 | // TODO: Check for too many ids. | ||
1404 | if (owner_ids) | ||
1405 | { | ||
1406 | uuid_list_t::iterator end = owner_ids->end(); | ||
1407 | for (uuid_list_t::iterator it = owner_ids->begin(); | ||
1408 | it != end; | ||
1409 | ++it) | ||
1410 | { | ||
1411 | msg->nextBlockFast(_PREHASH_OwnerIDs); | ||
1412 | msg->addUUIDFast(_PREHASH_OwnerID, (*it)); | ||
1413 | } | ||
1414 | } | ||
1415 | else | ||
1416 | { | ||
1417 | msg->nextBlockFast(_PREHASH_OwnerIDs); | ||
1418 | msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null); | ||
1419 | } | ||
1420 | |||
1421 | msg->sendReliable(region->getHost()); | ||
1422 | } | ||
1423 | |||
1424 | // static | ||
1425 | void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata) | ||
1426 | { | ||
1427 | LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata; | ||
1428 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1429 | if (0 == option) | ||
1430 | { | ||
1431 | if (parcel) | ||
1432 | { | ||
1433 | LLUUID owner_id = parcel->getOwnerID(); | ||
1434 | LLString::format_map_t args; | ||
1435 | if (owner_id == gAgentID) | ||
1436 | { | ||
1437 | LLNotifyBox::showXml("OwnedObjectsReturned"); | ||
1438 | } | ||
1439 | else | ||
1440 | { | ||
1441 | char first[DB_FIRST_NAME_BUF_SIZE]; | ||
1442 | char last[DB_LAST_NAME_BUF_SIZE]; | ||
1443 | gCacheName->getName(owner_id, first, last); | ||
1444 | args["[FIRST]"] = first; | ||
1445 | args["[LAST]"] = last; | ||
1446 | LLNotifyBox::showXml("OtherObjectsReturned", args); | ||
1447 | } | ||
1448 | send_return_objects_message(parcel->getLocalID(), RT_OWNER); | ||
1449 | } | ||
1450 | } | ||
1451 | |||
1452 | gSelectMgr->unhighlightAll(); | ||
1453 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
1454 | lop->refresh(); | ||
1455 | } | ||
1456 | |||
1457 | // static | ||
1458 | void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata) | ||
1459 | { | ||
1460 | LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata; | ||
1461 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1462 | if (0 == option) | ||
1463 | { | ||
1464 | if (parcel) | ||
1465 | { | ||
1466 | char group_name[MAX_STRING]; | ||
1467 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | ||
1468 | LLString::format_map_t args; | ||
1469 | args["[GROUPNAME]"] = group_name; | ||
1470 | LLNotifyBox::showXml("GroupObjectsReturned", args); | ||
1471 | send_return_objects_message(parcel->getLocalID(), RT_GROUP); | ||
1472 | } | ||
1473 | } | ||
1474 | gSelectMgr->unhighlightAll(); | ||
1475 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
1476 | lop->refresh(); | ||
1477 | } | ||
1478 | |||
1479 | // static | ||
1480 | void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata) | ||
1481 | { | ||
1482 | LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata; | ||
1483 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1484 | if (0 == option) | ||
1485 | { | ||
1486 | if (parcel) | ||
1487 | { | ||
1488 | LLNotifyBox::showXml("UnOwnedObjectsReturned"); | ||
1489 | send_return_objects_message(parcel->getLocalID(), RT_OTHER); | ||
1490 | } | ||
1491 | } | ||
1492 | gSelectMgr->unhighlightAll(); | ||
1493 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
1494 | lop->refresh(); | ||
1495 | } | ||
1496 | |||
1497 | // static | ||
1498 | void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata) | ||
1499 | { | ||
1500 | LLPanelLandObjects *self = (LLPanelLandObjects *)userdata; | ||
1501 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1502 | if (0 == option) | ||
1503 | { | ||
1504 | if (parcel) | ||
1505 | { | ||
1506 | // Make sure we have something selected. | ||
1507 | uuid_list_t::iterator selected = self->mSelectedOwners.begin(); | ||
1508 | if (selected != self->mSelectedOwners.end()) | ||
1509 | { | ||
1510 | LLString::format_map_t args; | ||
1511 | if (self->mSelectedIsGroup) | ||
1512 | { | ||
1513 | args["[GROUPNAME]"] = self->mSelectedName; | ||
1514 | LLNotifyBox::showXml("GroupObjectsReturned", args); | ||
1515 | } | ||
1516 | else | ||
1517 | { | ||
1518 | // XUI:translate NAME -> FIRST LAST | ||
1519 | args["[NAME]"] = self->mSelectedName; | ||
1520 | LLNotifyBox::showXml("OtherObjectsReturned2", args); | ||
1521 | } | ||
1522 | |||
1523 | send_return_objects_message(parcel->getLocalID(), RT_LIST, &(self->mSelectedOwners)); | ||
1524 | } | ||
1525 | } | ||
1526 | } | ||
1527 | gSelectMgr->unhighlightAll(); | ||
1528 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
1529 | self->refresh(); | ||
1530 | } | ||
1531 | |||
1532 | |||
1533 | // static | ||
1534 | void LLPanelLandObjects::onClickReturnOwnerList(void* userdata) | ||
1535 | { | ||
1536 | LLPanelLandObjects *self = (LLPanelLandObjects *)userdata; | ||
1537 | |||
1538 | S32 sw_max, sw_total; | ||
1539 | S32 max, total; | ||
1540 | S32 owned, group, other, selected; | ||
1541 | F32 parcel_object_bonus; | ||
1542 | S32 other_time; | ||
1543 | |||
1544 | gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time); | ||
1545 | |||
1546 | LLParcel* parcelp = gParcelMgr->getSelectedParcel(); | ||
1547 | if (!parcelp) return; | ||
1548 | |||
1549 | // Make sure we have something selected. | ||
1550 | if (self->mSelectedOwners.empty()) | ||
1551 | { | ||
1552 | return; | ||
1553 | } | ||
1554 | //uuid_list_t::iterator selected_itr = self->mSelectedOwners.begin(); | ||
1555 | //if (selected_itr == self->mSelectedOwners.end()) return; | ||
1556 | |||
1557 | send_parcel_select_objects(parcelp->getLocalID(), RT_LIST, &(self->mSelectedOwners)); | ||
1558 | |||
1559 | LLStringBase<char>::format_map_t args; | ||
1560 | args["[NAME]"] = self->mSelectedName; | ||
1561 | args["[N]"] = llformat("%d",self->mSelectedCount); | ||
1562 | if (self->mSelectedIsGroup) | ||
1563 | { | ||
1564 | gViewerWindow->alertXml("ReturnObjectsDeededToGroup", args, callbackReturnOwnerList, userdata); | ||
1565 | } | ||
1566 | else | ||
1567 | { | ||
1568 | gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerList, userdata); | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1572 | |||
1573 | // static | ||
1574 | void LLPanelLandObjects::onClickRefresh(void* userdata) | ||
1575 | { | ||
1576 | LLPanelLandObjects *self = (LLPanelLandObjects*)userdata; | ||
1577 | |||
1578 | LLMessageSystem *msg = gMessageSystem; | ||
1579 | |||
1580 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1581 | if (!parcel) return; | ||
1582 | |||
1583 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
1584 | if (!region) return; | ||
1585 | |||
1586 | // ready the list for results | ||
1587 | self->mOwnerList->deleteAllItems(); | ||
1588 | self->mOwnerList->addSimpleItem("Searching..."); | ||
1589 | self->mOwnerList->setEnabled(FALSE); | ||
1590 | self->mFirstReply = TRUE; | ||
1591 | |||
1592 | // send the message | ||
1593 | msg->newMessageFast(_PREHASH_ParcelObjectOwnersRequest); | ||
1594 | msg->nextBlockFast(_PREHASH_AgentData); | ||
1595 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1596 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1597 | msg->nextBlockFast(_PREHASH_ParcelData); | ||
1598 | msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID()); | ||
1599 | |||
1600 | msg->sendReliable(region->getHost()); | ||
1601 | } | ||
1602 | |||
1603 | // static | ||
1604 | void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, void **) | ||
1605 | { | ||
1606 | LLPanelLandObjects* self = LLFloaterLand::getCurrentPanelLandObjects(); | ||
1607 | |||
1608 | const LLFontGL* FONT = LLFontGL::sSansSerif; | ||
1609 | |||
1610 | // Extract all of the owners. | ||
1611 | S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data); | ||
1612 | //uuid_list_t return_ids; | ||
1613 | LLUUID owner_id; | ||
1614 | BOOL is_group_owned; | ||
1615 | S32 object_count; | ||
1616 | BOOL is_online; | ||
1617 | char object_count_str[MAX_STRING]; | ||
1618 | //BOOL b_need_refresh = FALSE; | ||
1619 | |||
1620 | // If we were waiting for the first reply, clear the "Searching..." text. | ||
1621 | if (self->mFirstReply) | ||
1622 | { | ||
1623 | self->mOwnerList->deleteAllItems(); | ||
1624 | self->mFirstReply = FALSE; | ||
1625 | } | ||
1626 | |||
1627 | for(S32 i = 0; i < rows; ++i) | ||
1628 | { | ||
1629 | msg->getUUIDFast(_PREHASH_Data, _PREHASH_OwnerID, owner_id, i); | ||
1630 | msg->getBOOLFast(_PREHASH_Data, _PREHASH_IsGroupOwned, is_group_owned, i); | ||
1631 | msg->getS32Fast (_PREHASH_Data, _PREHASH_Count, object_count, i); | ||
1632 | msg->getBOOLFast(_PREHASH_Data, _PREHASH_OnlineStatus, is_online, i); | ||
1633 | |||
1634 | if (owner_id.isNull()) | ||
1635 | { | ||
1636 | continue; | ||
1637 | } | ||
1638 | |||
1639 | LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id); | ||
1640 | if (is_group_owned) | ||
1641 | { | ||
1642 | row->addColumn(self->mIconGroup, self->mColWidth[0]); | ||
1643 | row->addColumn(OWNER_GROUP, FONT, self->mColWidth[1]); | ||
1644 | } | ||
1645 | else if (is_online) | ||
1646 | { | ||
1647 | row->addColumn(self->mIconAvatarOnline, self->mColWidth[0]); | ||
1648 | row->addColumn(OWNER_ONLINE, FONT, self->mColWidth[1]); | ||
1649 | } | ||
1650 | else // offline | ||
1651 | { | ||
1652 | row->addColumn(self->mIconAvatarOffline, self->mColWidth[0]); | ||
1653 | row->addColumn(OWNER_OFFLINE, FONT, self->mColWidth[1]); | ||
1654 | } | ||
1655 | // Placeholder for name. | ||
1656 | row->addColumn("", FONT, self->mColWidth[2]); | ||
1657 | |||
1658 | sprintf(object_count_str, "%d", object_count); | ||
1659 | row->addColumn(object_count_str, FONT, self->mColWidth[3]); | ||
1660 | |||
1661 | if (is_group_owned) | ||
1662 | { | ||
1663 | self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM); | ||
1664 | } | ||
1665 | else | ||
1666 | { | ||
1667 | self->mOwnerList->addNameItem(row, ADD_BOTTOM); | ||
1668 | } | ||
1669 | |||
1670 | lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") | ||
1671 | << ") owns " << object_count << " objects." << llendl; | ||
1672 | } | ||
1673 | self->mOwnerList->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending); | ||
1674 | |||
1675 | // check for no results | ||
1676 | if (0 == self->mOwnerList->getItemCount()) | ||
1677 | { | ||
1678 | self->mOwnerList->addSimpleItem("None found."); | ||
1679 | } | ||
1680 | else | ||
1681 | { | ||
1682 | self->mOwnerList->setEnabled(TRUE); | ||
1683 | } | ||
1684 | } | ||
1685 | |||
1686 | void LLPanelLandObjects::sortBtnCore(S32 column) | ||
1687 | { | ||
1688 | if (column == (S32)mCurrentSortColumn) // is this already our sorted column? | ||
1689 | { | ||
1690 | mCurrentSortAscending = !mCurrentSortAscending; | ||
1691 | } | ||
1692 | else // default to ascending first time a column is clicked | ||
1693 | { | ||
1694 | mCurrentSortColumn = column; | ||
1695 | mCurrentSortAscending = TRUE; | ||
1696 | } | ||
1697 | |||
1698 | mOwnerList->sortByColumn(column, mCurrentSortAscending); | ||
1699 | } | ||
1700 | |||
1701 | // static | ||
1702 | void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data) | ||
1703 | { | ||
1704 | LLPanelLandObjects* self = (LLPanelLandObjects*)data; | ||
1705 | |||
1706 | if (FALSE == self->mOwnerList->getCanSelect()) | ||
1707 | { | ||
1708 | return; | ||
1709 | } | ||
1710 | LLScrollListItem *item = self->mOwnerList->getFirstSelected(); | ||
1711 | if (item) | ||
1712 | { | ||
1713 | // Look up the selected name, for future dialog box use. | ||
1714 | const LLScrollListCell* cell; | ||
1715 | cell = item->getColumn(1); | ||
1716 | if (!cell) | ||
1717 | { | ||
1718 | return; | ||
1719 | } | ||
1720 | // Is this a group? | ||
1721 | self->mSelectedIsGroup = cell->getText() == OWNER_GROUP; | ||
1722 | cell = item->getColumn(2); | ||
1723 | self->mSelectedName = cell->getText(); | ||
1724 | cell = item->getColumn(3); | ||
1725 | self->mSelectedCount = atoi(cell->getText().c_str()); | ||
1726 | |||
1727 | // Set the selection, and enable the return button. | ||
1728 | self->mSelectedOwners.clear(); | ||
1729 | self->mSelectedOwners.insert(item->getUUID()); | ||
1730 | self->mBtnReturnOwnerList->setEnabled(TRUE); | ||
1731 | |||
1732 | // Highlight this user's objects | ||
1733 | clickShowCore(RT_LIST, &(self->mSelectedOwners)); | ||
1734 | } | ||
1735 | } | ||
1736 | |||
1737 | // static | ||
1738 | void LLPanelLandObjects::onClickType(void* userdata) | ||
1739 | { | ||
1740 | // Sort on hidden type column | ||
1741 | LLPanelLandObjects* self = (LLPanelLandObjects*)userdata; | ||
1742 | self->sortBtnCore(1); | ||
1743 | } | ||
1744 | |||
1745 | // static | ||
1746 | void LLPanelLandObjects::onClickDesc(void* userdata) | ||
1747 | { | ||
1748 | LLPanelLandObjects* self = (LLPanelLandObjects*)userdata; | ||
1749 | self->sortBtnCore(3); | ||
1750 | } | ||
1751 | |||
1752 | // static | ||
1753 | void LLPanelLandObjects::onClickName(void* userdata) | ||
1754 | { | ||
1755 | LLPanelLandObjects* self = (LLPanelLandObjects*)userdata; | ||
1756 | self->sortBtnCore(2); | ||
1757 | } | ||
1758 | |||
1759 | // static | ||
1760 | void LLPanelLandObjects::clickShowCore(S32 return_type, uuid_list_t* list) | ||
1761 | { | ||
1762 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1763 | if (!parcel) return; | ||
1764 | |||
1765 | send_parcel_select_objects(parcel->getLocalID(), return_type, list); | ||
1766 | } | ||
1767 | |||
1768 | // static | ||
1769 | void LLPanelLandObjects::onClickShowOwnerObjects(void*) | ||
1770 | { | ||
1771 | clickShowCore(RT_OWNER); | ||
1772 | } | ||
1773 | |||
1774 | // static | ||
1775 | void LLPanelLandObjects::onClickShowGroupObjects(void*) | ||
1776 | { | ||
1777 | clickShowCore(RT_GROUP); | ||
1778 | } | ||
1779 | |||
1780 | // static | ||
1781 | void LLPanelLandObjects::onClickShowOtherObjects(void*) | ||
1782 | { | ||
1783 | clickShowCore(RT_OTHER); | ||
1784 | } | ||
1785 | |||
1786 | // static | ||
1787 | void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata) | ||
1788 | { | ||
1789 | S32 sw_max=0, sw_total=0; | ||
1790 | S32 max=0, total=0; | ||
1791 | S32 owned=0, group=0, other=0, selected=0; | ||
1792 | F32 parcel_object_bonus=0; | ||
1793 | S32 other_time=0; | ||
1794 | |||
1795 | gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time); | ||
1796 | |||
1797 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1798 | if (!parcel) return; | ||
1799 | |||
1800 | send_parcel_select_objects(parcel->getLocalID(), RT_OWNER); | ||
1801 | |||
1802 | LLUUID owner_id = parcel->getOwnerID(); | ||
1803 | |||
1804 | LLStringBase<char>::format_map_t args; | ||
1805 | args["[N]"] = llformat("%d",owned); | ||
1806 | |||
1807 | if (owner_id == gAgent.getID()) | ||
1808 | { | ||
1809 | gViewerWindow->alertXml("ReturnObjectsOwnedBySelf", args, callbackReturnOwnerObjects, userdata); | ||
1810 | } | ||
1811 | else | ||
1812 | { | ||
1813 | char first[DB_FIRST_NAME_BUF_SIZE]; | ||
1814 | char last[DB_LAST_NAME_BUF_SIZE]; | ||
1815 | gCacheName->getName(owner_id, first, last); | ||
1816 | std::string name = first; | ||
1817 | name += " "; | ||
1818 | name += last; | ||
1819 | args["[NAME]"] = name; | ||
1820 | gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata); | ||
1821 | } | ||
1822 | } | ||
1823 | |||
1824 | // static | ||
1825 | void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata) | ||
1826 | { | ||
1827 | S32 sw_max=0, sw_total=0; | ||
1828 | S32 max=0, total=0; | ||
1829 | S32 owned=0, group=0, other=0, selected=0; | ||
1830 | F32 parcel_object_bonus=0; | ||
1831 | S32 other_time=0; | ||
1832 | |||
1833 | gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time); | ||
1834 | |||
1835 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1836 | if (!parcel) return; | ||
1837 | |||
1838 | send_parcel_select_objects(parcel->getLocalID(), RT_GROUP); | ||
1839 | |||
1840 | char group_name[MAX_STRING]; | ||
1841 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | ||
1842 | |||
1843 | LLStringBase<char>::format_map_t args; | ||
1844 | args["[NAME]"] = group_name; | ||
1845 | args["[N]"] = llformat("%d",group); | ||
1846 | |||
1847 | // create and show confirmation textbox | ||
1848 | gViewerWindow->alertXml("ReturnObjectsDeededToGroup", args, callbackReturnGroupObjects, userdata); | ||
1849 | } | ||
1850 | |||
1851 | // static | ||
1852 | void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) | ||
1853 | { | ||
1854 | S32 sw_max=0, sw_total=0; | ||
1855 | S32 max=0, total=0; | ||
1856 | S32 owned=0, group=0, other=0, selected=0; | ||
1857 | F32 parcel_object_bonus=0; | ||
1858 | S32 other_time=0; | ||
1859 | |||
1860 | gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time); | ||
1861 | |||
1862 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
1863 | if (!parcel) return; | ||
1864 | |||
1865 | send_parcel_select_objects(parcel->getLocalID(), RT_OTHER); | ||
1866 | |||
1867 | LLStringBase<char>::format_map_t args; | ||
1868 | args["[N]"] = llformat("%d", other); | ||
1869 | |||
1870 | if (parcel->getIsGroupOwned()) | ||
1871 | { | ||
1872 | char group_name[MAX_STRING]; | ||
1873 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | ||
1874 | args["[NAME]"] = group_name; | ||
1875 | |||
1876 | gViewerWindow->alertXml("ReturnObjectsNotOwnedByGroup", args, callbackReturnOtherObjects, userdata); | ||
1877 | } | ||
1878 | else | ||
1879 | { | ||
1880 | LLUUID owner_id = parcel->getOwnerID(); | ||
1881 | |||
1882 | if (owner_id == gAgent.getID()) | ||
1883 | { | ||
1884 | gViewerWindow->alertXml("ReturnObjectsNotOwnedBySelf", args, callbackReturnOtherObjects, userdata); | ||
1885 | } | ||
1886 | else | ||
1887 | { | ||
1888 | char first[DB_FIRST_NAME_BUF_SIZE]; | ||
1889 | char last[DB_LAST_NAME_BUF_SIZE]; | ||
1890 | gCacheName->getName(owner_id, first, last); | ||
1891 | std::string name; | ||
1892 | name += first; | ||
1893 | name += " "; | ||
1894 | name += last; | ||
1895 | args["[NAME]"] = name; | ||
1896 | |||
1897 | gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata); | ||
1898 | } | ||
1899 | } | ||
1900 | } | ||
1901 | |||
1902 | // static | ||
1903 | void LLPanelLandObjects::onLostFocus(LLLineEditor *caller, void* user_data) | ||
1904 | { | ||
1905 | LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data; | ||
1906 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
1907 | if (parcel) | ||
1908 | { | ||
1909 | lop->mOtherTime = atoi(lop->mCleanOtherObjectsTime->getText().c_str()); | ||
1910 | |||
1911 | parcel->setCleanOtherTime(lop->mOtherTime); | ||
1912 | send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime); | ||
1913 | } | ||
1914 | } | ||
1915 | |||
1916 | |||
1917 | //--------------------------------------------------------------------------- | ||
1918 | // LLPanelLandOptions | ||
1919 | //--------------------------------------------------------------------------- | ||
1920 | |||
1921 | LLPanelLandOptions::LLPanelLandOptions() | ||
1922 | : LLPanel("land_options_panel"), | ||
1923 | mCheckEditObjects(NULL), | ||
1924 | mCheckEditGroupObjects(NULL), | ||
1925 | mCheckAllObjectEntry(NULL), | ||
1926 | mCheckGroupObjectEntry(NULL), | ||
1927 | mCheckEditLand(NULL), | ||
1928 | mCheckSafe(NULL), | ||
1929 | mCheckFly(NULL), | ||
1930 | mCheckGroupScripts(NULL), | ||
1931 | mCheckOtherScripts(NULL), | ||
1932 | mCheckLandmark(NULL), | ||
1933 | mCheckShowDirectory(NULL), | ||
1934 | mCategoryCombo(NULL), | ||
1935 | mLandingTypeCombo(NULL), | ||
1936 | mSnapshotCtrl(NULL), | ||
1937 | mLocationText(NULL), | ||
1938 | mSetBtn(NULL), | ||
1939 | mClearBtn(NULL), | ||
1940 | mAllowPublishCtrl(NULL), | ||
1941 | mMatureCtrl(NULL), | ||
1942 | mPushRestrictionCtrl(NULL), | ||
1943 | mPublishHelpButton(NULL) | ||
1944 | { | ||
1945 | |||
1946 | } | ||
1947 | |||
1948 | |||
1949 | BOOL LLPanelLandOptions::postBuild() | ||
1950 | { | ||
1951 | |||
1952 | |||
1953 | mCheckEditObjects = LLUICtrlFactory::getCheckBoxByName(this, "edit objects check"); | ||
1954 | childSetCommitCallback("edit objects check", onCommitAny, this); | ||
1955 | |||
1956 | mCheckEditGroupObjects = LLUICtrlFactory::getCheckBoxByName(this, "edit group objects check"); | ||
1957 | childSetCommitCallback("edit group objects check", onCommitAny, this); | ||
1958 | |||
1959 | mCheckAllObjectEntry = LLUICtrlFactory::getCheckBoxByName(this, "all object entry check"); | ||
1960 | childSetCommitCallback("all object entry check", onCommitAny, this); | ||
1961 | |||
1962 | mCheckGroupObjectEntry = LLUICtrlFactory::getCheckBoxByName(this, "group object entry check"); | ||
1963 | childSetCommitCallback("group object entry check", onCommitAny, this); | ||
1964 | |||
1965 | mCheckEditLand = LLUICtrlFactory::getCheckBoxByName(this, "edit land check"); | ||
1966 | childSetCommitCallback("edit land check", onCommitAny, this); | ||
1967 | |||
1968 | |||
1969 | mCheckLandmark = LLUICtrlFactory::getCheckBoxByName(this, "check landmark"); | ||
1970 | childSetCommitCallback("check landmark", onCommitAny, this); | ||
1971 | |||
1972 | |||
1973 | mCheckGroupScripts = LLUICtrlFactory::getCheckBoxByName(this, "check group scripts"); | ||
1974 | childSetCommitCallback("check group scripts", onCommitAny, this); | ||
1975 | |||
1976 | |||
1977 | mCheckFly = LLUICtrlFactory::getCheckBoxByName(this, "check fly"); | ||
1978 | childSetCommitCallback("check fly", onCommitAny, this); | ||
1979 | |||
1980 | |||
1981 | mCheckOtherScripts = LLUICtrlFactory::getCheckBoxByName(this, "check other scripts"); | ||
1982 | childSetCommitCallback("check other scripts", onCommitAny, this); | ||
1983 | |||
1984 | |||
1985 | mCheckSafe = LLUICtrlFactory::getCheckBoxByName(this, "check safe"); | ||
1986 | childSetCommitCallback("check safe", onCommitAny, this); | ||
1987 | |||
1988 | |||
1989 | mPushRestrictionCtrl = LLUICtrlFactory::getCheckBoxByName(this, "PushRestrictCheck"); | ||
1990 | childSetCommitCallback("PushRestrictCheck", onCommitAny, this); | ||
1991 | |||
1992 | mCheckShowDirectory = LLUICtrlFactory::getCheckBoxByName(this, "ShowDirectoryCheck"); | ||
1993 | childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this); | ||
1994 | |||
1995 | |||
1996 | mCategoryCombo = LLUICtrlFactory::getComboBoxByName(this, "land category"); | ||
1997 | childSetCommitCallback("land category", onCommitAny, this); | ||
1998 | |||
1999 | mAllowPublishCtrl = LLUICtrlFactory::getCheckBoxByName(this, "PublishCheck"); | ||
2000 | childSetCommitCallback("PublishCheck", onCommitAny, this); | ||
2001 | |||
2002 | |||
2003 | mMatureCtrl = LLUICtrlFactory::getCheckBoxByName(this, "MatureCheck"); | ||
2004 | childSetCommitCallback("MatureCheck", onCommitAny, this); | ||
2005 | |||
2006 | mPublishHelpButton = LLUICtrlFactory::getButtonByName(this, "?"); | ||
2007 | mPublishHelpButton->setClickedCallback(onClickPublishHelp, this); | ||
2008 | |||
2009 | |||
2010 | if (gAgent.mAccess < SIM_ACCESS_MATURE) | ||
2011 | { | ||
2012 | // Disable these buttons if they are PG (Teen) users | ||
2013 | mAllowPublishCtrl->setVisible(FALSE); | ||
2014 | mAllowPublishCtrl->setEnabled(FALSE); | ||
2015 | mPublishHelpButton->setVisible(FALSE); | ||
2016 | mPublishHelpButton->setEnabled(FALSE); | ||
2017 | mMatureCtrl->setVisible(FALSE); | ||
2018 | mMatureCtrl->setEnabled(FALSE); | ||
2019 | } | ||
2020 | |||
2021 | // Load up the category list | ||
2022 | //now in xml file | ||
2023 | /* | ||
2024 | S32 i; | ||
2025 | for (i = 0; i < LLParcel::C_COUNT; i++) | ||
2026 | { | ||
2027 | LLParcel::ECategory cat = (LLParcel::ECategory)i; | ||
2028 | |||
2029 | // Selecting Linden Location when you're not a god | ||
2030 | // is also blocked on the server. | ||
2031 | BOOL enabled = TRUE; | ||
2032 | if (!gAgent.isGodlike() | ||
2033 | && i == LLParcel::C_LINDEN) | ||
2034 | { | ||
2035 | enabled = FALSE; | ||
2036 | } | ||
2037 | |||
2038 | mCategoryCombo->add( LLParcel::getCategoryUIString(cat), ADD_BOTTOM, enabled ); | ||
2039 | }*/ | ||
2040 | |||
2041 | |||
2042 | mSnapshotCtrl = LLUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); | ||
2043 | mSnapshotCtrl->setCommitCallback( onCommitAny ); | ||
2044 | mSnapshotCtrl->setCallbackUserData( this ); | ||
2045 | mSnapshotCtrl->setAllowNoTexture ( TRUE ); | ||
2046 | mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); | ||
2047 | mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); | ||
2048 | |||
2049 | |||
2050 | |||
2051 | mLocationText = LLUICtrlFactory::getTextBoxByName(this, "Landing Point: (none)"); | ||
2052 | |||
2053 | mSetBtn = LLUICtrlFactory::getButtonByName(this, "Set"); | ||
2054 | mSetBtn->setClickedCallback(onClickSet, this); | ||
2055 | |||
2056 | |||
2057 | mClearBtn = LLUICtrlFactory::getButtonByName(this, "Clear"); | ||
2058 | mClearBtn->setClickedCallback(onClickClear, this); | ||
2059 | |||
2060 | |||
2061 | mLandingTypeCombo = LLUICtrlFactory::getComboBoxByName(this, "landing type"); | ||
2062 | childSetCommitCallback("landing type", onCommitAny, this); | ||
2063 | |||
2064 | return TRUE; | ||
2065 | } | ||
2066 | |||
2067 | |||
2068 | // virtual | ||
2069 | LLPanelLandOptions::~LLPanelLandOptions() | ||
2070 | { } | ||
2071 | |||
2072 | |||
2073 | // public | ||
2074 | void LLPanelLandOptions::refresh() | ||
2075 | { | ||
2076 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
2077 | |||
2078 | if (!parcel) | ||
2079 | { | ||
2080 | mCheckEditObjects ->set(FALSE); | ||
2081 | mCheckEditObjects ->setEnabled(FALSE); | ||
2082 | |||
2083 | mCheckEditGroupObjects ->set(FALSE); | ||
2084 | mCheckEditGroupObjects ->setEnabled(FALSE); | ||
2085 | |||
2086 | mCheckAllObjectEntry ->set(FALSE); | ||
2087 | mCheckAllObjectEntry ->setEnabled(FALSE); | ||
2088 | |||
2089 | mCheckGroupObjectEntry ->set(FALSE); | ||
2090 | mCheckGroupObjectEntry ->setEnabled(FALSE); | ||
2091 | |||
2092 | mCheckEditLand ->set(FALSE); | ||
2093 | mCheckEditLand ->setEnabled(FALSE); | ||
2094 | |||
2095 | mCheckSafe ->set(FALSE); | ||
2096 | mCheckSafe ->setEnabled(FALSE); | ||
2097 | |||
2098 | mCheckFly ->set(FALSE); | ||
2099 | mCheckFly ->setEnabled(FALSE); | ||
2100 | |||
2101 | mCheckLandmark ->set(FALSE); | ||
2102 | mCheckLandmark ->setEnabled(FALSE); | ||
2103 | |||
2104 | mCheckGroupScripts ->set(FALSE); | ||
2105 | mCheckGroupScripts ->setEnabled(FALSE); | ||
2106 | |||
2107 | mCheckOtherScripts ->set(FALSE); | ||
2108 | mCheckOtherScripts ->setEnabled(FALSE); | ||
2109 | |||
2110 | mCheckShowDirectory ->set(FALSE); | ||
2111 | mCheckShowDirectory ->setEnabled(FALSE); | ||
2112 | |||
2113 | mPushRestrictionCtrl->set(FALSE); | ||
2114 | mPushRestrictionCtrl->setEnabled(FALSE); | ||
2115 | |||
2116 | const char* none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE); | ||
2117 | mCategoryCombo->setSimple(none_string); | ||
2118 | mCategoryCombo->setEnabled(FALSE); | ||
2119 | |||
2120 | mLandingTypeCombo->setCurrentByIndex(0); | ||
2121 | mLandingTypeCombo->setEnabled(FALSE); | ||
2122 | |||
2123 | mSnapshotCtrl->setImageAssetID(LLUUID::null); | ||
2124 | mSnapshotCtrl->setEnabled(FALSE); | ||
2125 | |||
2126 | mLocationText->setText("Landing Point: (none)"); | ||
2127 | mSetBtn->setEnabled(FALSE); | ||
2128 | mClearBtn->setEnabled(FALSE); | ||
2129 | |||
2130 | mAllowPublishCtrl->setEnabled(FALSE); | ||
2131 | mMatureCtrl->setEnabled(FALSE); | ||
2132 | mPublishHelpButton->setEnabled(FALSE); | ||
2133 | } | ||
2134 | else | ||
2135 | { | ||
2136 | // something selected, hooray! | ||
2137 | |||
2138 | // Display options | ||
2139 | BOOL can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS); | ||
2140 | mCheckEditObjects ->set( parcel->getAllowModify() ); | ||
2141 | mCheckEditObjects ->setEnabled( can_change_options ); | ||
2142 | |||
2143 | mCheckEditGroupObjects ->set( parcel->getAllowGroupModify() || parcel->getAllowModify()); | ||
2144 | mCheckEditGroupObjects ->setEnabled( can_change_options && !parcel->getAllowModify() ); // If others edit is enabled, then this is explicitly enabled. | ||
2145 | |||
2146 | mCheckAllObjectEntry ->set( parcel->getAllowAllObjectEntry() ); | ||
2147 | mCheckAllObjectEntry ->setEnabled( can_change_options ); | ||
2148 | |||
2149 | mCheckGroupObjectEntry ->set( parcel->getAllowGroupObjectEntry() || parcel->getAllowAllObjectEntry()); | ||
2150 | mCheckGroupObjectEntry ->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() ); | ||
2151 | |||
2152 | BOOL can_change_terraform = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_EDIT); | ||
2153 | mCheckEditLand ->set( parcel->getAllowTerraform() ); | ||
2154 | mCheckEditLand ->setEnabled( can_change_terraform ); | ||
2155 | |||
2156 | mCheckSafe ->set( !parcel->getAllowDamage() ); | ||
2157 | mCheckSafe ->setEnabled( can_change_options ); | ||
2158 | |||
2159 | mCheckFly ->set( parcel->getAllowFly() ); | ||
2160 | mCheckFly ->setEnabled( can_change_options ); | ||
2161 | |||
2162 | mCheckLandmark ->set( parcel->getAllowLandmark() ); | ||
2163 | mCheckLandmark ->setEnabled( can_change_options ); | ||
2164 | |||
2165 | mCheckGroupScripts ->set( parcel->getAllowGroupScripts() || parcel->getAllowOtherScripts()); | ||
2166 | mCheckGroupScripts ->setEnabled( can_change_options && !parcel->getAllowOtherScripts()); | ||
2167 | |||
2168 | mCheckOtherScripts ->set( parcel->getAllowOtherScripts() ); | ||
2169 | mCheckOtherScripts ->setEnabled( can_change_options ); | ||
2170 | |||
2171 | BOOL can_change_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, | ||
2172 | GP_LAND_CHANGE_IDENTITY); | ||
2173 | mCheckShowDirectory ->set( parcel->getParcelFlag(PF_SHOW_DIRECTORY)); | ||
2174 | mCheckShowDirectory ->setEnabled( can_change_identity ); | ||
2175 | |||
2176 | mPushRestrictionCtrl->set( parcel->getRestrictPushObject() ); | ||
2177 | if(parcel->getRegionPushOverride()) | ||
2178 | { | ||
2179 | mPushRestrictionCtrl->setLabel("Restrict Pushing (Region Override)"); | ||
2180 | mPushRestrictionCtrl->setEnabled(false); | ||
2181 | mPushRestrictionCtrl->set(TRUE); | ||
2182 | } | ||
2183 | else | ||
2184 | { | ||
2185 | mPushRestrictionCtrl->setLabel("Restrict Pushing"); | ||
2186 | mPushRestrictionCtrl->setEnabled(can_change_options); | ||
2187 | } | ||
2188 | |||
2189 | // Set by string in case the order in UI doesn't match the order | ||
2190 | // by index. | ||
2191 | LLParcel::ECategory cat = parcel->getCategory(); | ||
2192 | const char* category_string = LLParcel::getCategoryUIString(cat); | ||
2193 | mCategoryCombo->setSimple(category_string); | ||
2194 | mCategoryCombo->setEnabled( can_change_identity ); | ||
2195 | |||
2196 | BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, | ||
2197 | GP_LAND_SET_LANDING_POINT); | ||
2198 | mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType()); | ||
2199 | mLandingTypeCombo->setEnabled( can_change_landing_point ); | ||
2200 | |||
2201 | mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID()); | ||
2202 | mSnapshotCtrl->setEnabled( can_change_identity ); | ||
2203 | |||
2204 | LLVector3 pos = parcel->getUserLocation(); | ||
2205 | if (pos.isExactlyZero()) | ||
2206 | { | ||
2207 | mLocationText->setText("Landing Point: (none)"); | ||
2208 | } | ||
2209 | else | ||
2210 | { | ||
2211 | char buffer[256]; | ||
2212 | sprintf(buffer, "Landing Point: %d, %d, %d", | ||
2213 | llround(pos.mV[VX]), | ||
2214 | llround(pos.mV[VY]), | ||
2215 | llround(pos.mV[VZ])); | ||
2216 | mLocationText->setText(buffer); | ||
2217 | } | ||
2218 | |||
2219 | mSetBtn->setEnabled( can_change_landing_point ); | ||
2220 | mClearBtn->setEnabled( can_change_landing_point ); | ||
2221 | |||
2222 | mAllowPublishCtrl->set(parcel->getAllowPublish()); | ||
2223 | mAllowPublishCtrl->setEnabled( can_change_identity ); | ||
2224 | mMatureCtrl->set(parcel->getMaturePublish()); | ||
2225 | mMatureCtrl->setEnabled( can_change_identity ); | ||
2226 | mPublishHelpButton->setEnabled( can_change_identity ); | ||
2227 | |||
2228 | if (gAgent.mAccess < SIM_ACCESS_MATURE) | ||
2229 | { | ||
2230 | // Disable these buttons if they are PG (Teen) users | ||
2231 | mAllowPublishCtrl->setVisible(FALSE); | ||
2232 | mAllowPublishCtrl->setEnabled(FALSE); | ||
2233 | mPublishHelpButton->setVisible(FALSE); | ||
2234 | mPublishHelpButton->setEnabled(FALSE); | ||
2235 | mMatureCtrl->setVisible(FALSE); | ||
2236 | mMatureCtrl->setEnabled(FALSE); | ||
2237 | } | ||
2238 | } | ||
2239 | } | ||
2240 | |||
2241 | |||
2242 | // static | ||
2243 | void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata) | ||
2244 | { | ||
2245 | LLPanelLandOptions *self = (LLPanelLandOptions *)userdata; | ||
2246 | |||
2247 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2248 | if (!parcel) | ||
2249 | { | ||
2250 | return; | ||
2251 | } | ||
2252 | |||
2253 | // Extract data from UI | ||
2254 | BOOL create_objects = self->mCheckEditObjects->get(); | ||
2255 | BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get(); | ||
2256 | BOOL all_object_entry = self->mCheckAllObjectEntry->get(); | ||
2257 | BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get(); | ||
2258 | BOOL allow_terraform = self->mCheckEditLand->get(); | ||
2259 | BOOL allow_damage = !self->mCheckSafe->get(); | ||
2260 | BOOL allow_fly = self->mCheckFly->get(); | ||
2261 | BOOL allow_landmark = self->mCheckLandmark->get(); | ||
2262 | BOOL allow_group_scripts = self->mCheckGroupScripts->get() || self->mCheckOtherScripts->get(); | ||
2263 | BOOL allow_other_scripts = self->mCheckOtherScripts->get(); | ||
2264 | BOOL allow_publish = self->mAllowPublishCtrl->get(); | ||
2265 | BOOL mature_publish = self->mMatureCtrl->get(); | ||
2266 | BOOL push_restriction = self->mPushRestrictionCtrl->get(); | ||
2267 | BOOL show_directory = self->mCheckShowDirectory->get(); | ||
2268 | S32 category_index = self->mCategoryCombo->getCurrentIndex(); | ||
2269 | S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex(); | ||
2270 | LLUUID snapshot_id = self->mSnapshotCtrl->getImageAssetID(); | ||
2271 | LLViewerRegion* region; | ||
2272 | region = gParcelMgr->getSelectionRegion(); | ||
2273 | |||
2274 | if (!allow_other_scripts && region && region->getAllowDamage()) | ||
2275 | { | ||
2276 | |||
2277 | gViewerWindow->alertXml("UnableToDisableOutsideScripts"); | ||
2278 | return; | ||
2279 | } | ||
2280 | |||
2281 | // Push data into current parcel | ||
2282 | parcel->setParcelFlag(PF_CREATE_OBJECTS, create_objects); | ||
2283 | parcel->setParcelFlag(PF_CREATE_GROUP_OBJECTS, create_group_objects); | ||
2284 | parcel->setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, all_object_entry); | ||
2285 | parcel->setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, group_object_entry); | ||
2286 | parcel->setParcelFlag(PF_ALLOW_TERRAFORM, allow_terraform); | ||
2287 | parcel->setParcelFlag(PF_ALLOW_DAMAGE, allow_damage); | ||
2288 | parcel->setParcelFlag(PF_ALLOW_FLY, allow_fly); | ||
2289 | parcel->setParcelFlag(PF_ALLOW_LANDMARK, allow_landmark); | ||
2290 | parcel->setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, allow_group_scripts); | ||
2291 | parcel->setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, allow_other_scripts); | ||
2292 | parcel->setParcelFlag(PF_SHOW_DIRECTORY, show_directory); | ||
2293 | parcel->setParcelFlag(PF_ALLOW_PUBLISH, allow_publish); | ||
2294 | parcel->setParcelFlag(PF_MATURE_PUBLISH, mature_publish); | ||
2295 | parcel->setParcelFlag(PF_RESTRICT_PUSHOBJECT, push_restriction); | ||
2296 | parcel->setCategory((LLParcel::ECategory)category_index); | ||
2297 | parcel->setLandingType((LLParcel::ELandingType)landing_type_index); | ||
2298 | parcel->setSnapshotID(snapshot_id); | ||
2299 | |||
2300 | // Send current parcel data upstream to server | ||
2301 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
2302 | |||
2303 | // Might have changed properties, so let's redraw! | ||
2304 | self->refresh(); | ||
2305 | } | ||
2306 | |||
2307 | |||
2308 | // static | ||
2309 | void LLPanelLandOptions::onClickSet(void* userdata) | ||
2310 | { | ||
2311 | LLPanelLandOptions* self = (LLPanelLandOptions*)userdata; | ||
2312 | |||
2313 | LLParcel* selected_parcel = gParcelMgr->getSelectedParcel(); | ||
2314 | if (!selected_parcel) return; | ||
2315 | |||
2316 | LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); | ||
2317 | if (!agent_parcel) return; | ||
2318 | |||
2319 | if (agent_parcel->getLocalID() != selected_parcel->getLocalID()) | ||
2320 | { | ||
2321 | gViewerWindow->alertXml("MustBeInParcel"); | ||
2322 | return; | ||
2323 | } | ||
2324 | |||
2325 | LLVector3 pos_region = gAgent.getPositionAgent(); | ||
2326 | selected_parcel->setUserLocation(pos_region); | ||
2327 | selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis()); | ||
2328 | |||
2329 | gParcelMgr->sendParcelPropertiesUpdate(selected_parcel, LLFloaterLand::sRequestReplyOnUpdate); | ||
2330 | |||
2331 | self->refresh(); | ||
2332 | } | ||
2333 | |||
2334 | void LLPanelLandOptions::onClickClear(void* userdata) | ||
2335 | { | ||
2336 | LLPanelLandOptions* self = (LLPanelLandOptions*)userdata; | ||
2337 | |||
2338 | LLParcel* selected_parcel = gParcelMgr->getSelectedParcel(); | ||
2339 | if (!selected_parcel) return; | ||
2340 | |||
2341 | // yes, this magic number of 0,0,0 means that it is clear | ||
2342 | LLVector3 zero_vec(0.f, 0.f, 0.f); | ||
2343 | selected_parcel->setUserLocation(zero_vec); | ||
2344 | selected_parcel->setUserLookAt(zero_vec); | ||
2345 | |||
2346 | gParcelMgr->sendParcelPropertiesUpdate(selected_parcel, LLFloaterLand::sRequestReplyOnUpdate); | ||
2347 | |||
2348 | self->refresh(); | ||
2349 | } | ||
2350 | |||
2351 | // static | ||
2352 | void LLPanelLandOptions::onClickPublishHelp(void*) | ||
2353 | { | ||
2354 | gViewerWindow->alertXml("ClickPublishHelpLand"); | ||
2355 | } | ||
2356 | |||
2357 | //--------------------------------------------------------------------------- | ||
2358 | // LLPanelLandMedia | ||
2359 | //--------------------------------------------------------------------------- | ||
2360 | |||
2361 | LLPanelLandMedia::LLPanelLandMedia() | ||
2362 | : LLPanel("land_media_panel") | ||
2363 | { | ||
2364 | } | ||
2365 | |||
2366 | |||
2367 | |||
2368 | |||
2369 | BOOL LLPanelLandMedia::postBuild() | ||
2370 | { | ||
2371 | |||
2372 | mCheckSoundLocal = LLUICtrlFactory::getCheckBoxByName(this, "check sound local"); | ||
2373 | childSetCommitCallback("check sound local", onCommitAny, this); | ||
2374 | |||
2375 | mMusicURLEdit = LLUICtrlFactory::getLineEditorByName(this, "music_url"); | ||
2376 | childSetCommitCallback("music_url", onCommitAny, this); | ||
2377 | |||
2378 | |||
2379 | mMediaTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this, "media texture"); | ||
2380 | mMediaTextureCtrl->setCommitCallback( onCommitAny ); | ||
2381 | mMediaTextureCtrl->setCallbackUserData( this ); | ||
2382 | mMediaTextureCtrl->setAllowNoTexture ( TRUE ); | ||
2383 | mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); | ||
2384 | mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); | ||
2385 | |||
2386 | mMediaAutoScaleCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_auto_scale"); | ||
2387 | childSetCommitCallback("media_auto_scale", onCommitAny, this); | ||
2388 | |||
2389 | mMediaURLEdit = LLUICtrlFactory::getLineEditorByName(this, "media_url"); | ||
2390 | childSetCommitCallback("media_url", onCommitAny, this); | ||
2391 | |||
2392 | return TRUE; | ||
2393 | } | ||
2394 | |||
2395 | |||
2396 | // virtual | ||
2397 | LLPanelLandMedia::~LLPanelLandMedia() | ||
2398 | { } | ||
2399 | |||
2400 | |||
2401 | // public | ||
2402 | void LLPanelLandMedia::refresh() | ||
2403 | { | ||
2404 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
2405 | |||
2406 | if (!parcel) | ||
2407 | { | ||
2408 | mCheckSoundLocal->set(FALSE); | ||
2409 | mCheckSoundLocal->setEnabled(FALSE); | ||
2410 | |||
2411 | mMusicURLEdit->setText(""); | ||
2412 | mMusicURLEdit->setEnabled(FALSE); | ||
2413 | |||
2414 | mMediaURLEdit->setText(""); | ||
2415 | mMediaURLEdit->setEnabled(FALSE); | ||
2416 | |||
2417 | mMediaAutoScaleCheck->set ( FALSE ); | ||
2418 | mMediaAutoScaleCheck->setEnabled(FALSE); | ||
2419 | |||
2420 | mMediaTextureCtrl->clear(); | ||
2421 | mMediaTextureCtrl->setEnabled(FALSE); | ||
2422 | |||
2423 | #if 0 | ||
2424 | mMediaStopButton->setEnabled ( FALSE ); | ||
2425 | mMediaStartButton->setEnabled ( FALSE ); | ||
2426 | #endif | ||
2427 | } | ||
2428 | else | ||
2429 | { | ||
2430 | // something selected, hooray! | ||
2431 | |||
2432 | // Display options | ||
2433 | BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA); | ||
2434 | |||
2435 | mCheckSoundLocal->set( parcel->getSoundLocal() ); | ||
2436 | mCheckSoundLocal->setEnabled( can_change_media ); | ||
2437 | |||
2438 | // don't display urls if you're not able to change it | ||
2439 | // much requested change in forums so people can't 'steal' urls | ||
2440 | // NOTE: bug#2009 means this is still vunerable - however, bug | ||
2441 | // should be closed since this bug opens up major security issues elsewhere. | ||
2442 | if ( can_change_media ) | ||
2443 | { | ||
2444 | mMusicURLEdit->setDrawAsterixes ( FALSE ); | ||
2445 | mMediaURLEdit->setDrawAsterixes ( FALSE ); | ||
2446 | } | ||
2447 | else | ||
2448 | { | ||
2449 | mMusicURLEdit->setDrawAsterixes ( TRUE ); | ||
2450 | mMediaURLEdit->setDrawAsterixes ( TRUE ); | ||
2451 | } | ||
2452 | |||
2453 | mMusicURLEdit->setText(parcel->getMusicURL()); | ||
2454 | mMusicURLEdit->setEnabled( can_change_media ); | ||
2455 | |||
2456 | mMediaURLEdit->setText(parcel->getMediaURL()); | ||
2457 | mMediaURLEdit->setEnabled( can_change_media ); | ||
2458 | |||
2459 | mMediaAutoScaleCheck->set ( parcel->getMediaAutoScale () ); | ||
2460 | mMediaAutoScaleCheck->setEnabled ( can_change_media ); | ||
2461 | |||
2462 | LLUUID tmp = parcel->getMediaID(); | ||
2463 | mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() ); | ||
2464 | mMediaTextureCtrl->setEnabled( can_change_media ); | ||
2465 | |||
2466 | #if 0 | ||
2467 | // there is a media url and a media texture selected | ||
2468 | if ( ( ! ( std::string ( parcel->getMediaURL() ).empty () ) ) && ( ! ( parcel->getMediaID ().isNull () ) ) ) | ||
2469 | { | ||
2470 | // turn on transport controls if allowed for this parcel | ||
2471 | mMediaStopButton->setEnabled ( editable ); | ||
2472 | mMediaStartButton->setEnabled ( editable ); | ||
2473 | } | ||
2474 | else | ||
2475 | { | ||
2476 | // no media url or no media texture | ||
2477 | mMediaStopButton->setEnabled ( FALSE ); | ||
2478 | mMediaStartButton->setEnabled ( FALSE ); | ||
2479 | }; | ||
2480 | #endif | ||
2481 | } | ||
2482 | } | ||
2483 | |||
2484 | // static | ||
2485 | void LLPanelLandMedia::onCommitAny(LLUICtrl *ctrl, void *userdata) | ||
2486 | { | ||
2487 | LLPanelLandMedia *self = (LLPanelLandMedia *)userdata; | ||
2488 | |||
2489 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2490 | if (!parcel) | ||
2491 | { | ||
2492 | return; | ||
2493 | } | ||
2494 | |||
2495 | // Extract data from UI | ||
2496 | BOOL sound_local = self->mCheckSoundLocal->get(); | ||
2497 | std::string music_url = self->mMusicURLEdit->getText(); | ||
2498 | std::string media_url = self->mMediaURLEdit->getText(); | ||
2499 | U8 media_auto_scale = self->mMediaAutoScaleCheck->get(); | ||
2500 | LLUUID media_id = self->mMediaTextureCtrl->getImageAssetID(); | ||
2501 | |||
2502 | // Push data into current parcel | ||
2503 | parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local); | ||
2504 | parcel->setMusicURL(music_url.c_str()); | ||
2505 | parcel->setMediaURL(media_url.c_str()); | ||
2506 | parcel->setMediaID(media_id); | ||
2507 | parcel->setMediaAutoScale ( media_auto_scale ); | ||
2508 | |||
2509 | // Send current parcel data upstream to server | ||
2510 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
2511 | |||
2512 | // Might have changed properties, so let's redraw! | ||
2513 | self->refresh(); | ||
2514 | } | ||
2515 | |||
2516 | void LLPanelLandMedia::onClickStopMedia ( void* data ) | ||
2517 | { | ||
2518 | LLMediaEngine::getInstance ()->stop (); | ||
2519 | } | ||
2520 | |||
2521 | void LLPanelLandMedia::onClickStartMedia ( void* data ) | ||
2522 | { | ||
2523 | // force a commit | ||
2524 | gFocusMgr.setKeyboardFocus ( NULL, NULL ); | ||
2525 | |||
2526 | // force a reload | ||
2527 | LLMediaEngine::getInstance ()->convertImageAndLoadUrl ( true, false, std::string()); | ||
2528 | } | ||
2529 | |||
2530 | //--------------------------------------------------------------------------- | ||
2531 | // LLPanelLandAccess | ||
2532 | //--------------------------------------------------------------------------- | ||
2533 | |||
2534 | LLPanelLandAccess::LLPanelLandAccess() | ||
2535 | : LLPanel("land_access_panel") | ||
2536 | { | ||
2537 | } | ||
2538 | |||
2539 | |||
2540 | |||
2541 | BOOL LLPanelLandAccess::postBuild() | ||
2542 | { | ||
2543 | |||
2544 | |||
2545 | mCheckGroup = LLUICtrlFactory::getCheckBoxByName(this, "GroupCheck"); | ||
2546 | childSetCommitCallback("GroupCheck", onCommitAny, this); | ||
2547 | |||
2548 | mCheckAccess = LLUICtrlFactory::getCheckBoxByName(this, "AccessCheck"); | ||
2549 | childSetCommitCallback("AccessCheck", onCommitAny, this); | ||
2550 | |||
2551 | mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); | ||
2552 | |||
2553 | mBtnAddAccess = LLUICtrlFactory::getButtonByName(this, "Add..."); | ||
2554 | |||
2555 | mBtnAddAccess->setClickedCallback(onClickAdd, this); | ||
2556 | |||
2557 | mBtnRemoveAccess = LLUICtrlFactory::getButtonByName(this, "Remove"); | ||
2558 | |||
2559 | mBtnRemoveAccess->setClickedCallback(onClickRemove, this); | ||
2560 | |||
2561 | mCheckPass = LLUICtrlFactory::getCheckBoxByName(this, "PassCheck"); | ||
2562 | childSetCommitCallback("PassCheck", onCommitAny, this); | ||
2563 | |||
2564 | |||
2565 | mSpinPrice = LLUICtrlFactory::getSpinnerByName(this, "PriceSpin"); | ||
2566 | childSetCommitCallback("PriceSpin", onCommitAny, this); | ||
2567 | |||
2568 | mSpinHours = LLUICtrlFactory::getSpinnerByName(this, "HoursSpin"); | ||
2569 | childSetCommitCallback("HoursSpin", onCommitAny, this); | ||
2570 | |||
2571 | |||
2572 | return TRUE; | ||
2573 | } | ||
2574 | |||
2575 | |||
2576 | LLPanelLandAccess::~LLPanelLandAccess() | ||
2577 | { } | ||
2578 | |||
2579 | void LLPanelLandAccess::refresh() | ||
2580 | { | ||
2581 | mListAccess->deleteAllItems(); | ||
2582 | |||
2583 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
2584 | |||
2585 | if (parcel) | ||
2586 | { | ||
2587 | char label[256]; | ||
2588 | |||
2589 | // Display options | ||
2590 | BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); | ||
2591 | mCheckGroup->set( use_group ); | ||
2592 | |||
2593 | char group_name[MAX_STRING]; | ||
2594 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | ||
2595 | sprintf(label, "Group: %s", group_name); | ||
2596 | mCheckGroup->setLabel( label ); | ||
2597 | |||
2598 | S32 count = parcel->mAccessList.size(); | ||
2599 | |||
2600 | BOOL use_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); | ||
2601 | mCheckAccess->set( use_list ); | ||
2602 | sprintf(label, "Avatars: (%d listed, %d max)", | ||
2603 | count, PARCEL_MAX_ACCESS_LIST); | ||
2604 | mCheckAccess->setLabel( label ); | ||
2605 | |||
2606 | access_map_const_iterator cit = parcel->mAccessList.begin(); | ||
2607 | access_map_const_iterator end = parcel->mAccessList.end(); | ||
2608 | |||
2609 | for (; cit != end; ++cit) | ||
2610 | { | ||
2611 | const LLAccessEntry& entry = (*cit).second; | ||
2612 | LLString suffix; | ||
2613 | if (entry.mTime != 0) | ||
2614 | { | ||
2615 | S32 now = time(NULL); | ||
2616 | S32 seconds = entry.mTime - now; | ||
2617 | if (seconds < 0) seconds = 0; | ||
2618 | suffix.assign(" ("); | ||
2619 | if (seconds >= 120) | ||
2620 | { | ||
2621 | char buf[30]; | ||
2622 | sprintf(buf, "%d minutes", (seconds/60)); | ||
2623 | suffix.append(buf); | ||
2624 | } | ||
2625 | else if (seconds >= 60) | ||
2626 | { | ||
2627 | suffix.append("1 minute"); | ||
2628 | } | ||
2629 | else | ||
2630 | { | ||
2631 | char buf[30]; | ||
2632 | sprintf(buf, "%d seconds", seconds); | ||
2633 | suffix.append(buf); | ||
2634 | } | ||
2635 | suffix.append(" remaining)"); | ||
2636 | } | ||
2637 | mListAccess->addNameItem(entry.mID, ADD_BOTTOM, TRUE, suffix); | ||
2638 | } | ||
2639 | |||
2640 | BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); | ||
2641 | |||
2642 | BOOL enable_add = can_manage_allowed && (count < PARCEL_MAX_ACCESS_LIST); | ||
2643 | mBtnAddAccess->setEnabled(enable_add); | ||
2644 | |||
2645 | BOOL enable_remove = can_manage_allowed && (count > 0); | ||
2646 | mBtnRemoveAccess->setEnabled(enable_remove); | ||
2647 | |||
2648 | // Can only sell passes when limiting the access. | ||
2649 | BOOL can_manage_passes = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_PASSES); | ||
2650 | mCheckPass->setEnabled( (use_group || use_list) && can_manage_passes ); | ||
2651 | |||
2652 | BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); | ||
2653 | mCheckPass->set( use_pass ); | ||
2654 | |||
2655 | BOOL enable_pass = can_manage_passes && use_pass; | ||
2656 | mSpinPrice->setEnabled( enable_pass ); | ||
2657 | mSpinHours->setEnabled( enable_pass ); | ||
2658 | |||
2659 | S32 pass_price = parcel->getPassPrice(); | ||
2660 | mSpinPrice->set( F32(pass_price) ); | ||
2661 | |||
2662 | F32 pass_hours = parcel->getPassHours(); | ||
2663 | mSpinHours->set( pass_hours ); | ||
2664 | |||
2665 | mCheckGroup->setEnabled( can_manage_allowed ); | ||
2666 | mCheckAccess->setEnabled( can_manage_allowed ); | ||
2667 | |||
2668 | } | ||
2669 | else | ||
2670 | { | ||
2671 | mCheckGroup->set(FALSE); | ||
2672 | mCheckGroup->setLabel("Group:"); | ||
2673 | mCheckAccess->set(FALSE); | ||
2674 | mCheckAccess->setLabel("Avatars:"); | ||
2675 | mBtnAddAccess->setEnabled(FALSE); | ||
2676 | mBtnRemoveAccess->setEnabled(FALSE); | ||
2677 | mSpinPrice->set((F32)PARCEL_PASS_PRICE_DEFAULT); | ||
2678 | mSpinPrice->setEnabled(FALSE); | ||
2679 | mSpinHours->set( PARCEL_PASS_HOURS_DEFAULT ); | ||
2680 | mSpinHours->setEnabled(FALSE); | ||
2681 | mCheckGroup->setEnabled(FALSE); | ||
2682 | mCheckAccess->setEnabled(FALSE); | ||
2683 | } | ||
2684 | } | ||
2685 | |||
2686 | // public | ||
2687 | void LLPanelLandAccess::refreshNames() | ||
2688 | { | ||
2689 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2690 | char group_name[DB_GROUP_NAME_BUF_SIZE]; | ||
2691 | group_name[0] = '\0'; | ||
2692 | if(parcel) | ||
2693 | { | ||
2694 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | ||
2695 | } | ||
2696 | char label[MAX_STRING]; | ||
2697 | snprintf(label, MAX_STRING, "Group: %s", group_name); | ||
2698 | mCheckGroup->setLabel(label); | ||
2699 | } | ||
2700 | |||
2701 | |||
2702 | // virtual | ||
2703 | void LLPanelLandAccess::draw() | ||
2704 | { | ||
2705 | refreshNames(); | ||
2706 | LLPanel::draw(); | ||
2707 | } | ||
2708 | |||
2709 | |||
2710 | void LLPanelLandAccess::onAccessLevelChange(LLUICtrl*, void *userdata) | ||
2711 | { | ||
2712 | LLPanelLandAccess::onCommitAny(NULL, userdata); | ||
2713 | } | ||
2714 | |||
2715 | // static | ||
2716 | void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) | ||
2717 | { | ||
2718 | LLPanelLandAccess *self = (LLPanelLandAccess *)userdata; | ||
2719 | |||
2720 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2721 | if (!parcel) | ||
2722 | { | ||
2723 | return; | ||
2724 | } | ||
2725 | |||
2726 | // Extract data from UI | ||
2727 | BOOL use_access_group = self->mCheckGroup->get(); | ||
2728 | BOOL use_access_list = self->mCheckAccess->get(); | ||
2729 | BOOL use_pass_list = self->mCheckPass->get(); | ||
2730 | |||
2731 | |||
2732 | |||
2733 | // Must be limiting access to sell passes | ||
2734 | if (!use_access_group && !use_access_list) | ||
2735 | { | ||
2736 | use_pass_list = FALSE; | ||
2737 | } | ||
2738 | |||
2739 | S32 pass_price = llfloor(self->mSpinPrice->get()); | ||
2740 | F32 pass_hours = self->mSpinHours->get(); | ||
2741 | |||
2742 | // Validate extracted data | ||
2743 | |||
2744 | // Push data into current parcel | ||
2745 | parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); | ||
2746 | parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list); | ||
2747 | parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list); | ||
2748 | |||
2749 | parcel->setPassPrice( pass_price ); | ||
2750 | parcel->setPassHours( pass_hours ); | ||
2751 | |||
2752 | // Send current parcel data upstream to server | ||
2753 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
2754 | |||
2755 | // Might have changed properties, so let's redraw! | ||
2756 | self->refresh(); | ||
2757 | } | ||
2758 | |||
2759 | // static | ||
2760 | void LLPanelLandAccess::onClickAdd(void* data) | ||
2761 | { | ||
2762 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; | ||
2763 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); | ||
2764 | } | ||
2765 | |||
2766 | // static | ||
2767 | void LLPanelLandAccess::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | ||
2768 | { | ||
2769 | LLPanelLandAccess* self = (LLPanelLandAccess*)userdata; | ||
2770 | if (names.empty() || ids.empty()) return; | ||
2771 | self->addAvatar(ids[0]); | ||
2772 | } | ||
2773 | |||
2774 | |||
2775 | void LLPanelLandAccess::addAvatar(LLUUID id) | ||
2776 | { | ||
2777 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2778 | if (!parcel) return; | ||
2779 | |||
2780 | parcel->addToAccessList(id, 0); | ||
2781 | |||
2782 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); | ||
2783 | |||
2784 | refresh(); | ||
2785 | } | ||
2786 | |||
2787 | |||
2788 | // static | ||
2789 | void LLPanelLandAccess::onClickRemove(void* data) | ||
2790 | { | ||
2791 | LLPanelLandAccess* self = (LLPanelLandAccess*)data; | ||
2792 | if (!self) return; | ||
2793 | |||
2794 | LLScrollListItem* item = self->mListAccess->getFirstSelected(); | ||
2795 | if (!item) return; | ||
2796 | |||
2797 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2798 | if (!parcel) return; | ||
2799 | |||
2800 | const LLUUID& agent_id = item->getUUID(); | ||
2801 | |||
2802 | parcel->removeFromAccessList(agent_id); | ||
2803 | |||
2804 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); | ||
2805 | |||
2806 | self->refresh(); | ||
2807 | } | ||
2808 | |||
2809 | |||
2810 | |||
2811 | //--------------------------------------------------------------------------- | ||
2812 | // LLPanelLandBan | ||
2813 | //--------------------------------------------------------------------------- | ||
2814 | LLPanelLandBan::LLPanelLandBan() | ||
2815 | : LLPanel("land_ban_panel") | ||
2816 | { | ||
2817 | |||
2818 | } | ||
2819 | |||
2820 | |||
2821 | |||
2822 | BOOL LLPanelLandBan::postBuild() | ||
2823 | { | ||
2824 | |||
2825 | mCheck = LLUICtrlFactory::getCheckBoxByName(this, "LandBanCheck"); | ||
2826 | childSetCommitCallback("LandBanCheck", onCommitAny, this); | ||
2827 | |||
2828 | mList = LLUICtrlFactory::getNameListByName(this, "LandBanList"); | ||
2829 | |||
2830 | mBtnAdd = LLUICtrlFactory::getButtonByName(this, "Add..."); | ||
2831 | |||
2832 | mBtnAdd->setClickedCallback(onClickAdd, this); | ||
2833 | |||
2834 | mBtnRemove = LLUICtrlFactory::getButtonByName(this, "Remove"); | ||
2835 | |||
2836 | mBtnRemove->setClickedCallback(onClickRemove, this); | ||
2837 | |||
2838 | mCheckDenyAnonymous = LLUICtrlFactory::getCheckBoxByName(this, "DenyAnonymousCheck"); | ||
2839 | childSetCommitCallback("DenyAnonymousCheck", onCommitAny, this); | ||
2840 | |||
2841 | mCheckDenyIdentified = LLUICtrlFactory::getCheckBoxByName(this, "DenyIdentifiedCheck"); | ||
2842 | childSetCommitCallback("DenyIdentifiedCheck", onCommitAny, this); | ||
2843 | |||
2844 | mCheckDenyTransacted = LLUICtrlFactory::getCheckBoxByName(this, "DenyTransactedCheck"); | ||
2845 | childSetCommitCallback("DenyTransactedCheck", onCommitAny, this); | ||
2846 | |||
2847 | return TRUE; | ||
2848 | |||
2849 | } | ||
2850 | |||
2851 | |||
2852 | LLPanelLandBan::~LLPanelLandBan() | ||
2853 | { } | ||
2854 | |||
2855 | void LLPanelLandBan::refresh() | ||
2856 | { | ||
2857 | mList->deleteAllItems(); | ||
2858 | |||
2859 | LLParcel *parcel = gParcelMgr->getSelectedParcel(); | ||
2860 | |||
2861 | if (parcel) | ||
2862 | { | ||
2863 | char label[256]; | ||
2864 | |||
2865 | // Display options | ||
2866 | |||
2867 | S32 count = parcel->mBanList.size(); | ||
2868 | |||
2869 | BOOL use_ban = parcel->getParcelFlag(PF_USE_BAN_LIST); | ||
2870 | mCheck->set( use_ban ); | ||
2871 | |||
2872 | sprintf(label, "Ban these avatars: (%d listed, %d max)", | ||
2873 | count, PARCEL_MAX_ACCESS_LIST); | ||
2874 | mCheck->setLabel( label ); | ||
2875 | |||
2876 | access_map_const_iterator cit = parcel->mBanList.begin(); | ||
2877 | access_map_const_iterator end = parcel->mBanList.end(); | ||
2878 | for ( ; cit != end; ++cit) | ||
2879 | { | ||
2880 | const LLAccessEntry& entry = (*cit).second; | ||
2881 | LLString suffix; | ||
2882 | if (entry.mTime != 0) | ||
2883 | { | ||
2884 | S32 now = time(NULL); | ||
2885 | S32 seconds = entry.mTime - now; | ||
2886 | if (seconds < 0) seconds = 0; | ||
2887 | suffix.assign(" ("); | ||
2888 | if (seconds >= 120) | ||
2889 | { | ||
2890 | char buf[30]; | ||
2891 | sprintf(buf, "%d minutes", (seconds/60)); | ||
2892 | suffix.append(buf); | ||
2893 | } | ||
2894 | else if (seconds >= 60) | ||
2895 | { | ||
2896 | suffix.append("1 minute"); | ||
2897 | } | ||
2898 | else | ||
2899 | { | ||
2900 | char buf[30]; | ||
2901 | sprintf(buf, "%d seconds", seconds); | ||
2902 | suffix.append(buf); | ||
2903 | } | ||
2904 | suffix.append(" remaining)"); | ||
2905 | } | ||
2906 | mList->addNameItem(entry.mID, ADD_BOTTOM, TRUE, suffix); | ||
2907 | } | ||
2908 | |||
2909 | BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); | ||
2910 | mCheck->setEnabled( can_manage_banned ); | ||
2911 | mCheckDenyAnonymous->setEnabled( FALSE ); | ||
2912 | mCheckDenyIdentified->setEnabled( FALSE ); | ||
2913 | mCheckDenyTransacted->setEnabled( FALSE ); | ||
2914 | |||
2915 | if(parcel->getRegionDenyAnonymousOverride()) | ||
2916 | { | ||
2917 | mCheckDenyAnonymous->set(TRUE); | ||
2918 | } | ||
2919 | else if(can_manage_banned) | ||
2920 | { | ||
2921 | mCheckDenyAnonymous->setEnabled(TRUE); | ||
2922 | mCheckDenyAnonymous->set(parcel->getParcelFlag(PF_DENY_ANONYMOUS)); | ||
2923 | } | ||
2924 | if(parcel->getRegionDenyIdentifiedOverride()) | ||
2925 | { | ||
2926 | mCheckDenyIdentified->set(TRUE); | ||
2927 | } | ||
2928 | else if(can_manage_banned) | ||
2929 | { | ||
2930 | mCheckDenyIdentified->setEnabled(TRUE); | ||
2931 | mCheckDenyIdentified->set(parcel->getParcelFlag(PF_DENY_IDENTIFIED)); | ||
2932 | } | ||
2933 | if(parcel->getRegionDenyTransactedOverride()) | ||
2934 | { | ||
2935 | mCheckDenyTransacted->set(TRUE); | ||
2936 | } | ||
2937 | else if(can_manage_banned) | ||
2938 | { | ||
2939 | mCheckDenyTransacted->setEnabled(TRUE); | ||
2940 | mCheckDenyTransacted->set(parcel->getParcelFlag(PF_DENY_TRANSACTED)); | ||
2941 | } | ||
2942 | |||
2943 | |||
2944 | BOOL enable_add = can_manage_banned && (count < PARCEL_MAX_ACCESS_LIST); | ||
2945 | mBtnAdd->setEnabled(enable_add); | ||
2946 | |||
2947 | BOOL enable_remove = can_manage_banned && (count > 0); | ||
2948 | mBtnRemove->setEnabled(enable_remove); | ||
2949 | } | ||
2950 | else | ||
2951 | { | ||
2952 | mCheck->set(FALSE); | ||
2953 | mCheck->setLabel("Ban these avatars:"); | ||
2954 | mCheck->setEnabled(FALSE); | ||
2955 | mBtnAdd->setEnabled(FALSE); | ||
2956 | mBtnRemove->setEnabled(FALSE); | ||
2957 | mCheckDenyAnonymous->set(FALSE); | ||
2958 | mCheckDenyAnonymous->setEnabled(FALSE); | ||
2959 | mCheckDenyIdentified->set(FALSE); | ||
2960 | mCheckDenyIdentified->setEnabled(FALSE); | ||
2961 | mCheckDenyTransacted->set(FALSE); | ||
2962 | mCheckDenyTransacted->setEnabled(FALSE); | ||
2963 | } | ||
2964 | } | ||
2965 | |||
2966 | // static | ||
2967 | void LLPanelLandBan::onCommitAny(LLUICtrl *ctrl, void *userdata) | ||
2968 | { | ||
2969 | LLPanelLandBan *self = (LLPanelLandBan*)userdata; | ||
2970 | |||
2971 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
2972 | if (!parcel) | ||
2973 | { | ||
2974 | return; | ||
2975 | } | ||
2976 | |||
2977 | // Extract data from UI | ||
2978 | BOOL use_ban_list = self->mCheck->get(); | ||
2979 | BOOL deny_access_anonymous = self->mCheckDenyAnonymous->get(); | ||
2980 | BOOL deny_access_identified = self->mCheckDenyIdentified->get(); | ||
2981 | BOOL deny_access_transacted = self->mCheckDenyTransacted->get(); | ||
2982 | |||
2983 | // Push data into current parcel | ||
2984 | parcel->setParcelFlag(PF_USE_BAN_LIST, use_ban_list); | ||
2985 | parcel->setParcelFlag(PF_DENY_ANONYMOUS, deny_access_anonymous); | ||
2986 | parcel->setParcelFlag(PF_DENY_IDENTIFIED, deny_access_identified); | ||
2987 | parcel->setParcelFlag(PF_DENY_TRANSACTED, deny_access_transacted); | ||
2988 | |||
2989 | // Send current parcel data upstream to server | ||
2990 | gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate ); | ||
2991 | |||
2992 | // Might have changed properties, so let's redraw! | ||
2993 | self->refresh(); | ||
2994 | } | ||
2995 | |||
2996 | // static | ||
2997 | void LLPanelLandBan::onClickAdd(void* data) | ||
2998 | { | ||
2999 | LLPanelLandBan* panelp = (LLPanelLandBan*)data; | ||
3000 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); | ||
3001 | } | ||
3002 | |||
3003 | // static | ||
3004 | void LLPanelLandBan::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | ||
3005 | { | ||
3006 | LLPanelLandBan* self = (LLPanelLandBan*)userdata; | ||
3007 | if (names.empty() || ids.empty()) return; | ||
3008 | self->addAvatar(ids[0]); | ||
3009 | } | ||
3010 | |||
3011 | |||
3012 | void LLPanelLandBan::addAvatar(LLUUID id) | ||
3013 | { | ||
3014 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
3015 | if (!parcel) return; | ||
3016 | |||
3017 | parcel->addToBanList(id, 0); | ||
3018 | |||
3019 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); | ||
3020 | |||
3021 | refresh(); | ||
3022 | } | ||
3023 | |||
3024 | |||
3025 | // static | ||
3026 | void LLPanelLandBan::onClickRemove(void* data) | ||
3027 | { | ||
3028 | LLPanelLandBan* self = (LLPanelLandBan*)data; | ||
3029 | if (!self) return; | ||
3030 | |||
3031 | LLScrollListItem* item = self->mList->getFirstSelected(); | ||
3032 | if (!item) return; | ||
3033 | |||
3034 | LLParcel* parcel = gParcelMgr->getSelectedParcel(); | ||
3035 | if (!parcel) return; | ||
3036 | |||
3037 | const LLUUID& agent_id = item->getUUID(); | ||
3038 | |||
3039 | parcel->removeFromBanList(agent_id); | ||
3040 | |||
3041 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); | ||
3042 | |||
3043 | self->refresh(); | ||
3044 | } | ||
3045 | |||
3046 | //--------------------------------------------------------------------------- | ||
3047 | // LLPanelLandRenters | ||
3048 | //--------------------------------------------------------------------------- | ||
3049 | LLPanelLandRenters::LLPanelLandRenters() | ||
3050 | : LLPanel("landrenters", LLRect(0,500,500,0)) | ||
3051 | { | ||
3052 | const S32 BTN_WIDTH = 64; | ||
3053 | |||
3054 | S32 x = LEFT; | ||
3055 | S32 y = mRect.getHeight() - VPAD; | ||
3056 | |||
3057 | LLCheckBoxCtrl* check = NULL; | ||
3058 | LLButton* btn = NULL; | ||
3059 | LLNameListCtrl* list = NULL; | ||
3060 | |||
3061 | check = new LLCheckBoxCtrl("RentersCheck", | ||
3062 | LLRect(RULER0, y, RIGHT, y-LINE), | ||
3063 | "Rent space to these avatars:"); | ||
3064 | addChild(check); | ||
3065 | mCheckRenters = check; | ||
3066 | |||
3067 | y -= VPAD + LINE; | ||
3068 | |||
3069 | const S32 ITEMS = 5; | ||
3070 | const BOOL NO_MULTIPLE_SELECT = FALSE; | ||
3071 | |||
3072 | list = new LLNameListCtrl("RentersList", | ||
3073 | LLRect(RULER05, y, RIGHT, y-LINE*ITEMS), | ||
3074 | NULL, NULL, | ||
3075 | NO_MULTIPLE_SELECT); | ||
3076 | list->addSimpleItem("foo tester"); | ||
3077 | list->addSimpleItem("bar tester"); | ||
3078 | list->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); | ||
3079 | addChild(list); | ||
3080 | mListRenters = list; | ||
3081 | |||
3082 | y -= VPAD + LINE*ITEMS; | ||
3083 | |||
3084 | x = RULER05; | ||
3085 | btn = new LLButton("Add...", | ||
3086 | LLRect(x, y, x+BTN_WIDTH, y-LINE), | ||
3087 | "", | ||
3088 | onClickAdd, this); | ||
3089 | btn->setFont( LLFontGL::sSansSerifSmall ); | ||
3090 | btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); | ||
3091 | addChild(btn); | ||
3092 | mBtnAddRenter = btn; | ||
3093 | |||
3094 | x += HPAD + BTN_WIDTH; | ||
3095 | |||
3096 | btn = new LLButton("Remove", | ||
3097 | LLRect(x, y, x+BTN_WIDTH, y-LINE), | ||
3098 | "", | ||
3099 | onClickRemove, this); | ||
3100 | btn->setFont( LLFontGL::sSansSerifSmall ); | ||
3101 | btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); | ||
3102 | addChild(btn); | ||
3103 | mBtnRemoveRenter = btn; | ||
3104 | } | ||
3105 | |||
3106 | LLPanelLandRenters::~LLPanelLandRenters() | ||
3107 | { } | ||
3108 | |||
3109 | void LLPanelLandRenters::refresh() | ||
3110 | { } | ||
3111 | |||
3112 | // static | ||
3113 | void LLPanelLandRenters::onClickAdd(void*) | ||
3114 | { | ||
3115 | } | ||
3116 | |||
3117 | // static | ||
3118 | void LLPanelLandRenters::onClickRemove(void*) | ||
3119 | { | ||
3120 | } | ||
3121 | |||
3122 | //--------------------------------------------------------------------------- | ||
3123 | // LLPanelLandCovenant | ||
3124 | //--------------------------------------------------------------------------- | ||
3125 | LLPanelLandCovenant::LLPanelLandCovenant() | ||
3126 | : LLPanel("land_covenant_panel") | ||
3127 | { | ||
3128 | } | ||
3129 | |||
3130 | LLPanelLandCovenant::~LLPanelLandCovenant() | ||
3131 | { | ||
3132 | } | ||
3133 | |||
3134 | BOOL LLPanelLandCovenant::postBuild() | ||
3135 | { | ||
3136 | refresh(); | ||
3137 | return TRUE; | ||
3138 | } | ||
3139 | |||
3140 | // virtual | ||
3141 | void LLPanelLandCovenant::refresh() | ||
3142 | { | ||
3143 | LLViewerRegion* region = gParcelMgr->getSelectionRegion(); | ||
3144 | if(!region) return; | ||
3145 | |||
3146 | LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text"); | ||
3147 | if (region_name) | ||
3148 | { | ||
3149 | region_name->setText(region->getName()); | ||
3150 | } | ||
3151 | |||
3152 | LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause"); | ||
3153 | if (resellable_clause) | ||
3154 | { | ||
3155 | if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) | ||
3156 | { | ||
3157 | resellable_clause->setText(childGetText("can_not_resell")); | ||
3158 | } | ||
3159 | else | ||
3160 | { | ||
3161 | resellable_clause->setText(childGetText("can_resell")); | ||
3162 | } | ||
3163 | } | ||
3164 | |||
3165 | LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause"); | ||
3166 | if (changeable_clause) | ||
3167 | { | ||
3168 | if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) | ||
3169 | { | ||
3170 | changeable_clause->setText(childGetText("can_change")); | ||
3171 | } | ||
3172 | else | ||
3173 | { | ||
3174 | changeable_clause->setText(childGetText("can_not_change")); | ||
3175 | } | ||
3176 | } | ||
3177 | |||
3178 | // send EstateCovenantInfo message | ||
3179 | LLMessageSystem *msg = gMessageSystem; | ||
3180 | msg->newMessage("EstateCovenantRequest"); | ||
3181 | msg->nextBlockFast(_PREHASH_AgentData); | ||
3182 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
3183 | msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); | ||
3184 | msg->sendReliable(region->getHost()); | ||
3185 | } | ||
3186 | |||
3187 | // static | ||
3188 | void LLPanelLandCovenant::updateCovenantText(const std::string &string) | ||
3189 | { | ||
3190 | LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); | ||
3191 | if (self) | ||
3192 | { | ||
3193 | LLViewerTextEditor* editor = (LLViewerTextEditor*)self->getChildByName("covenant_editor"); | ||
3194 | if (editor) | ||
3195 | { | ||
3196 | editor->setHandleEditKeysDirectly(TRUE); | ||
3197 | editor->setText(string); | ||
3198 | } | ||
3199 | } | ||
3200 | } | ||
3201 | |||
3202 | // static | ||
3203 | void LLPanelLandCovenant::updateEstateName(const std::string& name) | ||
3204 | { | ||
3205 | LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); | ||
3206 | if (self) | ||
3207 | { | ||
3208 | LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_name_text"); | ||
3209 | if (editor) editor->setText(name); | ||
3210 | } | ||
3211 | } | ||
3212 | |||
3213 | // static | ||
3214 | void LLPanelLandCovenant::updateLastModified(const std::string& text) | ||
3215 | { | ||
3216 | LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); | ||
3217 | if (self) | ||
3218 | { | ||
3219 | LLTextBox* editor = (LLTextBox*)self->getChildByName("covenant_timestamp_text"); | ||
3220 | if (editor) editor->setText(text); | ||
3221 | } | ||
3222 | } | ||
3223 | |||
3224 | // static | ||
3225 | void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) | ||
3226 | { | ||
3227 | LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); | ||
3228 | if (self) | ||
3229 | { | ||
3230 | LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_owner_text"); | ||
3231 | if (editor) editor->setText(name); | ||
3232 | } | ||
3233 | } | ||