From 8ce71811c57e93fe0a0a3153ba213d33085ac514 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 14 Jun 2013 23:08:56 -0400 Subject: [PATCH] Feature Request (from IRC): Allow less restrictive access to group profiles from search mAllowEdit has really signified whether or not llpanelgroup was in its own standalone floater This change removes the restrictions the lindens chose to put on group search, allowing the user as much control as possible over a group from outside a dedicated floater Notices and Land & Money get their information from messages passed through viewermessage, addressed to the right instance by id, as such they must be unique to the standalone floater Cancel button in group search will only enable when changes have been made and will refresh the group, clearing changes. The OK button is not visible in group search as it serves the same purpose as the Apply button here. --- indra/newview/llfloaterdirectory.cpp | 2 +- indra/newview/llpanelgroup.cpp | 17 ++++++++----- indra/newview/llpanelgroupgeneral.cpp | 25 +++++++------------ indra/newview/llpanelgrouproles.cpp | 2 +- indra/newview/llpanelgroupvoting.cpp | 2 +- .../default/xui/en-us/floater_directory.xml | 2 +- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 552406479..cd3c85b5f 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -390,7 +390,7 @@ void* LLFloaterDirectory::createGroupDetail(void* userdata) { LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; self->mPanelGroupp = new LLPanelGroup(gAgent.getGroupID()); - self->mPanelGroupp->setAllowEdit(FALSE || gAgent.isGodlike()); // Gods can always edit panels + self->mPanelGroupp->setAllowEdit(false); // Singu Note: This setting actually just tells the panel whether or not it is in search self->mPanelGroupp->setVisible(FALSE); return self->mPanelGroupp; } diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 619f89e84..ad8b2cd40 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -246,14 +246,13 @@ BOOL LLPanelGroup::postBuild() if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnCancel,this)); - button->setVisible(mAllowEdit); + button->setEnabled(mAllowEdit); // Cancel should always be enabled for standalone group floater, this is expected behavior and may be used for simply closing } button = getChild("btn_apply"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnApply,this)); - button->setVisible(mAllowEdit); button->setEnabled(FALSE); mApplyBtn = button; @@ -263,7 +262,6 @@ BOOL LLPanelGroup::postBuild() if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnRefresh,this)); - button->setVisible(mAllowEdit); } return TRUE; @@ -286,11 +284,15 @@ void LLPanelGroup::tabChanged() { //some tab information has changed,....enable/disable the apply button //based on if they need an apply + std::string str; + const bool need = mCurrentTab->needsApply(str); if ( mApplyBtn ) { - std::string mesg; - mApplyBtn->setEnabled(mCurrentTab->needsApply(mesg)); + mApplyBtn->setEnabled(need); } + if (mAllowEdit) return; // Cancel should always be enabled for standalone group floater, this is expected behavior and may be used for simply closing + if (LLUICtrl* ctrl = getChild("btn_cancel")) + ctrl->setEnabled(need); } void LLPanelGroup::handleClickTab() @@ -477,7 +479,10 @@ void LLPanelGroup::onBtnOK(void* user_data) void LLPanelGroup::onBtnCancel(void* user_data) { LLPanelGroup* self = static_cast(user_data); - self->close(); + if (self->mAllowEdit) // We're in a standalone floater + self->close(); + else // We're in search, we can't close out, just refreshData to kill changes + self->refreshData(); } // static diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 55b5b70ad..e524a280b 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -298,8 +298,7 @@ void LLPanelGroupGeneral::onCommitEnrollment() } // Make sure the agent can change enrollment info. - if (!gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS) - || !mAllowEdit) + if (!gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS)) { return; } @@ -317,7 +316,7 @@ void LLPanelGroupGeneral::onCommitEnrollment() void LLPanelGroupGeneral::onCommitTitle() { - if (mGroupID.isNull() || !mAllowEdit) return; + if (mGroupID.isNull()) return; LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID()); update(GC_TITLES); mComboActiveTitle->resetDirty(); @@ -564,7 +563,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if (mComboActiveTitle) { mComboActiveTitle->setVisible(is_member); - mComboActiveTitle->setEnabled(mAllowEdit); if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member); @@ -624,7 +622,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if (mCtrlShowInGroupList) { mCtrlShowInGroupList->set(gdatap->mShowInList); - mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); + mCtrlShowInGroupList->setEnabled(can_change_ident); mCtrlShowInGroupList->resetDirty(); } @@ -638,20 +636,20 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) { mComboMature->setCurrentByIndex(NON_MATURE_CONTENT); } - mComboMature->setEnabled(mAllowEdit && can_change_ident); + mComboMature->setEnabled(can_change_ident); mComboMature->setVisible( !gAgent.isTeen() ); mComboMature->resetDirty(); } if (mCtrlOpenEnrollment) { mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment); - mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts); + mCtrlOpenEnrollment->setEnabled(can_change_member_opts); mCtrlOpenEnrollment->resetDirty(); } if (mCtrlEnrollmentFee) { mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0); - mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts); + mCtrlEnrollmentFee->setEnabled(can_change_member_opts); mCtrlEnrollmentFee->resetDirty(); } @@ -659,9 +657,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) { S32 fee = gdatap->mMembershipFee; mSpinEnrollmentFee->set((F32)fee); - mSpinEnrollmentFee->setEnabled( mAllowEdit && - (fee > 0) && - can_change_member_opts); + mSpinEnrollmentFee->setEnabled(fee && can_change_member_opts); mSpinEnrollmentFee->resetDirty(); } if ( mBtnJoinGroup ) @@ -693,7 +689,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) mCtrlReceiveNotices->setVisible(is_member); if (is_member) { - mCtrlReceiveNotices->setEnabled(mAllowEdit); if(!mCtrlReceiveNotices->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc. { mCtrlReceiveNotices->set(agent_gdatap.mAcceptNotices); @@ -707,7 +702,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) mCtrlListGroup->setVisible(is_member); if (is_member) { - mCtrlListGroup->setEnabled(mAllowEdit); if(!mCtrlListGroup->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc. { mCtrlListGroup->set(agent_gdatap.mListInProfile); @@ -721,7 +715,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) mCtrlReceiveChat->setVisible(is_member); if (is_member) { - mCtrlReceiveChat->setEnabled(mAllowEdit); if(!mCtrlReceiveChat->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc. { mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID)); @@ -730,8 +723,8 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) } } - if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident); - if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident); + if (mInsignia) mInsignia->setEnabled(can_change_ident); + if (mEditCharter) mEditCharter->setEnabled(can_change_ident); if (mGroupName) mGroupName->setText(gdatap->mName); if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index d341d3ce8..0b5acb543 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -198,7 +198,7 @@ BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp) GP_MEMBER_EJECT | GP_MEMBER_OPTIONS ); */ - return mAllowEdit && agentp->isInGroup(mGroupID); + return agentp->isInGroup(mGroupID); } diff --git a/indra/newview/llpanelgroupvoting.cpp b/indra/newview/llpanelgroupvoting.cpp index 0eac7e5ec..2b03523b8 100644 --- a/indra/newview/llpanelgroupvoting.cpp +++ b/indra/newview/llpanelgroupvoting.cpp @@ -1491,7 +1491,7 @@ LLPanelGroupVoting::~LLPanelGroupVoting() BOOL LLPanelGroupVoting::isVisibleByAgent(LLAgent* agentp) { //if they are in the group, the panel is viewable - return mAllowEdit && agentp->isInGroup(mGroupID); + return agentp->isInGroup(mGroupID); } BOOL LLPanelGroupVoting::postBuild() diff --git a/indra/newview/skins/default/xui/en-us/floater_directory.xml b/indra/newview/skins/default/xui/en-us/floater_directory.xml index 78391be16..6817602b0 100644 --- a/indra/newview/skins/default/xui/en-us/floater_directory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_directory.xml @@ -703,7 +703,7 @@ To buy direct, visit the land and click on the place name in the title bar. width="430" /> -