diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | indra/newview/llpanelgroup.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelgroupexperiences.cpp | 135 | ||||
-rw-r--r-- | indra/newview/llpanelgroupexperiences.h | 53 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml | 16 |
5 files changed, 208 insertions, 0 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 453669aca1..80981d04bd 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -413,6 +413,7 @@ set(viewer_SOURCE_FILES llpanelface.cpp llpanelgenerictip.cpp llpanelgroup.cpp + llpanelgroupexperiences.cpp llpanelgroupgeneral.cpp llpanelgroupinvite.cpp llpanelgrouplandmoney.cpp @@ -1007,6 +1008,7 @@ set(viewer_HEADER_FILES llpanelface.h llpanelgenerictip.h llpanelgroup.h + llpanelgroupexperiences.h llpanelgroupgeneral.h llpanelgroupinvite.h llpanelgrouplandmoney.h diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index f4aab6bd4e..8936084d97 100755 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -177,11 +177,13 @@ BOOL LLPanelGroup::postBuild() LLPanelGroupTab* panel_roles = findChild<LLPanelGroupTab>("group_roles_tab_panel"); LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel"); LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel"); + LLPanelGroupTab* panel_experiences = findChild<LLPanelGroupTab>("group_experiences_tab_panel"); if(panel_general) mTabs.push_back(panel_general); if(panel_roles) mTabs.push_back(panel_roles); if(panel_notices) mTabs.push_back(panel_notices); if(panel_land) mTabs.push_back(panel_land); + if(panel_experiences) mTabs.push_back(panel_experiences); if(panel_general) { diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp new file mode 100644 index 0000000000..140a71a528 --- /dev/null +++ b/indra/newview/llpanelgroupexperiences.cpp @@ -0,0 +1,135 @@ +/** + * @file llpanelgroupexperiences.cpp + * @brief List of experiences owned by a group. + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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 "llpanelgroupexperiences.h" + +#include "lluictrlfactory.h" +#include "roles_constants.h" + +#include "llhttpclient.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llflatlistview.h" +#include "llpanelexperiences.h" +#include "llsd.h" + + +static LLPanelInjector<LLPanelGroupExperiences> t_panel_group_experiences("panel_group_experiences"); + + +class LLGroupExperienceResponder : public LLHTTPClient::Responder +{ +public: + LLHandle<LLPanelGroupExperiences> mHandle; + + LLGroupExperienceResponder(LLHandle<LLPanelGroupExperiences> handle) : mHandle(handle) { } + +protected: + /*virtual*/ void httpSuccess() + { + if (mHandle.isDead()) + { + return; + } + + LLPanelGroupExperiences* panel = mHandle.get(); + if (panel) + { + panel->setExperienceList(getContent().get("experience_ids")); + } + } + + /*virtual*/ void httpFailure() + { + LL_WARNS() << "experience responder failed [status:" << getStatus() << "]: " << getContent() << LL_ENDL; + } +}; + +LLPanelGroupExperiences::LLPanelGroupExperiences() +: LLPanelGroupTab(), mExperiencesList(NULL) +{ +} + +LLPanelGroupExperiences::~LLPanelGroupExperiences() +{ +} + +BOOL LLPanelGroupExperiences::postBuild() +{ + mExperiencesList = getChild<LLFlatListView>("experiences_list"); + if(hasString("no_experiences")) + { + mExperiencesList->setNoItemsCommentText(getString("no_experiences")); + } + + return LLPanelGroupTab::postBuild(); +} + +void LLPanelGroupExperiences::activate() +{ + if (getGroupID() == LLUUID::null) + { + return; + } + + // search for experiences owned by the current group + std::string url = gAgent.getRegion()->getCapability("GroupExperiences"); + if (!url.empty()) + { + url += "?" + getGroupID().asString(); + + LLHTTPClient::get(url, new LLGroupExperienceResponder(getDerivedHandle<LLPanelGroupExperiences>())); + } +} + +void LLPanelGroupExperiences::setGroupID(const LLUUID& id) +{ + LLPanelGroupTab::setGroupID(id); + + if(id == LLUUID::null) + { + return; + } + + activate(); +} + +void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences) +{ + mExperiencesList->clear(); + + LLSD::array_const_iterator it = experiences.beginArray(); + for ( /**/ ; it != experiences.endArray(); ++it) + { + LLUUID public_key = it->asUUID(); + LLExperienceItem* item = new LLExperienceItem(); + + item->init(public_key); + mExperiencesList->addItem(item, public_key); + } +} diff --git a/indra/newview/llpanelgroupexperiences.h b/indra/newview/llpanelgroupexperiences.h new file mode 100644 index 0000000000..ae1ecc1ac5 --- /dev/null +++ b/indra/newview/llpanelgroupexperiences.h @@ -0,0 +1,53 @@ +/** + * @file llpanelgroupexperiences.h + * @brief List of experiences owned by a group. + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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$ + */ + +#ifndef LL_LLPANELGROUPEXPERIENCES_H +#define LL_LLPANELGROUPEXPERIENCES_H + +#include "llpanelgroup.h" + +class LLFlatListView; + +class LLPanelGroupExperiences : public LLPanelGroupTab +{ +public: + LLPanelGroupExperiences(); + virtual ~LLPanelGroupExperiences(); + + // LLPanelGroupTab + virtual void activate(); + + virtual BOOL postBuild(); + + virtual void setGroupID(const LLUUID& id); + + void setExperienceList(const LLSD& experiences); + +protected: + LLFlatListView* mExperiencesList; +}; + +#endif diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml index b3326d8da6..95312edfb9 100755 --- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml +++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml @@ -176,6 +176,22 @@ background_visible="true" name="group_land_tab_panel" top="0" /> </accordion_tab> + <accordion_tab + expanded="false" + layout="topleft" + name="group_experiences_tab" + title="Experiences" + fit_panel="false"> + <panel + border="false" + class="panel_group_experiences" + filename="panel_experiences.xml" + follows="left|top|right" + layout="topleft" + left="0" + name="group_experiences_tab_panel" + top="0" /> + </accordion_tab> </accordion> </layout_panel> </layout_stack> |