diff options
-rwxr-xr-x | indra/llui/llurlentry.cpp | 48 | ||||
-rwxr-xr-x | indra/llui/llurlentry.h | 14 | ||||
-rwxr-xr-x | indra/llui/llurlregistry.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterexperienceprofile.cpp | 42 | ||||
-rwxr-xr-x | indra/newview/llsidepaneliteminfo.cpp | 12 | ||||
-rwxr-xr-x | indra/newview/skins/default/textures/textures.xml | 1 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/sidepanel_item_info.xml | 57 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 2 |
8 files changed, 133 insertions, 44 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b1cc502c4b..6f7d072d00 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -37,6 +37,7 @@ #include "lltrans.h" #include "lluicolortable.h" #include "message.h" +#include "llexperiencecache.h" #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" @@ -1200,3 +1201,50 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url) LLStringUtil::trim(mIcon); return mIcon; } + +LLUrlEntryExperienceProfile::LLUrlEntryExperienceProfile() +{ + mPattern = boost::regex(APP_HEADER_REGEX "/experience/[\\da-f-]+/\\w+\\S*", + boost::regex::perl|boost::regex::icase); + mIcon = "Generic_Experience"; +} + +std::string LLUrlEntryExperienceProfile::getLabel( const std::string &url, const LLUrlLabelCallback &cb ) +{ + if (!gCacheName) + { + // probably at the login screen, use short string for layout + return LLTrans::getString("LoadingData"); + } + + std::string experience_id_string = getIDStringFromUrl(url); + if (experience_id_string.empty()) + { + // something went wrong, just give raw url + return unescapeUrl(url); + } + + LLUUID experience_id(experience_id_string); + if (experience_id.isNull()) + { + return LLTrans::getString("ExperienceNameNull"); + } + + LLSD experience_details; + if(LLExperienceCache::get(experience_id, experience_details)) + { + return experience_details[LLExperienceCache::NAME].asString(); + } + + addObserver(experience_id_string, url, cb); + LLExperienceCache::get(experience_id, boost::bind(&LLUrlEntryExperienceProfile::onExperienceDetails, this, _1)); + return LLTrans::getString("LoadingData"); + +} + +void LLUrlEntryExperienceProfile::onExperienceDetails( const LLSD& experience_details ) +{ + callObservers(experience_details[LLExperienceCache::EXPERIENCE_ID].asString(), experience_details[LLExperienceCache::NAME].asString(), LLStringUtil::null); +} + + diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 8c6c32178a..48b4a1d531 100755 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -258,6 +258,20 @@ private: }; /// +/// LLUrlEntryExperienceProfile Describes a Second Life experience profile Url, e.g., +/// secondlife:///app/experience/0e346d8b-4433-4d66-a6b0-fd37083abc4c/profile +/// that displays the experience name +class LLUrlEntryExperienceProfile : public LLUrlEntryBase +{ +public: + LLUrlEntryExperienceProfile(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); +private: + void onExperienceDetails(const LLSD& experience_details); +}; + + +/// /// LLUrlEntryGroup Describes a Second Life group Url, e.g., /// secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about /// diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 523ee5d78c..480f05bd72 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -60,6 +60,7 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntryPlace()); registerUrl(new LLUrlEntryInventory()); registerUrl(new LLUrlEntryObjectIM()); + registerUrl(new LLUrlEntryExperienceProfile()); //LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern, //so it should be registered in the end of list registerUrl(new LLUrlEntrySL()); diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index ec2e7f0f10..01af6b1cab 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -26,14 +26,20 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterexperienceprofile.h" #include "llagent.h" +#include "llappviewer.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llcommandhandler.h" #include "llexpandabletextbox.h" #include "llexperiencecache.h" -#include "llfloaterexperienceprofile.h" #include "llfloaterreg.h" #include "llhttpclient.h" #include "lllayoutstack.h" +#include "lllineeditor.h" +#include "llnotificationsutil.h" #include "llsdserialize.h" #include "llslurl.h" #include "lltabcontainer.h" @@ -41,11 +47,6 @@ #include "lltexturectrl.h" #include "lltrans.h" #include "llviewerregion.h" -#include "lllineeditor.h" -#include "llcombobox.h" -#include "llcheckboxctrl.h" -#include "llnotificationsutil.h" -#include "llappviewer.h" #define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml" #define TF_NAME "experience_title" @@ -75,6 +76,34 @@ #define BTN_PRIVATE "private_btn" + +class LLExperienceHandler : public LLCommandHandler +{ +public: + LLExperienceHandler() : LLCommandHandler("experience", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if(params.size() != 2 || params[1].asString() != "profile") + return false; + + LLExperienceCache::get(params[0].asUUID(), boost::bind(&LLExperienceHandler::experienceCallback, this, _1)); + return true; + } + + void experienceCallback(const LLSD& experienceDetails) + { + if(!experienceDetails.has(LLExperienceCache::MISSING)) + { + LLFloaterReg::showInstance("experience_profile", experienceDetails[LLExperienceCache::EXPERIENCE_ID].asUUID(), true); + } + } +}; + +LLExperienceHandler gExperienceHandler; + + LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data) : LLFloater(data) , mExperienceId(data.asUUID()) @@ -355,6 +384,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = experience[LLExperienceCache::SLURL].asString(); child = getChild<LLTextBox>(TF_SLURL); + value = LLSLURL(value).getSLURLString(); child->setText(value); locationPanel->setVisible(value.length()>0); diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 040c4ee72d..072b001890 100755 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -43,8 +43,9 @@ #include "llviewercontrol.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" -#include "llexperiencecache.h" #include "llexperienceassociationresponder.h" +#include "llexperiencecache.h" +#include "lltrans.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -684,18 +685,17 @@ void LLSidepanelItemInfo::setAssociatedExperience( LLHandle<LLSidepanelItemInfo> if(info) { LLUUID id; - if(experience.has(LLExperienceCache::EXPERIENCE_ID) && experience.has(LLExperienceCache::NAME)) + if(experience.has(LLExperienceCache::EXPERIENCE_ID)) { id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); } - LLTextBox* xpName = info->getChild<LLTextBox>("LabelItemExperience"); - if(id.isNull()) + if(id.notNull()) { - xpName->setText(info->getString("no_experience")); + info->getChild<LLTextBox>("LabelItemExperience")->setText(LLSLURL("experience", id, "profile").getSLURLString()); } else { - xpName->setText(experience[LLExperienceCache::NAME].asString()); + info->getChild<LLTextBox>("LabelItemExperience")->setText(LLTrans::getString("ExperienceNameNull")); } } } diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 54f60f4441..1cbf2d8282 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -217,6 +217,7 @@ with the same filename but different name <texture name="ForwardArrow_Off" file_name="icons/ForwardArrow_Off.png" preload="false" /> <texture name="ForwardArrow_Press" file_name="icons/ForwardArrow_Press.png" preload="false" /> + <texture name="Generic_Experience" file_name="Blank.png" preload="false" /> <texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" /> <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" /> <texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" /> diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index f1f8843a9d..fc3fdbcfa5 100755 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -8,11 +8,7 @@ title="Item Profile" width="333"> <panel.string - name="no_experience"> - (none) - </panel.string> - <panel.string - name="loading_experience"> + name="loading_experience"> (loading) </panel.string> <panel.string @@ -267,6 +263,31 @@ top_delta="0" width="210"> </text> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left="5" + name="LabelItemExperienceTitle" + top_pad="0" + width="78" + visible="true"> + Experience: + </text> + <text + type="string" + length="1" + follows="left|top|right" + height="10" + layout="topleft" + left_delta="78" + name="LabelItemExperience" + top_delta="0" + width="210" + visible="true" + /> <panel border="false" follows="left|top|right" @@ -428,32 +449,6 @@ height="23" max_val="999999999" top_pad="10"/> - - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="5" - name="LabelItemExperienceTitle" - top_pad="10" - width="78" - visible="false"> - Experience: - </text> - <text - type="string" - length="1" - follows="left|top|right" - height="10" - layout="topleft" - left_delta="78" - name="LabelItemExperience" - top_delta="0" - width="210" - visible="false" - ></text> </panel> </scroll_container> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index b02d4e5d8f..0c84d904a8 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3922,7 +3922,7 @@ Try enclosing path to the editor with double quotes. <!-- Experience Tools strings --> <string name="experience_tools_experience">Experience</string> - + <string name="ExperienceNameNull">(no experience)</string> <!-- Conversation log messages --> <string name="logging_calls_disabled_log_empty"> |