diff options
author | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
commit | 215f423cbe18fe9ca14a26caef918d303bad28ff (patch) | |
tree | 0743442b286216cc8e19aa487c26f4e9345ffd64 /linden/indra/newview/llpanelgroupgeneral.cpp | |
parent | Second Life viewer sources 1.18.3.5-RC (diff) | |
download | meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.zip meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.gz meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.bz2 meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.xz |
Second Life viewer sources 1.18.4.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelgroupgeneral.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.cpp | 179 |
1 files changed, 90 insertions, 89 deletions
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp index b443036..ba0895d 100644 --- a/linden/indra/newview/llpanelgroupgeneral.cpp +++ b/linden/indra/newview/llpanelgroupgeneral.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file llpanelgroupgeneral.cpp | 2 | * @file llpanelgroupgeneral.cpp |
3 | * @brief General information about a group. | 3 | * @brief General information about a group. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2006&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2006-2007, Linden Research, Inc. | 7 | * Copyright (c) 2006-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
@@ -73,12 +76,12 @@ LLPanelGroupGeneral::LLPanelGroupGeneral(const std::string& name, | |||
73 | mBtnJoinGroup(NULL), | 76 | mBtnJoinGroup(NULL), |
74 | mListVisibleMembers(NULL), | 77 | mListVisibleMembers(NULL), |
75 | mCtrlShowInGroupList(NULL), | 78 | mCtrlShowInGroupList(NULL), |
76 | mCtrlPublishOnWeb(NULL), | ||
77 | mCtrlMature(NULL), | 79 | mCtrlMature(NULL), |
78 | mCtrlOpenEnrollment(NULL), | 80 | mCtrlOpenEnrollment(NULL), |
79 | mCtrlEnrollmentFee(NULL), | 81 | mCtrlEnrollmentFee(NULL), |
80 | mSpinEnrollmentFee(NULL), | 82 | mSpinEnrollmentFee(NULL), |
81 | mCtrlReceiveNotices(NULL), | 83 | mCtrlReceiveNotices(NULL), |
84 | mCtrlListGroup(NULL), | ||
82 | mActiveTitleLabel(NULL), | 85 | mActiveTitleLabel(NULL), |
83 | mComboActiveTitle(NULL) | 86 | mComboActiveTitle(NULL) |
84 | { | 87 | { |
@@ -153,13 +156,6 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
153 | mCtrlShowInGroupList->setCallbackUserData(this); | 156 | mCtrlShowInGroupList->setCallbackUserData(this); |
154 | } | 157 | } |
155 | 158 | ||
156 | mCtrlPublishOnWeb = (LLCheckBoxCtrl*) getChildByName("publish_on_web", recurse); | ||
157 | if (mCtrlPublishOnWeb) | ||
158 | { | ||
159 | mCtrlPublishOnWeb->setCommitCallback(onCommitAny); | ||
160 | mCtrlPublishOnWeb->setCallbackUserData(this); | ||
161 | } | ||
162 | |||
163 | mCtrlMature = (LLCheckBoxCtrl*) getChildByName("mature", recurse); | 159 | mCtrlMature = (LLCheckBoxCtrl*) getChildByName("mature", recurse); |
164 | if (mCtrlMature) | 160 | if (mCtrlMature) |
165 | { | 161 | { |
@@ -191,20 +187,31 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
191 | } | 187 | } |
192 | 188 | ||
193 | BOOL accept_notices = FALSE; | 189 | BOOL accept_notices = FALSE; |
190 | BOOL list_in_profile = FALSE; | ||
194 | LLGroupData data; | 191 | LLGroupData data; |
195 | if(gAgent.getGroupData(mGroupID,data)) | 192 | if(gAgent.getGroupData(mGroupID,data)) |
196 | { | 193 | { |
197 | accept_notices = data.mAcceptNotices; | 194 | accept_notices = data.mAcceptNotices; |
195 | list_in_profile = data.mListInProfile; | ||
198 | } | 196 | } |
199 | mCtrlReceiveNotices = (LLCheckBoxCtrl*) getChildByName("receive_notices", recurse); | 197 | mCtrlReceiveNotices = (LLCheckBoxCtrl*) getChildByName("receive_notices", recurse); |
200 | if (mCtrlReceiveNotices) | 198 | if (mCtrlReceiveNotices) |
201 | { | 199 | { |
202 | mCtrlReceiveNotices->setCommitCallback(onReceiveNotices); | 200 | mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly); |
203 | mCtrlReceiveNotices->setCallbackUserData(this); | 201 | mCtrlReceiveNotices->setCallbackUserData(this); |
204 | mCtrlReceiveNotices->set(accept_notices); | 202 | mCtrlReceiveNotices->set(accept_notices); |
205 | mCtrlReceiveNotices->setEnabled(data.mID.notNull()); | 203 | mCtrlReceiveNotices->setEnabled(data.mID.notNull()); |
206 | } | 204 | } |
207 | 205 | ||
206 | mCtrlListGroup = (LLCheckBoxCtrl*) getChildByName("list_groups_in_profile", recurse); | ||
207 | if (mCtrlListGroup) | ||
208 | { | ||
209 | mCtrlListGroup->setCommitCallback(onCommitUserOnly); | ||
210 | mCtrlListGroup->setCallbackUserData(this); | ||
211 | mCtrlListGroup->set(list_in_profile); | ||
212 | mCtrlListGroup->setEnabled(data.mID.notNull()); | ||
213 | } | ||
214 | |||
208 | mActiveTitleLabel = (LLTextBox*) getChildByName("active_title_label", recurse); | 215 | mActiveTitleLabel = (LLTextBox*) getChildByName("active_title_label", recurse); |
209 | 216 | ||
210 | mComboActiveTitle = (LLComboBox*) getChildByName("active_title", recurse); | 217 | mComboActiveTitle = (LLComboBox*) getChildByName("active_title", recurse); |
@@ -238,7 +245,6 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
238 | mEditCharter->setEnabled(TRUE); | 245 | mEditCharter->setEnabled(TRUE); |
239 | 246 | ||
240 | mCtrlShowInGroupList->setEnabled(TRUE); | 247 | mCtrlShowInGroupList->setEnabled(TRUE); |
241 | mCtrlPublishOnWeb->setEnabled(TRUE); | ||
242 | mCtrlMature->setEnabled(TRUE); | 248 | mCtrlMature->setEnabled(TRUE); |
243 | mCtrlOpenEnrollment->setEnabled(TRUE); | 249 | mCtrlOpenEnrollment->setEnabled(TRUE); |
244 | mCtrlEnrollmentFee->setEnabled(TRUE); | 250 | mCtrlEnrollmentFee->setEnabled(TRUE); |
@@ -261,6 +267,15 @@ void LLPanelGroupGeneral::onCommitAny(LLUICtrl* ctrl, void* data) | |||
261 | } | 267 | } |
262 | 268 | ||
263 | // static | 269 | // static |
270 | void LLPanelGroupGeneral::onCommitUserOnly(LLUICtrl* ctrl, void* data) | ||
271 | { | ||
272 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | ||
273 | self->mChanged = TRUE; | ||
274 | self->notifyObservers(); | ||
275 | } | ||
276 | |||
277 | |||
278 | // static | ||
264 | void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data) | 279 | void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data) |
265 | { | 280 | { |
266 | onCommitAny(ctrl, data); | 281 | onCommitAny(ctrl, data); |
@@ -361,16 +376,6 @@ void LLPanelGroupGeneral::joinDlgCB(S32 which, void *userdata) | |||
361 | } | 376 | } |
362 | 377 | ||
363 | // static | 378 | // static |
364 | void LLPanelGroupGeneral::onReceiveNotices(LLUICtrl* ctrl, void* data) | ||
365 | { | ||
366 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | ||
367 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
368 | |||
369 | if(!self) return; | ||
370 | gAgent.setGroupAcceptNotices(self->mGroupID, check->get()); | ||
371 | } | ||
372 | |||
373 | // static | ||
374 | void LLPanelGroupGeneral::openProfile(void* data) | 379 | void LLPanelGroupGeneral::openProfile(void* data) |
375 | { | 380 | { |
376 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | 381 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; |
@@ -427,90 +432,92 @@ void LLPanelGroupGeneral::draw() | |||
427 | 432 | ||
428 | bool LLPanelGroupGeneral::apply(LLString& mesg) | 433 | bool LLPanelGroupGeneral::apply(LLString& mesg) |
429 | { | 434 | { |
430 | if (!mAllowEdit) | 435 | BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); |
431 | { | ||
432 | llwarns << "LLPanelGroupGeneral::apply() called with false mAllowEdit" | ||
433 | << llendl; | ||
434 | return true; | ||
435 | } | ||
436 | 436 | ||
437 | llinfos << "LLPanelGroupGeneral::apply" << llendl; | 437 | if (has_power_in_group || mGroupID.isNull()) |
438 | if (mGroupID.isNull()) | ||
439 | { | 438 | { |
440 | // Validate the group name length. | 439 | llinfos << "LLPanelGroupGeneral::apply" << llendl; |
441 | S32 group_name_len = mGroupNameEditor->getText().size(); | 440 | if (mGroupID.isNull()) |
442 | if ( group_name_len < DB_GROUP_NAME_MIN_LEN | ||
443 | || group_name_len > DB_GROUP_NAME_STR_LEN) | ||
444 | { | 441 | { |
445 | std::ostringstream temp_error; | 442 | // Validate the group name length. |
446 | temp_error << "A group name must be between " << DB_GROUP_NAME_MIN_LEN | 443 | S32 group_name_len = mGroupNameEditor->getText().size(); |
447 | << " and " << DB_GROUP_NAME_STR_LEN << " characters."; | 444 | if ( group_name_len < DB_GROUP_NAME_MIN_LEN |
448 | mesg = temp_error.str(); | 445 | || group_name_len > DB_GROUP_NAME_STR_LEN) |
449 | return false; | 446 | { |
450 | } | 447 | std::ostringstream temp_error; |
451 | 448 | temp_error << "A group name must be between " << DB_GROUP_NAME_MIN_LEN | |
452 | LLString::format_map_t args; | 449 | << " and " << DB_GROUP_NAME_STR_LEN << " characters."; |
453 | args["[MESSAGE]"] = mConfirmGroupCreateStr; | 450 | mesg = temp_error.str(); |
454 | gViewerWindow->alertXml("GenericAlertYesCancel", args, | 451 | return false; |
455 | createGroupCallback,this); | 452 | } |
456 | 453 | ||
457 | return false; | 454 | LLString::format_map_t args; |
458 | } | 455 | args["[MESSAGE]"] = mConfirmGroupCreateStr; |
456 | gViewerWindow->alertXml("GenericAlertYesCancel", args, | ||
457 | createGroupCallback,this); | ||
459 | 458 | ||
460 | LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); | 459 | return false; |
460 | } | ||
461 | 461 | ||
462 | if (!gdatap) | 462 | LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); |
463 | { | ||
464 | mesg = "No group data found for group "; | ||
465 | mesg.append(mGroupID.asString()); | ||
466 | return false; | ||
467 | } | ||
468 | 463 | ||
469 | bool can_change_ident = false; | 464 | if (!gdatap) |
470 | bool can_change_member_opts = false; | 465 | { |
471 | can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); | 466 | mesg = "No group data found for group "; |
472 | can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS); | 467 | mesg.append(mGroupID.asString()); |
468 | return false; | ||
469 | } | ||
470 | bool can_change_ident = false; | ||
471 | bool can_change_member_opts = false; | ||
472 | can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); | ||
473 | can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS); | ||
473 | 474 | ||
474 | if (can_change_ident) | 475 | if (can_change_ident) |
475 | { | ||
476 | if (mCtrlPublishOnWeb) gdatap->mAllowPublish = mCtrlPublishOnWeb->get(); | ||
477 | if (mEditCharter) gdatap->mCharter = mEditCharter->getText(); | ||
478 | if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID(); | ||
479 | if (mCtrlMature) | ||
480 | { | 476 | { |
481 | if (gAgent.mAccess > SIM_ACCESS_PG) | 477 | if (mEditCharter) gdatap->mCharter = mEditCharter->getText(); |
478 | if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID(); | ||
479 | if (mCtrlMature) | ||
482 | { | 480 | { |
483 | gdatap->mMaturePublish = mCtrlMature->get(); | 481 | if (gAgent.mAccess > SIM_ACCESS_PG) |
482 | { | ||
483 | gdatap->mMaturePublish = mCtrlMature->get(); | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | gdatap->mMaturePublish = FALSE; | ||
488 | } | ||
484 | } | 489 | } |
485 | else | 490 | if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get(); |
491 | } | ||
492 | |||
493 | if (can_change_member_opts) | ||
494 | { | ||
495 | if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get(); | ||
496 | if (mCtrlEnrollmentFee && mSpinEnrollmentFee) | ||
486 | { | 497 | { |
487 | gdatap->mMaturePublish = FALSE; | 498 | gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ? |
499 | (S32) mSpinEnrollmentFee->get() : 0; | ||
488 | // Set to the used value, and reset initial value used for isdirty check | 500 | // Set to the used value, and reset initial value used for isdirty check |
489 | mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee ); | 501 | mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee ); |
490 | } | 502 | } |
491 | } | 503 | } |
492 | if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get(); | ||
493 | } | ||
494 | 504 | ||
495 | if (can_change_member_opts) | 505 | if (can_change_ident || can_change_member_opts) |
496 | { | ||
497 | if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get(); | ||
498 | if (mCtrlEnrollmentFee && mSpinEnrollmentFee) | ||
499 | { | 506 | { |
500 | gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ? | 507 | gGroupMgr->sendUpdateGroupInfo(mGroupID); |
501 | (S32) mSpinEnrollmentFee->get() : 0; | ||
502 | } | 508 | } |
503 | } | 509 | } |
504 | 510 | ||
505 | if (can_change_ident || can_change_member_opts) | 511 | BOOL receive_notices = false; |
506 | { | 512 | BOOL list_in_profile = false; |
507 | gGroupMgr->sendUpdateGroupInfo(mGroupID); | 513 | if (mCtrlReceiveNotices) |
508 | } | 514 | receive_notices = mCtrlReceiveNotices->get(); |
515 | if (mCtrlListGroup) | ||
516 | list_in_profile = mCtrlListGroup->get(); | ||
509 | 517 | ||
510 | if (mCtrlReceiveNotices) gAgent.setGroupAcceptNotices(mGroupID, mCtrlReceiveNotices->get()); | 518 | gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile); |
511 | 519 | ||
512 | mChanged = FALSE; | 520 | mChanged = FALSE; |
513 | notifyObservers(); | ||
514 | 521 | ||
515 | return true; | 522 | return true; |
516 | } | 523 | } |
@@ -544,7 +551,7 @@ void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) | |||
544 | self->mInsignia->getImageAssetID(), | 551 | self->mInsignia->getImageAssetID(), |
545 | enrollment_fee, | 552 | enrollment_fee, |
546 | self->mCtrlOpenEnrollment->get(), | 553 | self->mCtrlOpenEnrollment->get(), |
547 | self->mCtrlPublishOnWeb->get(), | 554 | false, |
548 | self->mCtrlMature->get()); | 555 | self->mCtrlMature->get()); |
549 | 556 | ||
550 | } | 557 | } |
@@ -630,11 +637,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
630 | mCtrlShowInGroupList->set(gdatap->mShowInList); | 637 | mCtrlShowInGroupList->set(gdatap->mShowInList); |
631 | mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); | 638 | mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); |
632 | } | 639 | } |
633 | if (mCtrlPublishOnWeb) | ||
634 | { | ||
635 | mCtrlPublishOnWeb->set(gdatap->mAllowPublish); | ||
636 | mCtrlPublishOnWeb->setEnabled(mAllowEdit && can_change_ident); | ||
637 | } | ||
638 | if (mCtrlMature) | 640 | if (mCtrlMature) |
639 | { | 641 | { |
640 | mCtrlMature->set(gdatap->mMaturePublish); | 642 | mCtrlMature->set(gdatap->mMaturePublish); |
@@ -684,7 +686,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
684 | mCtrlReceiveNotices->setVisible(is_member); | 686 | mCtrlReceiveNotices->setVisible(is_member); |
685 | if (is_member) | 687 | if (is_member) |
686 | { | 688 | { |
687 | mCtrlReceiveNotices->set(agent_gdatap.mAcceptNotices); | ||
688 | mCtrlReceiveNotices->setEnabled(mAllowEdit); | 689 | mCtrlReceiveNotices->setEnabled(mAllowEdit); |
689 | } | 690 | } |
690 | } | 691 | } |
@@ -825,13 +826,13 @@ void LLPanelGroupGeneral::updateChanged() | |||
825 | mInsignia, | 826 | mInsignia, |
826 | mEditCharter, | 827 | mEditCharter, |
827 | mCtrlShowInGroupList, | 828 | mCtrlShowInGroupList, |
828 | mCtrlPublishOnWeb, // To fix after merge: Erase this line, and uncomment the mCtrlListGroup line. -- Soft | ||
829 | mCtrlMature, | 829 | mCtrlMature, |
830 | mCtrlOpenEnrollment, | 830 | mCtrlOpenEnrollment, |
831 | mCtrlEnrollmentFee, | 831 | mCtrlEnrollmentFee, |
832 | mSpinEnrollmentFee, | 832 | mSpinEnrollmentFee, |
833 | mCtrlReceiveNotices, | 833 | mCtrlReceiveNotices, |
834 | // mCtrlListGroup, // To fix after merge: See above comment -- Soft | 834 | mCtrlListGroup, |
835 | mActiveTitleLabel, | ||
835 | mComboActiveTitle | 836 | mComboActiveTitle |
836 | }; | 837 | }; |
837 | 838 | ||