summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLynx Linden <lynx@lindenlab.com>2009-12-07 18:22:52 +0000
committerLynx Linden <lynx@lindenlab.com>2009-12-07 18:22:52 +0000
commit37c7e4059cab2a7152e730ca5d68530f14f8f51e (patch)
treeaef3704c3d77605818d6194e9f27759951b78a0e
parent1db39c97a5ba8213c0c001b60060ba165f7dd04d (diff)
DEV-43439: Allow Home side panel URL to be customized.
The URL for the Home side panel is now specified via a new "HomeSidePanelURL" string in app_settings/settings.xml. This string supports the following substitutions: CHANNEL = the channel name for the viewer VERSION = the full version string for the viewer LANGUAGE = the current language set in the viewer AUTH_KEY = the authentication key (see below) The authentication key is an optional string that is read from the dictionary of strings returned by login.cgi. If login.cgi returns a key called "home_sidetray_token", then the value of that key is used for the AUTH_KEY substitution. This lets the server provide a piece of blind data that can be passed to the Home panel web page to support authentication. The viewer does not interpret the token in any way. This change adds a new module, llviewerhome.{cpp|h} to contain the model functionality, used by the view module, llpanelhome.{cpp|h}.
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llpanelhome.cpp6
-rw-r--r--indra/newview/llviewerhome.cpp79
-rw-r--r--indra/newview/llviewerhome.h49
5 files changed, 146 insertions, 1 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index dd3fc10fa2..3a1a318669 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -462,6 +462,7 @@ set(viewer_SOURCE_FILES
llviewergesture.cpp
llviewerhelp.cpp
llviewerhelputil.cpp
+ llviewerhome.cpp
llviewerinventory.cpp
llviewerjoint.cpp
llviewerjointattachment.cpp
@@ -964,6 +965,7 @@ set(viewer_HEADER_FILES
llviewergenericmessage.h
llviewergesture.h
llviewerhelp.h
+ llviewerhome.h
llviewerinventory.h
llviewerjoint.h
llviewerjointattachment.h
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index b301d784f9..ec28603d25 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -3587,6 +3587,17 @@
<key>Value</key>
<string>http://viewer-help.secondlife.com/[LANGUAGE]/[CHANNEL]/[VERSION]/[TOPIC]</string>
</map>
+ <key>HomeSidePanelURL</key>
+ <map>
+ <key>Comment</key>
+ <string>URL for the web page to display in the Home side panel</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>http://www.secondlife.com/</string>
+ </map>
<key>HighResSnapshot</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp
index de7a85836d..fb2629c692 100644
--- a/indra/newview/llpanelhome.cpp
+++ b/indra/newview/llpanelhome.cpp
@@ -35,6 +35,7 @@
#include "llpanelhome.h"
#include "llmediactrl.h"
+#include "llviewerhome.h"
static LLRegisterPanelClassWrapper<LLPanelHome> t_people("panel_sidetray_home");
@@ -62,9 +63,12 @@ BOOL LLPanelHome::postBuild()
mBrowser = getChild<LLMediaCtrl>("browser");
if (mBrowser)
{
+ // read the URL to display from settings.xml
+ std::string url = LLViewerHome::getHomeURL();
+
mBrowser->addObserver(this);
mBrowser->setTrusted(true);
- mBrowser->setHomePageUrl("http://www.secondlife.com/");
+ mBrowser->setHomePageUrl(url);
childSetAction("back", onClickBack, this);
childSetAction("forward", onClickForward, this);
diff --git a/indra/newview/llviewerhome.cpp b/indra/newview/llviewerhome.cpp
new file mode 100644
index 0000000000..64fe4f4fca
--- /dev/null
+++ b/indra/newview/llviewerhome.cpp
@@ -0,0 +1,79 @@
+/**
+ * @file llviewerhome.cpp
+ * @brief Model (non-View) component for the web-based Home side panel
+ * @author Martin Reddy
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llviewerhome.h"
+
+#include "lllogininstance.h"
+#include "llui.h"
+#include "lluri.h"
+#include "llsd.h"
+#include "llversionviewer.h"
+#include "llviewercontrol.h"
+
+//static
+std::string LLViewerHome::getHomeURL()
+{
+ // Return the URL to display in the Home side tray. We read
+ // this value from settings.xml and support various substitutions
+
+ // *TODO: We should put this version pattern in a central place; this and near
+ // equivalents are replicated in other code - what's a good location?
+ std::ostringstream version;
+ version << LL_VERSION_MAJOR << "."
+ << LL_VERSION_MINOR << "."
+ << LL_VERSION_PATCH << "."
+ << LL_VERSION_BUILD;
+
+ LLSD substitution;
+ substitution["VERSION"] = version.str();
+ substitution["CHANNEL"] = LLURI::escape(gSavedSettings.getString("VersionChannelName"));
+ substitution["LANGUAGE"] = LLUI::getLanguage();
+ substitution["AUTH_KEY"] = LLURI::escape(getAuthKey());
+
+ std::string homeURL = gSavedSettings.getString("HomeSidePanelURL");
+ LLStringUtil::format(homeURL, substitution);
+
+ return homeURL;
+}
+
+//static
+std::string LLViewerHome::getAuthKey()
+{
+ // return the value of the (optional) auth token returned by login.cgi
+ // this lets the server provide an authentication token that we can
+ // blindly pass to the Home web page for it to perform authentication.
+ static const std::string authKeyName("home_sidetray_token");
+ return LLLoginInstance::getInstance()->getResponse(authKeyName);
+}
+
diff --git a/indra/newview/llviewerhome.h b/indra/newview/llviewerhome.h
new file mode 100644
index 0000000000..50454a71b7
--- /dev/null
+++ b/indra/newview/llviewerhome.h
@@ -0,0 +1,49 @@
+/**
+ * @file llviewerhome.h
+ * @brief Model (non-View) component for the web-based Home side panel
+ * @author Martin Reddy
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLVIEWERHOME_H
+#define LL_LLVIEWERHOME_H
+
+#include <string>
+
+class LLViewerHome
+{
+public:
+ /// return the URL to use for the web-based Home side panel
+ static std::string getHomeURL();
+
+ /// return the authentication key for the Home web site
+ static std::string getAuthKey();
+};
+
+#endif