From 4945ae17d3692f089ce6c996f6585a5e5b308e4d Mon Sep 17 00:00:00 2001 From: Baker Linden Date: Thu, 29 Aug 2013 11:36:45 -0700 Subject: Initial commit for GroupBan - Lots of crap isn't working as intended yet. --- indra/newview/llpanelgroupbulk.cpp | 403 +++++++++++++++++++++++++++++++++++++ 1 file changed, 403 insertions(+) create mode 100644 indra/newview/llpanelgroupbulk.cpp (limited to 'indra/newview/llpanelgroupbulk.cpp') diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp new file mode 100644 index 0000000000..6c6fd8cfe0 --- /dev/null +++ b/indra/newview/llpanelgroupbulk.cpp @@ -0,0 +1,403 @@ +/** +* @file llpanelgroupbulk.cpp +* @brief Implementation of llpanelgroupbulk +* @author Baker@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelgroupbulk.h" +#include "llpanelgroupbulkimpl.h" + +#include "llagent.h" +#include "llavatarnamecache.h" +#include "llfloateravatarpicker.h" +#include "llbutton.h" +#include "llcallingcard.h" +#include "llcombobox.h" +#include "llgroupactions.h" +#include "llgroupmgr.h" +#include "llnamelistctrl.h" +#include "llnotificationsutil.h" +#include "llscrolllistitem.h" +#include "llspinctrl.h" +#include "lltextbox.h" +#include "llviewerobject.h" +#include "llviewerobjectlist.h" +#include "lluictrlfactory.h" +#include "llviewerwindow.h" + + +////////////////////////////////////////////////////////////////////////// +// Implementation of llpanelgroupbulkimpl.h functions +////////////////////////////////////////////////////////////////////////// +LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) : + mGroupID(group_id), + mBulkAgentList(NULL), + mOKButton(NULL), + mRemoveButton(NULL), + mGroupName(NULL), + mLoadingText(), + mTooManySelected(), + mCloseCallback(NULL), + mCloseCallbackUserData(NULL), + mAvatarNameCacheConnection(), + mRoleNames(NULL), + mOwnerWarning(), + mAlreadyInGroup(), + mConfirmedOwnerInvite(false) +{} + +LLPanelGroupBulkImpl::~LLPanelGroupBulkImpl() +{ + if(mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + +void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata) +{ + LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata; + + if(panelp) + { + //Right now this is hard coded with some knowledge that it is part + //of a floater since the avatar picker needs to be added as a dependent + //floater to the parent floater. + //Soon the avatar picker will be embedded into this panel + //instead of being it's own separate floater. But that is next week. + //This will do for now. -jwolk May 10, 2006 + LLView* button = panelp->findChild("add_button"); + LLFloater* root_floater = gFloaterView->getParentFloater(panelp); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( + boost::bind(callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button); + if(picker) + { + root_floater->addDependentFloater(picker); + } + } +} + +void LLPanelGroupBulkImpl::callbackClickRemove(void* userdata) +{ + LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; + if (selfp) + selfp->handleRemove(); +} + +void LLPanelGroupBulkImpl::callbackClickCancel(void* userdata) +{ + LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; + if(selfp) + (*(selfp->mCloseCallback))(selfp->mCloseCallbackUserData); +} + +void LLPanelGroupBulkImpl::callbackSelect(LLUICtrl* ctrl, void* userdata) +{ + LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*)userdata; + if (selfp) + selfp->handleSelection(); +} + +void LLPanelGroupBulkImpl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data) +{ + std::vector names; + for (S32 i = 0; i < (S32)agent_ids.size(); i++) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(agent_ids[i], &av_name)) + { + onAvatarNameCache(agent_ids[i], av_name, user_data); + } + else + { + LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data; + if (selfp) + { + if (selfp->mAvatarNameCacheConnection.connected()) + { + selfp->mAvatarNameCacheConnection.disconnect(); + } + // *TODO : Add a callback per avatar name being fetched. + selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(onAvatarNameCache, _1, _2, user_data)); + } + } + } +} + +void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, void* user_data) +{ + LLPanelGroupBulkImpl* selfp = (LLPanelGroupBulkImpl*) user_data; + + if (selfp) + { + if (selfp->mAvatarNameCacheConnection.connected()) + { + selfp->mAvatarNameCacheConnection.disconnect(); + } + std::vector names; + uuid_vec_t agent_ids; + agent_ids.push_back(agent_id); + names.push_back(av_name.getCompleteName()); + + selfp->addUsers(names, agent_ids); + } +} + +void LLPanelGroupBulkImpl::handleRemove() +{ + std::vector selection = mBulkAgentList->getAllSelected(); + if (selection.empty()) + return; + + mBulkAgentList->deleteSelectedItems(); + mRemoveButton->setEnabled(FALSE); + + if( mOKButton && mOKButton->getEnabled() && + mBulkAgentList->isEmpty()) + { + mOKButton->setEnabled(FALSE); + } +} + +void LLPanelGroupBulkImpl::handleSelection() +{ + std::vector selection = mBulkAgentList->getAllSelected(); + if (selection.empty()) + mRemoveButton->setEnabled(FALSE); + else + mRemoveButton->setEnabled(TRUE); +} + +void LLPanelGroupBulkImpl::addUsers(const std::vector& names, const uuid_vec_t& agent_ids) +{ + std::string name; + LLUUID id; + + for (S32 i = 0; i < (S32)names.size(); ++i) + { + name = names[i]; + id = agent_ids[i]; + + // Make sure this agent isn't already in the list. + bool already_in_list = false; + std::vector items = mBulkAgentList->getAllData(); + std::vector::iterator iter = items.begin(); + for (; iter != items.end(); ++iter) + { + LLScrollListItem* item = *iter; + if (item->getUUID() == id) + { + already_in_list = true; + break; + } + } + if (already_in_list) + { + continue; + } + + //add the name to the names list + LLSD row; + row["id"] = id; + row["columns"][0]["value"] = name; + + mBulkAgentList->addElement(row); + + // We've successfully added someone to the list. + if(mOKButton && !mOKButton->getEnabled()) + mOKButton->setEnabled(TRUE); + } +} + +void LLPanelGroupBulkImpl::setGroupName(std::string name) +{ + if(mGroupName) + mGroupName->setText(name); +} + + +LLPanelGroupBulk::LLPanelGroupBulk(const LLUUID& group_id) : + LLPanel(), + mImplementation(new LLPanelGroupBulkImpl(group_id)), + mPendingGroupPropertiesUpdate(false), + mPendingRoleDataUpdate(false), + mPendingMemberDataUpdate(false) +{} + +LLPanelGroupBulk::~LLPanelGroupBulk() +{ + delete mImplementation; +} + +void LLPanelGroupBulk::clear() +{ + if(mImplementation->mBulkAgentList) + mImplementation->mBulkAgentList->deleteAllItems(); + + if(mImplementation->mOKButton) + mImplementation->mOKButton->setEnabled(FALSE); +} + +void LLPanelGroupBulk::update() +{ + updateGroupName(); + updateGroupData(); +} + +void LLPanelGroupBulk::draw() +{ + LLPanel::draw(); + update(); +} + +void LLPanelGroupBulk::updateGroupName() +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); + + if( gdatap && + gdatap->isGroupPropertiesDataComplete()) + { + // Only do work if the current group name differs + if(mImplementation->mGroupName->getText().compare(gdatap->mName) != 0) + mImplementation->setGroupName(gdatap->mName); + } + else + { + mImplementation->setGroupName(mImplementation->mLoadingText); + } +} + +void LLPanelGroupBulk::updateGroupData() +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); + if(!gdatap) + return; + + if(gdatap->isGroupPropertiesDataComplete()) + mPendingGroupPropertiesUpdate = false; + else + { + if(!mPendingGroupPropertiesUpdate) + { + mPendingGroupPropertiesUpdate = true; + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); + } + } + + if(gdatap->isRoleDataComplete()) + mPendingRoleDataUpdate = false; + else + { + if(!mPendingRoleDataUpdate) + { + mPendingRoleDataUpdate = true; + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); + } + } + + if(gdatap->isMemberDataComplete()) + mPendingMemberDataUpdate = false; + else + { + if(!mPendingMemberDataUpdate) + { + mPendingMemberDataUpdate = true; + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID); + } + } +} + +void LLPanelGroupBulk::addUserCallback(const LLUUID& id, const LLAvatarName& av_name) +{ + std::vector names; + uuid_vec_t agent_ids; + agent_ids.push_back(id); + names.push_back(av_name.getAccountName()); + + mImplementation->addUsers(names, agent_ids); +} + +void LLPanelGroupBulk::setCloseCallback(void (*close_callback)(void*), void* data) +{ + mImplementation->mCloseCallback = close_callback; + mImplementation->mCloseCallbackUserData = data; +} + +void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) +{ + std::vector names; + for (S32 i = 0; i < (S32)agent_ids.size(); i++) + { + std::string fullname; + LLUUID agent_id = agent_ids[i]; + LLViewerObject* dest = gObjectList.findObject(agent_id); + if(dest && dest->isAvatar()) + { + LLNameValue* nvfirst = dest->getNVPair("FirstName"); + LLNameValue* nvlast = dest->getNVPair("LastName"); + if(nvfirst && nvlast) + { + fullname = LLCacheName::buildFullName( + nvfirst->getString(), nvlast->getString()); + + } + if (!fullname.empty()) + { + names.push_back(fullname); + } + else + { + llwarns << "llPanelGroupBulk: Selected avatar has no name: " << dest->getID() << llendl; + names.push_back("(Unknown)"); + } + } + else + { + //looks like user try to invite offline friend + //for offline avatar_id gObjectList.findObject() will return null + //so we need to do this additional search in avatar tracker, see EXT-4732 + if (LLAvatarTracker::instance().isBuddy(agent_id)) + { + LLAvatarName av_name; + if (!LLAvatarNameCache::get(agent_id, &av_name)) + { + // actually it should happen, just in case + LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&LLPanelGroupBulk::addUserCallback, this, _1, _2)); + // for this special case! + //when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence + // removed id will be added in callback + agent_ids.erase(agent_ids.begin() + i); + } + else + { + names.push_back(av_name.getAccountName()); + } + } + } + } + mImplementation->addUsers(names, agent_ids); +} + -- cgit v1.3 From 34f561db55868185f0a946009f41f4f212366484 Mon Sep 17 00:00:00 2001 From: Baker Linden Date: Fri, 13 Sep 2013 17:20:04 -0700 Subject: - Added ban date to ban list ui - Code cleanup --- indra/newview/llgroupmgr.cpp | 17 +- indra/newview/llgroupmgr.h | 11 +- indra/newview/llnamelistctrl.cpp | 29 +-- indra/newview/llnamelistctrl.h | 3 - indra/newview/llpanelgroupbulk.cpp | 3 + indra/newview/llpanelgroupbulkban.cpp | 9 +- indra/newview/llpanelgrouproles.cpp | 274 ++++----------------- indra/newview/llpanelgrouproles.h | 27 +- .../skins/default/xui/en/panel_group_roles.xml | 5 +- 9 files changed, 67 insertions(+), 311 deletions(-) (limited to 'indra/newview/llpanelgroupbulk.cpp') diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 7cb53066ea..7e7098420d 100755 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1872,7 +1872,6 @@ void GroupBanDataResponder::errorWithContent(U32 pStatus, const std::string& pRe void GroupBanDataResponder::result(const LLSD& content) { - LL_INFOS("GrpMgr") << "[BAKER] Received ban data!" << LL_ENDL; LLGroupMgr::processGroupBanRequest(content); } @@ -1934,7 +1933,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) // Did we get anything in content? if(!content.size()) { - LL_DEBUGS("GrpMgr") << "No group member data received." << LL_ENDL; + LL_WARNS("GrpMgr") << "No group member data received." << LL_ENDL; return; } @@ -1949,14 +1948,18 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) for(;i != iEnd; ++i) { const LLUUID ban_id(i->first); - // We have nothing right now inside our banlist map. - // Once ban_date is implemented, set that here! - // - gdatap->createBanEntry(ban_id, LLGroupBanData()); + LLSD ban_entry(i->second); + + LLGroupBanData ban_data; + if(ban_entry.has("ban_date")) + { + ban_data.mBanDate = ban_entry["ban_date"].asDate(); + } + + gdatap->createBanEntry(ban_id, ban_data); } gdatap->mChanged = TRUE; -// gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_COMPLETE); LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST); } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 7e3297b757..ba767b91ad 100755 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -195,10 +195,10 @@ struct lluuid_pair_less struct LLGroupBanData { - LLGroupBanData() { mBanDate = "00/00/0000"; } + LLGroupBanData(): mBanDate() {} ~LLGroupBanData() {} - std::string mBanDate; // Just store something here to ensure it works. + LLDate mBanDate; // Just store something here to ensure it works. }; @@ -248,11 +248,7 @@ public: const LLUUID& getMemberVersion() const { return mMemberVersion; } - ////////////////////////////////////////////////////////////////////////// - // BAN LIST - ////////////////////////////////////////////////////////////////////////// void clearBanList() { mBanList.clear(); } - void getBanList(const LLUUID& group_id, LLGroupBanData& ban_data); const LLGroupBanData& getBanEntry(const LLUUID& ban_id) { return mBanList[ban_id]; } @@ -383,7 +379,7 @@ public: static void sendGroupMemberInvites(const LLUUID& group_id, std::map& role_member_pairs); static void sendGroupMemberEjects(const LLUUID& group_id, uuid_vec_t& member_ids); - // BAKER - Group Ban + static void sendGroupBanRequest(EBanRequestType request_type, const LLUUID& group_id, EBanRequestAction ban_action = BAN_NO_ACTION, @@ -391,7 +387,6 @@ public: static void processGroupBanRequest(const LLSD& content); - // BAKER void sendCapGroupMembersRequest(const LLUUID& group_id); static void processCapGroupMembersRequest(const LLSD& content); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index ed684004f0..141f893945 100755 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -73,19 +73,11 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, BOOL enabled, const std::string& suffix) { - //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; - NameItem item; item.value = agent_id; item.enabled = enabled; item.target = INDIVIDUAL; - ////////////////////////////////////////////////////////////////////////// - // BAKER - FIX NameListCtrl - //mPendingLookupsRemaining--; - ////////////////////////////////////////////////////////////////////////// - - return addNameItemRow(item, pos, suffix); } @@ -282,12 +274,6 @@ void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPositi LLScrollListItem* LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { item.target = INDIVIDUAL; - - ////////////////////////////////////////////////////////////////////////// - // BAKER - FIX NameListCtrl - //mPendingLookupsRemaining--; - ////////////////////////////////////////////////////////////////////////// - return addNameItemRow(item, pos); } @@ -297,12 +283,6 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p LLParamSDParser parser; parser.readSD(element, item_params); item_params.userdata = userdata; - - ////////////////////////////////////////////////////////////////////////// - // BAKER - FIX NameListCtrl - //mPendingLookupsRemaining--; - ////////////////////////////////////////////////////////////////////////// - return addNameItemRow(item_params, pos); } @@ -355,10 +335,9 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( } mAvatarNameCacheConnection = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, item->getHandle())); - ////////////////////////////////////////////////////////////////////////// - // BAKER - FIX NameListCtrl if(mPendingLookupsRemaining <= 0) { + // BAKER TODO: // We might get into a state where mPendingLookupsRemaining might // go negative. So just reset it right now and figure out if it's // possible later :) @@ -366,8 +345,6 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( mNameListCompleteSignal(false); } mPendingLookupsRemaining++; - ////////////////////////////////////////////////////////////////////////// - } break; } @@ -420,11 +397,7 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id) selectNthItem(idx); // not sure whether this is needed, taken from previous implementation deleteSingleItem(idx); - ////////////////////////////////////////////////////////////////////////// - // BAKER - FIX NameListCtrl mPendingLookupsRemaining--; - ////////////////////////////////////////////////////////////////////////// - } } diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 80ed081fd3..856af84e23 100755 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -165,8 +165,6 @@ private: bool mShortNames; // display name only, no SLID boost::signals2::connection mAvatarNameCacheConnection; - ////////////////////////////////////////////////////////////////////////// - // BAKER: Fixing name list control not being updated properly. S32 mPendingLookupsRemaining; namelist_complete_signal_t mNameListCompleteSignal; @@ -175,7 +173,6 @@ public: { return mNameListCompleteSignal.connect(onNameListCompleteCallback); } - ////////////////////////////////////////////////////////////////////////// }; diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index 6c6fd8cfe0..ed05a5c7d1 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -294,7 +294,10 @@ void LLPanelGroupBulk::updateGroupData() { LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); if(!gdatap) + { + LL_WARNS("Groups") << "Unable to get group data for group " << mImplementation->mGroupID << LL_ENDL; return; + } if(gdatap->isGroupPropertiesDataComplete()) mPendingGroupPropertiesUpdate = false; diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index d6bb669275..af1809b1f8 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -143,14 +143,7 @@ void LLPanelGroupBulkBan::submit() LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE, banned_agent_list); - // BAKER TEMP: - // For now, don't close, but clear the list. - mImplementation->mBulkAgentList->deleteAllItems(); - //then close - //(*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); + (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); } - - - diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 76cb3cc498..01baedefb7 100755 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -110,6 +110,7 @@ bool agentCanAddToRole(const LLUUID& group_id, return false; } + // LLPanelGroupRoles ///////////////////////////////////////////////////// // static @@ -299,7 +300,6 @@ bool LLPanelGroupRoles::onModalClose(const LLSD& notification, const LLSD& respo return false; } - bool LLPanelGroupRoles::apply(std::string& mesg) { // Pass this along to the currently visible sub tab. @@ -336,7 +336,6 @@ void LLPanelGroupRoles::update(LLGroupChange gc) { if (mGroupID.isNull()) return; - LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); if (panelp) { @@ -353,39 +352,33 @@ void LLPanelGroupRoles::activate() { // Start requesting member and role data if needed. LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); - //if (!gdatap || mFirstUse) + if (!gdatap || !gdatap->isMemberDataComplete() ) { - // Check member data. - - if (!gdatap || !gdatap->isMemberDataComplete() ) - { - LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID); - } - - // Check role data. - if (!gdatap || !gdatap->isRoleDataComplete() ) - { - // Mildly hackish - clear all pending changes - cancel(); + LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID); + } - LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); - } + if (!gdatap || !gdatap->isRoleDataComplete() ) + { + // Mildly hackish - clear all pending changes + cancel(); - // Check role-member mapping data. - if (!gdatap || !gdatap->isRoleMemberDataComplete() ) - { - LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID); - } + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); + } - // Need this to get base group member powers - if (!gdatap || !gdatap->isGroupPropertiesDataComplete() ) - { - LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); - } + // Check role-member mapping data. + if (!gdatap || !gdatap->isRoleMemberDataComplete() ) + { + LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID); + } - mFirstUse = FALSE; + // Need this to get base group member powers + if (!gdatap || !gdatap->isGroupPropertiesDataComplete() ) + { + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); } + mFirstUse = FALSE; + LLPanelGroupTab* panelp = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); if (panelp) panelp->activate(); } @@ -414,7 +407,6 @@ BOOL LLPanelGroupRoles::hasModal() return panelp->hasModal(); } -// BAKER -- Moved this from all the way at the bottom void LLPanelGroupRoles::setGroupID(const LLUUID& id) { LLPanelGroupTab::setGroupID(id); @@ -439,14 +431,8 @@ void LLPanelGroupRoles::setGroupID(const LLUUID& id) activate(); } -////////////////////////////////////////////////////////////////////////// - // LLPanelGroupSubTab //////////////////////////////////////////////////// - -//////////////////////////// -// LLPanelGroupSubTab -//////////////////////////// LLPanelGroupSubTab::LLPanelGroupSubTab() : LLPanelGroupTab(), mHeader(NULL), @@ -759,14 +745,8 @@ void LLPanelGroupSubTab::setFooterEnabled(BOOL enable) } } -////////////////////////////////////////////////////////////////////////// - // LLPanelGroupMembersSubTab ///////////////////////////////////////////// - -//////////////////////////// -// LLPanelGroupMembersSubTab -//////////////////////////// static LLRegisterPanelClassWrapper t_panel_group_members_subtab("panel_group_members_subtab"); LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab() @@ -851,7 +831,6 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) mBanBtn->setEnabled(FALSE); } - return TRUE; } @@ -930,14 +909,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() LLGroupMgrGroupData::role_list_t::iterator iter = gdatap->mRoles.begin(); LLGroupMgrGroupData::role_list_t::iterator end = gdatap->mRoles.end(); - ////////////////////////////////////////////////////////////////////////// - // BAKER STUB: - // Check if the member has the power to ban (just like the eject below) - // Right now, just give it to them (for testing) BOOL can_ban_members = gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS); - ////////////////////////////////////////////////////////////////////////// - BOOL can_eject_members = gAgent.hasPowerInGroup(mGroupID, - GP_MEMBER_EJECT); + BOOL can_eject_members = gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_EJECT); BOOL member_is_owner = FALSE; for( ; iter != end; ++iter) @@ -1146,8 +1119,7 @@ void LLPanelGroupMembersSubTab::handleEjectMembers() sendEjectNotifications(mGroupID, selected_members); - LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, - selected_members); + LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members); } void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members) @@ -1180,7 +1152,6 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, BOOL is_owner_role = ( gdatap->mOwnerRole == role_id ); LLUUID member_id; - std::vector selection = mMembersList->getAllSelected(); if (selection.empty()) @@ -1191,7 +1162,6 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, for (std::vector::iterator itor = selection.begin() ; itor != selection.end(); ++itor) { - member_id = (*itor)->getUUID(); //see if we requested a change for this member before @@ -1304,8 +1274,6 @@ void LLPanelGroupMembersSubTab::deactivate() bool LLPanelGroupMembersSubTab::needsApply(std::string& mesg) { - LL_INFOS("BAKER") << "[BAKER] needsApply()" << LL_ENDL; - return mChanged; } @@ -1627,8 +1595,9 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) item_params.columns.add().column("donated").value(donated.getString()) .font.name("SANSSERIF_SMALL").style("NORMAL"); - item_params.columns.add().column("online").value(data->getOnlineStatus()) - .font.name("SANSSERIF_SMALL").style("NORMAL"); + item_params.columns.add().column("online").value(data->getOnlineStatus()) + .font.name("SANSSERIF_SMALL").style("NORMAL"); + mMembersList->addNameItemRow(item_params); mHasMatch = TRUE; @@ -1686,7 +1655,6 @@ void LLPanelGroupMembersSubTab::updateMembers() mMembersList->deleteAllItems(); } - LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end(); LLTimer update_time; @@ -1739,7 +1707,6 @@ void LLPanelGroupMembersSubTab::updateMembers() handleMemberSelect(); } -// BAKER void LLPanelGroupMembersSubTab::onBanMember(void* user_data) { LLPanelGroupMembersSubTab* self = static_cast(user_data); @@ -1748,20 +1715,16 @@ void LLPanelGroupMembersSubTab::onBanMember(void* user_data) void LLPanelGroupMembersSubTab::handleBanMember() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupMembersSubTab::handleBanMember()" << LL_ENDL; - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if(!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::handleMemberSelect() " - << "-- No group data!" << llendl; + LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL; return; } std::vector selection = mMembersList->getAllSelected(); if(selection.empty()) { - LL_WARNS("BAKER") << "[BAKER] Empty selection!" << LL_ENDL; return; } @@ -1777,19 +1740,11 @@ void LLPanelGroupMembersSubTab::handleBanMember() } LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_CREATE, ban_ids); - // Will this work? handleEjectMembers(); - } -////////////////////////////////////////////////////////////////////////// - // LLPanelGroupRolesSubTab /////////////////////////////////////////////// - -//////////////////////////// -// LLPanelGroupRolesSubTab -//////////////////////////// static LLRegisterPanelClassWrapper t_panel_group_roles_subtab("panel_group_roles_subtab"); LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab() @@ -2520,14 +2475,8 @@ void LLPanelGroupRolesSubTab::setGroupID(const LLUUID& id) LLPanelGroupSubTab::setGroupID(id); } -////////////////////////////////////////////////////////////////////////// - // LLPanelGroupActionsSubTab ///////////////////////////////////////////// - -//////////////////////////// -// LLPanelGroupActionsSubTab -//////////////////////////// static LLRegisterPanelClassWrapper t_panel_group_actions_subtab("panel_group_actions_subtab"); LLPanelGroupActionsSubTab::LLPanelGroupActionsSubTab() @@ -2714,9 +2663,7 @@ void LLPanelGroupActionsSubTab::setGroupID(const LLUUID& id) } -//////////////////////////// -// LLPanelGroupBanListSubTab -//////////////////////////// +// LLPanelGroupBanListSubTab ///////////////////////////////////////////// static LLRegisterPanelClassWrapper t_panel_group_ban_subtab("panel_group_banlist_subtab"); LLPanelGroupBanListSubTab::LLPanelGroupBanListSubTab() @@ -2784,91 +2731,21 @@ void LLPanelGroupBanListSubTab::activate() update(GC_ALL); } -void LLPanelGroupBanListSubTab::deactivate() -{ - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::deactivate()" << LL_ENDL; - - LLPanelGroupSubTab::deactivate(); -} - -bool LLPanelGroupBanListSubTab::needsApply(std::string& mesg) -{ - LL_INFOS("BAKER") << "LLPanelGroupBanListSubTab::needsApply()" << LL_ENDL; - - // STUB - return false; -} - -bool LLPanelGroupBanListSubTab::apply(std::string& mesg) -{ - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::apply()" << LL_ENDL; - - - - - // STUB - return true; -} - void LLPanelGroupBanListSubTab::update(LLGroupChange gc) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::update()" << LL_ENDL; - - //if (gc != GC_ALL && gc != GC_BANLIST) - // return; - -// LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); -// if(!gdatap) -// { -// LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; -// return; -// } - populateBanList(); -// // Do I even need this anymore? -// switch(gdatap->getGroupBanStatus()) -// { -// // Must be initial update [ Check if I should request this at panel creation -// // with everything else -- might as well] -// // Request our ban list! -// case LLGroupMgrGroupData::STATUS_INIT: -// LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); -// gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); -// break; -// -// // Already have a request out -- don't bother sending another one -// // Repeat sending won't make a difference, as it'll be behind a load balancer -// case LLGroupMgrGroupData::STATUS_REQUESTING: -// // Maybe here we call populate ban list as well, and see about how many -// // more names we need to complete the ban list -// break; -// -// // See if the list needs updating -- if we call update, but nothing changed, -// // there's no reason to send another request. -// // [NOTHING CHANGED] - Do Nothing! -// // [SOMETHING CHANGED] - Don't panic! Just repopulate the ban list! -// case LLGroupMgrGroupData::STATUS_COMPLETE: -// populateBanList(); -// break; -// } -// - - } void LLPanelGroupBanListSubTab::draw() { LLPanelGroupSubTab::draw(); - //if(mPendingBanUpdate) + // BAKER: Might be good to put it here instead of update, maybe.. See how often draw gets hit. // populateBanList(); } - void LLPanelGroupBanListSubTab::onBanEntrySelect(LLUICtrl* ctrl, void* user_data) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onBanEntrySelect()" << LL_ENDL; - LLPanelGroupBanListSubTab* self = static_cast(user_data); if (!self) return; @@ -2878,49 +2755,12 @@ void LLPanelGroupBanListSubTab::onBanEntrySelect(LLUICtrl* ctrl, void* user_data void LLPanelGroupBanListSubTab::handleBanEntrySelect() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleBanEntrySelect()" << LL_ENDL; - - // BAKER TODO: -- MOVE TO SELECT BAN ENTRY - // Make sure only authorized people have access to adding / deleting bans - //if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) - mCreateBanButton->setEnabled(TRUE); - - // Check if the agent has the ability to unban this person - //if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) + if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) mDeleteBanButton->setEnabled(TRUE); } - -void LLPanelGroupBanListSubTab::onBanGroupMember(void* user_data) -{ - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onBanGroupMember()" << LL_ENDL; - - LLPanelGroupBanListSubTab* self = static_cast(user_data); - if (!self) - return; - - self->handleBanGroupMember(); -} - -void LLPanelGroupBanListSubTab::handleBanGroupMember() -{ - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleBanGroupMember()" << LL_ENDL; - - ////////////////////////////////////////////////////////////////////////// - // BAKER TEMP - // Getting viewer functionality working, so I'm gonna cheat a bit here for now - // Assume everything worked on the back end - // - // First, get the entries added to the ban list - ////////////////////////////////////////////////////////////////////////// - -} - - void LLPanelGroupBanListSubTab::onCreateBanEntry(void* user_data) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onCreateBanEntry()" << LL_ENDL; - LLPanelGroupBanListSubTab* self = static_cast(user_data); if (!self) return; @@ -2930,26 +2770,12 @@ void LLPanelGroupBanListSubTab::onCreateBanEntry(void* user_data) void LLPanelGroupBanListSubTab::handleCreateBanEntry() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleCreateBanEntry()" << LL_ENDL; - - // STUB - // Attempt to add an entry into the database - // If there was a problem, don't add the entry to the local list - // Otherwise, add it - // - // For now, let's just add it to the local list for testing. We can hook it up - // at the end. - - LLFloaterGroupBulkBan::showForGroup(mGroupID); - + populateBanList(); } - void LLPanelGroupBanListSubTab::onDeleteBanEntry(void* user_data) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onDeleteBanEntry()" << LL_ENDL; - LLPanelGroupBanListSubTab* self = static_cast(user_data); if (!self) return; @@ -2959,33 +2785,25 @@ void LLPanelGroupBanListSubTab::onDeleteBanEntry(void* user_data) void LLPanelGroupBanListSubTab::handleDeleteBanEntry() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleDeleteBanEntry()" << LL_ENDL; - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if(!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::handleMemberSelect() " - << "-- No group data!" << llendl; + LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL; return; } std::vector selection = mBanList->getAllSelected(); if(selection.empty()) { - LL_WARNS("BAKER") << "[BAKER] Empty selection!" << LL_ENDL; return; } - ////////////////////////////////////////////////////////////////////////// - // BAKER STUB: - // Check if the member has the power to ban (just like the eject below) bool can_ban_members = false; if (gAgent.isGodlike() || gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) { can_ban_members = true; } - ////////////////////////////////////////////////////////////////////////// // Owners can ban anyone in the group. LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID()); @@ -3005,8 +2823,8 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() LLUUID ban_id = (*itor)->getUUID(); ban_ids.push_back(ban_id); - //gdatap->removeBanEntry(ban_id); - //mBanList->removeNameItem(ban_id); + gdatap->removeBanEntry(ban_id); + mBanList->removeNameItem(ban_id); // Removing an item removes the selection, we shouldn't be able to click // the button anymore until we reselect another entry. @@ -3016,11 +2834,8 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } - void LLPanelGroupBanListSubTab::onRefreshBanList(void* user_data) { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::onRefreshBanList()" << LL_ENDL; - LLPanelGroupBanListSubTab* self = static_cast(user_data); if (!self) return; @@ -3030,13 +2845,10 @@ void LLPanelGroupBanListSubTab::onRefreshBanList(void* user_data) void LLPanelGroupBanListSubTab::handleRefreshBanList() { - LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::handleRefreshBanList()" << LL_ENDL; - mRefreshBanListButton->setEnabled(FALSE); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); } - void LLPanelGroupBanListSubTab::onBanListCompleted(bool isComplete) { if(isComplete) @@ -3051,7 +2863,7 @@ void LLPanelGroupBanListSubTab::populateBanList() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if(!gdatap) { - LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; + LL_WARNS("Groups") << "Unable to get group data for group " << mGroupID << LL_ENDL; return; } @@ -3061,25 +2873,23 @@ void LLPanelGroupBanListSubTab::populateBanList() { LLNameListCtrl::NameItem ban_entry; ban_entry.value = entry->first; + LLGroupBanData bd = entry->second; + + ban_entry.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL"); + ban_entry.columns.add().column("ban_date").value(bd.mBanDate.toHTTPDateString("%Y/%m/%d")).font.name("SANSSERIF_SMALL").style("NORMAL"); + mBanList->addNameItemRow(ban_entry); } - + mRefreshBanListButton->setEnabled(TRUE); } - void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) { if(mBanList) mBanList->deleteAllItems(); setFooterEnabled(FALSE); - LLPanelGroupSubTab::setGroupID(id); + LLPanelGroupSubTab::setGroupID(id); } - - - - - - diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 2f37805f48..851f73bba0 100755 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -39,11 +39,9 @@ class LLScrollListCtrl; class LLScrollListItem; class LLTextEditor; -// Forward declare for friend usage. -//virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*); - typedef std::map icon_map_t; + class LLPanelGroupRoles : public LLPanelGroupTab { public: @@ -92,6 +90,7 @@ protected: std::string mWantApplyMesg; }; + class LLPanelGroupSubTab : public LLPanelGroupTab { public: @@ -147,6 +146,7 @@ protected: void setOthersVisible(BOOL b); }; + class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab { public: @@ -222,6 +222,7 @@ protected: boost::signals2::connection mAvatarNameCacheConnection; }; + class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab { public: @@ -284,6 +285,7 @@ protected: std::string mRemoveEveryoneTxt; }; + class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab { public: @@ -310,6 +312,7 @@ protected: LLTextEditor* mActionDescription; }; + class LLPanelGroupBanListSubTab : public LLPanelGroupSubTab { public: @@ -318,30 +321,12 @@ public: virtual BOOL postBuildSubTab(LLView* root); - // Triggered when the tab becomes active. virtual void activate(); - - // Triggered when the tab becomes inactive. - virtual void deactivate(); - - // Asks if something needs to be applied. - // If returning true, this function should modify the message to the user. - virtual bool needsApply(std::string& mesg); - - // Request to apply current data. - // If returning fail, this function should modify the message to the user. - virtual bool apply(std::string& mesg); - - // Triggered when group information changes in the group manager. virtual void update(LLGroupChange gc); - virtual void draw(); static void onBanEntrySelect(LLUICtrl* ctrl, void* user_data); void handleBanEntrySelect(); - - static void onBanGroupMember(void* user_data); - void handleBanGroupMember(); static void onCreateBanEntry(void* user_data); void handleCreateBanEntry(); diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml index 70d19de848..15ddc8f313 100755 --- a/indra/newview/skins/default/xui/en/panel_group_roles.xml +++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml @@ -327,14 +327,11 @@ name="name" font.name="SANSSERIF_SMALL" font.style="NORMAL" - relative_width="0.4" /> + relative_width="0.7" /> -