From a62592d73bafbdc00c3af68570ce4adac2f25c4e Mon Sep 17 00:00:00 2001
From: Callum Prentice <callum@gmail.com>
Date: Wed, 12 Jul 2017 16:07:02 -0700
Subject: [PATCH] Fixes for: 'MAINT-7588 Viewer takes 3 to 5 seconds to load
 TOS and styling different on redirecting page' and 'MAINT-7599 Reformat ToS
 'Accept' label as a single string'.  The former's load time is improved by
 only asking for the HTTP header to check site is alive and then applying a
 specific CSS style to the page instead of relying on the CEF default (which
 appears to change often). The latter replaces the XUI checkbox label with a
 text box and adjusts it visually as necessary for enabled/disabled states

---
 indra/newview/llfloatertos.cpp                | 25 ++++++++++++-------
 indra/newview/llfloatertos.h                  |  2 ++
 .../skins/default/xui/en/floater_tos.xml      | 12 +++++----
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index 1743d0fc69e..6af2e666b2c 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -74,8 +74,7 @@ BOOL LLFloaterTOS::postBuild()
 	}
 
 	// disable Agree to TOS radio button until the page has fully loaded
-	LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
-	tos_agreement->setEnabled( false );
+	updateAgreeEnabled(false);
 
 	// hide the SL text widget if we're displaying TOS with using a browser widget.
 	LLUICtrl *editor = getChild<LLUICtrl>("tos_text");
@@ -148,8 +147,7 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
 			LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL;
 			// normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads)
 			// but if the page is unavailable, we need to do this now
-			LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
-			tos_agreement->setEnabled( true );
+			updateAgreeEnabled(true);
 		}
 	}
 #endif
@@ -166,6 +164,17 @@ void LLFloaterTOS::draw()
 	LLModalDialog::draw();
 }
 
+
+// update status of "Agree" checkbox and text
+void LLFloaterTOS::updateAgreeEnabled(bool enabled)
+{
+	LLCheckBoxCtrl* tos_agreement_agree_cb = getChild<LLCheckBoxCtrl>("agree_chk");
+	tos_agreement_agree_cb->setEnabled(enabled);
+
+	LLTextBox* tos_agreement_agree_text = getChild<LLTextBox>("agree_list");
+	tos_agreement_agree_text->setEnabled(enabled);
+}
+
 // static
 void LLFloaterTOS::updateAgree(LLUICtrl*, void* userdata )
 {
@@ -227,9 +236,8 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev
 		else if(mRealNavigateBegun)
 		{
 			LL_INFOS("TOS") << "TOS: NAVIGATE COMPLETE" << LL_ENDL;
-			// enable Agree to TOS radio button now that page has loaded
-			LLCheckBoxCtrl * tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
-			tos_agreement->setEnabled( true );
+			// enable Agree to TOS check box now that page has loaded
+			updateAgreeEnabled(true);
 		}
 	}
 }
@@ -242,9 +250,8 @@ void LLFloaterTOS::testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string u
     LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
     LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
 
-
     httpOpts->setWantHeaders(true);
-
+	httpOpts->setHeadersOnly(true);
 
     LL_INFOS("testSiteIsAliveCoro") << "Generic POST for " << url << LL_ENDL;
 
diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h
index e70c9f24afc..85033acf4d9 100644
--- a/indra/newview/llfloatertos.h
+++ b/indra/newview/llfloatertos.h
@@ -58,6 +58,8 @@ class LLFloaterTOS :
 
 	void			setSiteIsAlive( bool alive );
 
+	void			updateAgreeEnabled(bool enabled);
+
 	// inherited from LLViewerMediaObserver
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
 
diff --git a/indra/newview/skins/default/xui/en/floater_tos.xml b/indra/newview/skins/default/xui/en/floater_tos.xml
index e3b49bf9179..8976d2a78f3 100644
--- a/indra/newview/skins/default/xui/en/floater_tos.xml
+++ b/indra/newview/skins/default/xui/en/floater_tos.xml
@@ -13,7 +13,7 @@
     </floater.string>
     <floater.string
      name="loading_url">
-        data:text/html,%3Chtml%3E%3Chead%3E%3C/head%3E%3Cbody text=%22000000%22%3E%3Ch2%3E Loading %3Ca%20target%3D%22_external%22%20href%3D%22http%3A//secondlife.com/app/tos/%22%3ETerms%20of%20Service%3C/a%3E...%3C/h2%3E %3C/body%3E %3C/html%3E
+      data:text/html;charset=utf-8;base64,PGh0bWw+DQo8aGVhZD4NCjxzdHlsZT4NCmJvZHkgew0KICBmb250LWZhbWlseTogIkRlamEgVnUgU2FucyIsIEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7DQogIGNvbG9yOiAjZmZmOw0KICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2IoMzEsIDMxLCAzMSk7DQp9DQphIHsNCiAgICBjb2xvcjogcmdiKDkyLCAxNzcsIDE0Nik7DQogICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOw0KfQ0KI2NlbnRlcmVkIHsNCiAgcG9zaXRpb246IHJlbGF0aXZlOw0KICBmbG9hdDogbGVmdDsNCiAgdG9wOiA1MCU7DQogIGxlZnQ6IDUwJTsNCiAgdHJhbnNmb3JtOiB0cmFuc2xhdGUoLTUwJSwgLTUwJSk7DQp9DQo8L3N0eWxlPg0KPC9oZWFkPg0KPGJvZHk+DQo8ZGl2IGlkPSJjZW50ZXJlZCI+TG9hZGluZyA8YSB0YXJnZXQ9Il9leHRlcm5hbCIgaHJlZj0iaHR0cDovL3NlY29uZGxpZmUuY29tL2FwcC90b3MvIj5UZXJtcyBvZiBTZXJ2aWNlPC9hPi4uLjwvZGl2Pg0KPC9ib2R5Pg0KPC9odG1sPg==
     </floater.string>
     <text
      type="string"
@@ -57,7 +57,7 @@
      follows="top|left"
      font="SansSerif"
      height="16"
-     label="I have read and agree to"
+     label=""
      layout="topleft"
      left_delta="0"
      name="agree_chk"
@@ -70,11 +70,13 @@
      font="SansSerif"
      height="30"
      layout="topleft"
-     left_delta="20"
+     left_delta="28"
      name="agree_list"
-     top_delta="15"
+     top_delta="0"
      word_wrap="true"
-     width="552">the Second Life Terms and Conditions, Privacy Policy, and Terms of Service, including the dispute resolution requirements. 
+     text_readonly_color="LabelDisabledColor"
+     width="552">
+      I have read and agree to the Second Life Terms and Conditions, Privacy Policy, and Terms of Service, including the dispute resolution requirements.
     </text>
     <button
      enabled="false"
-- 
GitLab