diff options
author | Josh Bell <josh@lindenlab.com> | 2007-12-21 06:44:41 +0000 |
---|---|---|
committer | Josh Bell <josh@lindenlab.com> | 2007-12-21 06:44:41 +0000 |
commit | df4d167cd13fd89a85e4d30dca94e40c934707d7 (patch) | |
tree | cde9373bce657013bf04c83ab60b4a4aa826fc76 /indra/newview/llpanellogin.cpp | |
parent | 8fde5f0d3241205067e5d7bf5380757e764eff31 (diff) |
svn merge -r74200:76302 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-18-6-Viewer --> release
Wheee, this was fun. Um, let's back-port fixes a little more rapidly next time. Reviewed by CG until alexandria died, did the rest by my lonesome.
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rw-r--r-- | indra/newview/llpanellogin.cpp | 127 |
1 files changed, 97 insertions, 30 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 74936dce0c..7e97622c8b 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -147,9 +147,46 @@ void LLLoginHandler::parse(const LLSD& queryMap) { gGridChoice = GRID_INFO_UMA; } + else if (queryMap["grid"].asString() == "mohini") + { + gGridChoice = GRID_INFO_MOHINI; + } + else if (queryMap["grid"].asString() == "yami") + { + gGridChoice = GRID_INFO_YAMI; + } + else if (queryMap["grid"].asString() == "nandi") + { + gGridChoice = GRID_INFO_NANDI; + } + else if (queryMap["grid"].asString() == "mitra") + { + gGridChoice = GRID_INFO_MITRA; + } + else if (queryMap["grid"].asString() == "radha") + { + gGridChoice = GRID_INFO_RADHA; + } + else if (queryMap["grid"].asString() == "ravi") + { + gGridChoice = GRID_INFO_RAVI; + } + else if (queryMap["grid"].asString() == "aruna") + { + gGridChoice = GRID_INFO_ARUNA; + } +#if !LL_RELEASE_FOR_DOWNLOAD + if (gGridChoice > GRID_INFO_NONE && gGridChoice < GRID_INFO_LOCAL) + { + gSavedSettings.setS32("ServerChoice", gGridChoice); + } +#endif - snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); /* Flawfinder: ignore */ - LLAppViewer::instance()->resetURIs(); + if (LLAppViewer::instance()->getLoginURIs().size() == 0) + { + snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); /* Flawfinder: ignore */ + LLAppViewer::instance()->resetURIs(); + } LLString startLocation = queryMap["location"].asString(); @@ -303,18 +340,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html"); if ( web_browser ) { + // observe browser events + web_browser->addObserver( this ); + // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); - - // painfully build the path to the loading screen - std::string loading_path( gDirUtilp->getExpandedFilename( LL_PATH_SKINS, "" ) ); - loading_path.append( gDirUtilp->getDirDelimiter() ); - loading_path.append( "html" ); - loading_path.append( gDirUtilp->getDirDelimiter() ); - loading_path.append( "loading" ); - loading_path.append( gDirUtilp->getDirDelimiter() ); - loading_path.append( "loading.html" ); - web_browser->navigateTo( loading_path.c_str() ); + web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); @@ -328,7 +359,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); - LLHTTPClient::get( childGetValue( "real_url" ).asString(), gResponsePtr ); + std::string login_page = LLAppViewer::instance()->getLoginPage(); + if (login_page.empty()) + { + login_page = childGetValue( "real_url" ).asString(); + } + LLHTTPClient::head( login_page, gResponsePtr ); }; #else mHtmlAvailable = FALSE; @@ -350,20 +386,19 @@ void LLPanelLogin::setSiteIsAlive( bool alive ) // mark as available mHtmlAvailable = TRUE; - }; + } } else // the site is not available (missing page, server down, other badness) { if ( web_browser ) - { - // hide browser control (revealing default one) - web_browser->setVisible( FALSE ); + { + web_browser->navigateToLocalPage( "loading-error" , "index.html" ); - // mark as unavailable - mHtmlAvailable = FALSE; - }; - }; + // mark as available + mHtmlAvailable = TRUE; + } + } #else mHtmlAvailable = FALSE; #endif @@ -387,13 +422,6 @@ void LLPanelLogin::draw() { if (!getVisible()) return; - BOOL target_fullscreen; - S32 target_width; - S32 target_height; - gViewerWindow->getTargetWindow(target_fullscreen, target_width, target_height); - - childSetVisible("full_screen_text", target_fullscreen); - glPushMatrix(); { F32 image_aspect = 1.333333f; @@ -604,17 +632,36 @@ void LLPanelLogin::loadLoginPage() char* curl_channel = curl_escape(gChannelName.c_str(), 0); char* curl_version = curl_escape(version.c_str(), 0); + std::string login_page = LLAppViewer::instance()->getLoginPage(); + if (login_page.empty()) + { + login_page = sInstance->childGetValue( "real_url" ).asString(); + } - oStr << sInstance->childGetValue( "real_url" ).asString() << "&firstname=" << firstname << + // Use the right delimeter depending on how LLURI parses the URL + LLURI login_page_uri = LLURI(login_page); + std::string first_query_delimiter = "&"; + if (login_page_uri.queryMap().size() == 0) + { + first_query_delimiter = "?"; + } + oStr << login_page << first_query_delimiter << "firstname=" << firstname << "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region << "&grid=" << gGridInfo[gGridChoice].mLabel << "&channel=" << curl_channel << "&version=" << curl_version; - curl_free(curl_region); curl_free(curl_channel); curl_free(curl_version); + LLString language(gSavedSettings.getString("Language")); + if(language == "default") + { + language = gSavedSettings.getString("SystemLanguage"); + } + + oStr << "&lang=" << language; + if (!gCmdLinePassword.empty()) { oStr << "&password=" << gCmdLinePassword; @@ -637,12 +684,32 @@ void LLPanelLogin::loadLoginPage() } #ifndef LL_RELEASE_FOR_DOWNLOAD oStr << "&show_grid=TRUE"; +#else + if (gSavedSettings.getBOOL("ForceShowGrid")) + oStr << "&show_grid=TRUE"; #endif // navigate to the "real" page web_browser->navigateTo( oStr.str() ); } +#if LL_LIBXUL_ENABLED +void LLPanelLogin::onNavigateComplete( const EventType& eventIn ) +{ + LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); + if (web_browser) + { + // *HACK HACK HACK HACK! + /* Stuff a Tab key into the browser now so that the first field will + ** get the focus! The embedded javascript on the page that properly + ** sets the initial focus in a real web browser is not working inside + ** the viewer, so this is an UGLY HACK WORKAROUND for now. + */ + // Commented out as it's not reliable + //web_browser->handleKey(KEY_TAB, MASK_NONE, false); + } +} +#endif //--------------------------------------------------------------------------- // Protected methods |