diff options
Diffstat (limited to 'indra/newview')
35 files changed, 845 insertions, 518 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e4e4d8a2fa..b74f67e72e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -169,9 +169,8 @@ set(viewer_SOURCE_FILES llfloatergroups.cpp llfloaterhandler.cpp llfloaterhardwaresettings.cpp - llfloaterhtmlcurrency.cpp + llfloaterhelpbrowser.cpp llfloatermediabrowser.cpp - llfloaterhtmlsimple.cpp llfloaterhud.cpp llfloaterimagepreview.cpp llfloaterinspect.cpp @@ -426,6 +425,8 @@ set(viewer_SOURCE_FILES llviewerfloaterreg.cpp llviewergenericmessage.cpp llviewergesture.cpp + llviewerhelp.cpp + llviewerhelputil.cpp llviewerinventory.cpp llviewerjointattachment.cpp llviewerjoint.cpp @@ -632,9 +633,8 @@ set(viewer_HEADER_FILES llfloatergroups.h llfloaterhandler.h llfloaterhardwaresettings.h - llfloaterhtmlcurrency.h + llfloaterhelpbrowser.h llfloatermediabrowser.h - llfloaterhtmlsimple.h llfloaterhud.h llfloaterimagepreview.h llfloaterinspect.h @@ -891,6 +891,7 @@ set(viewer_HEADER_FILES llviewerfloaterreg.h llviewergenericmessage.h llviewergesture.h + llviewerhelp.h llviewerinventory.h llviewerjoint.h llviewerjointattachment.h @@ -1526,6 +1527,7 @@ endif (INSTALL) include(LLAddBuildTest) SET(viewer_TEST_SOURCE_FILES llagentaccess.cpp + llviewerhelputil.cpp ) set_source_files_properties( ${viewer_TEST_SOURCE_FILES} diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 19d503390c..8cbe6d20c6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3542,28 +3542,28 @@ <string>S32</string> <key>Value</key> <integer>400</integer> - </map> - <key>HelpHomeURL</key> + </map> + <key>HelpUseLocal</key> <map> <key>Comment</key> - <string>URL of initial help page</string> + <string>If set, always use this for help: skins/default/html/[LANGUAGE]/help-offline/index.html</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> - <string>String</string> + <string>Boolean</string> <key>Value</key> - <string>help/index.html</string> + <integer>0</integer> </map> - <key>HelpLastVisitedURL</key> + <key>HelpURLFormat</key> <map> <key>Comment</key> - <string>URL of last help page, will be shown next time help is accessed</string> + <string>URL pattern for help page; arguments will be encoded; see llviewerhelp.cpp:buildHelpURL for arguments</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>String</string> <key>Value</key> - <string>help/index.html</string> + <string>http://www.google.com/search?q=site%3Awiki.secondlife.com+[TOPIC]&ignore_channel=[CHANNEL]&ignore_version=[VERSION]&ignore_os=[OS]&ignore_language=[LANGUAGE]&ignore_version_major=[VERSION_MAJOR]&ignore_version_minor=[VERSION_MINOR]&ignore_version_patch=[VERSION_PATCH]&ignore_version_build=[VERSION_BUILD]</string> </map> <key>HighResSnapshot</key> <map> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 355660faa5..30e0a5770c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -67,6 +67,7 @@ #include "llviewerobjectlist.h" #include "llworldmap.h" #include "llmutelist.h" +#include "llviewerhelp.h" #include "lluicolortable.h" #include "llurldispatcher.h" #include "llurlhistory.h" @@ -663,8 +664,6 @@ bool LLAppViewer::init() mNumSessions++; gSavedSettings.setS32("NumSessions", mNumSessions); - gSavedSettings.setString("HelpLastVisitedURL",gSavedSettings.getString("HelpHomeURL")); - if (gSavedSettings.getBOOL("VerboseLogs")) { LLError::setPrintLocation(true); @@ -694,6 +693,9 @@ bool LLAppViewer::init() LLUrlAction::setOpenURLExternalCallback(&LLWeb::loadURLExternal); LLUrlAction::setExecuteSLURLCallback(&LLURLDispatcher::dispatchFromTextEditor); + // Let code in llui access the viewer help floater + LLUI::sHelpImpl = LLViewerHelp::getInstance(); + // Set the link color for any Urls in text fields LLTextBase::setLinkColor( LLUIColorTable::instance().getColor("HTMLLinkColor") ); diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 14fb93df61..ca43f41d05 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -66,7 +66,6 @@ #include "lllogchat.h" #include "lltexteditor.h" #include "lltextparser.h" -#include "llfloaterhtml.h" #include "llweb.h" #include "llstylemap.h" diff --git a/indra/newview/llfloaterhelpbrowser.cpp b/indra/newview/llfloaterhelpbrowser.cpp new file mode 100644 index 0000000000..d67b26d36c --- /dev/null +++ b/indra/newview/llfloaterhelpbrowser.cpp @@ -0,0 +1,138 @@ +/** + * @file llfloaterhelpbrowser.cpp + * @brief HTML Help floater - uses embedded web browser control + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-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 "llfloaterhelpbrowser.h" + +#include "llfloaterreg.h" +#include "llpluginclassmedia.h" +#include "llmediactrl.h" +#include "llviewerwindow.h" +#include "llviewercontrol.h" +#include "llweb.h" +#include "llui.h" + +#include "llurlhistory.h" +#include "llmediactrl.h" +#include "llviewermedia.h" + + +LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key) + : LLFloater(key) +{ + // really really destroy the help browser when it's closed, it'll be recreated. + // *TODO: when onClose() is resurrected as a virtual, this bind can go away. + mCloseSignal.connect(boost::bind(&LLFloaterHelpBrowser::onClose, this)); +} + +BOOL LLFloaterHelpBrowser::postBuild() +{ + mBrowser = getChild<LLMediaCtrl>("browser"); + mBrowser->addObserver(this); + + childSetAction("open_browser", onClickOpenWebBrowser, this); + + buildURLHistory(); + return TRUE; +} + +void LLFloaterHelpBrowser::buildURLHistory() +{ + // Get all of the entries in the "browser" collection + LLSD browser_history = LLURLHistory::getURLHistory("browser"); + + // initialize URL history in the plugin + mBrowser->getMediaPlugin()->initializeUrlHistory(browser_history); +} + +void LLFloaterHelpBrowser::onClose() +{ + destroy(); // really destroy this dialog on closure, it's relatively heavyweight. +} + +void LLFloaterHelpBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) +{ + if(event == MEDIA_EVENT_LOCATION_CHANGED) + { + setCurrentURL(self->getLocation()); + } + else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) + { + // nothing yet + } +} + +void LLFloaterHelpBrowser::setCurrentURL(const std::string& url) +{ + mCurrentURL = url; + + // redirects will navigate momentarily to about:blank, don't add to history + if (mCurrentURL != "about:blank") + { + // Serialize url history + LLURLHistory::removeURL("browser", mCurrentURL); + LLURLHistory::addURL("browser", mCurrentURL); + } +} + +//static +void LLFloaterHelpBrowser::onClickClose(void* user_data) +{ + LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data; + + self->closeFloater(); +} + +//static +void LLFloaterHelpBrowser::onClickOpenWebBrowser(void* user_data) +{ + LLFloaterHelpBrowser* self = (LLFloaterHelpBrowser*)user_data; + + std::string url = self->mCurrentURL.empty() ? + self->mBrowser->getHomePageUrl() : + self->mCurrentURL; + LLWeb::loadURLExternal(url); +} + +void LLFloaterHelpBrowser::openMedia(const std::string& media_url) +{ + mBrowser->setHomePageUrl(media_url); + //mBrowser->navigateTo("data:text/html;charset=utf-8,I'd really love to be going to:<br><b>" + media_url + "</b>"); // tofu HACK for debugging =:) + mBrowser->navigateTo(media_url); + setCurrentURL(media_url); +} + +void LLFloaterHelpBrowser::navigateToLocalPage( const std::string& subdir, const std::string& filename_in ) +{ + mBrowser->navigateToLocalPage(subdir, filename_in); +} diff --git a/indra/newview/llfloaterhelpbrowser.h b/indra/newview/llfloaterhelpbrowser.h new file mode 100644 index 0000000000..14a276b428 --- /dev/null +++ b/indra/newview/llfloaterhelpbrowser.h @@ -0,0 +1,72 @@ +/** + * @file llfloatermediabrowser.h + * @brief HTML Help floater - uses embedded web browser control + * + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-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_LLFLOATERHELPBROWSER_H +#define LL_LLFLOATERHELPBROWSER_H + +#include "llfloater.h" +#include "llmediactrl.h" + + +class LLMediaCtrl; + +class LLFloaterHelpBrowser : + public LLFloater, + public LLViewerMediaObserver +{ + public: + LLFloaterHelpBrowser(const LLSD& key); + + /*virtual*/ BOOL postBuild(); + void onClose(); + + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + + void openMedia(const std::string& media_url); + + void navigateToLocalPage( const std::string& subdir, const std::string& filename_in ); + + private: + void buildURLHistory(); + void setCurrentURL(const std::string& url); + + static void onClickClose(void* user_data); + static void onClickOpenWebBrowser(void* user_data); + + private: + LLMediaCtrl* mBrowser; + std::string mCurrentURL; +}; + +#endif // LL_LLFLOATERHELPBROWSER_H + diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index c580cdef8a..c7ec4bd585 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -1,6 +1,6 @@ /** - * @file llfloaterhtmlhelp.cpp - * @brief HTML Help floater - uses embedded web browser control + * @file llfloatermediabrowser.cpp + * @brief media browser floater - uses embedded media browser control * * $LicenseInfo:firstyear=2006&license=viewergpl$ * @@ -33,7 +33,6 @@ #include "llviewerprecompiledheaders.h" #include "llfloatermediabrowser.h" -#include "llfloaterhtml.h" #include "llfloaterreg.h" #include "llparcel.h" @@ -330,69 +329,3 @@ void LLFloaterMediaBrowser::openMedia(const std::string& media_url) mBrowser->navigateTo(media_url); setCurrentURL(media_url); } -//////////////////////////////////////////////////////////////////////////////// -// - -LLViewerHtmlHelp gViewerHtmlHelp; - - -//////////////////////////////////////////////////////////////////////////////// -// -LLViewerHtmlHelp::LLViewerHtmlHelp() -{ - - LLUI::setHtmlHelp(this); -} - -LLViewerHtmlHelp::~LLViewerHtmlHelp() -{ - - LLUI::setHtmlHelp(NULL); -} - -void LLViewerHtmlHelp::show() -{ - show(""); -} - -void LLViewerHtmlHelp::show(std::string url) -{ - LLFloaterMediaBrowser* floater_html = dynamic_cast<LLFloaterMediaBrowser*>(LLFloaterReg::getInstance("media_browser")); - floater_html->setVisible(FALSE); - - if (url.empty()) - { - url = floater_html->getSupportURL(); - } - - if (gSavedSettings.getBOOL("UseExternalBrowser")) - { - LLSD notificationData; - notificationData["url"] = url; - - LLNotifications::instance().add("ClickOpenF1Help", notificationData, LLSD(), onClickF1HelpLoadURL); - floater_html->closeFloater(); - } - else - { - // don't wait, just do it - floater_html->setVisible(TRUE); - floater_html->openMedia(url); - } -} - -// static -bool LLViewerHtmlHelp::onClickF1HelpLoadURL(const LLSD& notification, const LLSD& response) -{ - LLFloaterMediaBrowser* floater_html = dynamic_cast<LLFloaterMediaBrowser*>(LLFloaterReg::getInstance("media_browser")); - floater_html->setVisible(FALSE); - std::string url = floater_html->getSupportURL(); - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { - LLWeb::loadURL(url); - } - floater_html->closeFloater(); - return false; -} - diff --git a/indra/newview/llfloatermediabrowser.h b/indra/newview/llfloatermediabrowser.h index 76e8b517a0..c315f9e797 100644 --- a/indra/newview/llfloatermediabrowser.h +++ b/indra/newview/llfloatermediabrowser.h @@ -1,6 +1,6 @@ /** * @file llfloatermediabrowser.h - * @brief HTML Help floater - uses embedded web browser control + * @brief media browser floater - uses embedded media browser control * * $LicenseInfo:firstyear=2006&license=viewergpl$ * @@ -33,23 +33,9 @@ #ifndef LL_LLFLOATERMEDIABROWSER_H #define LL_LLFLOATERMEDIABROWSER_H -#include "llhtmlhelp.h" #include "llfloater.h" #include "llmediactrl.h" -class LLViewerHtmlHelp : public LLHtmlHelp -{ -public: - LLViewerHtmlHelp(); - virtual ~LLViewerHtmlHelp(); - - /*virtual*/ void show(); - /*virtual*/ void show(std::string start_url); - void show(std::string start_url, std::string title); - - static bool onClickF1HelpLoadURL(const LLSD& notification, const LLSD& response); - -}; class LLComboBox; class LLMediaCtrl; @@ -93,7 +79,5 @@ private: std::string mCurrentURL; }; -extern LLViewerHtmlHelp gViewerHtmlHelp; - #endif // LL_LLFLOATERMEDIABROWSER_H diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 4d154c4cd3..3dcdc2f56e 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -1,6 +1,6 @@ /** * @file llfloaterreporter.cpp - * @brief Bug and abuse reports. + * @brief Abuse reports. * * $LicenseInfo:firstyear=2002&license=viewergpl$ * @@ -220,8 +220,7 @@ LLFloaterReporter::~LLFloaterReporter() void LLFloaterReporter::draw() { // this is set by a static callback sometime after the dialog is created. - // Only disable screenshot for abuse reports to estate owners - bug reports always - // allow screenshots to be taken. + // Only disable screenshot for abuse reports to estate owners if ( mEmailToEstateOwner ) { childSetValue("screen_check", FALSE ); @@ -479,15 +478,6 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) if (f) { f->setReportType(report_type); - - if (report_type == BUG_REPORT) - { - LLNotifications::instance().add("HelpReportBug"); - } - else - { - // popup for abuse reports is triggered elsewhere - } } } @@ -528,14 +518,7 @@ bool LLFloaterReporter::validateReport() U8 category = (U8)category_sd.asInteger(); if (category == 0) { - if ( mReportType != BUG_REPORT ) - { - LLNotifications::instance().add("HelpReportAbuseSelectCategory"); - } - else - { - LLNotifications::instance().add("HelpReportBugSelectCategory"); - } + LLNotifications::instance().add("HelpReportAbuseSelectCategory"); return false; } @@ -561,27 +544,13 @@ bool LLFloaterReporter::validateReport() if ( childGetText("summary_edit").empty() ) { - if ( mReportType != BUG_REPORT ) - { - LLNotifications::instance().add("HelpReportAbuseSummaryEmpty"); - } - else - { - LLNotifications::instance().add("HelpReportBugSummaryEmpty"); - } + LLNotifications::instance().add("HelpReportAbuseSummaryEmpty"); return false; }; if ( childGetText("details_edit") == mDefaultSummary ) { - if ( mReportType != BUG_REPORT ) - { - LLNotifications::instance().add("HelpReportAbuseDetailsEmpty"); - } - else - { - LLNotifications::instance().add("HelpReportBugDetailsEmpty"); - } + LLNotifications::instance().add("HelpReportAbuseDetailsEmpty"); return false; }; return true; diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index f363b9531e..7e8f05e3fc 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -1,7 +1,7 @@ /** * @file llfloaterreporter.h * @author Andrew Meadows - * @brief Bug and abuse reports. + * @brief Abuse reports. * * $LicenseInfo:firstyear=2006&license=viewergpl$ * @@ -48,7 +48,7 @@ class LLMeanCollisionData; struct LLResourceData; // these flags are used to label info requests to the server -const U32 BUG_REPORT_REQUEST = 0x01 << 0; +//const U32 BUG_REPORT_REQUEST = 0x01 << 0; // DEPRECATED const U32 COMPLAINT_REPORT_REQUEST = 0x01 << 1; const U32 OBJECT_PAY_REQUEST = 0x01 << 2; @@ -73,7 +73,7 @@ enum EReportType { NULL_REPORT = 0, // don't use this value anywhere UNKNOWN_REPORT = 1, - BUG_REPORT = 2, + //BUG_REPORT = 2, // DEPRECATED COMPLAINT_REPORT = 3, CS_REQUEST_REPORT = 4 }; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 09a7edaa43..6ec098b92b 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -36,7 +36,6 @@ #include "llmediactrl.h" // viewer includes -#include "llfloaterhtml.h" #include "llfloaterworldmap.h" #include "lluictrlfactory.h" #include "llurldispatcher.h" @@ -898,15 +897,7 @@ void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self ) if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 || LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 ) { - // If we spawn a new LLFloaterHTML, assume we want it to - // follow this LLMediaCtrl's trust for whether or - // not to open secondlife:///app/ links. JC. -// const bool open_links_externally = false; -// LLFloaterHtml::getInstance()->show( -// event_in.mStringPayload, -// "Second Life Browser", -// open_links_externally, -// mTrusted); + llwarns << "Dead, unimplemented path that we used to send to the built-in browser long ago." << llendl; } } } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 809e1852f4..daf0fbd5e0 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -57,6 +57,7 @@ #include "lluiconstants.h" #include "llurlsimstring.h" #include "llviewerbuild.h" +#include "llviewerhelp.h" #include "llviewertexturelist.h" #include "llviewermenu.h" // for handle_preferences() #include "llviewernetwork.h" @@ -69,7 +70,6 @@ #include "llmediactrl.h" #include "llrootview.h" -#include "llfloatermediabrowser.h" #include "llfloatertos.h" #include "lltrans.h" #include "llglheaders.h" @@ -412,8 +412,8 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) if ( KEY_F1 == key ) { - llinfos << "Spawning HTML help window" << llendl; - gViewerHtmlHelp.show(); + LLViewerHelp* vhelp = LLViewerHelp::getInstance(); + vhelp->showTopic(vhelp->getTopicFromFocus()); return TRUE; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0ecdec65d6..19bb60b237 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -44,6 +44,7 @@ #include "llinventorymodel.h" #include "llkeyboard.h" #include "lllineeditor.h" +#include "llhelp.h" #include "llresmgr.h" #include "llscrollbar.h" @@ -103,7 +104,7 @@ const std::string HELLO_LSL = " llSay(0, \"Touched.\");\n" " }\n" "}\n"; -const std::string HELP_LSL_URL = "http://wiki.secondlife.com/wiki/LSL_Portal"; +const std::string HELP_LSL_PORTAL_TOPIC = "LSL_Portal"; const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate? const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? @@ -264,7 +265,6 @@ struct LLSECKeywordCompare LLScriptEdCore::LLScriptEdCore( const std::string& sample, - const std::string& help_url, const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void*), void (*save_callback)(void*, BOOL), @@ -274,7 +274,6 @@ LLScriptEdCore::LLScriptEdCore( : LLPanel(), mSampleText(sample), - mHelpURL(help_url), mEditor( NULL ), mLoadCallback( load_callback ), mSaveCallback( save_callback ), @@ -436,7 +435,7 @@ void LLScriptEdCore::initMenu() menuItem = getChild<LLMenuItemCallGL>("Help..."); menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnHelp, this)); - menuItem = getChild<LLMenuItemCallGL>("LSL Wiki Help..."); + menuItem = getChild<LLMenuItemCallGL>("Keyword Help..."); menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnDynamicHelp, this)); } @@ -539,9 +538,12 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) mLiveHelpTimer.stop(); } } - else if (immediate) + else { - setHelpPage(LLStringUtil::null); + if (immediate) + { + setHelpPage(LLStringUtil::null); + } } } @@ -557,6 +559,7 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) if (!history_combo) return; LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); + url_string.setArg("[LSL_STRING]", help_string); addHelpItemToHistory(help_string); @@ -647,69 +650,52 @@ bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLS return false; } -// static -bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - switch(option) - { - case 0: - LLWeb::loadURL(notification["payload"]["help_url"]); - break; - default: - break; - } - return false; -} - void LLScriptEdCore::onBtnHelp() { - LLSD payload; - payload["help_url"] = mHelpURL; - LLNotifications::instance().add("WebLaunchLSLGuide", LLSD(), payload, onHelpWebDialog); + LLUI::sHelpImpl->showTopic(HELP_LSL_PORTAL_TOPIC); } void LLScriptEdCore::onBtnDynamicHelp() { LLFloater* live_help_floater = mLiveHelpHandle.get(); - if (live_help_floater) - { - live_help_floater->setFocus(TRUE); - updateDynamicHelp(TRUE); + if (!live_help_floater) + { + live_help_floater = new LLFloater(LLSD()); + LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml", NULL); + LLFloater* parent = dynamic_cast<LLFloater*>(getParent()); + parent->addDependentFloater(live_help_floater, TRUE); + live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); + live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); + live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this); + live_help_floater->childSetAction("back_btn", onClickBack, this); + live_help_floater->childSetAction("fwd_btn", onClickForward, this); + + LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html"); + browser->setAlwaysRefresh(TRUE); + + LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); + LLKeywordToken *token; + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); + token_it != mEditor->keywordsEnd(); + ++token_it) + { + token = token_it->second; + help_combo->add(wstring_to_utf8str(token->getToken())); + } + help_combo->sortByName(); - return; + // re-initialize help variables + mLastHelpToken = NULL; + mLiveHelpHandle = live_help_floater->getHandle(); + mLiveHelpHistorySize = 0; } - live_help_floater = new LLFloater(LLSD()); - LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml", NULL); - LLFloater* parent = dynamic_cast<LLFloater*>(getParent()); - parent->addDependentFloater(live_help_floater, TRUE); - live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); - live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); - live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this); - live_help_floater->childSetAction("back_btn", onClickBack, this); - live_help_floater->childSetAction("fwd_btn", onClickForward, this); - - LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html"); - browser->setAlwaysRefresh(TRUE); - - LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); - LLKeywordToken *token; - LLKeywords::keyword_iterator_t token_it; - for (token_it = mEditor->keywordsBegin(); - token_it != mEditor->keywordsEnd(); - ++token_it) - { - token = token_it->second; - help_combo->add(wstring_to_utf8str(token->getToken())); - } - help_combo->sortByName(); + BOOL visible = TRUE; + BOOL take_focus = TRUE; + live_help_floater->setVisible(visible); + live_help_floater->setFrontmost(take_focus); - // re-initialize help variables - mLastHelpToken = NULL; - mLiveHelpHandle = live_help_floater->getHandle(); - mLiveHelpHistorySize = 0; updateDynamicHelp(TRUE); } @@ -945,7 +931,6 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) self->mScriptEd = new LLScriptEdCore( HELLO_LSL, - HELP_LSL_URL, self->getHandle(), LLPreviewLSL::onLoad, LLPreviewLSL::onSave, @@ -1411,7 +1396,6 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) self->mScriptEd = new LLScriptEdCore( HELLO_LSL, - HELP_LSL_URL, self->getHandle(), &LLLiveLSLEditor::onLoad, &LLLiveLSLEditor::onSave, diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 623886101a..a00f580e32 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -64,7 +64,6 @@ class LLScriptEdCore : public LLPanel public: LLScriptEdCore( const std::string& sample, - const std::string& help_url, const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void* userdata), void (*save_callback)(void* userdata, BOOL close_after_save), @@ -86,7 +85,6 @@ public: bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); - static bool onHelpWebDialog(const LLSD& notification, const LLSD& response); static void onCheckLock(LLUICtrl*, void*); static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata); static void onClickBack(void* userdata); @@ -116,7 +114,6 @@ protected: private: std::string mSampleText; - std::string mHelpURL; LLTextEditor* mEditor; void (*mLoadCallback)(void* userdata); void (*mSaveCallback)(void* userdata, BOOL close_after_save); @@ -124,7 +121,6 @@ private: void* mUserdata; LLComboBox *mFunctions; BOOL mForceClose; - //LLPanel* mGuiPanel; LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; LLDynamicArray<LLEntryAndEdCore*> mBridges; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6a55b571ae..053b863b6d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1429,6 +1429,17 @@ bool idle_startup() LLStartUp::deletePasswordFromDisk(); } + // this is the base used to construct help URLs + text = LLUserAuth::getInstance()->getResponse("help_url_format"); + if (!text.empty()) + { + // replace the default help URL format + gSavedSettings.setString("HelpURLFormat",text); + + // don't fall back to Nebraska's pre-connection static help + gSavedSettings.setBOOL("HelpUseLocal", false); + } + // this is their actual ability to access content text = LLUserAuth::getInstance()->getResponse("agent_access_max"); if (!text.empty()) diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 901d0594f1..e7a8ad6605 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -37,7 +37,7 @@ #include "llagent.h" // teleportViaLocation() #include "llcommandhandler.h" #include "llfloaterdirectory.h" -#include "llfloatermediabrowser.h" +#include "llfloaterhelpbrowser.h" #include "llfloaterreg.h" #include "llfloaterurldisplay.h" #include "llfloaterworldmap.h" @@ -105,7 +105,7 @@ bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool trusted_browser) { if (url.empty()) return false; - if (dispatchHelp(url, right_mouse)) return true; + //if (dispatchHelp(url, right_mouse)) return true; if (dispatchApp(url, right_mouse, web, trusted_browser)) return true; if (dispatchRegion(url, right_mouse)) return true; @@ -140,19 +140,6 @@ bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url) } // static -bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, bool right_mouse) -{ -#if LL_LIBXUL_ENABLED - if (LLSLURL::isURLHelp(url)) - { - gViewerHtmlHelp.show(); - return true; - } -#endif - return false; -} - -// static bool LLURLDispatcherImpl::dispatchApp(const std::string& url, bool right_mouse, LLMediaCtrl* web, diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 51d699c0f7..725ed57d20 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -65,7 +65,7 @@ #include "llfloatergodtools.h" #include "llfloatergroups.h" #include "llfloaterhardwaresettings.h" -#include "llfloaterhtmlcurrency.h" +#include "llfloaterhelpbrowser.h" #include "llfloatermediabrowser.h" #include "llfloaterhud.h" #include "llfloaterimagepreview.h" @@ -164,8 +164,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGodTools>); LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupPicker>); + LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHelpBrowser>); LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>); - LLFloaterReg::add("html_simple", "floater_html_simple.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHtmlSimple>); LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloater>); LLFloaterReg::add("inventory", "floater_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventory>); @@ -244,11 +244,6 @@ void LLViewerFloaterReg::registerFloaters() // debug use only LLFloaterReg::add("media_remote_ctrl", "floater_media_remote.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaRemoteCtrl>); - - // Untested / dangerous - not for release -#if !LL_RELEASE_FOR_DOWNLOAD - LLFloaterReg::add("buy_currency_html", "floater_html_simple.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHtmlCurrency>); -#endif LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving } diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp new file mode 100644 index 0000000000..0e0727e382 --- /dev/null +++ b/indra/newview/llviewerhelp.cpp @@ -0,0 +1,125 @@ +/** + * @file llviewerhelp.cpp + * @brief Utility functions for the Help system + * @author Tofu Linden + * + * $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 "llfloaterhelpbrowser.h" +#include "llfloaterreg.h" +#include "llfocusmgr.h" +#include "llviewercontrol.h" +#include "llversionviewer.h" +#include "llappviewer.h" + +#include "llviewerhelputil.h" +#include "llviewerhelp.h" + + +////////////////////////////// +// implement LLHelp interface + +void LLViewerHelp::showTopic(const std::string &topic) +{ + showHelp(); + + if( gSavedSettings.getBOOL("HelpUseLocal") ) + { + LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser")); + helpbrowser->navigateToLocalPage( "help-offline" , "index.html" ); + } + else + { + const LLOSInfo& osinfo = LLAppViewer::instance()->getOSInfo(); + std::string helpURL = LLViewerHelpUtil::buildHelpURL( topic, gSavedSettings, osinfo ); + setRawURL( helpURL ); + } +} + +std::string LLViewerHelp::defaultTopic() +{ + // *hack: to be done properly + return "this_is_fallbacktopic"; +} + +////////////////////////////// +// our own interfaces + +std::string LLViewerHelp::getTopicFromFocus() +{ + // use UI element with viewer's keyboard focus as basis for searching + LLUICtrl* focused = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus()); + + if (focused) + { + std::string topic; + if (focused->findHelpTopic(topic)) + { + return topic; + } + } + + // didn't find a help topic in the UI hierarchy for focused + // element, return the fallback topic name instead. + return defaultTopic(); +} + +// static +void LLViewerHelp::showHelp() +{ + LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser")); + if (helpbrowser) + { + BOOL visible = TRUE; + BOOL take_focus = TRUE; + helpbrowser->setVisible(visible); + helpbrowser->setFrontmost(take_focus); + } + else + { + llwarns << "Eep, help_browser floater not found" << llendl; + } +} + +// static +void LLViewerHelp::setRawURL(std::string url) +{ + LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser")); + if (helpbrowser) + { + helpbrowser->openMedia(url); + } + else + { + llwarns << "Eep, help_browser floater not found" << llendl; + } +} + diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h new file mode 100644 index 0000000000..17aab6f239 --- /dev/null +++ b/indra/newview/llviewerhelp.h @@ -0,0 +1,65 @@ +/** + * @file llviewerhelp.h + * @brief Utility functions for the Help system + * @author Tofu Linden + * + * $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_LLVIEWERHELP_H +#define LL_LLVIEWERHELP_H + +// The Help UI lives in llfloaterhelpbrowser, llviewerhelp provides a +// layer of abstraction that protects help-system-using code from the details of +// the Help UI floater and how help topics are converted into URLs. + +#include "llhelp.h" // our abstract base +#include "llsingleton.h" + +class LLUICtrl; + +class LLViewerHelp : public LLHelp, public LLSingleton<LLViewerHelp> +{ + friend class LLSingleton<LLViewerHelp>; + + public: + /// display the specified help topic in the help viewer + /*virtual*/ void showTopic(const std::string &topic); + + /// return default (fallback) topic name suitable for showTopic() + /*virtual*/ std::string defaultTopic(); + + // return topic derived from viewer UI focus, else default topic + std::string getTopicFromFocus(); + + private: + static void showHelp(); // make sure help UI is visible & raised + static void setRawURL(std::string url); // send URL to help UI +}; + +#endif // header guard diff --git a/indra/newview/llviewerhelputil.cpp b/indra/newview/llviewerhelputil.cpp new file mode 100644 index 0000000000..c1555eacdc --- /dev/null +++ b/indra/newview/llviewerhelputil.cpp @@ -0,0 +1,114 @@ +/** + * @file llviewerhelp.cpp + * @brief Utility functions for the Help system + * @author Soft Linden + * + * $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 "llversionviewer.h" + +//#include "llfloaterhelpbrowser.h" +//#include "llfloaterreg.h" +//#include "llfocusmgr.h" +//#include "llviewercontrol.h" +//#include "llappviewer.h" + +#include "llstring.h" +#include "lluri.h" +#include "llsys.h" + +#include "llcontrol.h" + +#include "llviewerhelputil.h" + + +////////////////////////////////////////////// +// Build a help URL from a topic and formatter + +//static +std::string LLViewerHelpUtil::helpURLEncode( const std::string &component ) +{ + // Every character rfc3986 allows as unreserved in 2.3, minus the tilde + // which we may grant special meaning. Yay. + const char* allowed = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "-._"; + std::string escaped = LLURI::escape(component, allowed); + + return escaped; +} + +static std::string buildHelpVersion( const U32 ver_int ) +{ + std::ostringstream ver_str; + ver_str << ver_int; + return ver_str.str(); // not encoded - numbers are rfc3986-safe +} + +//static +std::string LLViewerHelpUtil::buildHelpURL( const std::string &topic, + LLControlGroup &savedSettings, + const LLOSInfo &osinfo ) +{ + std::string helpURL = savedSettings.getString("HelpURLFormat"); + LLSD substitution; + substitution["TOPIC"] = helpURLEncode(topic); + + substitution["CHANNEL"] = helpURLEncode(savedSettings.getString("VersionChannelName")); + + // *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; + substitution["VERSION"] = helpURLEncode(version.str()); + substitution["VERSION_MAJOR"] = buildHelpVersion(LL_VERSION_MAJOR); + substitution["VERSION_MINOR"] = buildHelpVersion(LL_VERSION_MINOR); + substitution["VERSION_PATCH"] = buildHelpVersion(LL_VERSION_PATCH); + substitution["VERSION_BUILD"] = buildHelpVersion(LL_VERSION_BUILD); + + substitution["OS"] = helpURLEncode(osinfo.getOSStringSimple()); + + std::string language = savedSettings.getString("Language"); + if( language.empty() || language == "default" ) + { + language = savedSettings.getString("SystemLanguage"); + } + substitution["LANGUAGE"] = helpURLEncode(language); + + LLStringUtil::format(helpURL, substitution); + + return helpURL; +} diff --git a/indra/newview/llviewerhelputil.h b/indra/newview/llviewerhelputil.h new file mode 100644 index 0000000000..8ee0d96023 --- /dev/null +++ b/indra/newview/llviewerhelputil.h @@ -0,0 +1,49 @@ +/** + * @file llviewerhelputil.h + * @brief Utility functions for the Help system + * @author Soft Linden + * + * $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_LLVIEWERHELPUTIL_H +#define LL_LLVIEWERHELPUTIL_H + +class LLControlGroup; +class LLOSInfo; + +class LLViewerHelpUtil +{ + public: + static std::string helpURLEncode( const std::string &component ); + static std::string buildHelpURL( const std::string &topic, + LLControlGroup &savedSettings, + const LLOSInfo &osinfo); +}; + +#endif // header guard diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a0bd5f301b..671a62962b 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -103,9 +103,6 @@ #include "llfloatergodtools.h" #include "llfloatergroupinvite.h" #include "llfloatergroups.h" -#include "llfloaterhtmlcurrency.h" -#include "llfloatermediabrowser.h" // gViewerHtmlHelp -#include "llfloaterhtmlsimple.h" #include "llfloaterhud.h" #include "llfloaterinspect.h" #include "llfloaterlagmeter.h" @@ -182,6 +179,7 @@ #include "lluuid.h" #include "llviewercamera.h" #include "llviewergenericmessage.h" +#include "llviewerhelp.h" #include "llviewertexturelist.h" // gTextureList #include "llviewerinventory.h" #include "llviewermenufile.h" // init_menu_file() @@ -375,7 +373,6 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt void dump_select_mgr(void*); void dump_inventory(void*); -void edit_ui(void*); void toggle_visibility(void*); BOOL get_visibility(void*); @@ -1247,21 +1244,6 @@ class LLAdvancedBuyCurrencyTest : public view_listener_t }; -//////////////////////// -// TOGGLE EDITABLE UI // -//////////////////////// - - -class LLAdvancedToggleEditableUI : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - edit_ui(NULL); - return true; - } -}; - - ///////////////////// // DUMP SELECT MGR // ///////////////////// @@ -5587,11 +5569,6 @@ class LLObjectEnableSitOrStand : public view_listener_t } }; -void edit_ui(void*) -{ - LLFloater::setEditModeEnabled(!LLFloater::getEditModeEnabled()); -} - void dump_select_mgr(void*) { LLSelectMgr::getInstance()->dump(); @@ -5649,8 +5626,8 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "help f1") { - llinfos << "Spawning HTML help window" << llendl; - gViewerHtmlHelp.show(); + LLViewerHelp* vhelp = LLViewerHelp::getInstance(); + vhelp->showTopic(vhelp->getTopicFromFocus()); } else if (floater_name == "complaint reporter") { @@ -7886,7 +7863,6 @@ void initialize_menus() // Advanced > UI view_listener_t::addMenu(new LLAdvancedWebBrowserTest(), "Advanced.WebBrowserTest"); view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest"); - view_listener_t::addMenu(new LLAdvancedToggleEditableUI(), "Advanced.ToggleEditableUI"); view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr"); view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory"); view_listener_t::addMenu(new LLAdvancedDumpFocusHolder(), "Advanced.DumpFocusHolder"); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index c5b09403cb..7ca11d8364 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -50,7 +50,6 @@ #include "llfirstuse.h" #include "llfloaterbuyland.h" #include "llfloatergroups.h" -//#include "llfloaterhtml.h" #include "llfloatersellland.h" #include "llfloatertools.h" #include "llnotify.h" diff --git a/indra/newview/skins/default/html/en-us/help-offline/index.html b/indra/newview/skins/default/html/en-us/help-offline/index.html new file mode 100644 index 0000000000..bf3677603e --- /dev/null +++ b/indra/newview/skins/default/html/en-us/help-offline/index.html @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Offline Help</title> +<style> +body {background-color:#000000;font-family:verdana,helvetica,sans-serif;font-size:62.5%;color:#e9f1f8;width:100%;padding:0px;margin:0px;} +a {color:#93a9d5;} +a:active {color:#50607C;text-decoration:underline;} +a:hover {color:#ff7900;text-decoration:underline;} +#infobox{position:absolute;top:40%;left:50%;z-index:1;padding:0;width:592px;margin-left:-296px;margin-top:-150px;text-align:center;font-size:1.2em; color:#ccc;} +#infobox #submitbtn {padding:15px 3px 5px 15px;height:28px;width:127px;margin-left:244px;} +#infobox #submitbtn input {text-transform:capitalize;color:#fff;font-size:1.0em;height:28px;width:127px;border:none;font-weight:normal;background:url(../../btn_purplepill_bg.png) bottom left no-repeat;vertical-align:text-bottom;font-weight:bold;} +#infobox #submitbtn input:hover.input_over, #login_box #submitbtn input:hover.input_off {color:#fff;border:none;background:url(../../btn_purplepill_bg.png) bottom right no-repeat;} +#infobox #submitbtn input:active.input_over {color:#fff;border:none;background:url(../../btn_purplepill_bg.png) top left no-repeat;} +#infobox #submitbtn input.pressed {color:#888;border:none;background:url(../../btn_purplepill_bg.png) top right no-repeat;} +</style> +</head> +<body> +<div id="infobox"> + <p> + Second Life Offline Help. + </p> + <p> + You are not online and are configured not to fetch help remotely. This is all the help that is available + until more stuff is done. Yeah. + </p> + </div> +</div> +</body> diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 46c294768d..66ea444c15 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -110,12 +110,10 @@ <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false" /> <texture name="Home_Press" file_name="navbar/Home_Press.png" preload="false" /> - <texture name="Icon_Close_Background" file_name="windows/Icon_Close_Background.png" preload="true" /> <texture name="Icon_Close_Foreground" file_name="windows/Icon_Close_Foreground.png" preload="true" /> <texture name="Icon_Close_Press" file_name="windows/Icon_Close_Press.png" preload="true" /> <texture name="Icon_Close_Toast" file_name="windows/Icon_Close_Toast.png" preload="true" /> - <texture name="Icon_Dock_Background" file_name="windows/Icon_Dock_Background.png" preload="true" /> <texture name="Icon_Dock_Foreground" file_name="windows/Icon_Dock_Foreground.png" preload="true" /> <texture name="Icon_Dock_Press" file_name="windows/Icon_Dock_Press.png" preload="true" /> @@ -125,16 +123,16 @@ <texture name="Icon_Gear_Foreground" file_name="windows/Icon_Gear_Foreground.png" preload="false" /> <texture name="Icon_Gear_Press" file_name="windows/Icon_Gear_Press.png" preload="false" /> - <texture name="Icon_Help_Background" file_name="windows/Icon_Help_Background.png" preload="false" /> <texture name="Icon_Help_Foreground" file_name="windows/Icon_Help_Foreground.png" preload="false" /> <texture name="Icon_Help_Press" file_name="windows/Icon_Help_Press.png" preload="false" /> <texture name="Icon_Info" file_name="windows/Icon_Info.png" preload="false" /> - <texture name="Icon_Minimize_Background" file_name="windows/Icon_Minimize_Background.png" preload="true" /> <texture name="Icon_Minimize_Foreground" file_name="windows/Icon_Minimize_Foreground.png" preload="true" /> <texture name="Icon_Minimize_Press" file_name="windows/Icon_Minimize_Press.png" preload="true" /> - <texture name="Icon_Undock_Background" file_name="windows/Icon_Undock_Background.png" preload="false" /> + <texture name="Icon_Restore_Foreground" file_name="windows/Icon_Restore_Foreground.png" preload="false" /> + <texture name="Icon_Restore_Press" file_name="windows/Icon_Restore_Press.png" preload="false" /> + <texture name="Icon_Undock_Foreground" file_name="windows/Icon_Undock_Foreground.png" preload="false" /> <texture name="Icon_Undock_Press" file_name="windows/Icon_Undock_Press.png" preload="false" /> @@ -442,8 +440,6 @@ <texture name="cam_zoom_plus_in.tga" preload="false" /> <texture name="cam_zoom_minus_in.tga" preload="false" /> - <texture name="close_inactive_blue.tga" /> - <texture name="closebox.tga" /> <texture name="icn_clear_lineeditor.tga" /> <texture name="icn_chatbar.tga" /> @@ -493,10 +489,6 @@ <texture name="up_arrow.tga" file_name="up_arrow.png" /> <texture name="down_arrow.tga" file_name="down_arrow.png" /> - <texture name="restore_inactive.tga" /> - <texture name="restore.tga" /> - <texture name="restore_pressed.tga" /> - <texture name="tearoffbox.tga" /> <texture name="tearoff_pressed.tga" /> diff --git a/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png Binary files differnew file mode 100644 index 0000000000..1e753aaf1d --- /dev/null +++ b/indra/newview/skins/default/textures/windows/Icon_Restore_Foreground.png diff --git a/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png b/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png Binary files differnew file mode 100644 index 0000000000..be66b05230 --- /dev/null +++ b/indra/newview/skins/default/textures/windows/Icon_Restore_Press.png diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index 97afe6d324..c9e143bf95 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -3,6 +3,7 @@ height="440" layout="topleft" name="floater_about" + help_topic="floater_about" save_rect="true" title="About [APP_NAME]" width="470"> diff --git a/indra/newview/skins/default/xui/en/floater_help_browser.xml b/indra/newview/skins/default/xui/en/floater_help_browser.xml index a1265d49f9..512b4c85a1 100644 --- a/indra/newview/skins/default/xui/en/floater_help_browser.xml +++ b/indra/newview/skins/default/xui/en/floater_help_browser.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater can_resize="true" - height="440" + height="400" layout="topleft" min_height="140" min_width="467" @@ -9,8 +9,8 @@ help_topic="floater_help_browser" save_rect="true" single_instance="true" - title="Holy Bananas, it's the Help Browser" - width="820"> + title="Help Browser" + width="620"> <floater.string name="home_page_url"> http://www.secondlife.com @@ -20,150 +20,13 @@ http://support.secondlife.com </floater.string> <layout_stack - bottom="440" + bottom="400" follows="left|right|top|bottom" layout="topleft" left="10" name="stack1" top="20" - width="800"> - <layout_panel - auto_resize="false" - height="20" - layout="topleft" - left="0" - name="nav_controls" - top="400" - user_resize="false" - width="800"> - <button - follows="left|top" - height="20" - label="Back" - layout="topleft" - left="0" - name="back" - top="0" - width="55" /> - <button - follows="left|top" - height="20" - label="Forward" - layout="topleft" - left_pad="3" - name="forward" - top_delta="0" - width="68" /> - <button - enabled="false" - follows="left|top" - height="20" - label="Reload" - layout="topleft" - left_pad="2" - name="reload" - top_delta="0" - width="70"/> - <combo_box - allow_text_entry="true" - follows="left|top|right" - height="20" - layout="topleft" - left_pad="5" - max_chars="255" - name="address" - top_delta="0" - width="540" /> - <button - enabled="false" - follows="right|top" - height="20" - label="Go" - layout="topleft" - left_pad="5" - name="go" - top_delta="0" - width="55" /> - </layout_panel> - <layout_panel - auto_resize="false" - height="20" - layout="topleft" - left_delta="0" - name="time_controls" - top_delta="0" - user_resize="false" - width="800"> - <button - follows="left|top" - height="20" - label="rewind" - layout="topleft" - left="0" - name="rewind" - top="0" - width="55" /> - <button - follows="left|top" - height="20" - image_selected="button_anim_play_selected.tga" - image_unselected="button_anim_play.tga" - layout="topleft" - left_delta="55" - name="play" - picture_style="true" - top_delta="0" - width="55" /> - <button - follows="left|top" - height="20" - image_selected="button_anim_pause_selected.tga" - image_unselected="button_anim_pause.tga" - layout="topleft" - left_delta="0" - name="pause" - picture_style="true" - top_delta="0" - width="55" /> - <button - follows="left|top" - height="20" - label="stop" - layout="topleft" - left_pad="10" - name="stop" - top_delta="0" - width="55" /> - <button - follows="left|top" - height="20" - label="forward" - layout="topleft" - left_pad="20" - name="seek" - top_delta="0" - width="55" /> - </layout_panel> - <layout_panel - auto_resize="false" - height="20" - layout="topleft" - left_delta="0" - name="parcel_owner_controls" - top_delta="0" - user_resize="false" - width="540"> - <button - enabled="false" - follows="left|top" - height="20" - label="Send Current URL to Parcel" - layout="topleft" - left="0" - name="assign" - top="0" - width="200" /> - </layout_panel> + width="600"> <layout_panel height="20" layout="topleft" @@ -171,7 +34,7 @@ name="external_controls" top_delta="0" user_resize="false" - width="540"> + width="570"> <web_browser bottom="-10" follows="left|right|top|bottom" @@ -179,7 +42,7 @@ left="0" name="browser" top="0" - width="540" /> + width="570" /> <button follows="bottom|left" height="20" @@ -189,25 +52,17 @@ name="open_browser" top_pad="5" width="185" /> - <check_box - control_name="UseExternalBrowser" - follows="bottom|left" - height="20" - label="Always open in my web browser" - layout="topleft" - left_pad="5" - name="open_always" - top_delta="0" - width="200" /> +<!-- <button follows="bottom|right" height="20" label="Close" layout="topleft" - left_pad="80" + left_pad="290" name="close" top_delta="0" width="70" /> +--> </layout_panel> </layout_stack> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 10aa23b715..648c3458e0 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1042,15 +1042,6 @@ <menu_item_separator layout="topleft" /> <menu_item_call - label="Report Bug..." - layout="topleft" - name="ReportBug"> - <menu_item_call.on_click - function="PromptShowURL" - name="ReportBug_url" - parameter="hud,http://help.secondlife.com/en/bugreport/" /> - </menu_item_call> - <menu_item_call label="Report Abuse..." layout="topleft" name="Report Abuse"> @@ -2771,15 +2762,6 @@ function="Advanced.ShowDebugSettings" parameter="skin" /> </menu_item_call> - <menu_item_check - label="Editable UI" - layout="topleft" - name="Editable UI"> - <menu_item_check.on_check - function="Advanced.CheckEditableUI" /> - <menu_item_check.on_click - function="Advanced.ToggleEditableUI" /> - </menu_item_check> <menu_item_call label="Dump SelectMgr" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 044194a4ed..ebe7a0236b 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1691,7 +1691,6 @@ No Group selected. type="alertmodal"> Unable to deed land: Cannot find the region this land is in. -Please use Help > Report Bug to report this. </notification> <notification @@ -1772,8 +1771,6 @@ Parcels you own appear in green. type="alertmodal"> Unable to abandon land: Cannot find the region this land is in. - -Please use Help > Report Bug to report this. </notification> <notification @@ -1846,8 +1843,6 @@ Divide land? type="alertmodal"> Unable to divide land: Cannot find the region this land is in. - -Please use Help > Report Bug to report this. </notification> <notification @@ -1856,8 +1851,6 @@ Please use Help > Report Bug to report this. type="alertmodal"> Unable to join land: Cannot find the region this land is in. - -Please use Help > Report Bug to report this. </notification> <notification @@ -1973,8 +1966,6 @@ Unable to save '[NAME]' to wearable file. You will need to free up so type="alertmodal"> Unable to save [NAME] to central asset store. This is usually a temporary failure. Please customize and save the wearable again in a few minutes. - -If this problem persists, please click on Help > Report Bug and provide details about your network setup. </notification> <notification @@ -2758,18 +2749,6 @@ Go to secondlife.com to manage your account? <notification icon="alertmodal.tga" - name="WebLaunchBugReport101" - type="alertmodal"> -Visit the [SECOND_LIFE] Wiki and learn how to report bugs correctly. - <usetemplate - ignoretext="Launch my browser to learn how to report a Bug" - name="okcancelignore" - notext="Cancel" - yestext="OK"/> - </notification> - - <notification - icon="alertmodal.tga" name="WebLaunchSecurityIssues" type="alertmodal"> Visit the [SECOND_LIFE] Wiki for details of how to report a security issue. @@ -4275,22 +4254,6 @@ The resolution of this report applies only to this Region. Residents' acces <notification icon="alertmodal.tga" - name="HelpReportBug" - type="alertmodal"> -Use this tool to *only* report technical features that do not perform as described or expected, please provide as much detail as possible. -You may reply to the auto-response email to add more details to your report. - -All bug reports are investigated and assessed. No email response will be sent. - -If you are having a technical difficulty, please contact Support at: - -http://secondlife.com/community/support.php - -Note: Incomplete reports will not be investigated - </notification> - - <notification - icon="alertmodal.tga" name="HelpReportAbuseSelectCategory" type="alertmodal"> Please select a category for this abuse report. @@ -4299,14 +4262,6 @@ Selecting a category helps us file and process abuse reports. <notification icon="alertmodal.tga" - name="HelpReportBugSelectCategory" - type="alertmodal"> -Please select a category for this bug. -Selecting a category helps us file and process bug reports. - </notification> - - <notification - icon="alertmodal.tga" name="HelpReportAbuseAbuserNameEmpty" type="alertmodal"> Please enter the name of the abuser. @@ -4331,14 +4286,6 @@ Entering an accurate summary helps us file and process abuse reports. <notification icon="alertmodal.tga" - name="HelpReportBugSummaryEmpty" - type="alertmodal"> -Please enter a summary of the bug. -Entering an accurate summary helps us file and process bug reports. - </notification> - - <notification - icon="alertmodal.tga" name="HelpReportAbuseDetailsEmpty" type="alertmodal"> Please enter a detailed description of the abuse that took place. @@ -4348,15 +4295,6 @@ Entering an accurate description helps us file and process abuse reports. <notification icon="alertmodal.tga" - name="HelpReportBugDetailsEmpty" - type="alertmodal"> -Please enter a detailed description of the bug. -Be as specific as you can, including steps to reproduce the bug if possible. -Entering an accurate description helps us file and process bug reports. - </notification> - - <notification - icon="alertmodal.tga" name="HelpReportAbuseContainsCopyright" type="alertmodal"> Dear Resident, diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 5738879c5a..a3c714ce72 100644 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -184,9 +184,9 @@ layout="topleft" name="Help..." /> <menu_item_call - label="LSL Wiki Help..." + label="Keyword Help..." layout="topleft" - name="LSL Wiki Help..." /> + name="Keyword Help..." /> </menu> </menu_bar> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_side_tray_tab_caption.xml b/indra/newview/skins/default/xui/en/panel_side_tray_tab_caption.xml index f25c4bfbba..aa76a61c15 100644 --- a/indra/newview/skins/default/xui/en/panel_side_tray_tab_caption.xml +++ b/indra/newview/skins/default/xui/en/panel_side_tray_tab_caption.xml @@ -19,4 +19,17 @@ top="4" value="Side Panel" width="255" /> + <button + follows="left|right|top" + font="SansSerif" + height="23" + label="?" + layout="topleft" + name="show_help" + top="5" + right="-8" + width="28"> + <button.commit_callback + function="Button.ShowHelp" /> + </button> </panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 13a53a4ce3..0f7afcba6e 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -93,7 +93,6 @@ <string name="BUTTON_RESTORE">Restore</string> <string name="BUTTON_MINIMIZE">Minimize</string> <string name="BUTTON_TEAR_OFF">Tear Off</string> - <string name="BUTTON_EDIT">Edit</string> <string name="BUTTON_DOCK">Dock</string> <string name="BUTTON_UNDOCK">Undock</string> <string name="BUTTON_HELP">Show Help</string> diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp new file mode 100644 index 0000000000..40f7d532bc --- /dev/null +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -0,0 +1,127 @@ +/** + * @file llviewerhelputil_test.cpp + * @brief LLViewerHelpUtil tests + * @author Tofu Linden + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-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 "../test/lltut.h" + +#include "../llviewerhelputil.h" +#include "llcontrol.h" +#include "llsys.h" + +#include <iostream> + +//---------------------------------------------------------------------------- +// Implementation of enough of LLControlGroup to support the tests: + +static std::map<std::string,std::string> test_stringvec; + +LLControlGroup::LLControlGroup(const std::string& name) + : LLInstanceTracker<LLControlGroup, std::string>(name) +{ +} + +LLControlGroup::~LLControlGroup() +{ +} + +// Implementation of just the LLControlGroup methods we requre +BOOL LLControlGroup::declareString(const std::string& name, + const std::string& initial_val, + const std::string& comment, + BOOL persist) +{ + test_stringvec[name] = initial_val; + return true; +} + +void LLControlGroup::setString(const std::string& name, const std::string& val) +{ + test_stringvec[name] = val; +} + +std::string LLControlGroup::getString(const std::string& name) +{ + return test_stringvec[name]; +} + +//---------------------------------------------------------------------------- + +namespace tut +{ + struct viewerhelputil + { + }; + + typedef test_group<viewerhelputil> viewerhelputil_t; + typedef viewerhelputil_t::object viewerhelputil_object_t; + tut::viewerhelputil_t tut_viewerhelputil("viewerhelputil"); + + template<> template<> + void viewerhelputil_object_t::test<1>() + { + LLOSInfo osinfo; + LLControlGroup cgr("test"); + cgr.declareString("HelpURLFormat", "fooformat", "declared_for_test", FALSE); + cgr.declareString("VersionChannelName", "foochannelname", "declared_for_test", FALSE); + cgr.declareString("Language", "foolanguage", "declared_for_test", FALSE); + std::string topic("test_topic"); + + std::string subresult; + + cgr.setString("HelpURLFormat", "fooformat"); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("no substitution tags", subresult, "fooformat"); + + cgr.setString("HelpURLFormat", ""); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("blank substitution format", subresult, ""); + + cgr.setString("HelpURLFormat", "[LANGUAGE]"); + cgr.setString("Language", ""); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("simple substitution with blank", subresult, ""); + + cgr.setString("HelpURLFormat", "[LANGUAGE]"); + cgr.setString("Language", "Esperanto"); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("simple substitution", subresult, "Esperanto"); + + cgr.setString("HelpURLFormat", "[XXX]"); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("unknown substitution", subresult, "[XXX]"); + + cgr.setString("HelpURLFormat", "[LANGUAGE]/[LANGUAGE]"); + cgr.setString("Language", "Esperanto"); + subresult = LLViewerHelpUtil::buildHelpURL(topic, cgr, osinfo); + ensure_equals("multiple substitution", subresult, "Esperanto/Esperanto"); + } + +} |