diff options
Diffstat (limited to 'linden/indra/newview/llpanelgroupvoting.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupvoting.cpp | 237 |
1 files changed, 127 insertions, 110 deletions
diff --git a/linden/indra/newview/llpanelgroupvoting.cpp b/linden/indra/newview/llpanelgroupvoting.cpp index e21af7a..b74bf9c 100644 --- a/linden/indra/newview/llpanelgroupvoting.cpp +++ b/linden/indra/newview/llpanelgroupvoting.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file llpanelgroupvoting.cpp | 2 | * @file llpanelgroupvoting.cpp |
3 | * @brief LLPanelGroupVoting class definition. | 3 | * @brief LLPanelGroupVoting class definition. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2003&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2003-2007, Linden Research, Inc. | 7 | * Copyright (c) 2003-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" |
@@ -48,7 +51,7 @@ | |||
48 | class LLPanelGroupVoting::impl | 51 | class LLPanelGroupVoting::impl |
49 | { | 52 | { |
50 | public: | 53 | public: |
51 | impl(const LLUUID& group_id); | 54 | impl(LLPanelGroupVoting& panel, const LLUUID& group_id); |
52 | ~impl(); | 55 | ~impl(); |
53 | 56 | ||
54 | static void onClickCreateProposal(void* userdata); | 57 | static void onClickCreateProposal(void* userdata); |
@@ -96,7 +99,8 @@ public: | |||
96 | LLUUID mGroupID; | 99 | LLUUID mGroupID; |
97 | LLUUID mProposalID; | 100 | LLUUID mProposalID; |
98 | 101 | ||
99 | LLTextBox *mQuorumText; | 102 | LLPanelGroupVoting& mPanel; |
103 | |||
100 | LLSpinCtrl *mQuorum; | 104 | LLSpinCtrl *mQuorum; |
101 | LLTextBox *mQuorumLbl; | 105 | LLTextBox *mQuorumLbl; |
102 | LLSpinCtrl *mDuration; | 106 | LLSpinCtrl *mDuration; |
@@ -104,9 +108,6 @@ public: | |||
104 | LLTextBox *mDurationText; | 108 | LLTextBox *mDurationText; |
105 | LLRadioGroup *mMajority; | 109 | LLRadioGroup *mMajority; |
106 | LLTextBox *mMajorityLbl; | 110 | LLTextBox *mMajorityLbl; |
107 | LLTextBox *mInstructions; | ||
108 | LLTextBox *mProposalHeader; | ||
109 | LLTextBox *mProposalLbl; | ||
110 | LLTextBox *mStartLbl; | 111 | LLTextBox *mStartLbl; |
111 | LLTextBox *mEndLbl; | 112 | LLTextBox *mEndLbl; |
112 | LLTextBox *mStartDate; | 113 | LLTextBox *mStartDate; |
@@ -131,11 +132,6 @@ public: | |||
131 | LLButton *mBtnViewHistoryList; | 132 | LLButton *mBtnViewHistoryList; |
132 | LLButton *mBtnViewHistoryItem; | 133 | LLButton *mBtnViewHistoryItem; |
133 | 134 | ||
134 | std::string mViewProposalHeaderText; | ||
135 | std::string mCreateProposalHeaderText; | ||
136 | std::string mVoteProposalHeaderText; | ||
137 | std::string mEmptyProposalText; | ||
138 | |||
139 | int mNumGroupMembers; | 135 | int mNumGroupMembers; |
140 | 136 | ||
141 | std::vector<LLSD> mActiveReceived; | 137 | std::vector<LLSD> mActiveReceived; |
@@ -154,9 +150,10 @@ public: | |||
154 | //** LLPanelGroupVoting::impl Functions ** | 150 | //** LLPanelGroupVoting::impl Functions ** |
155 | //**************************************** | 151 | //**************************************** |
156 | 152 | ||
157 | LLPanelGroupVoting::impl::impl(const LLUUID& group_id) | 153 | LLPanelGroupVoting::impl::impl(LLPanelGroupVoting& panel, const LLUUID& group_id) |
154 | : mPanel(panel), | ||
155 | mGroupID(group_id) | ||
158 | { | 156 | { |
159 | mGroupID = group_id; | ||
160 | 157 | ||
161 | mNumGroupMembers = 0; | 158 | mNumGroupMembers = 0; |
162 | 159 | ||
@@ -185,7 +182,6 @@ LLPanelGroupVoting::impl::impl(const LLUUID& group_id) | |||
185 | //will then only be working for the last panel for a given group id :( | 182 | //will then only be working for the last panel for a given group id :( |
186 | sGroupIDs[group_id] = this; | 183 | sGroupIDs[group_id] = this; |
187 | 184 | ||
188 | mQuorumText = NULL; | ||
189 | mQuorum = NULL; | 185 | mQuorum = NULL; |
190 | mQuorumLbl = NULL; | 186 | mQuorumLbl = NULL; |
191 | mDuration = NULL; | 187 | mDuration = NULL; |
@@ -193,9 +189,6 @@ LLPanelGroupVoting::impl::impl(const LLUUID& group_id) | |||
193 | mDurationText = NULL; | 189 | mDurationText = NULL; |
194 | mMajority = NULL; | 190 | mMajority = NULL; |
195 | mMajorityLbl = NULL; | 191 | mMajorityLbl = NULL; |
196 | mInstructions = NULL; | ||
197 | mProposalHeader = NULL; | ||
198 | mProposalLbl = NULL; | ||
199 | mStartLbl = NULL; | 192 | mStartLbl = NULL; |
200 | mEndLbl = NULL; | 193 | mEndLbl = NULL; |
201 | mStartDate = NULL; | 194 | mStartDate = NULL; |
@@ -239,10 +232,10 @@ void LLPanelGroupVoting::impl::setEnableListProposals() | |||
239 | return; | 232 | return; |
240 | 233 | ||
241 | 234 | ||
242 | mProposalHeader->setText(mViewProposalHeaderText); | 235 | mPanel.childSetText("proposal_header", mPanel.childGetText("proposals_header_view_txt")); |
243 | mInstructions->setText("Double Click on the proposal you would like to vote on or press\n" | 236 | mPanel.childSetText("proposal_instructions", mPanel.childGetText("proposals_header_view_inst")); |
244 | "Create Proposal to create a new proposal."); | 237 | mPanel.childSetVisible("proposal_lbl", FALSE); |
245 | mProposalLbl->setText("Proposal Voting Ends Voted?"); | 238 | mPanel.childSetVisible("proposal_voting_lbl", TRUE); |
246 | mProposals->setVisible(TRUE); | 239 | mProposals->setVisible(TRUE); |
247 | mProposals->setBgSelectedColor(gColors.getColor("ScrollSelectedBGColor")); | 240 | mProposals->setBgSelectedColor(gColors.getColor("ScrollSelectedBGColor")); |
248 | mProposalText->setVisible(FALSE); | 241 | mProposalText->setVisible(FALSE); |
@@ -266,7 +259,7 @@ void LLPanelGroupVoting::impl::setEnableListProposals() | |||
266 | mQuorumLbl->setVisible(FALSE); | 259 | mQuorumLbl->setVisible(FALSE); |
267 | mQuorum->setEnabled(FALSE); | 260 | mQuorum->setEnabled(FALSE); |
268 | mQuorum->setVisible(FALSE); | 261 | mQuorum->setVisible(FALSE); |
269 | mQuorumText->setVisible(FALSE); | 262 | mPanel.childSetVisible("quorum_text", FALSE); |
270 | 263 | ||
271 | mDurationLbl->setVisible(FALSE); | 264 | mDurationLbl->setVisible(FALSE); |
272 | mDuration->setEnabled(FALSE); | 265 | mDuration->setEnabled(FALSE); |
@@ -301,16 +294,72 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
301 | std::string vote_cast; | 294 | std::string vote_cast; |
302 | 295 | ||
303 | mProposalID = item->getUUID(); | 296 | mProposalID = item->getUUID(); |
297 | |||
304 | // col 0: index id | 298 | // col 0: index id |
305 | mProposalText->setText(item->getColumn(1)->getText()); //proposal text | 299 | LLScrollListCell * proposal_cell = item->getColumn(1); |
306 | mEndDate->setText(item->getColumn(2)->getText()); //end date | 300 | if ( proposal_cell ) |
301 | { | ||
302 | mProposalText->setText(proposal_cell->getText()); //proposal text | ||
303 | } | ||
304 | else | ||
305 | { // Something's wrong... should have some text | ||
306 | mProposalText->setText(LLString()); | ||
307 | } | ||
308 | |||
309 | proposal_cell = item->getColumn(2); | ||
310 | if (proposal_cell) | ||
311 | { | ||
312 | mEndDate->setText(proposal_cell->getText()); //end date | ||
313 | } | ||
314 | else | ||
315 | { // Something's wrong... should have some text | ||
316 | mEndDate->setText(LLString()); | ||
317 | } | ||
318 | |||
307 | // col 3: Vote Type | 319 | // col 3: Vote Type |
308 | already_voted = item->getColumn(4)->getText(); //already voted | 320 | proposal_cell = item->getColumn(3); |
309 | mStartDate->setText(item->getColumn(5)->getText()); //start date | 321 | if (proposal_cell) |
310 | vote_cast = item->getColumn(6)->getText(); // Vote Cast | 322 | { |
311 | // col 7: Vote Initiator | 323 | already_voted = proposal_cell->getText(); //already voted |
312 | mQuorum->set((F32)atoi(item->getColumn(8)->getText().c_str())); //quorum | 324 | } |
313 | F32 majority = (F32)atof(item->getColumn(9)->getText().c_str()); //majority | 325 | else |
326 | { // Something's wrong... should have some text | ||
327 | already_voted = ""; | ||
328 | } | ||
329 | |||
330 | proposal_cell = item->getColumn(5); | ||
331 | if (proposal_cell) | ||
332 | { | ||
333 | mStartDate->setText(proposal_cell->getText()); //start date | ||
334 | } | ||
335 | else | ||
336 | { // Something's wrong... should have some text | ||
337 | mStartDate->setText(LLString()); | ||
338 | } | ||
339 | |||
340 | proposal_cell = item->getColumn(6); | ||
341 | if (proposal_cell) | ||
342 | { | ||
343 | vote_cast = proposal_cell->getText(); // Vote Cast | ||
344 | } | ||
345 | |||
346 | // col 8: Vote Initiator | ||
347 | proposal_cell = item->getColumn(8); | ||
348 | if (proposal_cell) | ||
349 | { | ||
350 | mQuorum->set((F32)atoi(proposal_cell->getText().c_str())); //quorum | ||
351 | } | ||
352 | else | ||
353 | { | ||
354 | mQuorum->set(0); | ||
355 | } | ||
356 | |||
357 | F32 majority = 0.0f; | ||
358 | proposal_cell = item->getColumn(9); | ||
359 | if (proposal_cell) | ||
360 | { | ||
361 | majority = (F32)atof(proposal_cell->getText().c_str()); //majority | ||
362 | } | ||
314 | 363 | ||
315 | if(majority == 0.0f) | 364 | if(majority == 0.0f) |
316 | { // Select the Simple Majority | 365 | { // Select the Simple Majority |
@@ -329,9 +378,9 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
329 | 378 | ||
330 | if (already_voted == "Yes") | 379 | if (already_voted == "Yes") |
331 | { | 380 | { |
332 | char message[MAX_STRING]; /*Flawfinder: ignore*/ | 381 | LLUIString votestr = mPanel.childGetText("proposals_header_voted_inst"); |
333 | snprintf(message, MAX_STRING, "You have voted: %s ", vote_cast.c_str()); /* Flawfinder: ignore */ | 382 | votestr.setArg("[VOTE]", vote_cast); |
334 | mInstructions->setText(message); | 383 | mPanel.childSetText("proposal_instructions", votestr.getString()); |
335 | 384 | ||
336 | mBtnYes->setEnabled(FALSE); | 385 | mBtnYes->setEnabled(FALSE); |
337 | mBtnNo->setEnabled(FALSE); | 386 | mBtnNo->setEnabled(FALSE); |
@@ -339,16 +388,16 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
339 | } | 388 | } |
340 | else | 389 | else |
341 | { | 390 | { |
342 | mInstructions->setText("Press the Yes or No button to vote on the proposal, \n" | 391 | mPanel.childSetText("proposal_instructions", mPanel.childGetText("proposals_header_vote_inst")); |
343 | "or choose to Abstain voting on this proposal."); | ||
344 | 392 | ||
345 | mBtnYes->setEnabled(TRUE); | 393 | mBtnYes->setEnabled(TRUE); |
346 | mBtnNo->setEnabled(TRUE); | 394 | mBtnNo->setEnabled(TRUE); |
347 | mBtnAbstain->setEnabled(TRUE); | 395 | mBtnAbstain->setEnabled(TRUE); |
348 | } | 396 | } |
349 | 397 | ||
350 | mProposalHeader->setText(mVoteProposalHeaderText); | 398 | mPanel.childSetText("proposal_header", mPanel.childGetText("proposals_header_vote_txt")); |
351 | mProposalLbl->setText("Proposal Description"); | 399 | mPanel.childSetVisible("proposal_lbl", TRUE); |
400 | mPanel.childSetVisible("proposal_voting_lbl", FALSE); | ||
352 | mProposals->setVisible(FALSE); | 401 | mProposals->setVisible(FALSE); |
353 | mProposalText->setEnabled(FALSE); | 402 | mProposalText->setEnabled(FALSE); |
354 | mProposalText->setVisible(TRUE); | 403 | mProposalText->setVisible(TRUE); |
@@ -371,7 +420,7 @@ void LLPanelGroupVoting::impl::setEnableVoteProposal() | |||
371 | mQuorumLbl->setVisible(TRUE); | 420 | mQuorumLbl->setVisible(TRUE); |
372 | mQuorum->setEnabled(FALSE); | 421 | mQuorum->setEnabled(FALSE); |
373 | mQuorum->setVisible(TRUE); | 422 | mQuorum->setVisible(TRUE); |
374 | mQuorumText->setVisible(TRUE); | 423 | mPanel.childSetVisible("quorum_text", TRUE); |
375 | 424 | ||
376 | mDurationLbl->setVisible(FALSE); | 425 | mDurationLbl->setVisible(FALSE); |
377 | mDuration->setEnabled(FALSE); | 426 | mDuration->setEnabled(FALSE); |
@@ -393,13 +442,14 @@ void LLPanelGroupVoting::impl::setEnableCreateProposal() | |||
393 | if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_START) ) | 442 | if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_START) ) |
394 | return; | 443 | return; |
395 | 444 | ||
396 | mProposalHeader->setText(mCreateProposalHeaderText); | 445 | mPanel.childSetText("proposal_header", mPanel.childGetText("proposals_header_create_txt")); |
397 | mInstructions->setText("Type the Proposal Description for the new proposal. You can change the\nQuorum, Duration and Majority required to pass the proposal."); | 446 | mPanel.childSetText("proposal_instructions", mPanel.childGetText("proposals_header_create_inst")); |
398 | mProposalLbl->setText("Proposal Description"); | 447 | mPanel.childSetVisible("proposal_lbl", TRUE); |
448 | mPanel.childSetVisible("proposal_voting_lbl", FALSE); | ||
399 | mProposals->setVisible(FALSE); | 449 | mProposals->setVisible(FALSE); |
400 | mProposalText->setEnabled(TRUE); | 450 | mProposalText->setEnabled(TRUE); |
401 | mProposalText->setVisible(TRUE); | 451 | mProposalText->setVisible(TRUE); |
402 | mProposalText->setText(""); | 452 | mProposalText->setText(LLString::null); |
403 | mBtnYes->setEnabled(FALSE); | 453 | mBtnYes->setEnabled(FALSE); |
404 | mBtnYes->setVisible(FALSE); | 454 | mBtnYes->setVisible(FALSE); |
405 | mBtnNo->setEnabled(FALSE); | 455 | mBtnNo->setEnabled(FALSE); |
@@ -422,7 +472,7 @@ void LLPanelGroupVoting::impl::setEnableCreateProposal() | |||
422 | mQuorumLbl->setVisible(TRUE); | 472 | mQuorumLbl->setVisible(TRUE); |
423 | mQuorum->setEnabled(TRUE); | 473 | mQuorum->setEnabled(TRUE); |
424 | mQuorum->setVisible(TRUE); | 474 | mQuorum->setVisible(TRUE); |
425 | mQuorumText->setVisible(TRUE); | 475 | mPanel.childSetVisible("quorum_text", TRUE); |
426 | 476 | ||
427 | mDurationLbl->setVisible(TRUE); | 477 | mDurationLbl->setVisible(TRUE); |
428 | mDuration->setEnabled(TRUE); | 478 | mDuration->setEnabled(TRUE); |
@@ -488,8 +538,14 @@ void LLPanelGroupVoting::impl::setEnableHistoryItem() | |||
488 | LLScrollListItem *item = mVotesHistory->getFirstSelected(); | 538 | LLScrollListItem *item = mVotesHistory->getFirstSelected(); |
489 | // Get full text, not stripped version. | 539 | // Get full text, not stripped version. |
490 | const LLScrollListCell *cell = item->getColumn(5); | 540 | const LLScrollListCell *cell = item->getColumn(5); |
491 | mVoteHistoryText->setText(cell->getText()); | 541 | if (cell) |
492 | 542 | { | |
543 | mVoteHistoryText->setText(cell->getText()); | ||
544 | } | ||
545 | else | ||
546 | { // Something's wrong... | ||
547 | mVoteHistoryText->setText(LLString()); | ||
548 | } | ||
493 | mVotesHistoryLbl->setVisible(FALSE); | 549 | mVotesHistoryLbl->setVisible(FALSE); |
494 | mVotesHistory->setVisible(FALSE); | 550 | mVotesHistory->setVisible(FALSE); |
495 | 551 | ||
@@ -635,15 +691,7 @@ void LLPanelGroupVoting::impl::sendGroupVoteHistoryRequest(const LLUUID& group_i | |||
635 | 691 | ||
636 | void LLPanelGroupVoting::impl::updateQuorumText() | 692 | void LLPanelGroupVoting::impl::updateQuorumText() |
637 | { | 693 | { |
638 | if ( mQuorumText ) | 694 | mPanel.childSetTextArg("quorum_text", "[MEMBERS]", llformat("%d", mNumGroupMembers)); |
639 | { | ||
640 | //update the quorum count | ||
641 | char quorum_text[MAX_STRING]; /*Flawfinder: ignore*/ | ||
642 | snprintf(quorum_text, MAX_STRING, /* Flawfinder: ignore */ | ||
643 | " out of %d members must vote", | ||
644 | mNumGroupMembers); | ||
645 | mQuorumText->setText(quorum_text); | ||
646 | } | ||
647 | } | 695 | } |
648 | 696 | ||
649 | void LLPanelGroupVoting::impl::addPendingActiveScrollListItem(unsigned int current, | 697 | void LLPanelGroupVoting::impl::addPendingActiveScrollListItem(unsigned int current, |
@@ -1052,9 +1100,9 @@ void LLPanelGroupVoting::impl::onClickYes(void *userdata) | |||
1052 | { | 1100 | { |
1053 | LLPanelGroupVoting::impl* self = (LLPanelGroupVoting::impl*)userdata; | 1101 | LLPanelGroupVoting::impl* self = (LLPanelGroupVoting::impl*)userdata; |
1054 | 1102 | ||
1055 | if ( self && self->mInstructions ) | 1103 | if ( self ) |
1056 | { | 1104 | { |
1057 | self->mInstructions->setText("Submitting Yes to proposal..."); | 1105 | self->mPanel.childSetText("proposal_instructions", self->mPanel.childGetText("proposals_submit_yes_txt")); |
1058 | self->sendGroupProposalBallot("Yes"); | 1106 | self->sendGroupProposalBallot("Yes"); |
1059 | 1107 | ||
1060 | //refresh the proposals now that we've hit yes | 1108 | //refresh the proposals now that we've hit yes |
@@ -1069,9 +1117,9 @@ void LLPanelGroupVoting::impl::onClickNo(void *userdata) | |||
1069 | { | 1117 | { |
1070 | LLPanelGroupVoting::impl* self = (LLPanelGroupVoting::impl*)userdata; | 1118 | LLPanelGroupVoting::impl* self = (LLPanelGroupVoting::impl*)userdata; |
1071 | 1119 | ||
1072 | if ( self && self->mInstructions ) | 1120 | if ( self ) |
1073 | { | 1121 | { |
1074 | self->mInstructions->setText("Submitting No to proposal..."); | 1122 | self->mPanel.childSetText("proposal_instructions", self->mPanel.childGetText("proposals_submit_no_txt")); |
1075 | self->sendGroupProposalBallot("No"); | 1123 | self->sendGroupProposalBallot("No"); |
1076 | 1124 | ||
1077 | //refresh the proposals now that we've hit no | 1125 | //refresh the proposals now that we've hit no |
@@ -1086,9 +1134,9 @@ void LLPanelGroupVoting::impl::onClickAbstain(void *userdata) | |||
1086 | { | 1134 | { |
1087 | impl* self = (LLPanelGroupVoting::impl*) userdata; | 1135 | impl* self = (LLPanelGroupVoting::impl*) userdata; |
1088 | 1136 | ||
1089 | if ( self && self->mInstructions ) | 1137 | if ( self ) |
1090 | { | 1138 | { |
1091 | self->mInstructions->setText("Submitting Abstention to proposal..."); | 1139 | self->mPanel.childSetText("proposal_instructions", self->mPanel.childGetText("proposals_submit_abstain_txt")); |
1092 | self->sendGroupProposalBallot("Abstain"); | 1140 | self->sendGroupProposalBallot("Abstain"); |
1093 | 1141 | ||
1094 | //refresh the proposals now that we've hit abstain | 1142 | //refresh the proposals now that we've hit abstain |
@@ -1104,7 +1152,7 @@ void LLPanelGroupVoting::impl::onClickSubmitProposal(void *userdata) | |||
1104 | gFocusMgr.setKeyboardFocus(NULL, NULL); | 1152 | gFocusMgr.setKeyboardFocus(NULL, NULL); |
1105 | impl* self = (impl*)userdata; | 1153 | impl* self = (impl*)userdata; |
1106 | 1154 | ||
1107 | if ( self && self->mInstructions && self->mProposalText ) | 1155 | if ( self && self->mProposalText ) |
1108 | { | 1156 | { |
1109 | //check to see if the proposal has any text for some form of | 1157 | //check to see if the proposal has any text for some form of |
1110 | //"validation" | 1158 | //"validation" |
@@ -1112,12 +1160,12 @@ void LLPanelGroupVoting::impl::onClickSubmitProposal(void *userdata) | |||
1112 | { | 1160 | { |
1113 | //throw up an error dialog | 1161 | //throw up an error dialog |
1114 | LLString::format_map_t args; | 1162 | LLString::format_map_t args; |
1115 | args["[MESSAGE]"] = self->mEmptyProposalText; | 1163 | args["[MESSAGE]"] = self->mPanel.childGetText("empty_proposal_txt"); |
1116 | gViewerWindow->alertXml("GenericAlert", args); | 1164 | gViewerWindow->alertXml("GenericAlert", args); |
1117 | return; | 1165 | return; |
1118 | } | 1166 | } |
1119 | 1167 | ||
1120 | self->mInstructions->setText("Submitting new Proposal..."); | 1168 | self->mPanel.childSetText("proposal_instructions", self->mPanel.childGetText("proposals_submit_new_txt")); |
1121 | self->sendStartGroupProposal(); | 1169 | self->sendStartGroupProposal(); |
1122 | 1170 | ||
1123 | //refresh the proposals now that we've submitted a new one | 1171 | //refresh the proposals now that we've submitted a new one |
@@ -1152,7 +1200,9 @@ void LLPanelGroupVoting::impl::onClickViewProposalItem(void *userdata) | |||
1152 | 1200 | ||
1153 | if ( self && self->mProposals ) | 1201 | if ( self && self->mProposals ) |
1154 | { | 1202 | { |
1155 | if (self->mProposals->getFirstSelected() != NULL) | 1203 | LLScrollListItem * proposal = self->mProposals->getFirstSelected(); |
1204 | // Check if it has anything in column 2. If not, assume it's the "There are currently no active proposals" text | ||
1205 | if (proposal && proposal->getColumn(2)) | ||
1156 | { | 1206 | { |
1157 | self->setEnableVoteProposal(); | 1207 | self->setEnableVoteProposal(); |
1158 | } | 1208 | } |
@@ -1188,13 +1238,18 @@ void LLPanelGroupVoting::impl::onClickViewHistoryItem(void *userdata) | |||
1188 | { | 1238 | { |
1189 | impl* self = (impl*)userdata; | 1239 | impl* self = (impl*)userdata; |
1190 | 1240 | ||
1191 | if (self->mVotesHistory->getFirstSelected() != NULL) | 1241 | if ( self && self->mVotesHistory ) |
1192 | { | ||
1193 | self->setEnableHistoryItem(); | ||
1194 | } | ||
1195 | else | ||
1196 | { | 1242 | { |
1197 | gViewerWindow->alertXml("SelectHistoryItemToView"); | 1243 | LLScrollListItem * historic = self->mVotesHistory->getFirstSelected(); |
1244 | // Check if it has anything in column 2. If not, assume it's the "There are currently no active proposals" text | ||
1245 | if (historic && historic->getColumn(2)) | ||
1246 | { | ||
1247 | self->setEnableHistoryItem(); | ||
1248 | } | ||
1249 | else | ||
1250 | { | ||
1251 | gViewerWindow->alertXml("SelectHistoryItemToView"); | ||
1252 | } | ||
1198 | } | 1253 | } |
1199 | } | 1254 | } |
1200 | 1255 | ||
@@ -1221,7 +1276,7 @@ LLPanelGroupVoting::LLPanelGroupVoting(const std::string& name, | |||
1221 | const LLUUID& group_id) | 1276 | const LLUUID& group_id) |
1222 | : LLPanelGroupTab(name, group_id) | 1277 | : LLPanelGroupTab(name, group_id) |
1223 | { | 1278 | { |
1224 | mImpl = new impl(group_id); | 1279 | mImpl = new impl(*this, group_id); |
1225 | } | 1280 | } |
1226 | 1281 | ||
1227 | LLPanelGroupVoting::~LLPanelGroupVoting() | 1282 | LLPanelGroupVoting::~LLPanelGroupVoting() |
@@ -1239,7 +1294,6 @@ BOOL LLPanelGroupVoting::postBuild() | |||
1239 | { | 1294 | { |
1240 | bool recurse = true; | 1295 | bool recurse = true; |
1241 | 1296 | ||
1242 | mImpl->mQuorumText = (LLTextBox*) getChildByName("quorum_text", recurse); | ||
1243 | mImpl->mDurationText = (LLTextBox*) getChildByName("duration_text", | 1297 | mImpl->mDurationText = (LLTextBox*) getChildByName("duration_text", |
1244 | recurse); | 1298 | recurse); |
1245 | mImpl->mQuorum = (LLSpinCtrl*) getChildByName("quorum", recurse); | 1299 | mImpl->mQuorum = (LLSpinCtrl*) getChildByName("quorum", recurse); |
@@ -1248,12 +1302,7 @@ BOOL LLPanelGroupVoting::postBuild() | |||
1248 | mImpl->mDurationLbl = (LLTextBox*) getChildByName("duration_lbl", recurse); | 1302 | mImpl->mDurationLbl = (LLTextBox*) getChildByName("duration_lbl", recurse); |
1249 | mImpl->mMajority = (LLRadioGroup*) getChildByName("majority", recurse); | 1303 | mImpl->mMajority = (LLRadioGroup*) getChildByName("majority", recurse); |
1250 | mImpl->mMajorityLbl = (LLTextBox*) getChildByName("majority_lbl", recurse); | 1304 | mImpl->mMajorityLbl = (LLTextBox*) getChildByName("majority_lbl", recurse); |
1251 | mImpl->mInstructions = (LLTextBox*) getChildByName("proposal_instructions", | ||
1252 | recurse); | ||
1253 | mImpl->mProposalHeader = (LLTextBox*) getChildByName("proposal_header", | ||
1254 | recurse); | ||
1255 | 1305 | ||
1256 | mImpl->mProposalLbl = (LLTextBox*) getChildByName("proposal_lbl", recurse); | ||
1257 | mImpl->mStartLbl = (LLTextBox*) getChildByName("start_lbl", recurse); | 1306 | mImpl->mStartLbl = (LLTextBox*) getChildByName("start_lbl", recurse); |
1258 | mImpl->mEndLbl = (LLTextBox*) getChildByName("end_lbl", recurse); | 1307 | mImpl->mEndLbl = (LLTextBox*) getChildByName("end_lbl", recurse); |
1259 | mImpl->mStartDate = (LLTextBox*) getChildByName("start_date", recurse); | 1308 | mImpl->mStartDate = (LLTextBox*) getChildByName("start_date", recurse); |
@@ -1294,48 +1343,15 @@ BOOL LLPanelGroupVoting::postBuild() | |||
1294 | mImpl->mBtnViewHistoryItem = | 1343 | mImpl->mBtnViewHistoryItem = |
1295 | (LLButton*)getChildByName("btn_view_history_item", recurse); | 1344 | (LLButton*)getChildByName("btn_view_history_item", recurse); |
1296 | 1345 | ||
1297 | LLTextBox *txt = (LLTextBox*) getChildByName("proposals_header_view_txt", | ||
1298 | recurse); | ||
1299 | if (txt) | ||
1300 | { | ||
1301 | mImpl->mViewProposalHeaderText = txt->getText(); | ||
1302 | removeChild(txt, TRUE); | ||
1303 | } | ||
1304 | |||
1305 | txt = (LLTextBox*) getChildByName("proposals_header_create_txt", recurse); | ||
1306 | if (txt) | ||
1307 | { | ||
1308 | mImpl->mCreateProposalHeaderText = txt->getText(); | ||
1309 | removeChild(txt, TRUE); | ||
1310 | } | ||
1311 | |||
1312 | txt = (LLTextBox*) getChildByName("proposals_header_vote_txt", recurse); | ||
1313 | if (txt) | ||
1314 | { | ||
1315 | mImpl->mVoteProposalHeaderText = txt->getText(); | ||
1316 | removeChild(txt, TRUE); | ||
1317 | } | ||
1318 | |||
1319 | txt = (LLTextBox*) getChildByName("empty_proposal_txt", recurse); | ||
1320 | if (txt) | ||
1321 | { | ||
1322 | mImpl->mEmptyProposalText = txt->getText(); | ||
1323 | removeChild(txt, TRUE); | ||
1324 | } | ||
1325 | |||
1326 | mImpl->updateQuorumText(); | 1346 | mImpl->updateQuorumText(); |
1327 | 1347 | ||
1328 | bool success = (mImpl->mQuorumText && | 1348 | bool success = (mImpl->mDurationText && |
1329 | mImpl->mDurationText && | ||
1330 | mImpl->mQuorum && | 1349 | mImpl->mQuorum && |
1331 | mImpl->mQuorumLbl && | 1350 | mImpl->mQuorumLbl && |
1332 | mImpl->mDuration && | 1351 | mImpl->mDuration && |
1333 | mImpl->mDurationLbl && | 1352 | mImpl->mDurationLbl && |
1334 | mImpl->mMajority && | 1353 | mImpl->mMajority && |
1335 | mImpl->mMajorityLbl && | 1354 | mImpl->mMajorityLbl && |
1336 | mImpl->mInstructions && | ||
1337 | mImpl->mProposalHeader && | ||
1338 | mImpl->mProposalLbl && | ||
1339 | mImpl->mStartLbl && | 1355 | mImpl->mStartLbl && |
1340 | mImpl->mEndLbl && | 1356 | mImpl->mEndLbl && |
1341 | mImpl->mStartDate && | 1357 | mImpl->mStartDate && |
@@ -1442,3 +1458,4 @@ void LLPanelGroupVoting::update(LLGroupChange gc) | |||
1442 | mImpl->sendGroupVoteHistoryRequest(mGroupID); | 1458 | mImpl->sendGroupVoteHistoryRequest(mGroupID); |
1443 | } | 1459 | } |
1444 | 1460 | ||
1461 | |||