aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelgroupvoting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanelgroupvoting.cpp')
-rw-r--r--linden/indra/newview/llpanelgroupvoting.cpp100
1 files changed, 80 insertions, 20 deletions
diff --git a/linden/indra/newview/llpanelgroupvoting.cpp b/linden/indra/newview/llpanelgroupvoting.cpp
index b78d5c2..58a4842 100644
--- a/linden/indra/newview/llpanelgroupvoting.cpp
+++ b/linden/indra/newview/llpanelgroupvoting.cpp
@@ -604,9 +604,25 @@ void LLPanelGroupVoting::impl::sendGroupProposalsRequest(const LLUUID& group_id)
604 gAgent.sendReliableMessage(); 604 gAgent.sendReliableMessage();
605} 605}
606 606
607void LLPanelGroupVoting::handleResponse(void *userdata, ResponseType response, bool success) 607void LLPanelGroupVoting::handleResponse(
608 const LLUUID& group_id,
609 ResponseType response,
610 bool success)
608{ 611{
609 impl* self = (impl*)userdata; 612 impl* self = NULL;
613
614 //see if the voting ballot for the group is still even open
615 std::map<LLUUID, LLPanelGroupVoting::impl*>::const_iterator self_iter =
616 LLPanelGroupVoting::impl::sGroupIDs.find(group_id);
617
618 if ( LLPanelGroupVoting::impl::sGroupIDs.end() != self_iter )
619 {
620 //cool, we found the panel's implementation
621 //(the panel is still open)
622 //then we want to do some other stuff :)
623 self = self_iter->second;
624 }
625
610 if ( self ) 626 if ( self )
611 { 627 {
612 //refresh the proposals now that we've hit no 628 //refresh the proposals now that we've hit no
@@ -633,15 +649,44 @@ void LLPanelGroupVoting::handleResponse(void *userdata, ResponseType response, b
633 } 649 }
634} 650}
635 651
652void LLPanelGroupVoting::handleFailure(
653 const LLUUID& group_id)
654{
655 impl* self = NULL;
656
657 //see if the voting ballot for the group is still even open
658 std::map<LLUUID, LLPanelGroupVoting::impl*>::const_iterator self_iter =
659 LLPanelGroupVoting::impl::sGroupIDs.find(group_id);
660
661 if ( LLPanelGroupVoting::impl::sGroupIDs.end() != self_iter )
662 {
663 //cool, we found the panel's implementation
664 //(the panel is still open)
665 //then we want to do some other stuff :)
666 self = self_iter->second;
667 }
668
669 if ( self )
670 {
671 self->setEnableListProposals();
672 }
673}
674
636class LLStartGroupVoteResponder : public LLHTTPClient::Responder 675class LLStartGroupVoteResponder : public LLHTTPClient::Responder
637{ 676{
638public: 677public:
639 LLStartGroupVoteResponder(void *userdata) : mUserData(userdata) {}; 678 LLStartGroupVoteResponder(const LLUUID& group_id)
679 {
680 mGroupID = group_id;
681 }
682
640 //If we get back a normal response, handle it here 683 //If we get back a normal response, handle it here
641 virtual void result(const LLSD& content) 684 virtual void result(const LLSD& content)
642 { 685 {
643 //Ack'd the proposal initialization, now let's finish up. 686 //Ack'd the proposal initialization, now let's finish up.
644 LLPanelGroupVoting::handleResponse(mUserData,LLPanelGroupVoting::START_VOTE); 687 LLPanelGroupVoting::handleResponse(
688 mGroupID,
689 LLPanelGroupVoting::START_VOTE);
645 } 690 }
646 691
647 //If we get back an error (not found, etc...), handle it here 692 //If we get back an error (not found, etc...), handle it here
@@ -649,21 +694,29 @@ public:
649 { 694 {
650 llinfos << "LLPanelGroupVotingResponder::error " 695 llinfos << "LLPanelGroupVotingResponder::error "
651 << status << ": " << reason << llendl; 696 << status << ": " << reason << llendl;
697
698 LLPanelGroupVoting::handleFailure(mGroupID);
652 } 699 }
653private: 700private:
654 void *mUserData; 701 LLUUID mGroupID;
655}; 702};
656 703
657class LLGroupProposalBallotResponder : public LLHTTPClient::Responder 704class LLGroupProposalBallotResponder : public LLHTTPClient::Responder
658{ 705{
659public: 706public:
660 LLGroupProposalBallotResponder(void *userdata) : mUserData(userdata) {}; 707 LLGroupProposalBallotResponder(const LLUUID& group_id)
708 {
709 mGroupID = group_id;
710 }
711
661 //If we get back a normal response, handle it here 712 //If we get back a normal response, handle it here
662 virtual void result(const LLSD& content) 713 virtual void result(const LLSD& content)
663 { 714 {
664 //Ack'd the proposal initialization, now let's finish up. 715 //Ack'd the proposal initialization, now let's finish up.
665 716 LLPanelGroupVoting::handleResponse(
666 LLPanelGroupVoting::handleResponse(mUserData,LLPanelGroupVoting::BALLOT,content["voted"].asBoolean()); 717 mGroupID,
718 LLPanelGroupVoting::BALLOT,
719 content["voted"].asBoolean());
667 } 720 }
668 721
669 //If we get back an error (not found, etc...), handle it here 722 //If we get back an error (not found, etc...), handle it here
@@ -671,9 +724,11 @@ public:
671 { 724 {
672 llinfos << "LLPanelGroupVotingResponder::error " 725 llinfos << "LLPanelGroupVotingResponder::error "
673 << status << ": " << reason << llendl; 726 << status << ": " << reason << llendl;
727
728 LLPanelGroupVoting::handleFailure(mGroupID);
674 } 729 }
675private: 730private:
676 void *mUserData; 731 LLUUID mGroupID;
677}; 732};
678 733
679void LLPanelGroupVoting::impl::sendStartGroupProposal() 734void LLPanelGroupVoting::impl::sendStartGroupProposal()
@@ -715,7 +770,11 @@ void LLPanelGroupVoting::impl::sendStartGroupProposal()
715 body["duration"] = duration_seconds; 770 body["duration"] = duration_seconds;
716 body["proposal-text"] = mProposalText->getText(); 771 body["proposal-text"] = mProposalText->getText();
717 772
718 LLHTTPClient::post(url, body, new LLStartGroupVoteResponder((void*)this)); 773 LLHTTPClient::post(
774 url,
775 body,
776 new LLStartGroupVoteResponder(mGroupID),
777 300);
719 } 778 }
720 else 779 else
721 { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP! 780 { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP!
@@ -758,7 +817,11 @@ void LLPanelGroupVoting::impl::sendGroupProposalBallot(const char* vote)
758 body["group-id"] = mGroupID; 817 body["group-id"] = mGroupID;
759 body["vote"] = vote; 818 body["vote"] = vote;
760 819
761 LLHTTPClient::post(url, body, new LLGroupProposalBallotResponder((void*)this)); 820 LLHTTPClient::post(
821 url,
822 body,
823 new LLGroupProposalBallotResponder(mGroupID),
824 300);
762 } 825 }
763 else 826 else
764 { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP! 827 { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP!
@@ -829,23 +892,23 @@ void LLPanelGroupVoting::impl::addPendingActiveScrollListItem(unsigned int curre
829 EAddPosition pos) 892 EAddPosition pos)
830{ 893{
831 std::stringstream pending; 894 std::stringstream pending;
895 //*TODO: translate
832 pending << "Retrieving active proposals (" 896 pending << "Retrieving active proposals ("
833 << current 897 << current
834 << "\\" << expected << ")"; 898 << "\\" << expected << ")";
835 899
836 LLSD row; 900 mProposals->addCommentText(pending.str());
837 row["columns"][0]["value"] = pending.str();
838 row["columns"][0]["font"] = "SANSSERIF_SMALL";
839 mProposals->addElement(row, pos);
840} 901}
841 902
842void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos) 903void LLPanelGroupVoting::impl::addNoActiveScrollListItem(EAddPosition pos)
843{ 904{
905 //*TODO: translate
844 mProposals->addCommentText("There are currently no active proposals", pos); 906 mProposals->addCommentText("There are currently no active proposals", pos);
845} 907}
846 908
847void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos) 909void LLPanelGroupVoting::impl::addNoHistoryScrollListItem(EAddPosition pos)
848{ 910{
911 //*TODO: translate
849 mVotesHistory->addCommentText("There are currently no archived proposals", pos); 912 mVotesHistory->addCommentText("There are currently no archived proposals", pos);
850} 913}
851 914
@@ -853,16 +916,13 @@ void LLPanelGroupVoting::impl::addPendingHistoryScrollListItem(unsigned int curr
853 unsigned int expected, 916 unsigned int expected,
854 EAddPosition pos) 917 EAddPosition pos)
855{ 918{
919 //*TODO: translate
856 std::stringstream pending; 920 std::stringstream pending;
857 pending << "Retrieving archived proposals (" 921 pending << "Retrieving archived proposals ("
858 << current 922 << current
859 << "\\" << expected << ")"; 923 << "\\" << expected << ")";
860 924
861 LLSD row; 925 mVotesHistory->addCommentText(pending.str());
862 row["columns"][0]["value"] = pending.str();
863 row["columns"][0]["font"] = "SANSSERIF_SMALL";
864
865 mVotesHistory->addElement(row, pos);
866} 926}
867 927
868 928