diff options
Diffstat (limited to 'linden/indra/newview/llfloaterland.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterland.cpp | 713 |
1 files changed, 332 insertions, 381 deletions
diff --git a/linden/indra/newview/llfloaterland.cpp b/linden/indra/newview/llfloaterland.cpp index 283b3f4..543dd94 100644 --- a/linden/indra/newview/llfloaterland.cpp +++ b/linden/indra/newview/llfloaterland.cpp | |||
@@ -239,7 +239,6 @@ LLFloaterLand::LLFloaterLand() | |||
239 | factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); | 239 | factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); |
240 | factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); | 240 | factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); |
241 | factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); | 241 | factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); |
242 | factory_map["land_ban_panel"] = LLCallbackMap(createPanelLandBan, this); | ||
243 | 242 | ||
244 | gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); | 243 | gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); |
245 | 244 | ||
@@ -271,7 +270,6 @@ void LLFloaterLand::refresh() | |||
271 | mPanelOptions->refresh(); | 270 | mPanelOptions->refresh(); |
272 | mPanelMedia->refresh(); | 271 | mPanelMedia->refresh(); |
273 | mPanelAccess->refresh(); | 272 | mPanelAccess->refresh(); |
274 | mPanelBan->refresh(); | ||
275 | } | 273 | } |
276 | 274 | ||
277 | 275 | ||
@@ -326,15 +324,6 @@ void* LLFloaterLand::createPanelLandAccess(void* data) | |||
326 | return self->mPanelAccess; | 324 | return self->mPanelAccess; |
327 | } | 325 | } |
328 | 326 | ||
329 | // static | ||
330 | void* LLFloaterLand::createPanelLandBan(void* data) | ||
331 | { | ||
332 | LLFloaterLand* self = (LLFloaterLand*)data; | ||
333 | self->mPanelBan = new LLPanelLandBan(self->mParcel); | ||
334 | return self->mPanelBan; | ||
335 | } | ||
336 | |||
337 | |||
338 | //--------------------------------------------------------------------------- | 327 | //--------------------------------------------------------------------------- |
339 | // LLPanelLandGeneral | 328 | // LLPanelLandGeneral |
340 | //--------------------------------------------------------------------------- | 329 | //--------------------------------------------------------------------------- |
@@ -2558,35 +2547,27 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) | |||
2558 | 2547 | ||
2559 | BOOL LLPanelLandAccess::postBuild() | 2548 | BOOL LLPanelLandAccess::postBuild() |
2560 | { | 2549 | { |
2561 | 2550 | childSetCommitCallback("public_access", onCommitAny, this); | |
2562 | 2551 | childSetCommitCallback("limit_payment", onCommitAny, this); | |
2563 | mCheckGroup = LLUICtrlFactory::getCheckBoxByName(this, "GroupCheck"); | 2552 | childSetCommitCallback("limit_age_verified", onCommitAny, this); |
2564 | childSetCommitCallback("GroupCheck", onCommitAny, this); | 2553 | childSetCommitCallback("GroupCheck", onCommitAny, this); |
2565 | |||
2566 | mCheckAccess = LLUICtrlFactory::getCheckBoxByName(this, "AccessCheck"); | ||
2567 | childSetCommitCallback("AccessCheck", onCommitAny, this); | ||
2568 | |||
2569 | mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); | ||
2570 | mListAccess->sortByColumn(0, TRUE); // ascending | ||
2571 | |||
2572 | mBtnAddAccess = LLUICtrlFactory::getButtonByName(this, "Add..."); | ||
2573 | |||
2574 | mBtnAddAccess->setClickedCallback(onClickAdd, this); | ||
2575 | |||
2576 | mBtnRemoveAccess = LLUICtrlFactory::getButtonByName(this, "Remove"); | ||
2577 | |||
2578 | mBtnRemoveAccess->setClickedCallback(onClickRemove, this); | ||
2579 | |||
2580 | mCheckPass = LLUICtrlFactory::getCheckBoxByName(this, "PassCheck"); | ||
2581 | childSetCommitCallback("PassCheck", onCommitAny, this); | 2554 | childSetCommitCallback("PassCheck", onCommitAny, this); |
2582 | 2555 | childSetCommitCallback("pass_combo", onCommitAny, this); | |
2583 | |||
2584 | mSpinPrice = LLUICtrlFactory::getSpinnerByName(this, "PriceSpin"); | ||
2585 | childSetCommitCallback("PriceSpin", onCommitAny, this); | 2556 | childSetCommitCallback("PriceSpin", onCommitAny, this); |
2586 | |||
2587 | mSpinHours = LLUICtrlFactory::getSpinnerByName(this, "HoursSpin"); | ||
2588 | childSetCommitCallback("HoursSpin", onCommitAny, this); | 2557 | childSetCommitCallback("HoursSpin", onCommitAny, this); |
2589 | 2558 | ||
2559 | childSetAction("add_allowed", onClickAddAccess, this); | ||
2560 | childSetAction("remove_allowed", onClickRemoveAccess, this); | ||
2561 | childSetAction("add_banned", onClickAddBanned, this); | ||
2562 | childSetAction("remove_banned", onClickRemoveBanned, this); | ||
2563 | |||
2564 | mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); | ||
2565 | if (mListAccess) | ||
2566 | mListAccess->sortByColumn(0, TRUE); // ascending | ||
2567 | |||
2568 | mListBanned = LLUICtrlFactory::getNameListByName(this, "BannedList"); | ||
2569 | if (mListBanned) | ||
2570 | mListBanned->sortByColumn(0, TRUE); // ascending | ||
2590 | 2571 | ||
2591 | return TRUE; | 2572 | return TRUE; |
2592 | } | 2573 | } |
@@ -2598,106 +2579,241 @@ LLPanelLandAccess::~LLPanelLandAccess() | |||
2598 | 2579 | ||
2599 | void LLPanelLandAccess::refresh() | 2580 | void LLPanelLandAccess::refresh() |
2600 | { | 2581 | { |
2601 | mListAccess->deleteAllItems(); | 2582 | if (mListAccess) |
2602 | 2583 | mListAccess->deleteAllItems(); | |
2584 | if (mListBanned) | ||
2585 | mListBanned->deleteAllItems(); | ||
2586 | |||
2603 | LLParcel *parcel = mParcel->getParcel(); | 2587 | LLParcel *parcel = mParcel->getParcel(); |
2604 | 2588 | ||
2589 | // Display options | ||
2605 | if (parcel) | 2590 | if (parcel) |
2606 | { | 2591 | { |
2607 | // Display options | 2592 | BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); |
2608 | BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); | 2593 | BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); |
2609 | mCheckGroup->set( use_group ); | 2594 | BOOL public_access = !use_access_list && !use_group; |
2595 | |||
2596 | childSetValue("public_access", public_access ); | ||
2597 | childSetValue("GroupCheck", use_group ); | ||
2610 | 2598 | ||
2611 | char group_name[MAX_STRING]; /*Flawfinder: ignore*/ | 2599 | char group_name[MAX_STRING]; /*Flawfinder: ignore*/ |
2612 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | 2600 | gCacheName->getGroupName(parcel->getGroupID(), group_name); |
2613 | mCheckGroup->setLabelArg( "[GROUP]", LLString(group_name) ); | 2601 | childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name) ); |
2614 | 2602 | ||
2615 | S32 count = parcel->mAccessList.size(); | 2603 | // Allow list |
2616 | |||
2617 | BOOL use_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); | ||
2618 | mCheckAccess->set( use_list ); | ||
2619 | mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",count)); | ||
2620 | mCheckAccess->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); | ||
2621 | |||
2622 | access_map_const_iterator cit = parcel->mAccessList.begin(); | ||
2623 | access_map_const_iterator end = parcel->mAccessList.end(); | ||
2624 | |||
2625 | for (; cit != end; ++cit) | ||
2626 | { | 2604 | { |
2627 | const LLAccessEntry& entry = (*cit).second; | 2605 | S32 count = parcel->mAccessList.size(); |
2628 | LLString suffix; | 2606 | childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); |
2629 | if (entry.mTime != 0) | 2607 | childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); |
2608 | |||
2609 | // *TODO: Translate | ||
2610 | for (access_map_const_iterator cit = parcel->mAccessList.begin(); | ||
2611 | cit != parcel->mAccessList.end(); ++cit) | ||
2630 | { | 2612 | { |
2631 | S32 now = time(NULL); | 2613 | const LLAccessEntry& entry = (*cit).second; |
2632 | S32 seconds = entry.mTime - now; | 2614 | LLString suffix; |
2633 | if (seconds < 0) seconds = 0; | 2615 | if (entry.mTime != 0) |
2634 | suffix.assign(" ("); | ||
2635 | if (seconds >= 120) | ||
2636 | { | 2616 | { |
2637 | char buf[30]; /*Flawfinder: ignore*/ | 2617 | S32 now = time(NULL); |
2638 | snprintf(buf, sizeof(buf), "%d minutes", (seconds/60)); /* Flawfinder: ignore */ | 2618 | S32 seconds = entry.mTime - now; |
2639 | suffix.append(buf); | 2619 | if (seconds < 0) seconds = 0; |
2620 | suffix.assign(" ("); | ||
2621 | if (seconds >= 120) | ||
2622 | { | ||
2623 | std::string buf = llformat("%d minutes", (seconds/60)); | ||
2624 | suffix.append(buf); | ||
2625 | } | ||
2626 | else if (seconds >= 60) | ||
2627 | { | ||
2628 | suffix.append("1 minute"); | ||
2629 | } | ||
2630 | else | ||
2631 | { | ||
2632 | std::string buf = llformat("%d seconds", seconds); | ||
2633 | suffix.append(buf); | ||
2634 | } | ||
2635 | suffix.append(" remaining)"); | ||
2640 | } | 2636 | } |
2641 | else if (seconds >= 60) | 2637 | if (mListAccess) |
2642 | { | 2638 | mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); |
2643 | suffix.append("1 minute"); | ||
2644 | } | ||
2645 | else | ||
2646 | { | ||
2647 | char buf[30]; /*Flawfinder: ignore*/ | ||
2648 | snprintf(buf, sizeof(buf), "%d seconds", seconds); /* Flawfinder: ignore */ | ||
2649 | suffix.append(buf); | ||
2650 | } | ||
2651 | suffix.append(" remaining)"); | ||
2652 | } | 2639 | } |
2653 | mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); | ||
2654 | } | 2640 | } |
2655 | 2641 | ||
2656 | BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); | 2642 | // Ban List |
2657 | 2643 | { | |
2658 | BOOL enable_add = can_manage_allowed && (count < PARCEL_MAX_ACCESS_LIST); | 2644 | S32 count = parcel->mBanList.size(); |
2659 | mBtnAddAccess->setEnabled(enable_add); | ||
2660 | 2645 | ||
2661 | BOOL enable_remove = can_manage_allowed && (count > 0); | 2646 | childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",count)); |
2662 | mBtnRemoveAccess->setEnabled(enable_remove); | 2647 | childSetToolTipArg("BannedList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); |
2663 | 2648 | ||
2664 | // Can only sell passes when limiting the access. | 2649 | for (access_map_const_iterator cit = parcel->mBanList.begin(); |
2665 | BOOL can_manage_passes = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_PASSES); | 2650 | cit != parcel->mBanList.end(); ++cit) |
2666 | mCheckPass->setEnabled( (use_group || use_list) && can_manage_passes ); | 2651 | { |
2652 | const LLAccessEntry& entry = (*cit).second; | ||
2653 | LLString suffix; | ||
2654 | if (entry.mTime != 0) | ||
2655 | { | ||
2656 | S32 now = time(NULL); | ||
2657 | S32 seconds = entry.mTime - now; | ||
2658 | if (seconds < 0) seconds = 0; | ||
2659 | suffix.assign(" ("); | ||
2660 | if (seconds >= 120) | ||
2661 | { | ||
2662 | std::string buf = llformat("%d minutes", (seconds/60)); | ||
2663 | suffix.append(buf); | ||
2664 | } | ||
2665 | else if (seconds >= 60) | ||
2666 | { | ||
2667 | suffix.append("1 minute"); | ||
2668 | } | ||
2669 | else | ||
2670 | { | ||
2671 | std::string buf = llformat("%d seconds", seconds); | ||
2672 | suffix.append(buf); | ||
2673 | } | ||
2674 | suffix.append(" remaining)"); | ||
2675 | } | ||
2676 | mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); | ||
2677 | } | ||
2678 | } | ||
2667 | 2679 | ||
2680 | if(parcel->getRegionDenyAnonymousOverride()) | ||
2681 | { | ||
2682 | childSetValue("limit_payment", TRUE); | ||
2683 | } | ||
2684 | else | ||
2685 | { | ||
2686 | childSetValue("limit_payment", (parcel->getParcelFlag(PF_DENY_ANONYMOUS))); | ||
2687 | } | ||
2688 | if(parcel->getRegionDenyAgeUnverifiedOverride()) | ||
2689 | { | ||
2690 | childSetValue("limit_age_verified", TRUE); | ||
2691 | } | ||
2692 | else | ||
2693 | { | ||
2694 | childSetValue("limit_age_verified", (parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); | ||
2695 | } | ||
2696 | |||
2668 | BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); | 2697 | BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); |
2669 | mCheckPass->set( use_pass ); | 2698 | childSetValue("PassCheck", use_pass ); |
2670 | 2699 | LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); | |
2671 | BOOL enable_pass = can_manage_passes && use_pass; | 2700 | if (passcombo) |
2672 | mSpinPrice->setEnabled( enable_pass ); | 2701 | { |
2673 | mSpinHours->setEnabled( enable_pass ); | 2702 | if (public_access || !use_pass || !use_group) |
2674 | 2703 | { | |
2704 | passcombo->selectByValue("anyone"); | ||
2705 | } | ||
2706 | } | ||
2707 | |||
2675 | S32 pass_price = parcel->getPassPrice(); | 2708 | S32 pass_price = parcel->getPassPrice(); |
2676 | mSpinPrice->set( F32(pass_price) ); | 2709 | childSetValue( "PriceSpin", (F32)pass_price ); |
2677 | 2710 | ||
2678 | F32 pass_hours = parcel->getPassHours(); | 2711 | F32 pass_hours = parcel->getPassHours(); |
2679 | mSpinHours->set( pass_hours ); | 2712 | childSetValue( "HoursSpin", pass_hours ); |
2680 | |||
2681 | mCheckGroup->setEnabled( can_manage_allowed ); | ||
2682 | mCheckAccess->setEnabled( can_manage_allowed ); | ||
2683 | |||
2684 | } | 2713 | } |
2685 | else | 2714 | else |
2686 | { | 2715 | { |
2687 | mCheckGroup->set(FALSE); | 2716 | childSetValue("public_access", FALSE); |
2688 | mCheckGroup->setLabelArg( "[GROUP]", LLString::null ); | 2717 | childSetValue("limit_payment", FALSE); |
2689 | mCheckAccess->set(FALSE); | 2718 | childSetValue("limit_age_verified", FALSE); |
2690 | mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",0)); | 2719 | childSetValue("GroupCheck", FALSE); |
2691 | mBtnAddAccess->setEnabled(FALSE); | 2720 | childSetLabelArg("GroupCheck", "[GROUP]", LLString::null ); |
2692 | mBtnRemoveAccess->setEnabled(FALSE); | 2721 | childSetValue("PassCheck", FALSE); |
2693 | mSpinPrice->set((F32)PARCEL_PASS_PRICE_DEFAULT); | 2722 | childSetValue("PriceSpin", (F32)PARCEL_PASS_PRICE_DEFAULT); |
2694 | mSpinPrice->setEnabled(FALSE); | 2723 | childSetValue( "HoursSpin", PARCEL_PASS_HOURS_DEFAULT ); |
2695 | mSpinHours->set( PARCEL_PASS_HOURS_DEFAULT ); | 2724 | childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",0)); |
2696 | mSpinHours->setEnabled(FALSE); | 2725 | childSetToolTipArg("AccessList", "[MAX]", llformat("%d",0)); |
2697 | mCheckGroup->setEnabled(FALSE); | 2726 | childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",0)); |
2698 | mCheckAccess->setEnabled(FALSE); | 2727 | childSetToolTipArg("BannedList", "[MAX]", llformat("%d",0)); |
2728 | } | ||
2729 | } | ||
2730 | |||
2731 | void LLPanelLandAccess::refresh_ui() | ||
2732 | { | ||
2733 | childSetEnabled("public_access", FALSE); | ||
2734 | childSetEnabled("limit_payment", FALSE); | ||
2735 | childSetEnabled("limit_age_verified", FALSE); | ||
2736 | childSetEnabled("GroupCheck", FALSE); | ||
2737 | childSetEnabled("PassCheck", FALSE); | ||
2738 | childSetEnabled("pass_combo", FALSE); | ||
2739 | childSetEnabled("PriceSpin", FALSE); | ||
2740 | childSetEnabled("HoursSpin", FALSE); | ||
2741 | childSetEnabled("AccessList", FALSE); | ||
2742 | childSetEnabled("BannedList", FALSE); | ||
2743 | |||
2744 | LLParcel *parcel = mParcel->getParcel(); | ||
2745 | if (parcel) | ||
2746 | { | ||
2747 | BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); | ||
2748 | BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); | ||
2749 | |||
2750 | childSetEnabled("public_access", can_manage_allowed); | ||
2751 | BOOL public_access = childGetValue("public_access").asBoolean(); | ||
2752 | if (public_access) | ||
2753 | { | ||
2754 | bool override = false; | ||
2755 | if(parcel->getRegionDenyAnonymousOverride()) | ||
2756 | { | ||
2757 | override = true; | ||
2758 | childSetEnabled("limit_payment", FALSE); | ||
2759 | } | ||
2760 | else | ||
2761 | { | ||
2762 | childSetEnabled("limit_payment", can_manage_allowed); | ||
2763 | } | ||
2764 | if(parcel->getRegionDenyAgeUnverifiedOverride()) | ||
2765 | { | ||
2766 | override = true; | ||
2767 | childSetEnabled("limit_age_verified", FALSE); | ||
2768 | } | ||
2769 | else | ||
2770 | { | ||
2771 | childSetEnabled("limit_age_verified", can_manage_allowed); | ||
2772 | } | ||
2773 | if (override) | ||
2774 | { | ||
2775 | childSetToolTip("Only Allow", getUIString("estate_override")); | ||
2776 | } | ||
2777 | else | ||
2778 | { | ||
2779 | childSetToolTip("Only Allow", LLString()); | ||
2780 | } | ||
2781 | childSetEnabled("GroupCheck", FALSE); | ||
2782 | childSetEnabled("PassCheck", FALSE); | ||
2783 | childSetEnabled("pass_combo", FALSE); | ||
2784 | childSetEnabled("AccessList", FALSE); | ||
2785 | } | ||
2786 | else | ||
2787 | { | ||
2788 | childSetEnabled("limit_payment", FALSE); | ||
2789 | childSetEnabled("limit_age_verified", FALSE); | ||
2790 | char group_name[MAX_STRING]; /*Flawfinder: ignore*/ | ||
2791 | if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) | ||
2792 | { | ||
2793 | childSetEnabled("GroupCheck", can_manage_allowed); | ||
2794 | } | ||
2795 | BOOL group_access = childGetValue("GroupCheck").asBoolean(); | ||
2796 | BOOL sell_passes = childGetValue("PassCheck").asBoolean(); | ||
2797 | childSetEnabled("PassCheck", can_manage_allowed); | ||
2798 | if (sell_passes) | ||
2799 | { | ||
2800 | childSetEnabled("pass_combo", group_access && can_manage_allowed); | ||
2801 | childSetEnabled("PriceSpin", can_manage_allowed); | ||
2802 | childSetEnabled("HoursSpin", can_manage_allowed); | ||
2803 | } | ||
2804 | } | ||
2805 | childSetEnabled("AccessList", can_manage_allowed); | ||
2806 | S32 allowed_list_count = parcel->mAccessList.size(); | ||
2807 | childSetEnabled("add_allowed", can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); | ||
2808 | childSetEnabled("remove_allowed", can_manage_allowed && allowed_list_count > 0); | ||
2809 | |||
2810 | childSetEnabled("BannedList", can_manage_banned); | ||
2811 | S32 banned_list_count = parcel->mBanList.size(); | ||
2812 | childSetEnabled("add_banned", can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); | ||
2813 | childSetEnabled("remove_banned", can_manage_banned && banned_list_count > 0); | ||
2699 | } | 2814 | } |
2700 | } | 2815 | } |
2816 | |||
2701 | 2817 | ||
2702 | // public | 2818 | // public |
2703 | void LLPanelLandAccess::refreshNames() | 2819 | void LLPanelLandAccess::refreshNames() |
@@ -2709,23 +2825,19 @@ void LLPanelLandAccess::refreshNames() | |||
2709 | { | 2825 | { |
2710 | gCacheName->getGroupName(parcel->getGroupID(), group_name); | 2826 | gCacheName->getGroupName(parcel->getGroupID(), group_name); |
2711 | } | 2827 | } |
2712 | mCheckGroup->setLabelArg("[GROUP]", LLString(group_name)); | 2828 | childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name)); |
2713 | } | 2829 | } |
2714 | 2830 | ||
2715 | 2831 | ||
2716 | // virtual | 2832 | // virtual |
2717 | void LLPanelLandAccess::draw() | 2833 | void LLPanelLandAccess::draw() |
2718 | { | 2834 | { |
2835 | refresh_ui(); | ||
2719 | refreshNames(); | 2836 | refreshNames(); |
2720 | LLPanel::draw(); | 2837 | LLPanel::draw(); |
2721 | } | 2838 | } |
2722 | 2839 | ||
2723 | 2840 | ||
2724 | void LLPanelLandAccess::onAccessLevelChange(LLUICtrl*, void *userdata) | ||
2725 | { | ||
2726 | LLPanelLandAccess::onCommitAny(NULL, userdata); | ||
2727 | } | ||
2728 | |||
2729 | // static | 2841 | // static |
2730 | void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) | 2842 | void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) |
2731 | { | 2843 | { |
@@ -2738,27 +2850,53 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) | |||
2738 | } | 2850 | } |
2739 | 2851 | ||
2740 | // Extract data from UI | 2852 | // Extract data from UI |
2741 | BOOL use_access_group = self->mCheckGroup->get(); | 2853 | BOOL public_access = self->childGetValue("public_access").asBoolean(); |
2742 | BOOL use_access_list = self->mCheckAccess->get(); | 2854 | BOOL limit_payment = FALSE, limit_age_verified = FALSE; |
2743 | BOOL use_pass_list = self->mCheckPass->get(); | 2855 | BOOL use_access_group = FALSE; |
2744 | 2856 | BOOL use_access_list = FALSE; | |
2745 | 2857 | BOOL use_pass_list = FALSE; | |
2746 | 2858 | if (public_access) | |
2747 | // Must be limiting access to sell passes | ||
2748 | if (!use_access_group && !use_access_list) | ||
2749 | { | 2859 | { |
2750 | use_pass_list = FALSE; | 2860 | use_access_list = FALSE; |
2861 | limit_payment = self->childGetValue("limit_payment").asBoolean(); | ||
2862 | limit_age_verified = self->childGetValue("limit_age_verified").asBoolean(); | ||
2863 | } | ||
2864 | else | ||
2865 | { | ||
2866 | use_access_list = TRUE; | ||
2867 | use_access_group = self->childGetValue("GroupCheck").asBoolean(); | ||
2868 | use_pass_list = self->childGetValue("PassCheck").asBoolean(); | ||
2869 | if (use_access_group) | ||
2870 | { | ||
2871 | char group_name[MAX_STRING]; /*Flawfinder: ignore*/ | ||
2872 | if (!gCacheName->getGroupName(parcel->getGroupID(), group_name)) | ||
2873 | { | ||
2874 | use_access_group = FALSE; | ||
2875 | } | ||
2876 | if (use_pass_list) | ||
2877 | { | ||
2878 | LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); | ||
2879 | if (passcombo) | ||
2880 | { | ||
2881 | if (passcombo->getSimpleSelectedValue().asString() == "group") | ||
2882 | { | ||
2883 | use_access_list = FALSE; | ||
2884 | } | ||
2885 | } | ||
2886 | } | ||
2887 | } | ||
2751 | } | 2888 | } |
2752 | 2889 | ||
2753 | S32 pass_price = llfloor(self->mSpinPrice->get()); | 2890 | S32 pass_price = llfloor((F32)self->childGetValue("PriceSpin").asReal()); |
2754 | F32 pass_hours = self->mSpinHours->get(); | 2891 | F32 pass_hours = (F32)self->childGetValue("HoursSpin").asReal(); |
2755 | |||
2756 | // Validate extracted data | ||
2757 | 2892 | ||
2758 | // Push data into current parcel | 2893 | // Push data into current parcel |
2759 | parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); | 2894 | parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); |
2760 | parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list); | 2895 | parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list); |
2761 | parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list); | 2896 | parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list); |
2897 | parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE); | ||
2898 | parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment); | ||
2899 | parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified); | ||
2762 | 2900 | ||
2763 | parcel->setPassPrice( pass_price ); | 2901 | parcel->setPassPrice( pass_price ); |
2764 | parcel->setPassHours( pass_hours ); | 2902 | parcel->setPassHours( pass_hours ); |
@@ -2771,287 +2909,100 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) | |||
2771 | } | 2909 | } |
2772 | 2910 | ||
2773 | // static | 2911 | // static |
2774 | void LLPanelLandAccess::onClickAdd(void* data) | 2912 | void LLPanelLandAccess::onClickAddAccess(void* data) |
2775 | { | 2913 | { |
2776 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; | 2914 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; |
2777 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); | 2915 | if (panelp) |
2778 | } | 2916 | { |
2779 | 2917 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBAccess, data) ); | |
2780 | // static | 2918 | } |
2781 | void LLPanelLandAccess::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | ||
2782 | { | ||
2783 | LLPanelLandAccess* self = (LLPanelLandAccess*)userdata; | ||
2784 | if (names.empty() || ids.empty()) return; | ||
2785 | self->addAvatar(ids[0]); | ||
2786 | } | ||
2787 | |||
2788 | |||
2789 | void LLPanelLandAccess::addAvatar(LLUUID id) | ||
2790 | { | ||
2791 | LLParcel* parcel = mParcel->getParcel(); | ||
2792 | if (!parcel) return; | ||
2793 | |||
2794 | parcel->addToAccessList(id, 0); | ||
2795 | |||
2796 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); | ||
2797 | |||
2798 | refresh(); | ||
2799 | } | 2919 | } |
2800 | 2920 | ||
2801 | |||
2802 | // static | 2921 | // static |
2803 | void LLPanelLandAccess::onClickRemove(void* data) | 2922 | void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) |
2804 | { | 2923 | { |
2805 | LLPanelLandAccess* self = (LLPanelLandAccess*)data; | 2924 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; |
2806 | if (!self) return; | 2925 | if (!names.empty() && !ids.empty()) |
2807 | |||
2808 | LLScrollListItem* item = self->mListAccess->getFirstSelected(); | ||
2809 | if (!item) return; | ||
2810 | |||
2811 | LLParcel* parcel = self->mParcel->getParcel(); | ||
2812 | if (!parcel) return; | ||
2813 | |||
2814 | const LLUUID& agent_id = item->getUUID(); | ||
2815 | |||
2816 | parcel->removeFromAccessList(agent_id); | ||
2817 | |||
2818 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); | ||
2819 | |||
2820 | self->refresh(); | ||
2821 | } | ||
2822 | |||
2823 | |||
2824 | |||
2825 | //--------------------------------------------------------------------------- | ||
2826 | // LLPanelLandBan | ||
2827 | //--------------------------------------------------------------------------- | ||
2828 | LLPanelLandBan::LLPanelLandBan(LLParcelSelectionHandle& parcel) | ||
2829 | : LLPanel("land_ban_panel"), mParcel(parcel) | ||
2830 | { | ||
2831 | |||
2832 | } | ||
2833 | |||
2834 | |||
2835 | |||
2836 | BOOL LLPanelLandBan::postBuild() | ||
2837 | { | ||
2838 | |||
2839 | mCheck = LLUICtrlFactory::getCheckBoxByName(this, "LandBanCheck"); | ||
2840 | childSetCommitCallback("LandBanCheck", onCommitAny, this); | ||
2841 | |||
2842 | mList = LLUICtrlFactory::getNameListByName(this, "LandBanList"); | ||
2843 | mList->sortByColumn(0, TRUE); // ascending | ||
2844 | |||
2845 | mBtnAdd = LLUICtrlFactory::getButtonByName(this, "Add..."); | ||
2846 | |||
2847 | mBtnAdd->setClickedCallback(onClickAdd, this); | ||
2848 | |||
2849 | mBtnRemove = LLUICtrlFactory::getButtonByName(this, "Remove"); | ||
2850 | |||
2851 | mBtnRemove->setClickedCallback(onClickRemove, this); | ||
2852 | |||
2853 | mCheckDenyAnonymous = LLUICtrlFactory::getCheckBoxByName(this, "DenyAnonymousCheck"); | ||
2854 | childSetCommitCallback("DenyAnonymousCheck", onCommitAny, this); | ||
2855 | |||
2856 | mCheckDenyIdentified = LLUICtrlFactory::getCheckBoxByName(this, "DenyIdentifiedCheck"); | ||
2857 | childSetCommitCallback("DenyIdentifiedCheck", onCommitAny, this); | ||
2858 | |||
2859 | mCheckDenyTransacted = LLUICtrlFactory::getCheckBoxByName(this, "DenyTransactedCheck"); | ||
2860 | childSetCommitCallback("DenyTransactedCheck", onCommitAny, this); | ||
2861 | |||
2862 | return TRUE; | ||
2863 | |||
2864 | } | ||
2865 | |||
2866 | |||
2867 | LLPanelLandBan::~LLPanelLandBan() | ||
2868 | { } | ||
2869 | |||
2870 | void LLPanelLandBan::refresh() | ||
2871 | { | ||
2872 | mList->deleteAllItems(); | ||
2873 | |||
2874 | LLParcel *parcel = mParcel->getParcel(); | ||
2875 | |||
2876 | if (parcel) | ||
2877 | { | 2926 | { |
2878 | // Display options | 2927 | LLUUID id = ids[0]; |
2879 | 2928 | LLParcel* parcel = panelp->mParcel->getParcel(); | |
2880 | S32 count = parcel->mBanList.size(); | 2929 | if (parcel) |
2881 | |||
2882 | BOOL use_ban = parcel->getParcelFlag(PF_USE_BAN_LIST); | ||
2883 | mCheck->set( use_ban ); | ||
2884 | mCheck->setLabelArg( "[LISTED]", llformat("%d",count)); | ||
2885 | mCheck->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); | ||
2886 | |||
2887 | access_map_const_iterator cit = parcel->mBanList.begin(); | ||
2888 | access_map_const_iterator end = parcel->mBanList.end(); | ||
2889 | for ( ; cit != end; ++cit) | ||
2890 | { | ||
2891 | const LLAccessEntry& entry = (*cit).second; | ||
2892 | LLString suffix; | ||
2893 | if (entry.mTime != 0) | ||
2894 | { | ||
2895 | S32 now = time(NULL); | ||
2896 | S32 seconds = entry.mTime - now; | ||
2897 | if (seconds < 0) seconds = 0; | ||
2898 | suffix.assign(" ("); | ||
2899 | if (seconds >= 120) | ||
2900 | { | ||
2901 | char buf[30]; /*Flawfinder: ignore*/ | ||
2902 | snprintf(buf, sizeof(buf), "%d minutes", (seconds/60)); /* Flawfinder: ignore */ | ||
2903 | suffix.append(buf); | ||
2904 | } | ||
2905 | else if (seconds >= 60) | ||
2906 | { | ||
2907 | suffix.append("1 minute"); | ||
2908 | } | ||
2909 | else | ||
2910 | { | ||
2911 | char buf[30]; /*Flawfinder: ignore*/ | ||
2912 | snprintf(buf, sizeof(buf), "%d seconds", seconds); /* Flawfinder: ignore */ | ||
2913 | suffix.append(buf); | ||
2914 | } | ||
2915 | suffix.append(" remaining)"); | ||
2916 | } | ||
2917 | mList->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); | ||
2918 | } | ||
2919 | |||
2920 | BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); | ||
2921 | mCheck->setEnabled( can_manage_banned ); | ||
2922 | mCheckDenyAnonymous->setEnabled( FALSE ); | ||
2923 | mCheckDenyIdentified->setEnabled( FALSE ); | ||
2924 | mCheckDenyTransacted->setEnabled( FALSE ); | ||
2925 | |||
2926 | if(parcel->getRegionDenyAnonymousOverride()) | ||
2927 | { | ||
2928 | mCheckDenyAnonymous->set(TRUE); | ||
2929 | } | ||
2930 | else if(can_manage_banned) | ||
2931 | { | ||
2932 | mCheckDenyAnonymous->setEnabled(TRUE); | ||
2933 | mCheckDenyAnonymous->set(parcel->getParcelFlag(PF_DENY_ANONYMOUS)); | ||
2934 | } | ||
2935 | if(parcel->getRegionDenyIdentifiedOverride()) | ||
2936 | { | ||
2937 | mCheckDenyIdentified->set(TRUE); | ||
2938 | } | ||
2939 | else if(can_manage_banned) | ||
2940 | { | ||
2941 | mCheckDenyIdentified->setEnabled(TRUE); | ||
2942 | mCheckDenyIdentified->set(parcel->getParcelFlag(PF_DENY_IDENTIFIED)); | ||
2943 | } | ||
2944 | if(parcel->getRegionDenyTransactedOverride()) | ||
2945 | { | ||
2946 | mCheckDenyTransacted->set(TRUE); | ||
2947 | } | ||
2948 | else if(can_manage_banned) | ||
2949 | { | 2930 | { |
2950 | mCheckDenyTransacted->setEnabled(TRUE); | 2931 | parcel->addToAccessList(id, 0); |
2951 | mCheckDenyTransacted->set(parcel->getParcelFlag(PF_DENY_TRANSACTED)); | 2932 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); |
2933 | panelp->refresh(); | ||
2952 | } | 2934 | } |
2953 | |||
2954 | |||
2955 | BOOL enable_add = can_manage_banned && (count < PARCEL_MAX_ACCESS_LIST); | ||
2956 | mBtnAdd->setEnabled(enable_add); | ||
2957 | |||
2958 | BOOL enable_remove = can_manage_banned && (count > 0); | ||
2959 | mBtnRemove->setEnabled(enable_remove); | ||
2960 | } | ||
2961 | else | ||
2962 | { | ||
2963 | mCheck->set(FALSE); | ||
2964 | mCheck->setLabelArg( "[LISTED]", llformat("%d",0)); | ||
2965 | mCheck->setEnabled(FALSE); | ||
2966 | mBtnAdd->setEnabled(FALSE); | ||
2967 | mBtnRemove->setEnabled(FALSE); | ||
2968 | mCheckDenyAnonymous->set(FALSE); | ||
2969 | mCheckDenyAnonymous->setEnabled(FALSE); | ||
2970 | mCheckDenyIdentified->set(FALSE); | ||
2971 | mCheckDenyIdentified->setEnabled(FALSE); | ||
2972 | mCheckDenyTransacted->set(FALSE); | ||
2973 | mCheckDenyTransacted->setEnabled(FALSE); | ||
2974 | } | 2935 | } |
2975 | } | 2936 | } |
2976 | 2937 | ||
2977 | // static | 2938 | // static |
2978 | void LLPanelLandBan::onCommitAny(LLUICtrl *ctrl, void *userdata) | 2939 | void LLPanelLandAccess::onClickRemoveAccess(void* data) |
2979 | { | 2940 | { |
2980 | LLPanelLandBan *self = (LLPanelLandBan*)userdata; | 2941 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; |
2981 | 2942 | if (panelp && panelp->mListAccess) | |
2982 | LLParcel* parcel = self->mParcel->getParcel(); | ||
2983 | if (!parcel) | ||
2984 | { | 2943 | { |
2985 | return; | 2944 | LLParcel* parcel = panelp->mParcel->getParcel(); |
2945 | if (parcel) | ||
2946 | { | ||
2947 | std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected(); | ||
2948 | for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); | ||
2949 | iter != names.end(); ) | ||
2950 | { | ||
2951 | LLScrollListItem* item = *iter++; | ||
2952 | const LLUUID& agent_id = item->getUUID(); | ||
2953 | parcel->removeFromAccessList(agent_id); | ||
2954 | } | ||
2955 | gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); | ||
2956 | panelp->refresh(); | ||
2957 | } | ||
2986 | } | 2958 | } |
2987 | |||
2988 | // Extract data from UI | ||
2989 | BOOL use_ban_list = self->mCheck->get(); | ||
2990 | BOOL deny_access_anonymous = self->mCheckDenyAnonymous->get(); | ||
2991 | BOOL deny_access_identified = self->mCheckDenyIdentified->get(); | ||
2992 | BOOL deny_access_transacted = self->mCheckDenyTransacted->get(); | ||
2993 | |||
2994 | // Push data into current parcel | ||
2995 | parcel->setParcelFlag(PF_USE_BAN_LIST, use_ban_list); | ||
2996 | parcel->setParcelFlag(PF_DENY_ANONYMOUS, deny_access_anonymous); | ||
2997 | parcel->setParcelFlag(PF_DENY_IDENTIFIED, deny_access_identified); | ||
2998 | parcel->setParcelFlag(PF_DENY_TRANSACTED, deny_access_transacted); | ||
2999 | |||
3000 | // Send current parcel data upstream to server | ||
3001 | gParcelMgr->sendParcelPropertiesUpdate( parcel ); | ||
3002 | |||
3003 | // Might have changed properties, so let's redraw! | ||
3004 | self->refresh(); | ||
3005 | } | 2959 | } |
3006 | 2960 | ||
3007 | // static | 2961 | // static |
3008 | void LLPanelLandBan::onClickAdd(void* data) | 2962 | void LLPanelLandAccess::onClickAddBanned(void* data) |
3009 | { | 2963 | { |
3010 | LLPanelLandBan* panelp = (LLPanelLandBan*)data; | 2964 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; |
3011 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); | 2965 | gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBBanned, data) ); |
3012 | } | 2966 | } |
3013 | 2967 | ||
3014 | // static | 2968 | // static |
3015 | void LLPanelLandBan::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) | 2969 | void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) |
3016 | { | 2970 | { |
3017 | LLPanelLandBan* self = (LLPanelLandBan*)userdata; | 2971 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; |
3018 | if (names.empty() || ids.empty()) return; | 2972 | if (!names.empty() && !ids.empty()) |
3019 | self->addAvatar(ids[0]); | 2973 | { |
3020 | } | 2974 | LLUUID id = ids[0]; |
3021 | 2975 | LLParcel* parcel = panelp->mParcel->getParcel(); | |
3022 | 2976 | if (parcel) | |
3023 | void LLPanelLandBan::addAvatar(LLUUID id) | 2977 | { |
3024 | { | 2978 | parcel->addToBanList(id, 0); |
3025 | LLParcel* parcel = mParcel->getParcel(); | 2979 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); |
3026 | if (!parcel) return; | 2980 | panelp->refresh(); |
3027 | 2981 | } | |
3028 | parcel->addToBanList(id, 0); | 2982 | } |
3029 | |||
3030 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); | ||
3031 | |||
3032 | refresh(); | ||
3033 | } | 2983 | } |
3034 | 2984 | ||
3035 | |||
3036 | // static | 2985 | // static |
3037 | void LLPanelLandBan::onClickRemove(void* data) | 2986 | void LLPanelLandAccess::onClickRemoveBanned(void* data) |
3038 | { | 2987 | { |
3039 | LLPanelLandBan* self = (LLPanelLandBan*)data; | 2988 | LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; |
3040 | if (!self) return; | 2989 | if (panelp && panelp->mListBanned) |
3041 | 2990 | { | |
3042 | LLScrollListItem* item = self->mList->getFirstSelected(); | 2991 | LLParcel* parcel = panelp->mParcel->getParcel(); |
3043 | if (!item) return; | 2992 | if (parcel) |
3044 | 2993 | { | |
3045 | LLParcel* parcel = self->mParcel->getParcel(); | 2994 | std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected(); |
3046 | if (!parcel) return; | 2995 | for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); |
3047 | 2996 | iter != names.end(); ) | |
3048 | const LLUUID& agent_id = item->getUUID(); | 2997 | { |
3049 | 2998 | LLScrollListItem* item = *iter++; | |
3050 | parcel->removeFromBanList(agent_id); | 2999 | const LLUUID& agent_id = item->getUUID(); |
3051 | 3000 | parcel->removeFromBanList(agent_id); | |
3052 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); | 3001 | } |
3053 | 3002 | gParcelMgr->sendParcelAccessListUpdate(AL_BAN); | |
3054 | self->refresh(); | 3003 | panelp->refresh(); |
3004 | } | ||
3005 | } | ||
3055 | } | 3006 | } |
3056 | 3007 | ||
3057 | //--------------------------------------------------------------------------- | 3008 | //--------------------------------------------------------------------------- |