From 8d34d1a9c5ae321ce59b20f8673beed0312a41fe Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Tue, 18 Aug 2015 11:22:39 +0300
Subject: SL-173 FIXED Allow searching for an experience by SLurl.

---
 indra/newview/llpanelexperiencepicker.cpp | 42 ++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

(limited to 'indra/newview/llpanelexperiencepicker.cpp')

diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp
index 70d826a407..43dc7569a4 100644
--- a/indra/newview/llpanelexperiencepicker.cpp
+++ b/indra/newview/llpanelexperiencepicker.cpp
@@ -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);
-- 
cgit v1.2.3