aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r--linden/indra/newview/llpanellogin.cpp157
1 files changed, 116 insertions, 41 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp
index c26f70f..873920c 100644
--- a/linden/indra/newview/llpanellogin.cpp
+++ b/linden/indra/newview/llpanellogin.cpp
@@ -34,6 +34,8 @@
34#include "llpanellogin.h" 34#include "llpanellogin.h"
35#include "llpanelgeneral.h" 35#include "llpanelgeneral.h"
36 36
37#include "hippoGridManager.h"
38
37#include "indra_constants.h" // for key and mask constants 39#include "indra_constants.h" // for key and mask constants
38#include "llfontgl.h" 40#include "llfontgl.h"
39#include "llmd5.h" 41#include "llmd5.h"
@@ -63,17 +65,22 @@
63#include "llviewernetwork.h" 65#include "llviewernetwork.h"
64#include "llviewerwindow.h" // to link into child list 66#include "llviewerwindow.h" // to link into child list
65#include "llnotify.h" 67#include "llnotify.h"
68#include "llappviewer.h" // for gHideLinks
66#include "llurlsimstring.h" 69#include "llurlsimstring.h"
67#include "lluictrlfactory.h" 70#include "lluictrlfactory.h"
68#include "llhttpclient.h" 71#include "llhttpclient.h"
69#include "llweb.h" 72#include "llweb.h"
70#include "llwebbrowserctrl.h" 73#include "llwebbrowserctrl.h"
71 74
75#include "llfloaterhtml.h"
76
72#include "llfloaterhtmlhelp.h" 77#include "llfloaterhtmlhelp.h"
73#include "llfloatertos.h" 78#include "llfloatertos.h"
74 79
75#include "llglheaders.h" 80#include "llglheaders.h"
76 81
82#include "floaterlogin.h"
83
77#define USE_VIEWER_AUTH 0 84#define USE_VIEWER_AUTH 0
78 85
79std::string load_password_from_disk(void); 86std::string load_password_from_disk(void);
@@ -130,21 +137,8 @@ void LLLoginHandler::parse(const LLSD& queryMap)
130 mFirstName = queryMap["first_name"].asString(); 137 mFirstName = queryMap["first_name"].asString();
131 mLastName = queryMap["last_name"].asString(); 138 mLastName = queryMap["last_name"].asString();
132 139
133 EGridInfo grid_choice = GRID_INFO_NONE; 140 const std::string &grid = queryMap["grid"].asString();
134 if (queryMap["grid"].asString() == "sl beta grid") 141 if (grid != "") gHippoGridManager->setCurrentGrid(grid);
135 {
136 grid_choice = GRID_INFO_ADITI;
137 }
138 else if (queryMap["grid"].asString() == "sl main grid")
139 {
140 grid_choice = GRID_INFO_AGNI;
141 }
142
143 if(grid_choice != GRID_INFO_NONE)
144 {
145 LLViewerLogin::getInstance()->setGridChoice(grid_choice);
146 }
147
148 std::string startLocation = queryMap["location"].asString(); 142 std::string startLocation = queryMap["location"].asString();
149 143
150 if (startLocation == "specify") 144 if (startLocation == "specify")
@@ -258,11 +252,6 @@ namespace {
258 boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0; 252 boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
259}; 253};
260 254
261void set_start_location(LLUICtrl* ctrl, void* data)
262{
263 LLURLSimString::setString(ctrl->getValue().asString());
264}
265
266//--------------------------------------------------------------------------- 255//---------------------------------------------------------------------------
267// Public methods 256// Public methods
268//--------------------------------------------------------------------------- 257//---------------------------------------------------------------------------
@@ -349,13 +338,13 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
349 combo->setCurrentByIndex( 0 ); 338 combo->setCurrentByIndex( 0 );
350 } 339 }
351 340
352 combo->setCommitCallback( &set_start_location );
353 341
354 LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); 342 LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
355 server_choice_combo->setCommitCallback(onSelectServer); 343 server_choice_combo->setCommitCallback(onSelectServer);
356 server_choice_combo->setFocusLostCallback(onServerComboLostFocus); 344 //server_choice_combo->setFocusLostCallback(onServerComboLostFocus);
357 345
358 childSetAction("connect_btn", onClickConnect, this); 346 childSetAction("connect_btn", onClickConnect, this);
347 childSetAction("grid_btn", onClickGrid, this);
359 348
360 setDefaultBtn("connect_btn"); 349 setDefaultBtn("connect_btn");
361 350
@@ -657,6 +646,7 @@ void LLPanelLogin::show(const LLRect &rect,
657 646
658 // Make sure that focus always goes here (and use the latest sInstance that was just created) 647 // Make sure that focus always goes here (and use the latest sInstance that was just created)
659 gFocusMgr.setDefaultKeyboardFocus(sInstance); 648 gFocusMgr.setDefaultKeyboardFocus(sInstance);
649 LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel());
660} 650}
661 651
662// static 652// static
@@ -701,7 +691,7 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la
701 691
702 692
703// static 693// static
704void LLPanelLogin::addServer(const std::string& server, S32 domain_name) 694void LLPanelLogin::addServer(const std::string& server)
705{ 695{
706 if (!sInstance) 696 if (!sInstance)
707 { 697 {
@@ -709,17 +699,29 @@ void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
709 return; 699 return;
710 } 700 }
711 701
712 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); 702 const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick();
713 combo->add(server, LLSD(domain_name) );
714 combo->setCurrentByIndex(0);
715}
716 703
704 LLComboBox *grids = sInstance->getChild<LLComboBox>("server_combo");
705 S32 selectIndex = -1, i = 0;
706 grids->removeall();
707 if (defaultGrid != "") {
708 grids->add(defaultGrid);
709 selectIndex = i++;
710 }
711 HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid();
712 for (it = gHippoGridManager->beginGrid(); it != end; ++it) {
713 const std::string &grid = it->second->getGridNick();
714 if (grid != defaultGrid) {
715 grids->add(grid);
716 //if (grid == mCurGrid) selectIndex = i;
717 i++;
718 }
719 }
720 grids->setCurrentByIndex(0);
717 721
718// static 722 //LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
719void LLPanelLogin::setServer(S32 domain_name) 723 //combo->add(server, LLSD(domain_name) );
720{ 724 //combo->setCurrentByIndex(0);
721 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
722 combo->setCurrentByIndex(domain_name);
723} 725}
724 726
725// static 727// static
@@ -800,7 +802,12 @@ void LLPanelLogin::refreshLocation( bool force_visible )
800 sInstance->childSetVisible("start_location_combo", show_start); 802 sInstance->childSetVisible("start_location_combo", show_start);
801 sInstance->childSetVisible("start_location_text", show_start); 803 sInstance->childSetVisible("start_location_text", show_start);
802 804
805/*#if LL_RELEASE_FOR_DOWNLOAD
806 BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
807 sInstance->childSetVisible("server_combo", show_server);
808#else*/
803 sInstance->childSetVisible("server_combo", TRUE); 809 sInstance->childSetVisible("server_combo", TRUE);
810//#endif
804 811
805#endif 812#endif
806} 813}
@@ -833,18 +840,39 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh)
833} 840}
834 841
835 842
843// static
844void LLPanelLogin::refreshLoginPage()
845{
846 if (!sInstance) return;
847
848 sInstance->childSetVisible("create_new_account_text",
849 !gHippoGridManager->getConnectedGrid()->getRegisterUrl().empty());
850 sInstance->childSetVisible("forgot_password_text",
851 !gHippoGridManager->getConnectedGrid()->getPasswordUrl().empty());
852
853 // kick off a request to grab the url manually
854 gResponsePtr = LLIamHereLogin::build(sInstance);
855 std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
856 if (!login_page.empty()) {
857 LLHTTPClient::head(login_page, gResponsePtr);
858 } else {
859 sInstance->setSiteIsAlive(false);
860 }
861}
862
836 863
837void LLPanelLogin::loadLoginPage() 864void LLPanelLogin::loadLoginPage()
838{ 865{
839 if (!sInstance) return; 866 if (!sInstance) return;
840 867
841 std::ostringstream oStr;
842 868
843 std::string login_page = gSavedSettings.getString("LoginPage"); 869 std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
844 if (login_page.empty()) 870 if (login_page.empty()) {
845 { 871 sInstance->setSiteIsAlive(false);
846 login_page = sInstance->getString( "real_url" ); 872 return;
847 } 873 }
874
875 std::ostringstream oStr;
848 oStr << login_page; 876 oStr << login_page;
849 877
850 // Use the right delimeter depending on how LLURI parses the URL 878 // Use the right delimeter depending on how LLURI parses the URL
@@ -879,11 +907,12 @@ void LLPanelLogin::loadLoginPage()
879 curl_free(curl_version); 907 curl_free(curl_version);
880 908
881 // Grid 909 // Grid
882 char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridCodeName().c_str(), 0); 910 char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
883 oStr << "&grid=" << curl_grid; 911 oStr << "&grid=" << curl_grid;
884 curl_free(curl_grid); 912 curl_free(curl_grid);
885 913
886 gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid()); 914 gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
915 //LLViewerLogin::getInstance()->setMenuColor();
887 gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); 916 gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
888 917
889 918
@@ -1017,12 +1046,27 @@ void LLPanelLogin::onClickConnect(void *)
1017 } 1046 }
1018 else 1047 else
1019 { 1048 {
1049 if (gHideLinks)
1050 {
1051 gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks");
1052 }
1053 else
1054 {
1020 gViewerWindow->alertXml("MustHaveAccountToLogIn", 1055 gViewerWindow->alertXml("MustHaveAccountToLogIn",
1021 LLPanelLogin::newAccountAlertCallback); 1056 LLPanelLogin::newAccountAlertCallback);
1022 } 1057 }
1023 } 1058 }
1024} 1059}
1060}
1025 1061
1062void LLPanelLogin::onClickGrid(void *)
1063{
1064 if (sInstance && sInstance->mCallback)
1065 {
1066 LoginFloater::newShow(std::string("Test"), false, LoginFloater::testCallback, NULL);
1067 }
1068}
1069
1026 1070
1027// static 1071// static
1028void LLPanelLogin::newAccountAlertCallback(S32 option, void*) 1072void LLPanelLogin::newAccountAlertCallback(S32 option, void*)
@@ -1088,7 +1132,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
1088} 1132}
1089 1133
1090// static 1134// static
1091void LLPanelLogin::onSelectServer(LLUICtrl*, void*) 1135void LLPanelLogin::onSelectServer(LLUICtrl* ctrl, void*)
1092{ 1136{
1093 // *NOTE: The paramters for this method are ignored. 1137 // *NOTE: The paramters for this method are ignored.
1094 // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) 1138 // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
@@ -1097,11 +1141,31 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
1097 // The user twiddled with the grid choice ui. 1141 // The user twiddled with the grid choice ui.
1098 // apply the selection to the grid setting. 1142 // apply the selection to the grid setting.
1099 std::string grid_label; 1143 std::string grid_label;
1100 S32 grid_index; 1144 //S32 grid_index;
1101 1145
1102 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); 1146 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
1103 LLSD combo_val = combo->getValue(); 1147 LLSD combo_val = combo->getValue();
1104 1148
1149 std::string mCurGrid = ctrl->getValue().asString();
1150 //KOW
1151 gHippoGridManager->setCurrentGrid(mCurGrid);
1152 //gHippoGridManager->setDefaultGrid(mCurGrid);
1153 //gHippoGridManager->saveFile();
1154 HippoGridInfo *gridInfo = gHippoGridManager->getGrid(mCurGrid);
1155 if (gridInfo) {
1156 //childSetText("gridnick", gridInfo->getGridNick());
1157 //platform->setCurrentByIndex(gridInfo->getPlatform());
1158 //childSetText("gridname", gridInfo->getGridName());
1159 LLPanelLogin::setFields( gridInfo->getFirstName(), gridInfo->getLastName(), gridInfo->getAvatarPassword(), 1 );
1160 }
1161 //gHippoGridManager->setCurrentGrid(mCurGrid);
1162
1163
1164
1165 llwarns << "current grid = " << mCurGrid << llendl;
1166
1167 /*
1168
1105 if (LLSD::TypeInteger == combo_val.type()) 1169 if (LLSD::TypeInteger == combo_val.type())
1106 { 1170 {
1107 grid_index = combo->getValue().asInteger(); 1171 grid_index = combo->getValue().asInteger();
@@ -1126,17 +1190,27 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
1126 vl->resetURIs(); 1190 vl->resetURIs();
1127 if(grid_index != GRID_INFO_OTHER) 1191 if(grid_index != GRID_INFO_OTHER)
1128 { 1192 {
1129 vl->setGridChoice((EGridInfo)grid_index); 1193 vl->setGridChoice(grid_index);
1130 } 1194 }
1131 else 1195 else
1132 { 1196 {
1133 vl->setGridChoice(grid_label); 1197 vl->setGridChoice(grid_label);
1134 } 1198 }
1135 1199
1200 // clear the password if we are switching grids so we don't send
1201 // the wrong pass to the wrong grid.
1202 if (sInstance)
1203 {
1204 // no method to clear a text box?
1205 const std::string nothing("");
1206 sInstance->childSetText("password_edit", nothing);
1207 }
1208 */
1136 // grid changed so show new splash screen (possibly) 1209 // grid changed so show new splash screen (possibly)
1137 loadLoginPage(); 1210 loadLoginPage();
1138} 1211}
1139 1212
1213/*
1140void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) 1214void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
1141{ 1215{
1142 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); 1216 LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
@@ -1145,3 +1219,4 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
1145 onSelectServer(combo, NULL); 1219 onSelectServer(combo, NULL);
1146 } 1220 }
1147} 1221}
1222*/