aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-07-09 03:07:25 -0700
committerMcCabe Maxsted2010-07-09 03:12:47 -0700
commitd53a422354cbe27b0e0b3faa07be80b3c5df0896 (patch)
tree514fa434abae791afc146768dd38e1e1a9f958db
parentUpdated hipporestrequest code to hippo 0.6.3 (diff)
downloadmeta-impy-d53a422354cbe27b0e0b3faa07be80b3c5df0896.zip
meta-impy-d53a422354cbe27b0e0b3faa07be80b3c5df0896.tar.gz
meta-impy-d53a422354cbe27b0e0b3faa07be80b3c5df0896.tar.bz2
meta-impy-d53a422354cbe27b0e0b3faa07be80b3c5df0896.tar.xz
Use cancel-apply-ok for the grid manager, fixed those weird refresh bugs, re-added notfications for errors
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/floatergridmanager.cpp217
-rw-r--r--linden/indra/newview/floatergridmanager.h6
-rw-r--r--linden/indra/newview/hippoGridManager.cpp194
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_grid_manager.xml12
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/notifications.xml41
5 files changed, 305 insertions, 165 deletions
diff --git a/linden/indra/newview/floatergridmanager.cpp b/linden/indra/newview/floatergridmanager.cpp
index efd02ca..1ca7ae3 100644
--- a/linden/indra/newview/floatergridmanager.cpp
+++ b/linden/indra/newview/floatergridmanager.cpp
@@ -53,32 +53,6 @@ FloaterGridManager::~FloaterGridManager()
53 53
54BOOL FloaterGridManager::postBuild() 54BOOL FloaterGridManager::postBuild()
55{ 55{
56 /*requires<LLScrollListCtrl>("grid_selector");
57 requires<LLLineEditor>("gridnick");
58 requires<LLLineEditor>("gridname");
59 requires<LLLineEditor>("loginuri");
60 requires<LLLineEditor>("loginpage");
61 requires<LLLineEditor>("helperuri");
62 requires<LLLineEditor>("website");
63 requires<LLLineEditor>("support");
64 requires<LLLineEditor>("register");
65 requires<LLLineEditor>("password");
66 requires<LLLineEditor>("first_name");
67 requires<LLLineEditor>("last_name");
68 requires<LLLineEditor>("avatar_password");
69 //requires<LLLineEditor>("search");
70 requires<LLButton>("btn_delete");
71 requires<LLButton>("btn_add");
72 requires<LLButton>("btn_copy");
73 requires<LLButton>("set_default");
74 requires<LLButton>("btn_gridinfo");*/
75 //requires<LLButton>("btn_help_render_compat");
76
77 /*if (!checkRequirements())
78 {
79 return false;
80 }*/
81
82 LLLineEditor* password_edit = getChild<LLLineEditor>("avatar_password"); 56 LLLineEditor* password_edit = getChild<LLLineEditor>("avatar_password");
83 if (password_edit) 57 if (password_edit)
84 { 58 {
@@ -105,49 +79,120 @@ BOOL FloaterGridManager::postBuild()
105 return TRUE; 79 return TRUE;
106} 80}
107 81
82void FloaterGridManager::clearInfo()
83{
84 //getChild<LLScrollListCtrl>("grid_selector")->clear();
85 //getChild<LLLineEditor>("gridnick")->clear();
86 //getChild<LLLineEditor>("gridname")->clear();
87 //getChild<LLLineEditor>("loginuri")->clear();
88 getChild<LLLineEditor>("loginpage")->clear();
89 getChild<LLLineEditor>("helperuri")->clear();
90 getChild<LLLineEditor>("website")->clear();
91 getChild<LLLineEditor>("support")->clear();
92 getChild<LLLineEditor>("register")->clear();
93 getChild<LLLineEditor>("password")->clear();
94 //getChild<LLLineEditor>("first_name")->clear();
95 //getChild<LLLineEditor>("last_name")->clear();
96 //getChild<LLLineEditor>("avatar_password")->clear();
97 //getChild<LLLineEditor>("search")->clear();
98 //getChild<LLButton>("btn_delete");
99 //getChild<LLButton>("btn_add")
100 //getChild<LLButton>("btn_copy");
101 //getChild<LLButton>("set_default")->setEnabled(FALSE);
102 getChild<LLButton>("btn_gridinfo")->setEnabled(TRUE);
103 //getChild<LLButton>("btn_clear");
104 //getChild<LLButton>("btn_help_render_compat")->setEnabled(FALSE);
105}
106
107void FloaterGridManager::draw()
108{
109 refresh();
110
111 LLFloater::draw();
112}
113
114void FloaterGridManager::refresh()
115{
116 //TODO: these should just be set in a prompt
117 bool can_edit = (!getChild<LLLineEditor>("gridnick")->getText().empty() &&
118 !getChild<LLLineEditor>("loginuri")->getText().empty() &&
119 getChild<LLLineEditor>("gridnick")->getText() != "<required>" &&
120 getChild<LLLineEditor>("loginuri")->getText() != "<required>");
121
122 //getChild<LLLineEditor>("gridname");
123 getChild<LLLineEditor>("loginpage")->setEnabled(can_edit);
124 getChild<LLLineEditor>("helperuri")->setEnabled(can_edit);
125 getChild<LLLineEditor>("website")->setEnabled(can_edit);
126 getChild<LLLineEditor>("support")->setEnabled(can_edit);
127 getChild<LLLineEditor>("register")->setEnabled(can_edit);
128 getChild<LLLineEditor>("password")->setEnabled(can_edit);
129 //getChild<LLLineEditor>("first_name")->setEnabled(can_edit);
130 //getChild<LLLineEditor>("last_name")->setEnabled(can_edit);
131 //getChild<LLLineEditor>("avatar_password")->setEnabled(can_edit);
132 //getChild<LLLineEditor>("search")->setEnabled(can_edit);
133 getChild<LLButton>("btn_delete")->setEnabled(can_edit);
134 //getChild<LLButton>("btn_add")
135 //getChild<LLButton>("btn_copy")->setEnabled(can_edit);
136 //getChild<LLButton>("set_default")->setEnabled(can_dit);
137 getChild<LLButton>("btn_gridinfo")->setEnabled(can_edit);
138 getChild<LLButton>("btn_clear")->setEnabled(can_edit);
139 //getChild<LLButton>("btn_help_render_compat")->setEnabled(can_edit);
140}
141
108void FloaterGridManager::refreshGrids() 142void FloaterGridManager::refreshGrids()
109{ 143{
110 const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick();
111 LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector"); 144 LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector");
112 grids->deleteAllItems(); 145 std::string lastSelectedItem;
146 LLSD element;
113 147
114 S32 selectIndex = -1; 148 if (grids->getFirstSelected())
115 S32 i = 0;
116 if (defaultGrid != "")
117 { 149 {
118 LLSD value; 150 lastSelectedItem = grids->getFirstSelected()->getValue().asString();
119 value["id"] = defaultGrid;
120 value["columns"][0]["column"] = "grid";
121 value["columns"][0]["value"] = defaultGrid;
122 grids->addElement(value);
123 selectIndex = i++;
124 } 151 }
125 152
126 HippoGridManager::GridIterator it = gHippoGridManager->beginGrid(); 153 grids->deleteAllItems();
127 HippoGridManager::GridIterator end = gHippoGridManager->endGrid(); 154
128 for (it; it != end; ++it) 155 for (HippoGridManager::GridIterator it = gHippoGridManager->beginGrid(); it != gHippoGridManager->endGrid(); ++it)
129 { 156 {
130 const std::string &grid = it->second->getGridNick(); 157 std::string grid_nick = it->second->getGridNick();
131 if (grid != defaultGrid) 158 // There's no reason why empty grids nicks should be in this list, ugh
159 if (!grid_nick.empty() && grid_nick != gHippoGridManager->getCurrentGridNick())
132 { 160 {
133 LLSD value; 161 element["id"] = grid_nick;
134 value["id"] = grid; 162 element["columns"][0]["column"] = "grid";
135 value["columns"][0]["column"] = "grid"; 163 element["columns"][0]["type"] = "text";
136 value["columns"][0]["value"] = grid; 164 element["columns"][0]["value"] = grid_nick;
137 grids->addElement(value); 165 grids->addElement(element, ADD_BOTTOM);
138
139 if (grid == FloaterGridManager::getInstance()->getCurGrid())
140 {
141 selectIndex = i;
142 }
143 i++;
144 } 166 }
145 } 167 }
146 168
169 // Setting the default needs to be rethought.
170 // Right now, we just use the last-selected grid,
171 // but leaving this as the current behavior for now
172 if (!gHippoGridManager->getCurrentGridNick().empty())
173 {
174 element["id"] = gHippoGridManager->getCurrentGridNick();
175 element["columns"][0]["column"] = "grid";
176 element["columns"][0]["type"] = "text";
177 element["columns"][0]["font-style"] = "BOLD";
178 element["columns"][0]["value"] = gHippoGridManager->getCurrentGridNick();
179 grids->addElement(element, ADD_TOP);
180 }
181
182 // Reselect the item if we had one selected
183 if (lastSelectedItem.empty())
184 {
185 grids->selectItemByLabel(gHippoGridManager->getCurrentGridNick());
186 }
187 else
188 {
189 grids->selectItemByLabel(lastSelectedItem);
190 }
191
192 // TODO: get rid of all this state junk
147 if ((FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)) 193 if ((FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY))
148 { 194 {
149 grids->addElement("<new>"); 195 grids->addElement("<new>", ADD_BOTTOM);
150 selectIndex = i++;
151 } 196 }
152 197
153 //if (selectIndex >= 0) 198 //if (selectIndex >= 0)
@@ -161,9 +206,10 @@ void FloaterGridManager::refreshGrids()
161 206
162 // FloaterGridManager::getInstance()->childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); 207 // FloaterGridManager::getInstance()->childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");
163 208
164 FloaterGridManager::getInstance()->childSetEnabled("btn_delete", (selectIndex >= 0)); 209 FloaterGridManager::getInstance()->childSetEnabled("btn_delete", grids->getItemCount() > 0);
165 FloaterGridManager::getInstance()->childSetEnabled("btn_copy", (FloaterGridManager::getInstance()->getState() == NORMAL) && (selectIndex >= 0)); 210
166 // FloaterGridManager::getInstance()->childSetEnabled("set_default", (FloaterGridManager::getInstance()->getState() == NORMAL) && (selectIndex > 0)); 211 FloaterGridManager::getInstance()->childSetEnabled("btn_copy", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0));
212 // FloaterGridManager::getInstance()->childSetEnabled("set_default", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0));
167 FloaterGridManager::getInstance()->childSetEnabled("gridnick", (FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)); 213 FloaterGridManager::getInstance()->childSetEnabled("gridnick", (FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY));
168 214
169 if (FloaterGridManager::getInstance()->getState() == NORMAL) 215 if (FloaterGridManager::getInstance()->getState() == NORMAL)
@@ -309,15 +355,15 @@ bool FloaterGridManager::createNewGrid()
309 355
310 if (gridnick.empty()) 356 if (gridnick.empty())
311 { 357 {
312 //KOW gViewerWindow->alertXml("GridsNoNick"); 358 LLNotifications::instance().add("GridsNoNick");
313 return false; 359 return false;
314 } 360 }
315 361
316 if (gHippoGridManager->getGrid(gridnick)) 362 if (gHippoGridManager->getGrid(gridnick))
317 { 363 {
318 //LLStringUtil::format_map_t args; 364 LLSD args;
319 //args["[NAME]"] = gridnick; 365 args["[NAME]"] = gridnick;
320 //KOW gViewerWindow->alertXml("GridExists", args); 366 LLNotifications::instance().add("GridExists", args);
321 return false; 367 return false;
322 } 368 }
323 369
@@ -325,9 +371,9 @@ bool FloaterGridManager::createNewGrid()
325 std::string loginuri = childGetValue("loginuri"); 371 std::string loginuri = childGetValue("loginuri");
326 if ((loginuri.empty()) || (loginuri == "<required>")) 372 if ((loginuri.empty()) || (loginuri == "<required>"))
327 { 373 {
328 //LLStringUtil::format_map_t args; 374 LLSD args;
329 //args["[NAME]"] = gridnick; 375 args["[NAME]"] = gridnick;
330 //KOW gViewerWindow->alertXml("GridsNoLoginUri", args); 376 LLNotifications::instance().add("GridsNoLoginUri", args);
331 return false; 377 return false;
332 } 378 }
333 379
@@ -365,7 +411,7 @@ void FloaterGridManager::retrieveGridInfo()
365 std::string loginuri = childGetValue("loginuri"); 411 std::string loginuri = childGetValue("loginuri");
366 if ((loginuri == "") || (loginuri == "<required>")) 412 if ((loginuri == "") || (loginuri == "<required>"))
367 { 413 {
368 //KOW gViewerWindow->alertXml("GridInfoNoLoginUri"); 414 LLNotifications::instance().add("GridInfoNoLoginUri");
369 return; 415 return;
370 } 416 }
371 417
@@ -408,7 +454,7 @@ void FloaterGridManager::retrieveGridInfo()
408 } 454 }
409 else 455 else
410 { 456 {
411 //KOW gViewerWindow->alertXml("GridInfoError"); 457 LLNotifications::instance().add("GridInfoError");
412 } 458 }
413 459
414 if (cleanupGrid) delete grid; 460 if (cleanupGrid) delete grid;
@@ -533,8 +579,7 @@ void FloaterGridManager::onClickApply(void* data)
533// static 579// static
534void FloaterGridManager::onClickClear(void* data) 580void FloaterGridManager::onClickClear(void* data)
535{ 581{
536 gHippoGridManager->discardAndReload(); 582 FloaterGridManager::getInstance()->clearInfo();
537 FloaterGridManager::getInstance()->update();
538} 583}
539 584
540//static 585//static
@@ -595,38 +640,6 @@ void FloaterGridManager::onClickCancel(void* data)
595 //FloaterGridManager::getInstance()->childSetVisible("server_combo", TRUE); 640 //FloaterGridManager::getInstance()->childSetVisible("server_combo", TRUE);
596//} 641//}
597 642
598//void FloaterGridManager::newShow(const std::string &grid, bool initialLogin)
599//{
600// llinfos << "newShow called" << llendl;
601// /*if (!FloaterGridManager::getInstance())
602// {
603// FloaterGridManager::sGrid = grid;
604// FloaterGridManager::sIsInitialLogin = initialLogin;
605// FloaterGridManager::getInstance() = new FloaterGridManager();
606//
607// llinfos << "FloaterGridManager::getInstance() assigned. FloaterGridManager::getInstance()=" << FloaterGridManager::getInstance() << llendl;
608// }*/
609//
610// llinfos << "newshow called" << llendl;
611// FloaterGridManager::getInstance()->setCurGrid(gHippoGridManager->getCurrentGridNick());
612// refreshGrids();
613//
614// FloaterGridManager::getInstance()->open();
615// // we're important
616// //FloaterGridManager::getInstance()->setFrontmost(TRUE);
617// //FloaterGridManager::getInstance()->setFocus(TRUE);
618//
619//}
620
621//void FloaterGridManager::show(const LLRect &rect, BOOL show_server,
622// void (*callback)(S32 option, void* user_data),
623// void* callback_data)
624//{
625// // we don't need a grid passed in because this is old-style login
626// std::string grid = "";
627// newShow(grid, TRUE);
628//}
629
630//void FloaterGridManager::setFocus(BOOL b) 643//void FloaterGridManager::setFocus(BOOL b)
631//{ 644//{
632// if(b != hasFocus()) 645// if(b != hasFocus())
diff --git a/linden/indra/newview/floatergridmanager.h b/linden/indra/newview/floatergridmanager.h
index 16720bd..55517f5 100644
--- a/linden/indra/newview/floatergridmanager.h
+++ b/linden/indra/newview/floatergridmanager.h
@@ -30,6 +30,12 @@ public:
30 //void setDefault(); 30 //void setDefault();
31 void cancel(); 31 void cancel();
32 32
33 void clearInfo();
34
35 virtual void draw();
36
37 void refresh();
38
33 // new-style login methods 39 // new-style login methods
34 virtual std::string& getPassword(); 40 virtual std::string& getPassword();
35 virtual void setPassword(std::string &password); 41 virtual void setPassword(std::string &password);
diff --git a/linden/indra/newview/hippoGridManager.cpp b/linden/indra/newview/hippoGridManager.cpp
index e89e3ff..c9f2549 100644
--- a/linden/indra/newview/hippoGridManager.cpp
+++ b/linden/indra/newview/hippoGridManager.cpp
@@ -1,4 +1,4 @@
1 1// Ported to Imprudence from the Hippo OpenSim Viewer by Jacek Antonelli
2 2
3#include "llviewerprecompiledheaders.h" 3#include "llviewerprecompiledheaders.h"
4 4
@@ -173,11 +173,16 @@ void HippoGridInfo::setPlatform(const std::string &platform)
173 for (unsigned i=0; i<platform.size(); i++) 173 for (unsigned i=0; i<platform.size(); i++)
174 tmp[i] = tolower(tmp[i]); 174 tmp[i] = tolower(tmp[i]);
175 175
176 if (tmp == "opensim") { 176 if (tmp == "opensim")
177 {
177 setPlatform(PLATFORM_OPENSIM); 178 setPlatform(PLATFORM_OPENSIM);
178 } else if (tmp == "secondlife") { 179 }
180 else if (tmp == "secondlife")
181 {
179 setPlatform(PLATFORM_SECONDLIFE); 182 setPlatform(PLATFORM_SECONDLIFE);
180 } else { 183 }
184 else
185 {
181 setPlatform(PLATFORM_OTHER); 186 setPlatform(PLATFORM_OTHER);
182 llwarns << "Unknown platform '" << platform << "'." << llendl; 187 llwarns << "Unknown platform '" << platform << "'." << llendl;
183 } 188 }
@@ -278,13 +283,20 @@ std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const
278 if (mPlatform == PLATFORM_SECONDLIFE) 283 if (mPlatform == PLATFORM_SECONDLIFE)
279 { 284 {
280 // Second Life defaults 285 // Second Life defaults
281 if (ty == SEARCH_ALL_EMPTY) { 286 if (ty == SEARCH_ALL_EMPTY)
287 {
282 return gSavedSettings.getString("SearchURLDefault"); 288 return gSavedSettings.getString("SearchURLDefault");
283 } else if (ty == SEARCH_ALL_QUERY) { 289 }
290 else if (ty == SEARCH_ALL_QUERY)
291 {
284 return gSavedSettings.getString("SearchURLQuery"); 292 return gSavedSettings.getString("SearchURLQuery");
285 } else if (ty == SEARCH_ALL_TEMPLATE) { 293 }
294 else if (ty == SEARCH_ALL_TEMPLATE)
295 {
286 return gSavedSettings.getString("SearchURLSuffix2"); 296 return gSavedSettings.getString("SearchURLSuffix2");
287 } else { 297 }
298 else
299 {
288 llinfos << "Illegal search URL type " << ty << llendl; 300 llinfos << "Illegal search URL type " << ty << llendl;
289 return ""; 301 return "";
290 } 302 }
@@ -292,13 +304,20 @@ std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const
292 else 304 else
293 { 305 {
294 // OpenSim and other web search defaults 306 // OpenSim and other web search defaults
295 if (ty == SEARCH_ALL_EMPTY) { 307 if (ty == SEARCH_ALL_EMPTY)
308 {
296 return gSavedSettings.getString("SearchURLDefaultOpenSim"); 309 return gSavedSettings.getString("SearchURLDefaultOpenSim");
297 } else if (ty == SEARCH_ALL_QUERY) { 310 }
311 else if (ty == SEARCH_ALL_QUERY)
312 {
298 return gSavedSettings.getString("SearchURLQueryOpenSim"); 313 return gSavedSettings.getString("SearchURLQueryOpenSim");
299 } else if (ty == SEARCH_ALL_TEMPLATE) { 314 }
315 else if (ty == SEARCH_ALL_TEMPLATE)
316 {
300 return gSavedSettings.getString("SearchURLSuffixOpenSim"); 317 return gSavedSettings.getString("SearchURLSuffixOpenSim");
301 } else { 318 }
319 else
320 {
302 llinfos << "Illegal search URL type " << ty << llendl; 321 llinfos << "Illegal search URL type " << ty << llendl;
303 return ""; 322 return "";
304 } 323 }
@@ -307,13 +326,20 @@ std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const
307 else 326 else
308 { 327 {
309 // Use the old search all 328 // Use the old search all
310 if (ty == SEARCH_ALL_EMPTY) { 329 if (ty == SEARCH_ALL_EMPTY)
330 {
311 return (mSearchUrl + "panel=All&"); 331 return (mSearchUrl + "panel=All&");
312 } else if (ty == SEARCH_ALL_QUERY) { 332 }
333 else if (ty == SEARCH_ALL_QUERY)
334 {
313 return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); 335 return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&");
314 } else if (ty == SEARCH_ALL_TEMPLATE) { 336 }
337 else if (ty == SEARCH_ALL_TEMPLATE)
338 {
315 return "lang=[LANG]&m=[MATURE]&t=[TEEN]&region=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; 339 return "lang=[LANG]&m=[MATURE]&t=[TEEN]&region=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]";
316 } else { 340 }
341 else
342 {
317 llinfos << "Illegal search URL type " << ty << llendl; 343 llinfos << "Illegal search URL type " << ty << llendl;
318 return ""; 344 return "";
319 } 345 }
@@ -360,33 +386,38 @@ void HippoGridInfo::onXmlElementEnd(void *userData, const XML_Char *name)
360void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int len) 386void HippoGridInfo::onXmlCharacterData(void *userData, const XML_Char *s, int len)
361{ 387{
362 HippoGridInfo *self = (HippoGridInfo*)userData; 388 HippoGridInfo *self = (HippoGridInfo*)userData;
363 switch (self->mXmlState) { 389 switch (self->mXmlState)
364 390 {
365 case XML_GRIDNICK: { 391 case XML_GRIDNICK:
392 {
366 if (self->mGridNick == "") self->mGridNick.assign(s, len); 393 if (self->mGridNick == "") self->mGridNick.assign(s, len);
367 self->mGridNick = sanitizeGridNick(self->mGridNick); 394 self->mGridNick = sanitizeGridNick(self->mGridNick);
368 break; 395 break;
369 } 396 }
370 397
371 case XML_PLATFORM: { 398 case XML_PLATFORM:
399 {
372 std::string platform(s, len); 400 std::string platform(s, len);
373 self->setPlatform(platform); 401 self->setPlatform(platform);
374 break; 402 break;
375 } 403 }
376 404
377 case XML_LOGINURI: { 405 case XML_LOGINURI:
406 {
378 std::string loginuri(s, len); 407 std::string loginuri(s, len);
379 self->mLoginUri = sanitizeUri( loginuri ); 408 self->mLoginUri = sanitizeUri( loginuri );
380 break; 409 break;
381 } 410 }
382 411
383 case XML_HELPERURI: { 412 case XML_HELPERURI:
413 {
384 std::string helperuri(s, len); 414 std::string helperuri(s, len);
385 self->mHelperUri = sanitizeUri( helperuri ); 415 self->mHelperUri = sanitizeUri( helperuri );
386 break; 416 break;
387 } 417 }
388 418
389 case XML_SEARCH: { 419 case XML_SEARCH:
420 {
390 //self->mSearchUrl.assign(s, len); 421 //self->mSearchUrl.assign(s, len);
391 //sanitizeQueryUrl(mSearchUrl); 422 //sanitizeQueryUrl(mSearchUrl);
392 break; 423 break;
@@ -426,7 +457,8 @@ bool HippoGridInfo::retrieveGridInfo()
426 XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd); 457 XML_SetElementHandler(parser, onXmlElementStart, onXmlElementEnd);
427 XML_SetCharacterDataHandler(parser, onXmlCharacterData); 458 XML_SetCharacterDataHandler(parser, onXmlCharacterData);
428 mXmlState = XML_VOID; 459 mXmlState = XML_VOID;
429 if (!XML_Parse(parser, reply.data(), reply.size(), TRUE)) { 460 if (!XML_Parse(parser, reply.data(), reply.size(), TRUE))
461 {
430 llwarns << "XML Parse Error: " << XML_ErrorString(XML_GetErrorCode(parser)) << llendl; 462 llwarns << "XML Parse Error: " << XML_ErrorString(XML_GetErrorCode(parser)) << llendl;
431 success = false; 463 success = false;
432 } 464 }
@@ -477,7 +509,8 @@ void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const
477// static 509// static
478const char *HippoGridInfo::getPlatformString(Platform platform) 510const char *HippoGridInfo::getPlatformString(Platform platform)
479{ 511{
480 static const char *platformStrings[PLATFORM_LAST] = { 512 static const char *platformStrings[PLATFORM_LAST] =
513 {
481 "Other", "OpenSim", "SecondLife" 514 "Other", "OpenSim", "SecondLife"
482 }; 515 };
483 516
@@ -492,11 +525,15 @@ std::string HippoGridInfo::sanitizeGridNick(std::string &gridnick)
492{ 525{
493 std::string tmp; 526 std::string tmp;
494 int size = gridnick.size(); 527 int size = gridnick.size();
495 for (int i=0; i<size; i++) { 528 for (int i=0; i<size; i++)
529 {
496 char c = gridnick[i]; 530 char c = gridnick[i];
497 if ((c == '_') || isalnum(c)) { 531 if ((c == '_') || isalnum(c))
532 {
498 tmp += tolower(c); 533 tmp += tolower(c);
499 } else if (isspace(c)) { 534 }
535 else if (isspace(c))
536 {
500 tmp += "_"; 537 tmp += "_";
501 } 538 }
502 } 539 }
@@ -543,7 +580,9 @@ void HippoGridInfo::initFallback()
543 580
544HippoGridManager::HippoGridManager() : 581HippoGridManager::HippoGridManager() :
545 mConnectedGrid(0), 582 mConnectedGrid(0),
546 mDefaultGridsVersion(0) 583 mDefaultGridsVersion(0),
584 mCurrentGrid("osgrid"),
585 mDefaultGrid("osgrid")
547{ 586{
548} 587}
549 588
@@ -556,7 +595,8 @@ HippoGridManager::~HippoGridManager()
556void HippoGridManager::cleanup() 595void HippoGridManager::cleanup()
557{ 596{
558 std::map<std::string, HippoGridInfo*>::iterator it, end = mGridInfo.end(); 597 std::map<std::string, HippoGridInfo*>::iterator it, end = mGridInfo.end();
559 for (it=mGridInfo.begin(); it != end; ++it) { 598 for (it=mGridInfo.begin(); it != end; ++it)
599 {
560 delete it->second; 600 delete it->second;
561 } 601 }
562 mGridInfo.clear(); 602 mGridInfo.clear();
@@ -589,9 +629,12 @@ HippoGridInfo* HippoGridManager::getGrid(const std::string &grid) const
589{ 629{
590 std::map<std::string, HippoGridInfo*>::const_iterator it; 630 std::map<std::string, HippoGridInfo*>::const_iterator it;
591 it = mGridInfo.find(grid); 631 it = mGridInfo.find(grid);
592 if (it != mGridInfo.end()) { 632 if (it != mGridInfo.end())
633 {
593 return it->second; 634 return it->second;
594 } else { 635 }
636 else
637 {
595 return 0; 638 return 0;
596 } 639 }
597} 640}
@@ -606,9 +649,12 @@ HippoGridInfo* HippoGridManager::getConnectedGrid() const
606HippoGridInfo* HippoGridManager::getCurrentGrid() const 649HippoGridInfo* HippoGridManager::getCurrentGrid() const
607{ 650{
608 HippoGridInfo *grid = getGrid(mCurrentGrid); 651 HippoGridInfo *grid = getGrid(mCurrentGrid);
609 if (grid) { 652 if (grid)
653 {
610 return grid; 654 return grid;
611 } else { 655 }
656 else
657 {
612 return &HippoGridInfo::FALLBACK_GRIDINFO; 658 return &HippoGridInfo::FALLBACK_GRIDINFO;
613 } 659 }
614} 660}
@@ -620,6 +666,10 @@ const std::string& HippoGridManager::getDefaultGridNick() const
620 666
621const std::string& HippoGridManager::getCurrentGridNick() const 667const std::string& HippoGridManager::getCurrentGridNick() const
622{ 668{
669 if (mCurrentGrid.empty())
670 {
671 return mDefaultGrid;
672 }
623 return mCurrentGrid; 673 return mCurrentGrid;
624} 674}
625 675
@@ -633,12 +683,14 @@ void HippoGridManager::addGrid(HippoGridInfo *grid)
633{ 683{
634 if (!grid) return; 684 if (!grid) return;
635 const std::string &nick = grid->getGridNick(); 685 const std::string &nick = grid->getGridNick();
636 if (nick == "") { 686 if (nick == "")
687 {
637 llwarns << "Ignoring to try adding grid with empty nick." << llendl; 688 llwarns << "Ignoring to try adding grid with empty nick." << llendl;
638 delete grid; 689 delete grid;
639 return; 690 return;
640 } 691 }
641 if (mGridInfo.find(nick) != mGridInfo.end()) { 692 if (mGridInfo.find(nick) != mGridInfo.end())
693 {
642 llwarns << "Ignoring to try adding existing grid " << nick << '.' << llendl; 694 llwarns << "Ignoring to try adding existing grid " << nick << '.' << llendl;
643 delete grid; 695 delete grid;
644 return; 696 return;
@@ -667,13 +719,20 @@ void HippoGridManager::deleteGrid(const std::string &grid)
667void HippoGridManager::setDefaultGrid(const std::string &grid) 719void HippoGridManager::setDefaultGrid(const std::string &grid)
668{ 720{
669 GridIterator it = mGridInfo.find(grid); 721 GridIterator it = mGridInfo.find(grid);
670 if (it != mGridInfo.end()) { 722 if (it != mGridInfo.end())
723 {
671 mDefaultGrid = grid; 724 mDefaultGrid = grid;
672 } else if (mGridInfo.find("secondlife") != mGridInfo.end()) { 725 }
726 else if (mGridInfo.find("secondlife") != mGridInfo.end())
727 {
673 mDefaultGrid = "secondlife"; 728 mDefaultGrid = "secondlife";
674 } else if (!mGridInfo.empty()) { 729 }
730 else if (!mGridInfo.empty())
731 {
675 mDefaultGrid = mGridInfo.begin()->first; 732 mDefaultGrid = mGridInfo.begin()->first;
676 } else { 733 }
734 else
735 {
677 mDefaultGrid = ""; 736 mDefaultGrid = "";
678 } 737 }
679} 738}
@@ -682,9 +741,12 @@ void HippoGridManager::setDefaultGrid(const std::string &grid)
682void HippoGridManager::setCurrentGrid(const std::string &grid) 741void HippoGridManager::setCurrentGrid(const std::string &grid)
683{ 742{
684 GridIterator it = mGridInfo.find(grid); 743 GridIterator it = mGridInfo.find(grid);
685 if (it != mGridInfo.end()) { 744 if (it != mGridInfo.end())
745 {
686 mCurrentGrid = grid; 746 mCurrentGrid = grid;
687 } else if (!mGridInfo.empty()) { 747 }
748 else if (!mGridInfo.empty())
749 {
688 llwarns << "Unknown grid '" << grid << "'. Setting to default grid." << llendl; 750 llwarns << "Unknown grid '" << grid << "'. Setting to default grid." << llendl;
689 mCurrentGrid = mDefaultGrid; 751 mCurrentGrid = mDefaultGrid;
690 } 752 }
@@ -722,7 +784,8 @@ void HippoGridManager::parseUrl(const char *url, bool mergeIfNewer)
722 784
723 // check response, return on error 785 // check response, return on error
724 S32 status = response["status"].asInteger(); 786 S32 status = response["status"].asInteger();
725 if ((status != 200) || !response["body"].isArray()) { 787 if ((status != 200) || !response["body"].isArray())
788 {
726 llinfos << "GridInfo Update failed (" << status << "): " 789 llinfos << "GridInfo Update failed (" << status << "): "
727 << (response["body"].isString()? response["body"].asString(): "<unknown error>") 790 << (response["body"].isString()? response["body"].asString(): "<unknown error>")
728 << llendl; 791 << llendl;
@@ -737,13 +800,15 @@ void HippoGridManager::parseFile(const std::string &fileName, bool mergeIfNewer)
737{ 800{
738 llifstream infile; 801 llifstream infile;
739 infile.open(fileName.c_str()); 802 infile.open(fileName.c_str());
740 if(!infile.is_open()) { 803 if (!infile.is_open())
804 {
741 llwarns << "Cannot find grid info file " << fileName << " to load." << llendl; 805 llwarns << "Cannot find grid info file " << fileName << " to load." << llendl;
742 return; 806 return;
743 } 807 }
744 808
745 LLSD gridInfo; 809 LLSD gridInfo;
746 if (LLSDSerialize::fromXML(gridInfo, infile) <= 0) { 810 if (LLSDSerialize::fromXML(gridInfo, infile) <= 0)
811 {
747 llwarns << "Unable to parse grid info file " << fileName << '.' << llendl; 812 llwarns << "Unable to parse grid info file " << fileName << '.' << llendl;
748 return; 813 return;
749 } 814 }
@@ -755,17 +820,21 @@ void HippoGridManager::parseFile(const std::string &fileName, bool mergeIfNewer)
755 820
756void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) 821void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
757{ 822{
758 if (mergeIfNewer) { 823 if (mergeIfNewer)
824 {
759 LLSD::array_const_iterator it, end = gridInfo.endArray(); 825 LLSD::array_const_iterator it, end = gridInfo.endArray();
760 for (it = gridInfo.beginArray(); it != end; ++it) { 826 for (it = gridInfo.beginArray(); it != end; ++it)
827 {
761 LLSD gridMap = *it; 828 LLSD gridMap = *it;
762 if (gridMap.has("default_grids_version")) { 829 if (gridMap.has("default_grids_version"))
830 {
763 int version = gridMap["default_grids_version"]; 831 int version = gridMap["default_grids_version"];
764 if (version <= mDefaultGridsVersion) return; 832 if (version <= mDefaultGridsVersion) return;
765 else break; 833 else break;
766 } 834 }
767 } 835 }
768 if (it == end) { 836 if (it == end)
837 {
769 llwarns << "Grid data has no version number." << llendl; 838 llwarns << "Grid data has no version number." << llendl;
770 return; 839 return;
771 } 840 }
@@ -774,19 +843,26 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
774 llinfos << "Loading grid data." << llendl; 843 llinfos << "Loading grid data." << llendl;
775 844
776 LLSD::array_const_iterator it, end = gridInfo.endArray(); 845 LLSD::array_const_iterator it, end = gridInfo.endArray();
777 for (it = gridInfo.beginArray(); it != end; ++it) { 846 for (it = gridInfo.beginArray(); it != end; ++it)
847 {
778 LLSD gridMap = *it; 848 LLSD gridMap = *it;
779 if (gridMap.has("default_grids_version")) { 849 if (gridMap.has("default_grids_version"))
850 {
780 mDefaultGridsVersion = gridMap["default_grids_version"]; 851 mDefaultGridsVersion = gridMap["default_grids_version"];
781 } else if (gridMap.has("gridnick") && gridMap.has("loginuri")) { 852 }
853 else if (gridMap.has("gridnick") && gridMap.has("loginuri"))
854 {
782 std::string gridnick = gridMap["gridnick"]; 855 std::string gridnick = gridMap["gridnick"];
783 HippoGridInfo *grid; 856 HippoGridInfo *grid;
784 GridIterator it = mGridInfo.find(gridnick); 857 GridIterator it = mGridInfo.find(gridnick);
785 bool newGrid = (it == mGridInfo.end()); 858 bool newGrid = (it == mGridInfo.end());
786 if (newGrid) { 859 if (newGrid)
860 {
787 // create new grid info 861 // create new grid info
788 grid = new HippoGridInfo(gridnick); 862 grid = new HippoGridInfo(gridnick);
789 } else { 863 }
864 else
865 {
790 // update existing grid info 866 // update existing grid info
791 grid = it->second; 867 grid = it->second;
792 } 868 }
@@ -822,7 +898,8 @@ void HippoGridManager::saveFile()
822 // add grids 898 // add grids
823 S32 i = 1; 899 S32 i = 1;
824 GridIterator it, end = mGridInfo.end(); 900 GridIterator it, end = mGridInfo.end();
825 for (it = mGridInfo.begin(); it != end; ++it, i++) { 901 for (it = mGridInfo.begin(); it != end; ++it, i++)
902 {
826 HippoGridInfo *grid = it->second; 903 HippoGridInfo *grid = it->second;
827 gridInfo[i]["gridnick"] = grid->getGridNick(); 904 gridInfo[i]["gridnick"] = grid->getGridNick();
828 gridInfo[i]["platform"] = HippoGridInfo::getPlatformString(grid->getPlatform()); 905 gridInfo[i]["platform"] = HippoGridInfo::getPlatformString(grid->getPlatform());
@@ -846,11 +923,14 @@ void HippoGridManager::saveFile()
846 std::string fileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"); 923 std::string fileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml");
847 llofstream file; 924 llofstream file;
848 file.open(fileName.c_str()); 925 file.open(fileName.c_str());
849 if (file.is_open()) { 926 if (file.is_open())
927 {
850 LLSDSerialize::toPrettyXML(gridInfo, file); 928 LLSDSerialize::toPrettyXML(gridInfo, file);
851 file.close(); 929 file.close();
852 llinfos << "Saved grids to " << fileName << llendl; 930 llinfos << "Saved grids to " << fileName << llendl;
853 } else { 931 }
932 else
933 {
854 llerrs << "Unable to open grid info file: " << fileName << llendl; 934 llerrs << "Unable to open grid info file: " << fileName << llendl;
855 } 935 }
856} 936}
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_grid_manager.xml b/linden/indra/newview/skins/default/xui/en-us/floater_grid_manager.xml
index df7b2a0..8d3e101 100644
--- a/linden/indra/newview/skins/default/xui/en-us/floater_grid_manager.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_grid_manager.xml
@@ -14,10 +14,10 @@
14 </text> 14 </text>
15 15
16 <scroll_list background_visible="true" bottom_delta="65" draw_border="true" 16 <scroll_list background_visible="true" bottom_delta="65" draw_border="true"
17 draw_stripes="true" 17 draw_stripes="false" sort_column="0"
18 follows="top|left|bottom" height="300" left="10" multi_select="false" 18 follows="top|left|bottom" height="300" left="10" multi_select="false"
19 name="grid_selector" width="170"> 19 name="grid_selector" width="170">
20 <column label="" name="grid" width="200" /> 20 <column label="Grid List" name="grid" width="170" />
21 </scroll_list> 21 </scroll_list>
22 22
23 <!-- Grid Selector Buttons --> 23 <!-- Grid Selector Buttons -->
@@ -122,7 +122,7 @@
122 halign="center" follows="left|top" scale_image="true" 122 halign="center" follows="left|top" scale_image="true"
123 font="SansSerifSmall" mouse_opaque="true" /> 123 font="SansSerifSmall" mouse_opaque="true" />
124 <button bottom_delta="0" follows="left|top" font="SansSerifSmall" halign="center" 124 <button bottom_delta="0" follows="left|top" font="SansSerifSmall" halign="center"
125 height="18" label="Clear All" left_delta="104" 125 height="18" label="Clear Info" left_delta="104"
126 mouse_opaque="true" name="btn_clear" scale_image="true" width="100" /> 126 mouse_opaque="true" name="btn_clear" scale_image="true" width="100" />
127 127
128 <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" 128 <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
@@ -247,13 +247,13 @@
247 height="24" label="Connect" label_selected="Connect" 247 height="24" label="Connect" label_selected="Connect"
248 left="280" mouse_opaque="true" name="connect_btn" scale_image="TRUE" 248 left="280" mouse_opaque="true" name="connect_btn" scale_image="TRUE"
249 width="100" /> --> 249 width="100" /> -->
250 <button bottom="8" follows="right|bottom" font="SansSerif" halign="center" 250 <button bottom="2" follows="right|bottom" font="SansSerif" halign="center"
251 height="24" label="Apply" label_selected="Apply" left="-108" 251 height="24" label="Apply" label_selected="Apply" left="-108"
252 mouse_opaque="true" name="btn_apply" scale_image="TRUE" width="100" /> 252 mouse_opaque="true" name="btn_apply" scale_image="TRUE" width="100" />
253 <button bottom="8" follows="right|bottom" font="SansSerif" halign="center" 253 <button bottom="2" follows="right|bottom" font="SansSerif" halign="center"
254 height="24" label="Cancel" label_selected="Cancel" left_delta="-104" 254 height="24" label="Cancel" label_selected="Cancel" left_delta="-104"
255 mouse_opaque="true" name="btn_cancel" scale_image="TRUE" width="100" /> 255 mouse_opaque="true" name="btn_cancel" scale_image="TRUE" width="100" />
256 <button bottom="8" follows="right|bottom" font="SansSerif" halign="center" 256 <button bottom="2" follows="right|bottom" font="SansSerif" halign="center"
257 height="24" label="OK" label_selected="OK" left_delta="-104" 257 height="24" label="OK" label_selected="OK" left_delta="-104"
258 mouse_opaque="true" name="btn_ok" scale_image="TRUE" width="100" /> 258 mouse_opaque="true" name="btn_ok" scale_image="TRUE" width="100" />
259 <!-- 259 <!--
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
index 5677073..57c401e 100644
--- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
@@ -6864,6 +6864,47 @@ You have been disconnected from the region you were in. Unable to continue.
6864</notification> 6864</notification>
6865 6865
6866<notification 6866<notification
6867 icon="alertmodal.tga"
6868 name="GridsNoNick"
6869 type="alertmodal">
6870Cannot save new grid information.
6871
6872You need to specify a unique grid nickname.
6873</notification>
6874
6875<notification
6876 icon="alertmodal.tga"
6877 name="GridsNoLoginUri"
6878 type="alertmodal">
6879Cannot save new grid '[NAME]'.
6880
6881You need to specify a login URI.
6882</notification>
6883
6884<notification
6885 icon="alertmodal.tga"
6886 name="GridExists"
6887 type="alertmodal">
6888Cannot save new grid '[NAME]'.
6889
6890A grid with the same nickname already exists.
6891</notification>
6892
6893<notification
6894 icon="alertmodal.tga"
6895 name="GridInfoNoLoginUri"
6896 type="alertmodal">
6897A login URI is required to retrieve the grid info.
6898</notification>
6899
6900<notification
6901 icon="alertmodal.tga"
6902 name="GridInfoError"
6903 type="alertmodal">
6904Cannot retrieve grid info from server.
6905</notification>
6906
6907<notification
6867 icon="alert.tga" 6908 icon="alert.tga"
6868 name="IMLogNotFound" 6909 name="IMLogNotFound"
6869 type="alert"> 6910 type="alert">