SL-173 FIXED Allow searching for an experience by SLurl.

meow-7.2.2
Mnikolenko ProductEngine 2015-08-18 11:22:39 +03:00
parent d5572f4f67
commit 8d34d1a9c5
2 changed files with 42 additions and 2 deletions

View File

@ -1397,7 +1397,7 @@ std::string LLUrlEntryEmail::getUrl(const std::string &string) const
LLUrlEntryExperienceProfile::LLUrlEntryExperienceProfile()
{
mPattern = boost::regex(APP_HEADER_REGEX "/experience/[\\da-f-]+/\\w+\\S*",
mPattern = boost::regex(APP_HEADER_REGEX "/experience/[\\da-f-]+/profile",
boost::regex::perl|boost::regex::icase);
mIcon = "Generic_Experience";
mMenuName = "menu_url_experience.xml";

View File

@ -42,6 +42,7 @@
#include "llviewercontrol.h"
#include "llfloater.h"
#include "lltrans.h"
#include <boost/regex.hpp>
#define BTN_FIND "find"
#define BTN_OK "ok_btn"
@ -147,6 +148,46 @@ void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* u
void LLPanelExperiencePicker::onBtnFind()
{
mCurrentPage=1;
boost::cmatch what;
std::string text = getChild<LLUICtrl>(TEXT_EDIT)->getValue().asString();
const boost::regex expression("secondlife:///app/experience/[\\da-f-]+/profile");
if (boost::regex_match(text.c_str(), what, expression))
{
LLURI uri(text);
LLSD path_array = uri.pathArray();
if (path_array.size() == 4)
{
std::string exp_id = path_array.get(2).asString();
LLUUID experience_id(exp_id);
if (!experience_id.isNull())
{
const LLSD& experience_details = LLExperienceCache::get(experience_id);
if(!experience_details.isUndefined())
{
std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString();
if(!experience_name_string.empty())
{
getChild<LLUICtrl>(TEXT_EDIT)->setValue(experience_name_string);
}
}
else
{
getChild<LLScrollListCtrl>(LIST_RESULTS)->deleteAllItems();
getChild<LLScrollListCtrl>(LIST_RESULTS)->setCommentText(getString("searching"));
getChildView(BTN_OK)->setEnabled(FALSE);
getChildView(BTN_PROFILE)->setEnabled(FALSE);
getChildView(BTN_RIGHT)->setEnabled(FALSE);
getChildView(BTN_LEFT)->setEnabled(FALSE);
LLExperienceCache::get(experience_id, boost::bind(&LLPanelExperiencePicker::onBtnFind, this));
return;
}
}
}
}
find();
}
@ -183,7 +224,6 @@ void LLPanelExperiencePicker::find()
getChildView(BTN_LEFT)->setEnabled(FALSE);
}
bool LLPanelExperiencePicker::isSelectButtonEnabled()
{
LLScrollListCtrl* list=getChild<LLScrollListCtrl>(LIST_RESULTS);