Skip to content
Snippets Groups Projects
Commit aaf03990 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add support for TOS popup on opensim

parent eafa4d3f
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
#include "llfloatertos.h"
// viewer includes
#include "llviewernetwork.h"
#include "llviewerstats.h"
#include "llviewerwindow.h"
......@@ -45,6 +46,9 @@
#include "llcorehttputil.h"
#include "llfloaterreg.h"
// system includes
#include <boost/regex.hpp>
LLFloaterTOS::LLFloaterTOS(const LLSD& data)
: LLModalDialog( data["message"].asString() ),
mMessage(data["message"].asString()),
......@@ -80,7 +84,27 @@ BOOL LLFloaterTOS::postBuild()
editor->setVisible( FALSE );
LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
if ( web_browser )
bool use_web_browser = false;
if (LLGridManager::getInstance()->isInOpenSim())
{
//Check to see if the message is a link to display
const boost::regex url_regex("https?://([^\\s/?\\.#]+\\.?)+\\.\\w+(:\\d+)?(/\\S*)?",
boost::regex::perl | boost::regex::icase);
//IF it has http:// in it, we use the web browser
if(mMessage.size() >= 4 && boost::regex_match(mMessage, url_regex))
{
// it exists
use_web_browser = true;
}
}
else
{
use_web_browser = true;
}
if (web_browser && use_web_browser)
{
// if we are forced to send users to an external site in their system browser
// (e.g.) Linux users because of lack of media support for HTML ToS page
......@@ -98,17 +122,44 @@ BOOL LLFloaterTOS::postBuild()
#else
web_browser->addObserver(this);
// Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
// Store the URL separately and navigate here instead.
web_browser->navigateTo( getString( "loading_url" ) );
LLPluginClassMedia* media_plugin = web_browser->getMediaPlugin();
if (media_plugin)
if (LLGridManager::getInstance()->isInOpenSim())
{
// All links from tos_html should be opened in external browser
media_plugin->setOverrideClickTarget("_external");
mRealNavigateBegun = true;
updateAgreeEnabled(true);
web_browser->navigateTo(mMessage);
}
else
{
// Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
// Store the URL separately and navigate here instead.
web_browser->navigateTo( getString( "loading_url" ) );
LLPluginClassMedia* media_plugin = web_browser->getMediaPlugin();
if (media_plugin)
{
// All links from tos_html should be opened in external browser
media_plugin->setOverrideClickTarget("_external");
}
}
#endif
}
else if (LLGridManager::getInstance()->isInOpenSim())
{
std::string showTos = "data:text/html,%3Chtml%3E%3Chead%3E"
"%3Cstyle%3E%0A"
"body%20%7B%0A"
"background-color%3Argb%2831%2C%2031%2C%2031%29%3B%0A"
"margin%3A5px%2020px%205px%2030px%3B%0A"
"padding%3A0%3B%0A%7D%0A"
"pre%20%7B%0Afont-size%3A12px%3B%0A"
"font-family%3A%22Deja%20Vu%20Sans%22%2C%20Helvetica%2C%20Arial%2C%20sans-serif%3B%0A"
"color%3A%23fff%3B%0A%7D%0A"
"%3C/style%3E"
"%3C/head%3E%3Cbody%3E%3Cpre%3E" + mMessage + "%3C/pre%3E%3C/body%3E%3C/html%3E";
mRealNavigateBegun = true;
updateAgreeEnabled(true);
web_browser->navigateTo(showTos);
}
return TRUE;
}
......
......@@ -3,7 +3,7 @@
legacy_header_height="18"
can_close="false"
can_minimize="false"
height="500"
height="492"
layout="topleft"
name="modal container"
width="600">
......@@ -20,14 +20,14 @@
length="1"
follows="left|top"
font="SansSerif"
height="45"
height="55"
layout="topleft"
left="20"
name="tos_heading"
top="20"
word_wrap="true"
width="552">
Please read the following Second Life Terms and Conditions, Privacy Policy, and Terms of Service, including the requirements for the use of arbitration and the waiver of any class or group claim to resolve disputes. To continue logging in to [SECOND_LIFE], you must accept these agreements.
Please read the following Terms and Conditions, Privacy Policy, and Terms of Service, including the requirements for the use of arbitration and the waiver of any class or group claim to resolve disputes. To continue logging in you must accept these agreements.
</text>
<text
type="string"
......@@ -51,7 +51,7 @@
layout="topleft"
left_delta="0"
name="tos_html"
top_delta="70"
top_delta="75"
width="568" />
<check_box
follows="top|left"
......@@ -72,11 +72,11 @@
layout="topleft"
left_delta="28"
name="agree_list"
top_delta="0"
top_delta="-4"
word_wrap="true"
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.
I have read and agree to the Terms and Conditions, Privacy Policy, and Terms of Service, including the dispute resolution requirements.
</text>
<button
enabled="false"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment