00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llfloaterland.h"
00035
00036 #include "llcachename.h"
00037 #include "llfocusmgr.h"
00038 #include "llparcel.h"
00039 #include "message.h"
00040
00041 #include "llagent.h"
00042 #include "llfloateravatarpicker.h"
00043 #include "llbutton.h"
00044 #include "llcheckboxctrl.h"
00045 #include "llradiogroup.h"
00046 #include "llcombobox.h"
00047 #include "llfloaterauction.h"
00048 #include "llfloateravatarinfo.h"
00049 #include "llfloatergroups.h"
00050 #include "llfloatergroupinfo.h"
00051 #include "lllineeditor.h"
00052 #include "llnamelistctrl.h"
00053 #include "llnotify.h"
00054 #include "llpanellandmedia.h"
00055 #include "llradiogroup.h"
00056 #include "llscrolllistctrl.h"
00057 #include "llselectmgr.h"
00058 #include "llspinctrl.h"
00059 #include "lltabcontainer.h"
00060 #include "lltextbox.h"
00061 #include "lltexturectrl.h"
00062 #include "lluiconstants.h"
00063 #include "lluictrlfactory.h"
00064 #include "llviewermessage.h"
00065 #include "llviewerparcelmgr.h"
00066 #include "llviewerregion.h"
00067 #include "llviewerstats.h"
00068 #include "llviewertexteditor.h"
00069 #include "llviewerwindow.h"
00070 #include "llviewercontrol.h"
00071 #include "roles_constants.h"
00072
00073 #include <sstream>
00074 #include <time.h>
00075
00076 static const S32 EDIT_HEIGHT = 16;
00077 static const S32 LEFT = HPAD;
00078 static const S32 BOTTOM = VPAD;
00079 static const S32 RULER0 = LEFT;
00080 static const S32 RULER05 = RULER0 + 24;
00081 static const S32 RULER1 = RULER05 + 16;
00082 static const S32 RULER15 = RULER1 + 20;
00083 static const S32 RULER2 = RULER1 + 32;
00084 static const S32 RULER205= RULER2 + 32;
00085 static const S32 RULER20 = RULER2 + 64;
00086 static const S32 RULER21 = RULER20 + 16;
00087 static const S32 RULER22 = RULER21 + 32;
00088 static const S32 RULER225 = RULER20 + 64;
00089 static const S32 RULER23 = RULER22 + 64;
00090 static const S32 RULER24 = RULER23 + 26;
00091 static const S32 RULER3 = RULER2 + 102;
00092 static const S32 RULER4 = RULER3 + 8;
00093 static const S32 RULER5 = RULER4 + 50;
00094 static const S32 RULER6 = RULER5 + 52;
00095 static const S32 RULER7 = RULER6 + 24;
00096 static const S32 RIGHT = LEFT + 278;
00097 static const S32 FAR_RIGHT = LEFT + 324 + 40;
00098
00099 static const char PRICE[] = "Price:";
00100 static const char NO_PRICE[] = "";
00101 static const char AREA[] = "Area:";
00102
00103 static const char OWNER_ONLINE[] = "0";
00104 static const char OWNER_OFFLINE[] = "1";
00105 static const char OWNER_GROUP[] = "2";
00106
00107
00108 static const BOOL BUY_GROUP_LAND = TRUE;
00109 static const BOOL BUY_PERSONAL_LAND = FALSE;
00110
00111
00112 LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
00113 S32 LLFloaterLand::sLastTab = 0;
00114
00115 LLHandle<LLFloater> LLPanelLandGeneral::sBuyPassDialogHandle;
00116
00117
00118 class LLParcelSelectionObserver : public LLParcelObserver
00119 {
00120 public:
00121 virtual void changed() { LLFloaterLand::refreshAll(); }
00122 };
00123
00124
00125
00126
00127
00128 void send_parcel_select_objects(S32 parcel_local_id, S32 return_type,
00129 uuid_list_t* return_ids = NULL)
00130 {
00131 LLMessageSystem *msg = gMessageSystem;
00132
00133 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
00134 if (!region) return;
00135
00136
00137
00138 LLSelectMgr::getInstance()->unhighlightAll();
00139
00140 msg->newMessageFast(_PREHASH_ParcelSelectObjects);
00141 msg->nextBlockFast(_PREHASH_AgentData);
00142 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
00143 msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
00144 msg->nextBlockFast(_PREHASH_ParcelData);
00145 msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
00146 msg->addS32Fast(_PREHASH_ReturnType, return_type);
00147
00148
00149
00150 if (return_ids)
00151 {
00152 uuid_list_t::iterator end = return_ids->end();
00153 for (uuid_list_t::iterator it = return_ids->begin();
00154 it != end;
00155 ++it)
00156 {
00157 msg->nextBlockFast(_PREHASH_ReturnIDs);
00158 msg->addUUIDFast(_PREHASH_ReturnID, (*it));
00159 }
00160 }
00161 else
00162 {
00163
00164 msg->nextBlockFast(_PREHASH_ReturnIDs);
00165 msg->addUUIDFast(_PREHASH_ReturnID, LLUUID::null);
00166 }
00167
00168 msg->sendReliable(region->getHost());
00169 }
00170
00171
00172
00173 LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects()
00174 {
00175 return LLFloaterLand::getInstance()->mPanelObjects;
00176 }
00177
00178
00179 LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
00180 {
00181 return LLFloaterLand::getInstance()->mPanelCovenant;
00182 }
00183
00184
00185 void LLFloaterLand::refreshAll()
00186 {
00187 LLFloaterLand::getInstance()->refresh();
00188 }
00189
00190 void LLFloaterLand::onOpen()
00191 {
00192
00193
00194
00195
00196 mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
00197
00198
00199
00200 refresh();
00201 }
00202
00203
00204
00205 void LLFloaterLand::onClose(bool app_quitting)
00206 {
00207 LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
00208 delete sObserver;
00209 sObserver = NULL;
00210
00211
00212 LLSelectMgr::getInstance()->unhighlightAll();
00213
00214
00215 sLastTab = mTabLand->getCurrentPanelIndex();
00216
00217 destroy();
00218 }
00219
00220
00221 LLFloaterLand::LLFloaterLand(const LLSD& seed)
00222 : LLFloater("floaterland", "FloaterLandRect5", "About Land")
00223 {
00224
00225
00226 std::map<LLString, LLCallbackMap> factory_map;
00227 factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this);
00228
00229
00230 factory_map["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this);
00231 factory_map["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this);
00232 factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this);
00233 factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
00234 factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
00235
00236 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", &factory_map, false);
00237
00238 sObserver = new LLParcelSelectionObserver();
00239 LLViewerParcelMgr::getInstance()->addObserver( sObserver );
00240 }
00241
00242 BOOL LLFloaterLand::postBuild()
00243 {
00244 LLTabContainer* tab = getChild<LLTabContainer>("landtab");
00245
00246 mTabLand = (LLTabContainer*) tab;
00247
00248 if (tab)
00249 {
00250 tab->selectTab(sLastTab);
00251 }
00252
00253 return TRUE;
00254 }
00255
00256
00257
00258 LLFloaterLand::~LLFloaterLand()
00259 {
00260 }
00261
00262
00263 void LLFloaterLand::refresh()
00264 {
00265 mPanelGeneral->refresh();
00266 mPanelObjects->refresh();
00267 mPanelOptions->refresh();
00268 mPanelMedia->refresh();
00269 mPanelAccess->refresh();
00270 }
00271
00272
00273
00274 void* LLFloaterLand::createPanelLandGeneral(void* data)
00275 {
00276 LLFloaterLand* self = (LLFloaterLand*)data;
00277 self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel);
00278 return self->mPanelGeneral;
00279 }
00280
00281
00282 void* LLFloaterLand::createPanelLandCovenant(void* data)
00283 {
00284 LLFloaterLand* self = (LLFloaterLand*)data;
00285 self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel);
00286 return self->mPanelCovenant;
00287 }
00288
00289
00290
00291 void* LLFloaterLand::createPanelLandObjects(void* data)
00292 {
00293 LLFloaterLand* self = (LLFloaterLand*)data;
00294 self->mPanelObjects = new LLPanelLandObjects(self->mParcel);
00295 return self->mPanelObjects;
00296 }
00297
00298
00299 void* LLFloaterLand::createPanelLandOptions(void* data)
00300 {
00301 LLFloaterLand* self = (LLFloaterLand*)data;
00302 self->mPanelOptions = new LLPanelLandOptions(self->mParcel);
00303 return self->mPanelOptions;
00304 }
00305
00306
00307 void* LLFloaterLand::createPanelLandMedia(void* data)
00308 {
00309 LLFloaterLand* self = (LLFloaterLand*)data;
00310 self->mPanelMedia = new LLPanelLandMedia(self->mParcel);
00311 return self->mPanelMedia;
00312 }
00313
00314
00315 void* LLFloaterLand::createPanelLandAccess(void* data)
00316 {
00317 LLFloaterLand* self = (LLFloaterLand*)data;
00318 self->mPanelAccess = new LLPanelLandAccess(self->mParcel);
00319 return self->mPanelAccess;
00320 }
00321
00322
00323
00324
00325
00326
00327 LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel)
00328 : LLPanel("land_general_panel"),
00329 mUncheckedSell(FALSE),
00330 mParcel(parcel)
00331 {
00332 }
00333
00334 BOOL LLPanelLandGeneral::postBuild()
00335 {
00336
00337 mEditName = getChild<LLLineEditor>("Name");
00338 mEditName->setCommitCallback(onCommitAny);
00339 childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe);
00340 childSetUserData("Name", this);
00341
00342 mEditDesc = getChild<LLTextEditor>("Description");
00343 mEditDesc->setCommitOnFocusLost(TRUE);
00344 mEditDesc->setCommitCallback(onCommitAny);
00345 childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe);
00346 childSetUserData("Description", this);
00347
00348
00349 mTextSalePending = getChild<LLTextBox>("SalePending");
00350 mTextOwnerLabel = getChild<LLTextBox>("Owner:");
00351 mTextOwner = getChild<LLTextBox>("OwnerText");
00352
00353
00354 mBtnProfile = getChild<LLButton>("Profile...");
00355 mBtnProfile->setClickedCallback(onClickProfile, this);
00356
00357
00358 mTextGroupLabel = getChild<LLTextBox>("Group:");
00359 mTextGroup = getChild<LLTextBox>("GroupText");
00360
00361
00362 mBtnSetGroup = getChild<LLButton>("Set...");
00363 mBtnSetGroup->setClickedCallback(onClickSetGroup, this);
00364
00365
00366
00367 mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed");
00368 childSetCommitCallback("check deed", onCommitAny, this);
00369
00370
00371 mBtnDeedToGroup = getChild<LLButton>("Deed...");
00372 mBtnDeedToGroup->setClickedCallback(onClickDeed, this);
00373
00374
00375 mCheckContributeWithDeed = getChild<LLCheckBoxCtrl>( "check contrib");
00376 childSetCommitCallback("check contrib", onCommitAny, this);
00377
00378
00379
00380 mSaleInfoNotForSale = getChild<LLTextBox>("Not for sale.");
00381
00382 mSaleInfoForSale1 = getChild<LLTextBox>("For Sale: Price L$[PRICE].");
00383
00384
00385 mBtnSellLand = getChild<LLButton>("Sell Land...");
00386 mBtnSellLand->setClickedCallback(onClickSellLand, this);
00387
00388 mSaleInfoForSale2 = getChild<LLTextBox>("For sale to");
00389
00390 mSaleInfoForSaleObjects = getChild<LLTextBox>("Sell with landowners objects in parcel.");
00391
00392 mSaleInfoForSaleNoObjects = getChild<LLTextBox>("Selling with no objects in parcel.");
00393
00394
00395 mBtnStopSellLand = getChild<LLButton>("Cancel Land Sale");
00396 mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this);
00397
00398
00399 mTextClaimDateLabel = getChild<LLTextBox>("Claimed:");
00400 mTextClaimDate = getChild<LLTextBox>("DateClaimText");
00401
00402
00403 mTextPriceLabel = getChild<LLTextBox>("PriceLabel");
00404 mTextPrice = getChild<LLTextBox>("PriceText");
00405
00406
00407 mTextDwell = getChild<LLTextBox>("DwellText");
00408
00409
00410 mBtnBuyLand = getChild<LLButton>("Buy Land...");
00411 mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND);
00412
00413 mBtnBuyGroupLand = getChild<LLButton>("Buy For Group...");
00414 mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND);
00415
00416
00417 mBtnBuyPass = getChild<LLButton>("Buy Pass...");
00418 mBtnBuyPass->setClickedCallback(onClickBuyPass, this);
00419
00420 mBtnReleaseLand = getChild<LLButton>("Abandon Land...");
00421 mBtnReleaseLand->setClickedCallback(onClickRelease, NULL);
00422
00423 mBtnReclaimLand = getChild<LLButton>("Reclaim Land...");
00424 mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL);
00425
00426 mBtnStartAuction = getChild<LLButton>("Linden Sale...");
00427 mBtnStartAuction->setClickedCallback(onClickStartAuction, NULL);
00428
00429 return TRUE;
00430 }
00431
00432
00433
00434 LLPanelLandGeneral::~LLPanelLandGeneral()
00435 { }
00436
00437
00438
00439 void LLPanelLandGeneral::refresh()
00440 {
00441 mBtnStartAuction->setVisible(gAgent.isGodlike());
00442
00443 LLParcel *parcel = mParcel->getParcel();
00444 bool region_owner = false;
00445 LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
00446 if(regionp && (regionp->getOwner() == gAgent.getID()))
00447 {
00448 region_owner = true;
00449 mBtnReleaseLand->setVisible(FALSE);
00450 mBtnReclaimLand->setVisible(TRUE);
00451 }
00452 else
00453 {
00454 mBtnReleaseLand->setVisible(TRUE);
00455 mBtnReclaimLand->setVisible(FALSE);
00456 }
00457 if (!parcel)
00458 {
00459
00460 mEditName->setEnabled(FALSE);
00461 mEditName->setText(LLString::null);
00462
00463 mEditDesc->setEnabled(FALSE);
00464 mEditDesc->setText(LLString::null);
00465
00466 mTextSalePending->setText(LLString::null);
00467 mTextSalePending->setEnabled(FALSE);
00468
00469 mBtnDeedToGroup->setEnabled(FALSE);
00470 mBtnSetGroup->setEnabled(FALSE);
00471 mBtnStartAuction->setEnabled(FALSE);
00472
00473 mCheckDeedToGroup ->set(FALSE);
00474 mCheckDeedToGroup ->setEnabled(FALSE);
00475 mCheckContributeWithDeed->set(FALSE);
00476 mCheckContributeWithDeed->setEnabled(FALSE);
00477
00478 mTextOwner->setText(LLString::null);
00479 mBtnProfile->setLabel(getString("profile_text"));
00480 mBtnProfile->setEnabled(FALSE);
00481
00482 mTextClaimDate->setText(LLString::null);
00483 mTextGroup->setText(LLString::null);
00484 mTextPrice->setText(LLString::null);
00485
00486 mSaleInfoForSale1->setVisible(FALSE);
00487 mSaleInfoForSale2->setVisible(FALSE);
00488 mSaleInfoForSaleObjects->setVisible(FALSE);
00489 mSaleInfoForSaleNoObjects->setVisible(FALSE);
00490 mSaleInfoNotForSale->setVisible(FALSE);
00491 mBtnSellLand->setVisible(FALSE);
00492 mBtnStopSellLand->setVisible(FALSE);
00493
00494 mTextPriceLabel->setText(LLString::null);
00495 mTextDwell->setText(LLString::null);
00496
00497 mBtnBuyLand->setEnabled(FALSE);
00498 mBtnBuyGroupLand->setEnabled(FALSE);
00499 mBtnReleaseLand->setEnabled(FALSE);
00500 mBtnReclaimLand->setEnabled(FALSE);
00501 mBtnBuyPass->setEnabled(FALSE);
00502 }
00503 else
00504 {
00505
00506 BOOL is_leased = (LLParcel::OS_LEASED == parcel->getOwnershipStatus());
00507 BOOL region_xfer = FALSE;
00508 if(regionp
00509 && !(regionp->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL))
00510 {
00511 region_xfer = TRUE;
00512 }
00513
00514
00515 BOOL estate_manager_sellable = !parcel->getAuctionID()
00516 && gAgent.canManageEstate()
00517
00518 && regionp
00519 && (parcel->getOwnerID() == regionp->getOwner());
00520 BOOL owner_sellable = region_xfer && !parcel->getAuctionID()
00521 && LLViewerParcelMgr::isParcelModifiableByAgent(
00522 parcel, GP_LAND_SET_SALE_INFO);
00523 BOOL can_be_sold = owner_sellable || estate_manager_sellable;
00524
00525 const LLUUID &owner_id = parcel->getOwnerID();
00526 BOOL is_public = parcel->isPublic();
00527
00528
00529 if (is_public)
00530 {
00531 mTextSalePending->setText(LLString::null);
00532 mTextSalePending->setEnabled(FALSE);
00533 mTextOwner->setText(getString("public_text"));
00534 mTextOwner->setEnabled(FALSE);
00535 mBtnProfile->setEnabled(FALSE);
00536 mTextClaimDate->setText(LLString::null);
00537 mTextClaimDate->setEnabled(FALSE);
00538 mTextGroup->setText(getString("none_text"));
00539 mTextGroup->setEnabled(FALSE);
00540 mBtnStartAuction->setEnabled(FALSE);
00541 }
00542 else
00543 {
00544 if(!is_leased && (owner_id == gAgent.getID()))
00545 {
00546 mTextSalePending->setText(getString("need_tier_to_modify"));
00547 mTextSalePending->setEnabled(TRUE);
00548 }
00549 else if(parcel->getAuctionID())
00550 {
00551 mTextSalePending->setText(getString("auction_id_text"));
00552 mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
00553 mTextSalePending->setEnabled(TRUE);
00554 }
00555 else
00556 {
00557
00558 mTextSalePending->setText(LLString::null);
00559 mTextSalePending->setEnabled(FALSE);
00560 }
00561
00562 mTextOwner->setEnabled(TRUE);
00563
00564
00565 mBtnProfile->setEnabled(TRUE);
00566
00567 if (parcel->getGroupID().isNull())
00568 {
00569
00570 mBtnProfile->setLabel(getString("profile_text"));
00571
00572 mTextGroup->setText(getString("none_text"));
00573 mTextGroup->setEnabled(FALSE);
00574 }
00575 else
00576 {
00577
00578 mBtnProfile->setLabel(getString("info_text"));
00579
00580
00581 mTextGroup->setEnabled(TRUE);
00582 }
00583
00584
00585
00586 time_t claim_date = parcel->getClaimDate();
00587 char time_buf[TIME_STR_LENGTH];
00588 mTextClaimDate->setText(LLString(formatted_time(claim_date, time_buf)));
00589 mTextClaimDate->setEnabled(is_leased);
00590
00591 BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON)
00592 && (owner_id == GOVERNOR_LINDEN_ID)
00593 && (parcel->getAuctionID() == 0);
00594 mBtnStartAuction->setEnabled(enable_auction);
00595 }
00596
00597
00598 BOOL can_edit_identity = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
00599 mEditName->setEnabled(can_edit_identity);
00600 mEditDesc->setEnabled(can_edit_identity);
00601
00602 BOOL can_edit_agent_only = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_NO_POWERS);
00603 mBtnSetGroup->setEnabled(can_edit_agent_only && !parcel->getIsGroupOwned());
00604
00605 const LLUUID& group_id = parcel->getGroupID();
00606
00607
00608 BOOL enable_deed = (owner_id == gAgent.getID()
00609 && group_id.notNull()
00610 && gAgent.isInGroup(group_id));
00611
00612
00613 mCheckDeedToGroup->setEnabled(enable_deed);
00614 mCheckDeedToGroup->set( parcel->getAllowDeedToGroup() );
00615 mCheckContributeWithDeed->setEnabled(enable_deed && parcel->getAllowDeedToGroup());
00616 mCheckContributeWithDeed->set(parcel->getContributeWithDeed());
00617
00618
00619
00620 BOOL can_deed = gAgent.hasPowerInGroup(group_id, GP_LAND_DEED);
00621 mBtnDeedToGroup->setEnabled( parcel->getAllowDeedToGroup()
00622 && group_id.notNull()
00623 && can_deed
00624 && !parcel->getIsGroupOwned()
00625 );
00626
00627 mEditName->setText( parcel->getName() );
00628 mEditDesc->setText( parcel->getDesc() );
00629
00630 BOOL for_sale = parcel->getForSale();
00631
00632 mBtnSellLand->setVisible(FALSE);
00633 mBtnStopSellLand->setVisible(FALSE);
00634
00635 if (for_sale)
00636 {
00637 mSaleInfoForSale1->setVisible(TRUE);
00638 mSaleInfoForSale2->setVisible(TRUE);
00639 if (parcel->getSellWithObjects())
00640 {
00641 mSaleInfoForSaleObjects->setVisible(TRUE);
00642 mSaleInfoForSaleNoObjects->setVisible(FALSE);
00643 }
00644 else
00645 {
00646 mSaleInfoForSaleObjects->setVisible(FALSE);
00647 mSaleInfoForSaleNoObjects->setVisible(TRUE);
00648 }
00649 mSaleInfoNotForSale->setVisible(FALSE);
00650 mSaleInfoForSale1->setTextArg("[PRICE]", llformat("%d", parcel->getSalePrice()));
00651 if (can_be_sold)
00652 {
00653 mBtnStopSellLand->setVisible(TRUE);
00654 }
00655 }
00656 else
00657 {
00658 mSaleInfoForSale1->setVisible(FALSE);
00659 mSaleInfoForSale2->setVisible(FALSE);
00660 mSaleInfoForSaleObjects->setVisible(FALSE);
00661 mSaleInfoForSaleNoObjects->setVisible(FALSE);
00662 mSaleInfoNotForSale->setVisible(TRUE);
00663 if (can_be_sold)
00664 {
00665 mBtnSellLand->setVisible(TRUE);
00666 }
00667 }
00668
00669 refreshNames();
00670
00671 mBtnBuyLand->setEnabled(
00672 LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false));
00673 mBtnBuyGroupLand->setEnabled(
00674 LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, true));
00675
00676
00677 S32 area;
00678 S32 claim_price;
00679 S32 rent_price;
00680 F32 dwell;
00681 LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
00682 &claim_price,
00683 &rent_price,
00684 &for_sale,
00685 &dwell);
00686
00687
00688 LLUIString price = getString("area_size_text");
00689 price.setArg("[AREA]", llformat("%d",area));
00690 mTextPriceLabel->setText(getString("area_text"));
00691 mTextPrice->setText(price.getString());
00692
00693 mTextDwell->setText(llformat("%.0f", dwell));
00694
00695 if(region_owner)
00696 {
00697 mBtnReclaimLand->setEnabled(
00698 !is_public && (parcel->getOwnerID() != gAgent.getID()));
00699 }
00700 else
00701 {
00702 BOOL is_owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
00703 BOOL is_manager_release = (gAgent.canManageEstate() &&
00704 regionp &&
00705 (parcel->getOwnerID() != regionp->getOwner()));
00706 BOOL can_release = is_owner_release || is_manager_release;
00707 mBtnReleaseLand->setEnabled( can_release );
00708 }
00709
00710 BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();;
00711 mBtnBuyPass->setEnabled(use_pass);
00712 }
00713 }
00714
00715
00716 void LLPanelLandGeneral::refreshNames()
00717 {
00718 LLParcel *parcel = mParcel->getParcel();
00719 if (!parcel)
00720 {
00721 mTextOwner->setText(LLString::null);
00722 return;
00723 }
00724
00725 LLString owner;
00726 if (parcel->getIsGroupOwned())
00727 {
00728 owner = getString("group_owned_text");
00729 }
00730 else
00731 {
00732
00733 gCacheName->getFullName(parcel->getOwnerID(), owner);
00734 }
00735
00736 if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
00737 {
00738 owner += getString("sale_pending_text");
00739 }
00740 mTextOwner->setText(owner);
00741
00742 LLString group;
00743 if(!parcel->getGroupID().isNull())
00744 {
00745 gCacheName->getGroupName(parcel->getGroupID(), group);
00746 }
00747 mTextGroup->setText(group);
00748
00749 const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
00750 if(auth_buyer_id.notNull())
00751 {
00752 LLString name;
00753 gCacheName->getFullName(auth_buyer_id, name);
00754 mSaleInfoForSale2->setTextArg("[BUYER]", name);
00755 }
00756 else
00757 {
00758 mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
00759 }
00760 }
00761
00762
00763
00764 void LLPanelLandGeneral::draw()
00765 {
00766 refreshNames();
00767 LLPanel::draw();
00768 }
00769
00770
00771 void LLPanelLandGeneral::onClickSetGroup(void* userdata)
00772 {
00773 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata;
00774 LLFloaterGroupPicker* fg;
00775
00776 LLFloater* parent_floater = gFloaterView->getParentFloater(panelp);
00777
00778 fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID()));
00779 fg->setSelectCallback( cbGroupID, userdata );
00780
00781 if (parent_floater)
00782 {
00783 LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
00784 fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
00785 parent_floater->addDependentFloater(fg);
00786 }
00787 }
00788
00789
00790 void LLPanelLandGeneral::onClickProfile(void* data)
00791 {
00792 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00793 LLParcel* parcel = panelp->mParcel->getParcel();
00794 if (!parcel) return;
00795
00796 if (parcel->getIsGroupOwned())
00797 {
00798 const LLUUID& group_id = parcel->getGroupID();
00799 LLFloaterGroupInfo::showFromUUID(group_id);
00800 }
00801 else
00802 {
00803 const LLUUID& avatar_id = parcel->getOwnerID();
00804 LLFloaterAvatarInfo::showFromObject(avatar_id);
00805 }
00806 }
00807
00808
00809 void LLPanelLandGeneral::cbGroupID(LLUUID group_id, void* userdata)
00810 {
00811 LLPanelLandGeneral* self = (LLPanelLandGeneral*)userdata;
00812 self->setGroup(group_id);
00813 }
00814
00815
00816 void LLPanelLandGeneral::setGroup(const LLUUID& group_id)
00817 {
00818 LLParcel* parcel = mParcel->getParcel();
00819 if (!parcel) return;
00820
00821
00822 parcel->setGroupID(group_id);
00823
00824
00825
00826
00827 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
00828
00829
00830 refresh();
00831 }
00832
00833
00834 void LLPanelLandGeneral::onClickBuyLand(void* data)
00835 {
00836 BOOL* for_group = (BOOL*)data;
00837 LLViewerParcelMgr::getInstance()->startBuyLand(*for_group);
00838 }
00839
00840 BOOL LLPanelLandGeneral::enableDeedToGroup(void* data)
00841 {
00842 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00843 LLParcel* parcel = panelp->mParcel->getParcel();
00844 return (parcel != NULL) && (parcel->getParcelFlag(PF_ALLOW_DEED_TO_GROUP));
00845 }
00846
00847
00848 void LLPanelLandGeneral::onClickDeed(void*)
00849 {
00850
00851
00852
00853 LLViewerParcelMgr::getInstance()->startDeedLandToGroup();
00854
00855 }
00856
00857
00858 void LLPanelLandGeneral::onClickRelease(void*)
00859 {
00860 LLViewerParcelMgr::getInstance()->startReleaseLand();
00861 }
00862
00863
00864 void LLPanelLandGeneral::onClickReclaim(void*)
00865 {
00866 lldebugs << "LLPanelLandGeneral::onClickReclaim()" << llendl;
00867 LLViewerParcelMgr::getInstance()->reclaimParcel();
00868 }
00869
00870
00871 BOOL LLPanelLandGeneral::enableBuyPass(void* data)
00872 {
00873 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00874 LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
00875 return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned());
00876 }
00877
00878
00879
00880 void LLPanelLandGeneral::onClickBuyPass(void* data)
00881 {
00882 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00883 LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
00884
00885 if (!parcel) return;
00886
00887 S32 pass_price = parcel->getPassPrice();
00888 LLString parcel_name = parcel->getName();
00889 F32 pass_hours = parcel->getPassHours();
00890
00891 char cost[256], time[256];
00892 snprintf(cost, sizeof(cost), "%d", pass_price);
00893 snprintf(time, sizeof(time), "%.2f", pass_hours);
00894
00895 LLStringBase<char>::format_map_t args;
00896 args["[COST]"] = cost;
00897 args["[PARCEL_NAME]"] = parcel_name;
00898 args["[TIME]"] = time;
00899
00900 sBuyPassDialogHandle = gViewerWindow->alertXml("LandBuyPass", args, cbBuyPass)->getHandle();
00901 }
00902
00903
00904 void LLPanelLandGeneral::onClickStartAuction(void* data)
00905 {
00906 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00907 LLParcel* parcelp = panelp->mParcel->getParcel();
00908 if(parcelp)
00909 {
00910 if(parcelp->getForSale())
00911 {
00912 gViewerWindow->alertXml("CannotStartAuctionAlreadForSale");
00913 }
00914 else
00915 {
00916 LLFloaterAuction::show();
00917 }
00918 }
00919 }
00920
00921
00922 void LLPanelLandGeneral::cbBuyPass(S32 option, void* data)
00923 {
00924 if (0 == option)
00925 {
00926
00927 LLViewerParcelMgr::getInstance()->buyPass();
00928 }
00929 }
00930
00931
00932 BOOL LLPanelLandGeneral::buyPassDialogVisible()
00933 {
00934 return sBuyPassDialogHandle.get() != NULL;
00935 }
00936
00937
00938 void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata)
00939 {
00940 LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)userdata;
00941
00942 LLParcel* parcel = panelp->mParcel->getParcel();
00943 if (!parcel)
00944 {
00945 return;
00946 }
00947
00948
00949 std::string name = panelp->mEditName->getText();
00950 std::string desc = panelp->mEditDesc->getText();
00951
00952
00953
00954
00955 parcel->setName(name.c_str());
00956 parcel->setDesc(desc.c_str());
00957
00958 BOOL allow_deed_to_group= panelp->mCheckDeedToGroup->get();
00959 BOOL contribute_with_deed = panelp->mCheckContributeWithDeed->get();
00960
00961 parcel->setParcelFlag(PF_ALLOW_DEED_TO_GROUP, allow_deed_to_group);
00962 parcel->setContributeWithDeed(contribute_with_deed);
00963
00964
00965 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
00966
00967
00968 panelp->refresh();
00969 }
00970
00971
00972 void LLPanelLandGeneral::onClickSellLand(void* data)
00973 {
00974 LLViewerParcelMgr::getInstance()->startSellLand();
00975 }
00976
00977
00978 void LLPanelLandGeneral::onClickStopSellLand(void* data)
00979 {
00980 LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
00981 LLParcel* parcel = panelp->mParcel->getParcel();
00982
00983 parcel->setParcelFlag(PF_FOR_SALE, FALSE);
00984 parcel->setSalePrice(0);
00985 parcel->setAuthorizedBuyerID(LLUUID::null);
00986
00987 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
00988 }
00989
00990
00991
00992
00993 LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel)
00994 : LLPanel("land_objects_panel"), mParcel(parcel)
00995 {
00996 }
00997
00998
00999
01000 BOOL LLPanelLandObjects::postBuild()
01001 {
01002
01003 mFirstReply = TRUE;
01004 mParcelObjectBonus = getChild<LLTextBox>("parcel_object_bonus");
01005 mSWTotalObjects = getChild<LLTextBox>("objects_available");
01006 mObjectContribution = getChild<LLTextBox>("object_contrib_text");
01007 mTotalObjects = getChild<LLTextBox>("total_objects_text");
01008 mOwnerObjects = getChild<LLTextBox>("owner_objects_text");
01009
01010 mBtnShowOwnerObjects = getChild<LLButton>("ShowOwner");
01011 mBtnShowOwnerObjects->setClickedCallback(onClickShowOwnerObjects, this);
01012
01013 mBtnReturnOwnerObjects = getChild<LLButton>("ReturnOwner...");
01014 mBtnReturnOwnerObjects->setClickedCallback(onClickReturnOwnerObjects, this);
01015
01016 mGroupObjects = getChild<LLTextBox>("group_objects_text");
01017 mBtnShowGroupObjects = getChild<LLButton>("ShowGroup");
01018 mBtnShowGroupObjects->setClickedCallback(onClickShowGroupObjects, this);
01019
01020 mBtnReturnGroupObjects = getChild<LLButton>("ReturnGroup...");
01021 mBtnReturnGroupObjects->setClickedCallback(onClickReturnGroupObjects, this);
01022
01023 mOtherObjects = getChild<LLTextBox>("other_objects_text");
01024 mBtnShowOtherObjects = getChild<LLButton>("ShowOther");
01025 mBtnShowOtherObjects->setClickedCallback(onClickShowOtherObjects, this);
01026
01027 mBtnReturnOtherObjects = getChild<LLButton>("ReturnOther...");
01028 mBtnReturnOtherObjects->setClickedCallback(onClickReturnOtherObjects, this);
01029
01030 mSelectedObjects = getChild<LLTextBox>("selected_objects_text");
01031 mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time");
01032
01033 mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus, this);
01034 mCleanOtherObjectsTime->setCommitCallback(onCommitClean);
01035
01036 childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32);
01037 childSetUserData("clean other time", this);
01038
01039 mBtnRefresh = getChild<LLButton>("Refresh List");
01040 mBtnRefresh->setClickedCallback(onClickRefresh, this);
01041
01042 mBtnReturnOwnerList = getChild<LLButton>("Return objects...");
01043 mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this);
01044
01045 mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga");
01046 mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga");
01047 mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga");
01048
01049 mOwnerList = getChild<LLNameListCtrl>("owner list");
01050 mOwnerList->sortByColumn(3, FALSE);
01051 childSetCommitCallback("owner list", onCommitList, this);
01052 mOwnerList->setDoubleClickCallback(onDoubleClickOwner);
01053
01054 return TRUE;
01055 }
01056
01057
01058
01059
01060
01061 LLPanelLandObjects::~LLPanelLandObjects()
01062 { }
01063
01064
01065 void LLPanelLandObjects::onDoubleClickOwner(void *userdata)
01066 {
01067 LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
01068
01069 LLScrollListItem* item = self->mOwnerList->getFirstSelected();
01070 if (item)
01071 {
01072 LLUUID owner_id = item->getUUID();
01073
01074 const LLScrollListCell* cell;
01075 cell = item->getColumn(1);
01076 if (!cell)
01077 {
01078 return;
01079 }
01080
01081 BOOL is_group = cell->getValue().asString() == OWNER_GROUP;
01082 if (is_group)
01083 {
01084 LLFloaterGroupInfo::showFromUUID(owner_id);
01085 }
01086 else
01087 {
01088 LLFloaterAvatarInfo::showFromDirectory(owner_id);
01089 }
01090 }
01091 }
01092
01093
01094 void LLPanelLandObjects::refresh()
01095 {
01096 LLParcel *parcel = mParcel->getParcel();
01097
01098 mBtnShowOwnerObjects->setEnabled(FALSE);
01099 mBtnShowGroupObjects->setEnabled(FALSE);
01100 mBtnShowOtherObjects->setEnabled(FALSE);
01101 mBtnReturnOwnerObjects->setEnabled(FALSE);
01102 mBtnReturnGroupObjects->setEnabled(FALSE);
01103 mBtnReturnOtherObjects->setEnabled(FALSE);
01104 mCleanOtherObjectsTime->setEnabled(FALSE);
01105 mBtnRefresh-> setEnabled(FALSE);
01106 mBtnReturnOwnerList-> setEnabled(FALSE);
01107
01108 mSelectedOwners.clear();
01109 mOwnerList->deleteAllItems();
01110 mOwnerList->setEnabled(FALSE);
01111
01112 if (!parcel)
01113 {
01114 mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
01115 mSWTotalObjects->setTextArg("[TOTAL]", llformat("%d", 0));
01116 mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", 0));
01117 mObjectContribution->setTextArg("[COUNT]", llformat("%d", 0));
01118 mTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
01119 mOwnerObjects->setTextArg("[COUNT]", llformat("%d", 0));
01120 mGroupObjects->setTextArg("[COUNT]", llformat("%d", 0));
01121 mOtherObjects->setTextArg("[COUNT]", llformat("%d", 0));
01122 mSelectedObjects->setTextArg("[COUNT]", llformat("%d", 0));
01123 }
01124 else
01125 {
01126 S32 sw_max = parcel->getSimWideMaxPrimCapacity();
01127 S32 sw_total = parcel->getSimWidePrimCount();
01128 S32 max = llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
01129 S32 total = parcel->getPrimCount();
01130 S32 owned = parcel->getOwnerPrimCount();
01131 S32 group = parcel->getGroupPrimCount();
01132 S32 other = parcel->getOtherPrimCount();
01133 S32 selected = parcel->getSelectedPrimCount();
01134 F32 parcel_object_bonus = parcel->getParcelPrimBonus();
01135 mOtherTime = parcel->getCleanOtherTime();
01136
01137
01138
01139 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
01140 if (region)
01141 {
01142 S32 max_tasks_per_region = (S32)region->getMaxTasks();
01143 sw_max = llmin(sw_max, max_tasks_per_region);
01144 max = llmin(max, max_tasks_per_region);
01145 }
01146
01147 if (parcel_object_bonus != 1.0f)
01148 {
01149 mParcelObjectBonus->setVisible(TRUE);
01150 mParcelObjectBonus->setTextArg("[BONUS]", llformat("%.2f", parcel_object_bonus));
01151 }
01152 else
01153 {
01154 mParcelObjectBonus->setVisible(FALSE);
01155 }
01156
01157 if (sw_total > sw_max)
01158 {
01159 mSWTotalObjects->setText(getString("objects_deleted_text"));
01160 mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
01161 }
01162 else
01163 {
01164 mSWTotalObjects->setText(getString("objects_available_text"));
01165 mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
01166 }
01167 mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
01168 mSWTotalObjects->setTextArg("[MAX]", llformat("%d", sw_max));
01169
01170 mObjectContribution->setTextArg("[COUNT]", llformat("%d", max));
01171 mTotalObjects->setTextArg("[COUNT]", llformat("%d", total));
01172 mOwnerObjects->setTextArg("[COUNT]", llformat("%d", owned));
01173 mGroupObjects->setTextArg("[COUNT]", llformat("%d", group));
01174 mOtherObjects->setTextArg("[COUNT]", llformat("%d", other));
01175 mSelectedObjects->setTextArg("[COUNT]", llformat("%d", selected));
01176 mCleanOtherObjectsTime->setText(llformat("%d", mOtherTime));
01177
01178 BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED);
01179 BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET);
01180 BOOL can_return_other = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_NON_GROUP);
01181
01182 if (can_return_owned || can_return_group_set || can_return_other)
01183 {
01184 if (owned && can_return_owned)
01185 {
01186 mBtnShowOwnerObjects->setEnabled(TRUE);
01187 mBtnReturnOwnerObjects->setEnabled(TRUE);
01188 }
01189 if (group && can_return_group_set)
01190 {
01191 mBtnShowGroupObjects->setEnabled(TRUE);
01192 mBtnReturnGroupObjects->setEnabled(TRUE);
01193 }
01194 if (other && can_return_other)
01195 {
01196 mBtnShowOtherObjects->setEnabled(TRUE);
01197 mBtnReturnOtherObjects->setEnabled(TRUE);
01198 }
01199
01200 mCleanOtherObjectsTime->setEnabled(TRUE);
01201 mBtnRefresh->setEnabled(TRUE);
01202 }
01203 }
01204 }
01205
01206
01207 void LLPanelLandObjects::draw()
01208 {
01209 LLPanel::draw();
01210 }
01211
01212 void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time)
01213 {
01214 LLMessageSystem *msg = gMessageSystem;
01215
01216 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
01217 if (!region) return;
01218
01219 msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
01220 msg->nextBlockFast(_PREHASH_AgentData);
01221 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
01222 msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
01223 msg->nextBlockFast(_PREHASH_ParcelData);
01224 msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
01225 msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time);
01226
01227 msg->sendReliable(region->getHost());
01228 }
01229
01230 void send_return_objects_message(S32 parcel_local_id, S32 return_type,
01231 uuid_list_t* owner_ids = NULL)
01232 {
01233 LLMessageSystem *msg = gMessageSystem;
01234
01235 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
01236 if (!region) return;
01237
01238 msg->newMessageFast(_PREHASH_ParcelReturnObjects);
01239 msg->nextBlockFast(_PREHASH_AgentData);
01240 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
01241 msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
01242 msg->nextBlockFast(_PREHASH_ParcelData);
01243 msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
01244 msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type);
01245
01246
01247 msg->nextBlock("TaskIDs");
01248 msg->addUUID("TaskID", LLUUID::null);
01249
01250
01251
01252 if (owner_ids)
01253 {
01254 uuid_list_t::iterator end = owner_ids->end();
01255 for (uuid_list_t::iterator it = owner_ids->begin();
01256 it != end;
01257 ++it)
01258 {
01259 msg->nextBlockFast(_PREHASH_OwnerIDs);
01260 msg->addUUIDFast(_PREHASH_OwnerID, (*it));
01261 }
01262 }
01263 else
01264 {
01265 msg->nextBlockFast(_PREHASH_OwnerIDs);
01266 msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
01267 }
01268
01269 msg->sendReliable(region->getHost());
01270 }
01271
01272
01273 void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
01274 {
01275 LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
01276 LLParcel *parcel = lop->mParcel->getParcel();
01277 if (0 == option)
01278 {
01279 if (parcel)
01280 {
01281 LLUUID owner_id = parcel->getOwnerID();
01282 LLString::format_map_t args;
01283 if (owner_id == gAgentID)
01284 {
01285 LLNotifyBox::showXml("OwnedObjectsReturned");
01286 }
01287 else
01288 {
01289 std::string first, last;
01290 gCacheName->getName(owner_id, first, last);
01291 args["[FIRST]"] = first;
01292 args["[LAST]"] = last;
01293 LLNotifyBox::showXml("OtherObjectsReturned", args);
01294 }
01295 send_return_objects_message(parcel->getLocalID(), RT_OWNER);
01296 }
01297 }
01298
01299 LLSelectMgr::getInstance()->unhighlightAll();
01300 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
01301 lop->refresh();
01302 }
01303
01304
01305 void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
01306 {
01307 LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
01308 LLParcel *parcel = lop->mParcel->getParcel();
01309 if (0 == option)
01310 {
01311 if (parcel)
01312 {
01313 std::string group_name;
01314 gCacheName->getGroupName(parcel->getGroupID(), group_name);
01315 LLString::format_map_t args;
01316 args["[GROUPNAME]"] = group_name;
01317 LLNotifyBox::showXml("GroupObjectsReturned", args);
01318 send_return_objects_message(parcel->getLocalID(), RT_GROUP);
01319 }
01320 }
01321 LLSelectMgr::getInstance()->unhighlightAll();
01322 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
01323 lop->refresh();
01324 }
01325
01326
01327 void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata)
01328 {
01329 LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
01330 LLParcel *parcel = lop->mParcel->getParcel();
01331 if (0 == option)
01332 {
01333 if (parcel)
01334 {
01335 LLNotifyBox::showXml("UnOwnedObjectsReturned");
01336 send_return_objects_message(parcel->getLocalID(), RT_OTHER);
01337 }
01338 }
01339 LLSelectMgr::getInstance()->unhighlightAll();
01340 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
01341 lop->refresh();
01342 }
01343
01344
01345 void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata)
01346 {
01347 LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
01348 LLParcel *parcel = self->mParcel->getParcel();
01349 if (0 == option)
01350 {
01351 if (parcel)
01352 {
01353
01354 uuid_list_t::iterator selected = self->mSelectedOwners.begin();
01355 if (selected != self->mSelectedOwners.end())
01356 {
01357 LLString::format_map_t args;
01358 if (self->mSelectedIsGroup)
01359 {
01360 args["[GROUPNAME]"] = self->mSelectedName;
01361 LLNotifyBox::showXml("GroupObjectsReturned", args);
01362 }
01363 else
01364 {
01365 args["[NAME]"] = self->mSelectedName;
01366 LLNotifyBox::showXml("OtherObjectsReturned2", args);
01367 }
01368
01369 send_return_objects_message(parcel->getLocalID(), RT_LIST, &(self->mSelectedOwners));
01370 }
01371 }
01372 }
01373 LLSelectMgr::getInstance()->unhighlightAll();
01374 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
01375 self->refresh();
01376 }
01377
01378
01379
01380 void LLPanelLandObjects::onClickReturnOwnerList(void* userdata)
01381 {
01382 LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
01383
01384 LLParcel* parcelp = self->mParcel->getParcel();
01385 if (!parcelp) return;
01386
01387
01388 if (self->mSelectedOwners.empty())
01389 {
01390 return;
01391 }
01392
01393
01394
01395 send_parcel_select_objects(parcelp->getLocalID(), RT_LIST, &(self->mSelectedOwners));
01396
01397 LLStringBase<char>::format_map_t args;
01398 args["[NAME]"] = self->mSelectedName;
01399 args["[N]"] = llformat("%d",self->mSelectedCount);
01400 if (self->mSelectedIsGroup)
01401 {
01402 gViewerWindow->alertXml("ReturnObjectsDeededToGroup", args, callbackReturnOwnerList, userdata);
01403 }
01404 else
01405 {
01406 gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerList, userdata);
01407 }
01408 }
01409
01410
01411
01412 void LLPanelLandObjects::onClickRefresh(void* userdata)
01413 {
01414 LLPanelLandObjects *self = (LLPanelLandObjects*)userdata;
01415
01416 LLMessageSystem *msg = gMessageSystem;
01417
01418 LLParcel* parcel = self->mParcel->getParcel();
01419 if (!parcel) return;
01420
01421 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
01422 if (!region) return;
01423
01424
01425 self->mOwnerList->deleteAllItems();
01426 self->mOwnerList->addCommentText("Searching...");
01427 self->mOwnerList->setEnabled(FALSE);
01428 self->mFirstReply = TRUE;
01429
01430
01431 msg->newMessageFast(_PREHASH_ParcelObjectOwnersRequest);
01432 msg->nextBlockFast(_PREHASH_AgentData);
01433 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
01434 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
01435 msg->nextBlockFast(_PREHASH_ParcelData);
01436 msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID());
01437
01438 msg->sendReliable(region->getHost());
01439 }
01440
01441
01442 void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, void **)
01443 {
01444 LLPanelLandObjects* self = LLFloaterLand::getCurrentPanelLandObjects();
01445
01446 if (!self)
01447 {
01448 llwarns << "Received message for nonexistent LLPanelLandObject"
01449 << llendl;
01450 return;
01451 }
01452
01453 const LLFontGL* FONT = LLFontGL::sSansSerif;
01454
01455
01456 S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data);
01457
01458 LLUUID owner_id;
01459 BOOL is_group_owned;
01460 S32 object_count;
01461 BOOL is_online;
01462 char object_count_str[MAX_STRING];
01463
01464
01465
01466 if (self->mFirstReply)
01467 {
01468 self->mOwnerList->deleteAllItems();
01469 self->mFirstReply = FALSE;
01470 }
01471
01472 for(S32 i = 0; i < rows; ++i)
01473 {
01474 msg->getUUIDFast(_PREHASH_Data, _PREHASH_OwnerID, owner_id, i);
01475 msg->getBOOLFast(_PREHASH_Data, _PREHASH_IsGroupOwned, is_group_owned, i);
01476 msg->getS32Fast (_PREHASH_Data, _PREHASH_Count, object_count, i);
01477 msg->getBOOLFast(_PREHASH_Data, _PREHASH_OnlineStatus, is_online, i);
01478
01479 if (owner_id.isNull())
01480 {
01481 continue;
01482 }
01483
01484 LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id);
01485 if (is_group_owned)
01486 {
01487 row->addColumn(self->mIconGroup);
01488 row->addColumn(OWNER_GROUP, FONT);
01489 }
01490 else if (is_online)
01491 {
01492 row->addColumn(self->mIconAvatarOnline);
01493 row->addColumn(OWNER_ONLINE, FONT);
01494 }
01495 else
01496 {
01497 row->addColumn(self->mIconAvatarOffline);
01498 row->addColumn(OWNER_OFFLINE, FONT);
01499 }
01500
01501 row->addColumn(LLString::null, FONT);
01502
01503 snprintf(object_count_str, sizeof(object_count_str), "%d", object_count);
01504 row->addColumn(object_count_str, FONT);
01505
01506 if (is_group_owned)
01507 {
01508 self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM);
01509 }
01510 else
01511 {
01512 self->mOwnerList->addNameItem(row, ADD_BOTTOM);
01513 }
01514
01515 lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent")
01516 << ") owns " << object_count << " objects." << llendl;
01517 }
01518
01519 if (0 == self->mOwnerList->getItemCount())
01520 {
01521 self->mOwnerList->addCommentText("None found.");
01522 }
01523 else
01524 {
01525 self->mOwnerList->setEnabled(TRUE);
01526 }
01527 }
01528
01529
01530 void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data)
01531 {
01532 LLPanelLandObjects* self = (LLPanelLandObjects*)data;
01533
01534 if (FALSE == self->mOwnerList->getCanSelect())
01535 {
01536 return;
01537 }
01538 LLScrollListItem *item = self->mOwnerList->getFirstSelected();
01539 if (item)
01540 {
01541
01542 const LLScrollListCell* cell;
01543 cell = item->getColumn(1);
01544 if (!cell)
01545 {
01546 return;
01547 }
01548
01549 self->mSelectedIsGroup = cell->getValue().asString() == OWNER_GROUP;
01550 cell = item->getColumn(2);
01551 self->mSelectedName = cell->getValue().asString();
01552 cell = item->getColumn(3);
01553 self->mSelectedCount = atoi(cell->getValue().asString().c_str());
01554
01555
01556 self->mSelectedOwners.clear();
01557 self->mSelectedOwners.insert(item->getUUID());
01558 self->mBtnReturnOwnerList->setEnabled(TRUE);
01559
01560
01561 clickShowCore(self, RT_LIST, &(self->mSelectedOwners));
01562 }
01563 }
01564
01565
01566 void LLPanelLandObjects::clickShowCore(LLPanelLandObjects* self, S32 return_type, uuid_list_t* list)
01567 {
01568 LLParcel* parcel = self->mParcel->getParcel();
01569 if (!parcel) return;
01570
01571 send_parcel_select_objects(parcel->getLocalID(), return_type, list);
01572 }
01573
01574
01575 void LLPanelLandObjects::onClickShowOwnerObjects(void* userdata)
01576 {
01577 clickShowCore((LLPanelLandObjects*)userdata, RT_OWNER);
01578 }
01579
01580
01581 void LLPanelLandObjects::onClickShowGroupObjects(void* userdata)
01582 {
01583 clickShowCore((LLPanelLandObjects*)userdata, (RT_GROUP));
01584 }
01585
01586
01587 void LLPanelLandObjects::onClickShowOtherObjects(void* userdata)
01588 {
01589 clickShowCore((LLPanelLandObjects*)userdata, RT_OTHER);
01590 }
01591
01592
01593 void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata)
01594 {
01595 S32 owned = 0;
01596
01597 LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
01598 LLParcel* parcel = panelp->mParcel->getParcel();
01599 if (!parcel) return;
01600
01601 owned = parcel->getOwnerPrimCount();
01602
01603 send_parcel_select_objects(parcel->getLocalID(), RT_OWNER);
01604
01605 LLUUID owner_id = parcel->getOwnerID();
01606
01607 LLStringBase<char>::format_map_t args;
01608 args["[N]"] = llformat("%d",owned);
01609
01610 if (owner_id == gAgent.getID())
01611 {
01612 gViewerWindow->alertXml("ReturnObjectsOwnedBySelf", args, callbackReturnOwnerObjects, userdata);
01613 }
01614 else
01615 {
01616 std::string name;
01617 gCacheName->getFullName(owner_id, name);
01618 args["[NAME]"] = name;
01619 gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata);
01620 }
01621 }
01622
01623
01624 void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata)
01625 {
01626 LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
01627 LLParcel* parcel = panelp->mParcel->getParcel();
01628 if (!parcel) return;
01629
01630 send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
01631
01632 std::string group_name;
01633 gCacheName->getGroupName(parcel->getGroupID(), group_name);
01634
01635 LLStringBase<char>::format_map_t args;
01636 args["[NAME]"] = group_name;
01637 args["[N]"] = llformat("%d", parcel->getGroupPrimCount());
01638
01639
01640 gViewerWindow->alertXml("ReturnObjectsDeededToGroup", args, callbackReturnGroupObjects, userdata);
01641 }
01642
01643
01644 void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
01645 {
01646 S32 other = 0;
01647
01648 LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
01649 LLParcel* parcel = panelp->mParcel->getParcel();
01650 if (!parcel) return;
01651
01652 other = parcel->getOtherPrimCount();
01653
01654 send_parcel_select_objects(parcel->getLocalID(), RT_OTHER);
01655
01656 LLStringBase<char>::format_map_t args;
01657 args["[N]"] = llformat("%d", other);
01658
01659 if (parcel->getIsGroupOwned())
01660 {
01661 std::string group_name;
01662 gCacheName->getGroupName(parcel->getGroupID(), group_name);
01663 args["[NAME]"] = group_name;
01664
01665 gViewerWindow->alertXml("ReturnObjectsNotOwnedByGroup", args, callbackReturnOtherObjects, userdata);
01666 }
01667 else
01668 {
01669 LLUUID owner_id = parcel->getOwnerID();
01670
01671 if (owner_id == gAgent.getID())
01672 {
01673 gViewerWindow->alertXml("ReturnObjectsNotOwnedBySelf", args, callbackReturnOtherObjects, userdata);
01674 }
01675 else
01676 {
01677 std::string name;
01678 gCacheName->getFullName(owner_id, name);
01679 args["[NAME]"] = name;
01680
01681 gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata);
01682 }
01683 }
01684 }
01685
01686
01687 void LLPanelLandObjects::onLostFocus(LLFocusableElement* caller, void* user_data)
01688 {
01689 onCommitClean((LLUICtrl*)caller, user_data);
01690 }
01691
01692
01693 void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data)
01694 {
01695 LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data;
01696 LLParcel* parcel = lop->mParcel->getParcel();
01697 if (parcel)
01698 {
01699 lop->mOtherTime = atoi(lop->mCleanOtherObjectsTime->getText().c_str());
01700
01701 parcel->setCleanOtherTime(lop->mOtherTime);
01702 send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime);
01703 }
01704 }
01705
01706
01707
01708
01709
01710
01711 LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel)
01712 : LLPanel("land_options_panel"),
01713 mCheckEditObjects(NULL),
01714 mCheckEditGroupObjects(NULL),
01715 mCheckAllObjectEntry(NULL),
01716 mCheckGroupObjectEntry(NULL),
01717 mCheckEditLand(NULL),
01718 mCheckSafe(NULL),
01719 mCheckFly(NULL),
01720 mCheckGroupScripts(NULL),
01721 mCheckOtherScripts(NULL),
01722 mCheckLandmark(NULL),
01723 mCheckShowDirectory(NULL),
01724 mCategoryCombo(NULL),
01725 mLandingTypeCombo(NULL),
01726 mSnapshotCtrl(NULL),
01727 mLocationText(NULL),
01728 mSetBtn(NULL),
01729 mClearBtn(NULL),
01730 mMatureCtrl(NULL),
01731 mPushRestrictionCtrl(NULL),
01732 mPublishHelpButton(NULL),
01733 mParcel(parcel)
01734 {
01735 }
01736
01737
01738 BOOL LLPanelLandOptions::postBuild()
01739 {
01740
01741
01742 mCheckEditObjects = getChild<LLCheckBoxCtrl>( "edit objects check");
01743 childSetCommitCallback("edit objects check", onCommitAny, this);
01744
01745 mCheckEditGroupObjects = getChild<LLCheckBoxCtrl>( "edit group objects check");
01746 childSetCommitCallback("edit group objects check", onCommitAny, this);
01747
01748 mCheckAllObjectEntry = getChild<LLCheckBoxCtrl>( "all object entry check");
01749 childSetCommitCallback("all object entry check", onCommitAny, this);
01750
01751 mCheckGroupObjectEntry = getChild<LLCheckBoxCtrl>( "group object entry check");
01752 childSetCommitCallback("group object entry check", onCommitAny, this);
01753
01754 mCheckEditLand = getChild<LLCheckBoxCtrl>( "edit land check");
01755 childSetCommitCallback("edit land check", onCommitAny, this);
01756
01757
01758 mCheckLandmark = getChild<LLCheckBoxCtrl>( "check landmark");
01759 childSetCommitCallback("check landmark", onCommitAny, this);
01760
01761
01762 mCheckGroupScripts = getChild<LLCheckBoxCtrl>( "check group scripts");
01763 childSetCommitCallback("check group scripts", onCommitAny, this);
01764
01765
01766 mCheckFly = getChild<LLCheckBoxCtrl>( "check fly");
01767 childSetCommitCallback("check fly", onCommitAny, this);
01768
01769
01770 mCheckOtherScripts = getChild<LLCheckBoxCtrl>( "check other scripts");
01771 childSetCommitCallback("check other scripts", onCommitAny, this);
01772
01773
01774 mCheckSafe = getChild<LLCheckBoxCtrl>( "check safe");
01775 childSetCommitCallback("check safe", onCommitAny, this);
01776
01777
01778 mPushRestrictionCtrl = getChild<LLCheckBoxCtrl>( "PushRestrictCheck");
01779 childSetCommitCallback("PushRestrictCheck", onCommitAny, this);
01780
01781 mCheckShowDirectory = getChild<LLCheckBoxCtrl>( "ShowDirectoryCheck");
01782 childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this);
01783
01784
01785 mCategoryCombo = getChild<LLComboBox>( "land category");
01786 childSetCommitCallback("land category", onCommitAny, this);
01787
01788 mMatureCtrl = getChild<LLCheckBoxCtrl>( "MatureCheck");
01789 childSetCommitCallback("MatureCheck", onCommitAny, this);
01790
01791 mPublishHelpButton = getChild<LLButton>("?");
01792 mPublishHelpButton->setClickedCallback(onClickPublishHelp, this);
01793
01794
01795 if (gAgent.isTeen())
01796 {
01797
01798 mPublishHelpButton->setVisible(FALSE);
01799 mPublishHelpButton->setEnabled(FALSE);
01800 mMatureCtrl->setVisible(FALSE);
01801 mMatureCtrl->setEnabled(FALSE);
01802 }
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822
01823
01824
01825 mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
01826 if (mSnapshotCtrl)
01827 {
01828 mSnapshotCtrl->setCommitCallback( onCommitAny );
01829 mSnapshotCtrl->setCallbackUserData( this );
01830 mSnapshotCtrl->setAllowNoTexture ( TRUE );
01831 mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
01832 mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
01833 }
01834 else
01835 {
01836 llwarns << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'snapshot_ctrl'" << llendl;
01837 }
01838
01839
01840 mLocationText = getChild<LLTextBox>("landing_point");
01841
01842 mSetBtn = getChild<LLButton>("Set");
01843 mSetBtn->setClickedCallback(onClickSet, this);
01844
01845
01846 mClearBtn = getChild<LLButton>("Clear");
01847 mClearBtn->setClickedCallback(onClickClear, this);
01848
01849
01850 mLandingTypeCombo = getChild<LLComboBox>( "landing type");
01851 childSetCommitCallback("landing type", onCommitAny, this);
01852
01853 return TRUE;
01854 }
01855
01856
01857
01858 LLPanelLandOptions::~LLPanelLandOptions()
01859 { }
01860
01861
01862
01863 void LLPanelLandOptions::refresh()
01864 {
01865 LLParcel *parcel = mParcel->getParcel();
01866
01867 if (!parcel)
01868 {
01869 mCheckEditObjects ->set(FALSE);
01870 mCheckEditObjects ->setEnabled(FALSE);
01871
01872 mCheckEditGroupObjects ->set(FALSE);
01873 mCheckEditGroupObjects ->setEnabled(FALSE);
01874
01875 mCheckAllObjectEntry ->set(FALSE);
01876 mCheckAllObjectEntry ->setEnabled(FALSE);
01877
01878 mCheckGroupObjectEntry ->set(FALSE);
01879 mCheckGroupObjectEntry ->setEnabled(FALSE);
01880
01881 mCheckEditLand ->set(FALSE);
01882 mCheckEditLand ->setEnabled(FALSE);
01883
01884 mCheckSafe ->set(FALSE);
01885 mCheckSafe ->setEnabled(FALSE);
01886
01887 mCheckFly ->set(FALSE);
01888 mCheckFly ->setEnabled(FALSE);
01889
01890 mCheckLandmark ->set(FALSE);
01891 mCheckLandmark ->setEnabled(FALSE);
01892
01893 mCheckGroupScripts ->set(FALSE);
01894 mCheckGroupScripts ->setEnabled(FALSE);
01895
01896 mCheckOtherScripts ->set(FALSE);
01897 mCheckOtherScripts ->setEnabled(FALSE);
01898
01899 mCheckShowDirectory ->set(FALSE);
01900 mCheckShowDirectory ->setEnabled(FALSE);
01901
01902 mPushRestrictionCtrl->set(FALSE);
01903 mPushRestrictionCtrl->setEnabled(FALSE);
01904
01905
01906 const char* none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE);
01907 mCategoryCombo->setSimple(LLString(none_string));
01908 mCategoryCombo->setEnabled(FALSE);
01909
01910 mLandingTypeCombo->setCurrentByIndex(0);
01911 mLandingTypeCombo->setEnabled(FALSE);
01912
01913 mSnapshotCtrl->setImageAssetID(LLUUID::null);
01914 mSnapshotCtrl->setEnabled(FALSE);
01915
01916 mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
01917 mSetBtn->setEnabled(FALSE);
01918 mClearBtn->setEnabled(FALSE);
01919
01920 mMatureCtrl->setEnabled(FALSE);
01921 mPublishHelpButton->setEnabled(FALSE);
01922 }
01923 else
01924 {
01925
01926
01927
01928 BOOL can_change_options = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS);
01929 mCheckEditObjects ->set( parcel->getAllowModify() );
01930 mCheckEditObjects ->setEnabled( can_change_options );
01931
01932 mCheckEditGroupObjects ->set( parcel->getAllowGroupModify() || parcel->getAllowModify());
01933 mCheckEditGroupObjects ->setEnabled( can_change_options && !parcel->getAllowModify() );
01934
01935 mCheckAllObjectEntry ->set( parcel->getAllowAllObjectEntry() );
01936 mCheckAllObjectEntry ->setEnabled( can_change_options );
01937
01938 mCheckGroupObjectEntry ->set( parcel->getAllowGroupObjectEntry() || parcel->getAllowAllObjectEntry());
01939 mCheckGroupObjectEntry ->setEnabled( can_change_options && !parcel->getAllowAllObjectEntry() );
01940
01941 BOOL can_change_terraform = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_EDIT);
01942 mCheckEditLand ->set( parcel->getAllowTerraform() );
01943 mCheckEditLand ->setEnabled( can_change_terraform );
01944
01945 mCheckSafe ->set( !parcel->getAllowDamage() );
01946 mCheckSafe ->setEnabled( can_change_options );
01947
01948 mCheckFly ->set( parcel->getAllowFly() );
01949 mCheckFly ->setEnabled( can_change_options );
01950
01951 mCheckLandmark ->set( parcel->getAllowLandmark() );
01952 mCheckLandmark ->setEnabled( can_change_options );
01953
01954 mCheckGroupScripts ->set( parcel->getAllowGroupScripts() || parcel->getAllowOtherScripts());
01955 mCheckGroupScripts ->setEnabled( can_change_options && !parcel->getAllowOtherScripts());
01956
01957 mCheckOtherScripts ->set( parcel->getAllowOtherScripts() );
01958 mCheckOtherScripts ->setEnabled( can_change_options );
01959
01960 mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
01961 if(parcel->getRegionPushOverride())
01962 {
01963 mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text"));
01964 mPushRestrictionCtrl->setEnabled(false);
01965 mPushRestrictionCtrl->set(TRUE);
01966 }
01967 else
01968 {
01969 mPushRestrictionCtrl->setLabel(getString("push_restrict_text"));
01970 mPushRestrictionCtrl->setEnabled(can_change_options);
01971 }
01972
01973 BOOL can_change_identity =
01974 LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
01975
01976
01977 LLParcel::ECategory cat = parcel->getCategory();
01978 const char* category_string = LLParcel::getCategoryUIString(cat);
01979 mCategoryCombo->setSimple(LLString(category_string));
01980 mCategoryCombo->setEnabled( can_change_identity );
01981
01982 BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel,
01983 GP_LAND_SET_LANDING_POINT);
01984 mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType());
01985 mLandingTypeCombo->setEnabled( can_change_landing_point );
01986
01987 mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID());
01988 mSnapshotCtrl->setEnabled( can_change_identity );
01989
01990 LLVector3 pos = parcel->getUserLocation();
01991 if (pos.isExactlyZero())
01992 {
01993 mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
01994 }
01995 else
01996 {
01997 mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d",
01998 llround(pos.mV[VX]),
01999 llround(pos.mV[VY]),
02000 llround(pos.mV[VZ])));
02001 }
02002
02003 mSetBtn->setEnabled( can_change_landing_point );
02004 mClearBtn->setEnabled( can_change_landing_point );
02005
02006 mMatureCtrl->set(parcel->getMaturePublish());
02007 mMatureCtrl->setEnabled( can_change_identity );
02008 mPublishHelpButton->setEnabled( can_change_identity );
02009
02010 if (gAgent.isTeen())
02011 {
02012
02013 mPublishHelpButton->setVisible(FALSE);
02014 mPublishHelpButton->setEnabled(FALSE);
02015 mMatureCtrl->setVisible(FALSE);
02016 mMatureCtrl->setEnabled(FALSE);
02017 }
02018 }
02019 }
02020
02021
02022 void LLPanelLandOptions::draw()
02023 {
02024 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel();
02025
02026 if(parcel)
02027 {
02028 LLViewerRegion* region;
02029 region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
02030 llassert(region);
02031
02032 BOOL can_change_identity = region ?
02033 LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY) &&
02034 ! (region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH) : false;
02035
02036
02037
02038
02039
02040
02041 if(! can_change_identity && parcel->getParcelFlag(PF_SHOW_DIRECTORY))
02042 {
02043 parcel->setParcelFlag(PF_SHOW_DIRECTORY, FALSE);
02044 }
02045 mCheckShowDirectory ->set(parcel->getParcelFlag(PF_SHOW_DIRECTORY));
02046 mCheckShowDirectory ->setEnabled(can_change_identity);
02047 mCategoryCombo->setEnabled(can_change_identity);
02048 }
02049
02050 LLPanel::draw();
02051
02052
02053 }
02054
02055 void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
02056 {
02057 LLPanelLandOptions *self = (LLPanelLandOptions *)userdata;
02058
02059 LLParcel* parcel = self->mParcel->getParcel();
02060 if (!parcel)
02061 {
02062 return;
02063 }
02064
02065
02066 BOOL create_objects = self->mCheckEditObjects->get();
02067 BOOL create_group_objects = self->mCheckEditGroupObjects->get() || self->mCheckEditObjects->get();
02068 BOOL all_object_entry = self->mCheckAllObjectEntry->get();
02069 BOOL group_object_entry = self->mCheckGroupObjectEntry->get() || self->mCheckAllObjectEntry->get();
02070 BOOL allow_terraform = self->mCheckEditLand->get();
02071 BOOL allow_damage = !self->mCheckSafe->get();
02072 BOOL allow_fly = self->mCheckFly->get();
02073 BOOL allow_landmark = self->mCheckLandmark->get();
02074 BOOL allow_group_scripts = self->mCheckGroupScripts->get() || self->mCheckOtherScripts->get();
02075 BOOL allow_other_scripts = self->mCheckOtherScripts->get();
02076 BOOL allow_publish = FALSE;
02077 BOOL mature_publish = self->mMatureCtrl->get();
02078 BOOL push_restriction = self->mPushRestrictionCtrl->get();
02079 BOOL show_directory = self->mCheckShowDirectory->get();
02080 S32 category_index = self->mCategoryCombo->getCurrentIndex();
02081 S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex();
02082 LLUUID snapshot_id = self->mSnapshotCtrl->getImageAssetID();
02083 LLViewerRegion* region;
02084 region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
02085
02086 if (!allow_other_scripts && region && region->getAllowDamage())
02087 {
02088
02089 gViewerWindow->alertXml("UnableToDisableOutsideScripts");
02090 return;
02091 }
02092
02093
02094 parcel->setParcelFlag(PF_CREATE_OBJECTS, create_objects);
02095 parcel->setParcelFlag(PF_CREATE_GROUP_OBJECTS, create_group_objects);
02096 parcel->setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, all_object_entry);
02097 parcel->setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, group_object_entry);
02098 parcel->setParcelFlag(PF_ALLOW_TERRAFORM, allow_terraform);
02099 parcel->setParcelFlag(PF_ALLOW_DAMAGE, allow_damage);
02100 parcel->setParcelFlag(PF_ALLOW_FLY, allow_fly);
02101 parcel->setParcelFlag(PF_ALLOW_LANDMARK, allow_landmark);
02102 parcel->setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, allow_group_scripts);
02103 parcel->setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, allow_other_scripts);
02104 parcel->setParcelFlag(PF_SHOW_DIRECTORY, show_directory);
02105 parcel->setParcelFlag(PF_ALLOW_PUBLISH, allow_publish);
02106 parcel->setParcelFlag(PF_MATURE_PUBLISH, mature_publish);
02107 parcel->setParcelFlag(PF_RESTRICT_PUSHOBJECT, push_restriction);
02108 parcel->setCategory((LLParcel::ECategory)category_index);
02109 parcel->setLandingType((LLParcel::ELandingType)landing_type_index);
02110 parcel->setSnapshotID(snapshot_id);
02111
02112
02113 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
02114
02115
02116 self->refresh();
02117 }
02118
02119
02120
02121 void LLPanelLandOptions::onClickSet(void* userdata)
02122 {
02123 LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
02124
02125 LLParcel* selected_parcel = self->mParcel->getParcel();
02126 if (!selected_parcel) return;
02127
02128 LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
02129 if (!agent_parcel) return;
02130
02131 if (agent_parcel->getLocalID() != selected_parcel->getLocalID())
02132 {
02133 gViewerWindow->alertXml("MustBeInParcel");
02134 return;
02135 }
02136
02137 LLVector3 pos_region = gAgent.getPositionAgent();
02138 selected_parcel->setUserLocation(pos_region);
02139 selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis());
02140
02141 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
02142
02143 self->refresh();
02144 }
02145
02146 void LLPanelLandOptions::onClickClear(void* userdata)
02147 {
02148 LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
02149
02150 LLParcel* selected_parcel = self->mParcel->getParcel();
02151 if (!selected_parcel) return;
02152
02153
02154 LLVector3 zero_vec(0.f, 0.f, 0.f);
02155 selected_parcel->setUserLocation(zero_vec);
02156 selected_parcel->setUserLookAt(zero_vec);
02157
02158 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel);
02159
02160 self->refresh();
02161 }
02162
02163
02164 void LLPanelLandOptions::onClickPublishHelp(void*)
02165 {
02166 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
02167 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel();
02168 llassert(region);
02169
02170 bool can_change_identity = region && parcel ?
02171 LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY) &&
02172 ! (region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH) : false;
02173
02174 if(! can_change_identity)
02175 {
02176 gViewerWindow->alertXml("ClickPublishHelpLandDisabled");
02177 }
02178 else
02179 {
02180 gViewerWindow->alertXml("ClickPublishHelpLand");
02181 }
02182 }
02183
02184
02185
02186
02187
02188
02189
02190 LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel)
02191 : LLPanel("land_access_panel"), mParcel(parcel)
02192 {
02193 }
02194
02195
02196
02197 BOOL LLPanelLandAccess::postBuild()
02198 {
02199 childSetCommitCallback("public_access", onCommitPublicAccess, this);
02200 childSetCommitCallback("limit_payment", onCommitAny, this);
02201 childSetCommitCallback("limit_age_verified", onCommitAny, this);
02202 childSetCommitCallback("GroupCheck", onCommitAny, this);
02203 childSetCommitCallback("PassCheck", onCommitAny, this);
02204 childSetCommitCallback("pass_combo", onCommitAny, this);
02205 childSetCommitCallback("PriceSpin", onCommitAny, this);
02206 childSetCommitCallback("HoursSpin", onCommitAny, this);
02207
02208 childSetAction("add_allowed", onClickAddAccess, this);
02209 childSetAction("remove_allowed", onClickRemoveAccess, this);
02210 childSetAction("add_banned", onClickAddBanned, this);
02211 childSetAction("remove_banned", onClickRemoveBanned, this);
02212
02213 mListAccess = getChild<LLNameListCtrl>("AccessList");
02214 if (mListAccess)
02215 mListAccess->sortByColumn(0, TRUE);
02216
02217 mListBanned = getChild<LLNameListCtrl>("BannedList");
02218 if (mListBanned)
02219 mListBanned->sortByColumn(0, TRUE);
02220
02221 return TRUE;
02222 }
02223
02224
02225 LLPanelLandAccess::~LLPanelLandAccess()
02226 {
02227 }
02228
02229 void LLPanelLandAccess::refresh()
02230 {
02231 if (mListAccess)
02232 mListAccess->deleteAllItems();
02233 if (mListBanned)
02234 mListBanned->deleteAllItems();
02235
02236 LLParcel *parcel = mParcel->getParcel();
02237
02238
02239 if (parcel)
02240 {
02241 BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST);
02242 BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP);
02243 BOOL public_access = !use_access_list && !use_group;
02244
02245 childSetValue("public_access", public_access );
02246 childSetValue("GroupCheck", use_group );
02247
02248 std::string group_name;
02249 gCacheName->getGroupName(parcel->getGroupID(), group_name);
02250 childSetLabelArg("GroupCheck", "[GROUP]", group_name );
02251
02252
02253 {
02254 S32 count = parcel->mAccessList.size();
02255 childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count));
02256 childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
02257
02258
02259 for (access_map_const_iterator cit = parcel->mAccessList.begin();
02260 cit != parcel->mAccessList.end(); ++cit)
02261 {
02262 const LLAccessEntry& entry = (*cit).second;
02263 LLString suffix;
02264 if (entry.mTime != 0)
02265 {
02266 S32 now = time(NULL);
02267 S32 seconds = entry.mTime - now;
02268 if (seconds < 0) seconds = 0;
02269 suffix.assign(" (");
02270 if (seconds >= 120)
02271 {
02272 std::string buf = llformat("%d minutes", (seconds/60));
02273 suffix.append(buf);
02274 }
02275 else if (seconds >= 60)
02276 {
02277 suffix.append("1 minute");
02278 }
02279 else
02280 {
02281 std::string buf = llformat("%d seconds", seconds);
02282 suffix.append(buf);
02283 }
02284 suffix.append(" remaining)");
02285 }
02286 if (mListAccess)
02287 mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix);
02288 }
02289 }
02290
02291
02292 {
02293 S32 count = parcel->mBanList.size();
02294
02295 childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",count));
02296 childSetToolTipArg("BannedList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
02297
02298 for (access_map_const_iterator cit = parcel->mBanList.begin();
02299 cit != parcel->mBanList.end(); ++cit)
02300 {
02301 const LLAccessEntry& entry = (*cit).second;
02302 LLString suffix;
02303 if (entry.mTime != 0)
02304 {
02305 S32 now = time(NULL);
02306 S32 seconds = entry.mTime - now;
02307 if (seconds < 0) seconds = 0;
02308 suffix.assign(" (");
02309 if (seconds >= 120)
02310 {
02311 std::string buf = llformat("%d minutes", (seconds/60));
02312 suffix.append(buf);
02313 }
02314 else if (seconds >= 60)
02315 {
02316 suffix.append("1 minute");
02317 }
02318 else
02319 {
02320 std::string buf = llformat("%d seconds", seconds);
02321 suffix.append(buf);
02322 }
02323 suffix.append(" remaining)");
02324 }
02325 mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix);
02326 }
02327 }
02328
02329 if(parcel->getRegionDenyAnonymousOverride())
02330 {
02331 childSetValue("limit_payment", TRUE);
02332 }
02333 else
02334 {
02335 childSetValue("limit_payment", (parcel->getParcelFlag(PF_DENY_ANONYMOUS)));
02336 }
02337 if(parcel->getRegionDenyAgeUnverifiedOverride())
02338 {
02339 childSetValue("limit_age_verified", TRUE);
02340 }
02341 else
02342 {
02343 childSetValue("limit_age_verified", (parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED)));
02344 }
02345
02346 BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST);
02347 childSetValue("PassCheck", use_pass );
02348 LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo");
02349 if (passcombo)
02350 {
02351 if (public_access || !use_pass || !use_group)
02352 {
02353 passcombo->selectByValue("anyone");
02354 }
02355 }
02356
02357 S32 pass_price = parcel->getPassPrice();
02358 childSetValue( "PriceSpin", (F32)pass_price );
02359
02360 F32 pass_hours = parcel->getPassHours();
02361 childSetValue( "HoursSpin", pass_hours );
02362 }
02363 else
02364 {
02365 childSetValue("public_access", FALSE);
02366 childSetValue("limit_payment", FALSE);
02367 childSetValue("limit_age_verified", FALSE);
02368 childSetValue("GroupCheck", FALSE);
02369 childSetLabelArg("GroupCheck", "[GROUP]", LLString::null );
02370 childSetValue("PassCheck", FALSE);
02371 childSetValue("PriceSpin", (F32)PARCEL_PASS_PRICE_DEFAULT);
02372 childSetValue( "HoursSpin", PARCEL_PASS_HOURS_DEFAULT );
02373 childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",0));
02374 childSetToolTipArg("AccessList", "[MAX]", llformat("%d",0));
02375 childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",0));
02376 childSetToolTipArg("BannedList", "[MAX]", llformat("%d",0));
02377 }
02378 }
02379
02380 void LLPanelLandAccess::refresh_ui()
02381 {
02382 childSetEnabled("public_access", FALSE);
02383 childSetEnabled("limit_payment", FALSE);
02384 childSetEnabled("limit_age_verified", FALSE);
02385 childSetEnabled("GroupCheck", FALSE);
02386 childSetEnabled("PassCheck", FALSE);
02387 childSetEnabled("pass_combo", FALSE);
02388 childSetEnabled("PriceSpin", FALSE);
02389 childSetEnabled("HoursSpin", FALSE);
02390 childSetEnabled("AccessList", FALSE);
02391 childSetEnabled("BannedList", FALSE);
02392
02393 LLParcel *parcel = mParcel->getParcel();
02394 if (parcel)
02395 {
02396 BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED);
02397 BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED);
02398
02399 childSetEnabled("public_access", can_manage_allowed);
02400 BOOL public_access = childGetValue("public_access").asBoolean();
02401 if (public_access)
02402 {
02403 bool override = false;
02404 if(parcel->getRegionDenyAnonymousOverride())
02405 {
02406 override = true;
02407 childSetEnabled("limit_payment", FALSE);
02408 }
02409 else
02410 {
02411 childSetEnabled("limit_payment", can_manage_allowed);
02412 }
02413 if(parcel->getRegionDenyAgeUnverifiedOverride())
02414 {
02415 override = true;
02416 childSetEnabled("limit_age_verified", FALSE);
02417 }
02418 else
02419 {
02420 childSetEnabled("limit_age_verified", can_manage_allowed);
02421 }
02422 if (override)
02423 {
02424 childSetToolTip("Only Allow", getUIString("estate_override"));
02425 }
02426 else
02427 {
02428 childSetToolTip("Only Allow", LLString());
02429 }
02430 childSetEnabled("GroupCheck", FALSE);
02431 childSetEnabled("PassCheck", FALSE);
02432 childSetEnabled("pass_combo", FALSE);
02433 childSetEnabled("AccessList", FALSE);
02434 }
02435 else
02436 {
02437 childSetEnabled("limit_payment", FALSE);
02438 childSetEnabled("limit_age_verified", FALSE);
02439 char group_name[MAX_STRING];
02440 if (gCacheName->getGroupName(parcel->getGroupID(), group_name))
02441 {
02442 childSetEnabled("GroupCheck", can_manage_allowed);
02443 }
02444 BOOL group_access = childGetValue("GroupCheck").asBoolean();
02445 BOOL sell_passes = childGetValue("PassCheck").asBoolean();
02446 childSetEnabled("PassCheck", can_manage_allowed);
02447 if (sell_passes)
02448 {
02449 childSetEnabled("pass_combo", group_access && can_manage_allowed);
02450 childSetEnabled("PriceSpin", can_manage_allowed);
02451 childSetEnabled("HoursSpin", can_manage_allowed);
02452 }
02453 }
02454 childSetEnabled("AccessList", can_manage_allowed);
02455 S32 allowed_list_count = parcel->mAccessList.size();
02456 childSetEnabled("add_allowed", can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST);
02457 childSetEnabled("remove_allowed", can_manage_allowed && allowed_list_count > 0);
02458
02459 childSetEnabled("BannedList", can_manage_banned);
02460 S32 banned_list_count = parcel->mBanList.size();
02461 childSetEnabled("add_banned", can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST);
02462 childSetEnabled("remove_banned", can_manage_banned && banned_list_count > 0);
02463 }
02464 }
02465
02466
02467
02468 void LLPanelLandAccess::refreshNames()
02469 {
02470 LLParcel* parcel = mParcel->getParcel();
02471 std::string group_name;
02472 if(parcel)
02473 {
02474 gCacheName->getGroupName(parcel->getGroupID(), group_name);
02475 }
02476 childSetLabelArg("GroupCheck", "[GROUP]", group_name);
02477 }
02478
02479
02480
02481 void LLPanelLandAccess::draw()
02482 {
02483 refresh_ui();
02484 refreshNames();
02485 LLPanel::draw();
02486 }
02487
02488
02489 void LLPanelLandAccess::onCommitPublicAccess(LLUICtrl *ctrl, void *userdata)
02490 {
02491 LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
02492 LLParcel* parcel = self->mParcel->getParcel();
02493 if (!parcel)
02494 {
02495 return;
02496 }
02497
02498
02499 BOOL public_access = self->childGetValue("public_access").asBoolean();
02500 if (public_access == FALSE)
02501 {
02502 char group_name[MAX_STRING];
02503 if (gCacheName->getGroupName(parcel->getGroupID(), group_name))
02504 {
02505 self->childSetValue("GroupCheck", public_access ? FALSE : TRUE);
02506 }
02507 }
02508
02509 onCommitAny(ctrl, userdata);
02510 }
02511
02512
02513 void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
02514 {
02515 LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
02516
02517 LLParcel* parcel = self->mParcel->getParcel();
02518 if (!parcel)
02519 {
02520 return;
02521 }
02522
02523
02524 BOOL public_access = self->childGetValue("public_access").asBoolean();
02525 BOOL use_access_group = self->childGetValue("GroupCheck").asBoolean();
02526 if (use_access_group)
02527 {
02528 std::string group_name;
02529 if (!gCacheName->getGroupName(parcel->getGroupID(), group_name))
02530 {
02531 use_access_group = FALSE;
02532 }
02533 }
02534
02535 BOOL limit_payment = FALSE, limit_age_verified = FALSE;
02536 BOOL use_access_list = FALSE;
02537 BOOL use_pass_list = FALSE;
02538
02539 if (public_access)
02540 {
02541 use_access_list = FALSE;
02542 use_access_group = FALSE;
02543 limit_payment = self->childGetValue("limit_payment").asBoolean();
02544 limit_age_verified = self->childGetValue("limit_age_verified").asBoolean();
02545 }
02546 else
02547 {
02548 use_access_list = TRUE;
02549 use_pass_list = self->childGetValue("PassCheck").asBoolean();
02550 if (use_access_group && use_pass_list)
02551 {
02552 LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo");
02553 if (passcombo)
02554 {
02555 if (passcombo->getSelectedValue().asString() == "group")
02556 {
02557 use_access_list = FALSE;
02558 }
02559 }
02560 }
02561 }
02562
02563 S32 pass_price = llfloor((F32)self->childGetValue("PriceSpin").asReal());
02564 F32 pass_hours = (F32)self->childGetValue("HoursSpin").asReal();
02565
02566
02567 parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group);
02568 parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list);
02569 parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list);
02570 parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE);
02571 parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment);
02572 parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified);
02573
02574 parcel->setPassPrice( pass_price );
02575 parcel->setPassHours( pass_hours );
02576
02577
02578 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
02579
02580
02581 self->refresh();
02582 }
02583
02584
02585 void LLPanelLandAccess::onClickAddAccess(void* data)
02586 {
02587 LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
02588 if (panelp)
02589 {
02590 gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBAccess, data) );
02591 }
02592 }
02593
02594
02595 void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
02596 {
02597 LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata;
02598 if (!names.empty() && !ids.empty())
02599 {
02600 LLUUID id = ids[0];
02601 LLParcel* parcel = panelp->mParcel->getParcel();
02602 if (parcel)
02603 {
02604 parcel->addToAccessList(id, 0);
02605 LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS);
02606 panelp->refresh();
02607 }
02608 }
02609 }
02610
02611
02612 void LLPanelLandAccess::onClickRemoveAccess(void* data)
02613 {
02614 LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
02615 if (panelp && panelp->mListAccess)
02616 {
02617 LLParcel* parcel = panelp->mParcel->getParcel();
02618 if (parcel)
02619 {
02620 std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected();
02621 for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
02622 iter != names.end(); )
02623 {
02624 LLScrollListItem* item = *iter++;
02625 const LLUUID& agent_id = item->getUUID();
02626 parcel->removeFromAccessList(agent_id);
02627 }
02628 LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS);
02629 panelp->refresh();
02630 }
02631 }
02632 }
02633
02634
02635 void LLPanelLandAccess::onClickAddBanned(void* data)
02636 {
02637 LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
02638 gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBBanned, data) );
02639 }
02640
02641
02642 void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata)
02643 {
02644 LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata;
02645 if (!names.empty() && !ids.empty())
02646 {
02647 LLUUID id = ids[0];
02648 LLParcel* parcel = panelp->mParcel->getParcel();
02649 if (parcel)
02650 {
02651 parcel->addToBanList(id, 0);
02652 LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN);
02653 panelp->refresh();
02654 }
02655 }
02656 }
02657
02658
02659 void LLPanelLandAccess::onClickRemoveBanned(void* data)
02660 {
02661 LLPanelLandAccess* panelp = (LLPanelLandAccess*)data;
02662 if (panelp && panelp->mListBanned)
02663 {
02664 LLParcel* parcel = panelp->mParcel->getParcel();
02665 if (parcel)
02666 {
02667 std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected();
02668 for (std::vector<LLScrollListItem*>::iterator iter = names.begin();
02669 iter != names.end(); )
02670 {
02671 LLScrollListItem* item = *iter++;
02672 const LLUUID& agent_id = item->getUUID();
02673 parcel->removeFromBanList(agent_id);
02674 }
02675 LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN);
02676 panelp->refresh();
02677 }
02678 }
02679 }
02680
02681
02682
02683
02684 LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel)
02685 : LLPanel("land_covenant_panel"), mParcel(parcel)
02686 {
02687 }
02688
02689 LLPanelLandCovenant::~LLPanelLandCovenant()
02690 {
02691 }
02692
02693 BOOL LLPanelLandCovenant::postBuild()
02694 {
02695 refresh();
02696 return TRUE;
02697 }
02698
02699
02700 void LLPanelLandCovenant::refresh()
02701 {
02702 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
02703 if(!region) return;
02704
02705 LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
02706 if (region_name)
02707 {
02708 region_name->setText(region->getName());
02709 }
02710
02711 LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
02712 if (resellable_clause)
02713 {
02714 if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
02715 {
02716 resellable_clause->setText(getString("can_not_resell"));
02717 }
02718 else
02719 {
02720 resellable_clause->setText(getString("can_resell"));
02721 }
02722 }
02723
02724 LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
02725 if (changeable_clause)
02726 {
02727 if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
02728 {
02729 changeable_clause->setText(getString("can_change"));
02730 }
02731 else
02732 {
02733 changeable_clause->setText(getString("can_not_change"));
02734 }
02735 }
02736
02737
02738 LLMessageSystem *msg = gMessageSystem;
02739 msg->newMessage("EstateCovenantRequest");
02740 msg->nextBlockFast(_PREHASH_AgentData);
02741 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
02742 msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
02743 msg->sendReliable(region->getHost());
02744 }
02745
02746
02747 void LLPanelLandCovenant::updateCovenantText(const std::string &string)
02748 {
02749 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
02750 if (self)
02751 {
02752 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
02753 if (editor)
02754 {
02755 editor->setHandleEditKeysDirectly(TRUE);
02756 editor->setText(string);
02757 }
02758 }
02759 }
02760
02761
02762 void LLPanelLandCovenant::updateEstateName(const std::string& name)
02763 {
02764 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
02765 if (self)
02766 {
02767 LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text");
02768 if (editor) editor->setText(name);
02769 }
02770 }
02771
02772
02773 void LLPanelLandCovenant::updateLastModified(const std::string& text)
02774 {
02775 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
02776 if (self)
02777 {
02778 LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text");
02779 if (editor) editor->setText(text);
02780 }
02781 }
02782
02783
02784 void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
02785 {
02786 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
02787 if (self)
02788 {
02789 LLTextBox* editor = self->getChild<LLTextBox>("estate_owner_text");
02790 if (editor) editor->setText(name);
02791 }
02792 }