From 37bd01152ac278e3401a96b12baf5505c5c1f789 Mon Sep 17 00:00:00 2001
From: dolphin <dolphin@lindenlab.com>
Date: Tue, 21 May 2013 22:57:15 -0700
Subject: [PATCH] Update experience request to use the new post service.

---
 indra/newview/llpreviewscript.cpp | 40 ++++++++++++++++++++-----------
 indra/newview/llpreviewscript.h   |  1 +
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 7c1b83dfa9d..bba0f1330c3 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1290,6 +1290,10 @@ void LLScriptEdCore::addExperienceInfo( const LLSD& experience )
 {
 	mExperiences->setEnabled(TRUE);
 	mExperiences->add(experience[LLExperienceCache::NAME], experience[LLExperienceCache::EXPERIENCE_ID].asUUID());
+    if(mAssociatedExperience == experience[LLExperienceCache::EXPERIENCE_ID].asUUID())
+    {
+        setAssociatedExperience(mAssociatedExperience);
+    }
 }
 
 void LLScriptEdCore::clearExperiences()
@@ -1306,7 +1310,7 @@ LLUUID LLScriptEdCore::getSelectedExperience()const
 void LLScriptEdCore::setAssociatedExperience( const LLUUID& experience_id )
 {
     mAssociatedExperience = experience_id;
-    if(experience_id.isNull())
+    if(experience_id.notNull())
     {
         if(!mExperiences->setSelectedByValue(mAssociatedExperience, TRUE))
         {
@@ -2028,19 +2032,8 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id,
 	
 	if(instance )
 	{
-        LLViewerRegion* region = gAgent.getRegion();
-        if (region)
-        {
-            std::string lookup_url=region->getCapability("GetMetadata"); 
-            //lookup_url = "http://127.0.0.1:12035/meta";
-            if(!lookup_url.empty())
-            {
-                lookup_url += "/";
-                lookup_url += asset_id.asString();
-                lookup_url += "/experience";
-                LLHTTPClient::get(lookup_url, new ExperienceAssociationResponder(*xored_id));
-            }
-        }
+        instance->fetchAssociatedExperience(asset_id);
+
 
 		if( LL_ERR_NOERR == status )
 		{
@@ -2488,6 +2481,25 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use
 	delete data;
 }
 
+void LLLiveLSLEditor::fetchAssociatedExperience(const LLUUID& asset_id)
+{
+    LLViewerRegion* region = gAgent.getRegion();
+    if (region)
+    {
+        std::string lookup_url=region->getCapability("GetMetadata"); 
+        if(!lookup_url.empty())
+        {
+            LLSD request;
+            request["asset-id"]=asset_id;
+            LLSD fields;
+            fields.append("experience");
+            request["fields"] = fields;
+            LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(getKey()));
+        }
+    }
+}
+
+
 BOOL LLLiveLSLEditor::canClose()
 {
 	return (mScriptEd->canClose());
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index b29d16c58da..28e71b111aa 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -238,6 +238,7 @@ class LLLiveLSLEditor : public LLScriptEdContainer
 	
     void setIsNew() { mIsNew = TRUE; }
     void setAssociatedExperience( const LLUUID& experience_id );
+    void fetchAssociatedExperience(const LLUUID& asset_id);
 	
 private:
 	virtual BOOL canClose();
-- 
GitLab