Remove hardcoded URLs in favour of the web URL provided by the shard

ryzomclassic-develop
kaetemi 3 years ago
parent fc3f0355a5
commit deb1c7c131
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -100,8 +100,8 @@ SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING
SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL") SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL")
SET(RYZOM_CLIENT_APP_NAME "default") SET(RYZOM_CLIENT_APP_NAME "default")
SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL") SET(RYZOM_CLIENT_RELEASENOTES_URL "https://open.ryzom.dev/releasenotes/index.php" CACHE STRING "Ryzom Client Release Notes URL")
SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain") SET(RYZOM_CLIENT_RELEASENOTES_RING_URL "https://open.ryzom.dev/releasenotes_ring/index.php" CACHE STRING "Ryzom Client Release Notes URL")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# urls when compiling ryzom live client # urls when compiling ryzom live client
@ -113,8 +113,8 @@ IF(WITH_RYZOM_LIVE)
SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live") SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live")
SET(RYZOM_CLIENT_APP_NAME "ryzom_live") SET(RYZOM_CLIENT_APP_NAME "ryzom_live")
SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/") SET(RYZOM_CLIENT_RELEASENOTES_URL "https://app.ryzom.com/releasenotes/index.php")
SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com") SET(RYZOM_CLIENT_RELEASENOTES_RING_URL "https://app.ryzom.com/releasenotes_ring/index.php")
ENDIF() ENDIF()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

@ -39,8 +39,8 @@
#cmakedefine RYZOM_CLIENT_PATCH_URL "${RYZOM_CLIENT_PATCH_URL}" #cmakedefine RYZOM_CLIENT_PATCH_URL "${RYZOM_CLIENT_PATCH_URL}"
#cmakedefine RYZOM_CLIENT_APP_NAME "${RYZOM_CLIENT_APP_NAME}" #cmakedefine RYZOM_CLIENT_APP_NAME "${RYZOM_CLIENT_APP_NAME}"
#cmakedefine RYZOM_WEBIG_MAIN_URL "${RYZOM_WEBIG_MAIN_URL}" #cmakedefine RYZOM_CLIENT_RELEASENOTES_RING_URL "${RYZOM_CLIENT_RELEASENOTES_RING_URL}"
#cmakedefine RYZOM_WEBIG_TRUSTED_DOMAIN "${RYZOM_WEBIG_TRUSTED_DOMAIN}" #cmakedefine RYZOM_CLIENT_RELEASENOTES_URL "${RYZOM_CLIENT_RELEASENOTES_URL}"
#cmakedefine AUTHOR "${AUTHOR}" #cmakedefine AUTHOR "${AUTHOR}"
#cmakedefine YEAR "${YEAR}" #cmakedefine YEAR "${YEAR}"

@ -71,6 +71,9 @@ namespace NLGUI
std::string languageCode; std::string languageCode;
/// List of domains the widget can consider secure. /// List of domains the widget can consider secure.
std::vector<std::string> trustedDomains; std::vector<std::string> trustedDomains;
/// Web server
std::string webServer;
std::string webServerDomain;
/// Maximum concurrent MultiCurl connections per CGroupHTML instance /// Maximum concurrent MultiCurl connections per CGroupHTML instance
sint32 curlMaxConnections; sint32 curlMaxConnections;

@ -269,6 +269,9 @@ namespace NLGUI
// Check if domain is on TrustedDomain // Check if domain is on TrustedDomain
bool CGroupHTML::isTrustedDomain(const string &domain) bool CGroupHTML::isTrustedDomain(const string &domain)
{ {
if (domain == options.webServerDomain)
return true;
vector<string>::iterator it; vector<string>::iterator it;
it = find(options.trustedDomains.begin(), options.trustedDomains.end(), domain); it = find(options.trustedDomains.begin(), options.trustedDomains.end(), domain);
return it != options.trustedDomains.end(); return it != options.trustedDomains.end();
@ -3272,6 +3275,11 @@ namespace NLGUI
string finalUrl; string finalUrl;
bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true); bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true);
if (!isLocal && _URL.c_str()[0] == '/' && !options.webServer.empty())
finalUrl = options.webServer + finalUrl;
// FIXME: In case options.webServer is empty(), can we defer browsing? -Kaetemi
_URL = finalUrl; _URL = finalUrl;
CUrlParser uri (_URL); CUrlParser uri (_URL);

@ -608,9 +608,7 @@ HelpPages =
}; };
// interval in minutes for webig notify thread to run // interval in minutes for webig notify thread to run
WebIgMainDomain = "https://classic.ryzom.dev";
WebIgTrustedDomains = { WebIgTrustedDomains = {
"classic.ryzom.dev"
}; };
SelectedSlot = 0; SelectedSlot = 0;

@ -223,7 +223,7 @@
<ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:webig:content:html" /> <ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:webig:content:html" />
</group> </group>
<group id="content" x="0" y="0" w="0" h="0" posref="TL TL"> <group id="content" x="0" y="0" w="0" h="0" posref="TL TL">
<group type="webig_html" id="html" posref="TL TL" url="" home="http://app.ryzom.com/index.php" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:webig:header_opened:browse_refresh" browse_undo="ui:interface:webig:header_opened:browse_undo" browse_redo="ui:interface:webig:header_opened:browse_redo"> <group type="webig_html" id="html" posref="TL TL" url="" home="/webig/mailbox.php" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:webig:header_opened:browse_refresh" browse_undo="ui:interface:webig:header_opened:browse_undo" browse_redo="ui:interface:webig:header_opened:browse_redo">
<group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" /> <group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" />
<instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" /> <instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" />
@ -244,7 +244,7 @@
<ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:web_transactions:content:html" /> <ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:web_transactions:content:html" />
</group> </group>
<group id="content" x="0" y="0" w="0" h="0" posref="TL TL"> <group id="content" x="0" y="0" w="0" h="0" posref="TL TL">
<group type="webig_html" id="html" posref="TL TL" url="" home="http://app.ryzom.com/init_ig.php" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:web_transactions:header_opened:browse_refresh" browse_undo="ui:interface:web_transactions:header_opened:browse_undo" browse_redo="ui:interface:web_transactions:header_opened:browse_redo"> <group type="webig_html" id="html" posref="TL TL" url="" home="/webig/mailbox.php" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:web_transactions:header_opened:browse_refresh" browse_undo="ui:interface:web_transactions:header_opened:browse_undo" browse_redo="ui:interface:web_transactions:header_opened:browse_redo">
<group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" /> <group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" />
<instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" /> <instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" />
@ -265,7 +265,7 @@
<ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:web_lua_action:content:html" /> <ctrl style="text_button_header" button_type="push_button" id="browse_home" posparent="browse_refresh" posref="ML MR" x="-4" y="0" hardtext="uiBrowseHome" tooltip="uittBrowseHome" onclick_l="browse_home" params_l="name=ui:interface:web_lua_action:content:html" />
</group> </group>
<group id="content" x="0" y="0" w="0" h="0" posref="TL TL"> <group id="content" x="0" y="0" w="0" h="0" posref="TL TL">
<group type="webig_html" id="html" posref="TL TL" url="" home="http://app.ryzom.com/" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:web_lua_action:header_opened:browse_refresh" browse_undo="ui:interface:web_lua_action:header_opened:browse_undo" browse_redo="ui:interface:web_lua_action:header_opened:browse_redo"> <group type="webig_html" id="html" posref="TL TL" url="" home="/webig/mailbox.php" sizeref="wh" x="0" y="0" w="0" h="0" background_color="0 0 0 255" error_color="255 240 48 255" link_color="240 155 100 255" text_color="210 210 210 255" h1_color="255 255 255 255" h2_color="255 255 255 255" h3_color="255 255 255 255" h4_color="255 255 255 255" h5_color="255 255 255 255" h6_color="255 255 255 255" text_font_size="10" h1_font_size="20" h2_font_size="18" h3_font_size="16" h4_font_size="14" h5_font_size="12" h6_font_size="12" paragraph_begin_space="12" multi_line_space_factor="0.25" td_begin_space="0" li_begin_space="4" ul_begin_space="12" li_indent="-10" ul_indent="30" checkbox_bitmap_normal="w_slot_on.tga" checkbox_bitmap_pushed="w_opacity_on.tga" checkbox_bitmap_over="" background_bitmap_view="black2" browse_next_time="false" form_text_area_group="edit_box_widget_multiline" browse_refresh="ui:interface:web_lua_action:header_opened:browse_refresh" browse_undo="ui:interface:web_lua_action:header_opened:browse_undo" browse_redo="ui:interface:web_lua_action:header_opened:browse_redo">
<group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" /> <group id="black" posref="BR BR" sizeref="hw" w="-10" h="-12" inherit_gc_alpha="true" />
<instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" /> <instance template="inner_thin_border" posparent="black" inherit_gc_alpha="true" />

@ -223,7 +223,7 @@
</group> </group>
</group> </group>
</group> </group>
<define id="cs_url" value="http://app.ryzom.com/ticket_system/index.php?mode=load" /> <define id="cs_url" value="/ticket_system/index.php?mode=load" />
<group type="container" id="cs_browser" w="410" h="400" title="uiHelp" global_color="false" header_color="UI:SAVE:WIN:COLORS:HELP" resizer="true" pop_min_w="400" pop_min_h="96" pop_max_w="2000" pop_max_h="1600" title_bar_open="false" open_button="false" force_open_out="true" lockable="true" openable="true" opened="true" movable="true" active="true"> <group type="container" id="cs_browser" w="410" h="400" title="uiHelp" global_color="false" header_color="UI:SAVE:WIN:COLORS:HELP" resizer="true" pop_min_w="400" pop_min_h="96" pop_max_w="2000" pop_max_h="1600" title_bar_open="false" open_button="false" force_open_out="true" lockable="true" openable="true" opened="true" movable="true" active="true">
<group id="header_closed" x="0" y="0" h="12" posref="TL TL" group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color" on_active="lua" on_active_params="help:closeCSBrowserHeader('cs_browser')"> <group id="header_closed" x="0" y="0" h="12" posref="TL TL" group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color" on_active="lua" on_active_params="help:closeCSBrowserHeader('cs_browser')">
</group> </group>

@ -434,14 +434,13 @@ CClientConfig::CClientConfig()
#endif #endif
PatchVersion.clear(); PatchVersion.clear();
WebIgMainDomain = RYZOM_WEBIG_MAIN_URL; // https://open.ryzom.dev/" WebIgTrustedDomains.clear();
WebIgTrustedDomains.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN); // open.ryzom.dev
CurlMaxConnections = 5; CurlMaxConnections = 5;
CurlCABundle.clear(); CurlCABundle.clear();
RingReleaseNotePath = WebIgMainDomain + "/releasenotes_ring/index.php"; RingReleaseNotePath = RYZOM_CLIENT_RELEASENOTES_RING_URL;
ReleaseNotePath = WebIgMainDomain + "/releasenotes/index.php"; ReleaseNotePath = RYZOM_CLIENT_RELEASENOTES_URL;
/////////////// ///////////////
@ -1109,10 +1108,6 @@ void CClientConfig::setValues()
/////////// ///////////
// WEBIG // // WEBIG //
READ_STRING_FV(WebIgMainDomain);
if (ClientCfg.WebIgMainDomain.find("http://") == std::string::npos
|| ClientCfg.WebIgMainDomain.find("https://") == std::string::npos)
ClientCfg.WebIgMainDomain = "http://" + ClientCfg.WebIgMainDomain;
READ_STRINGVECTOR_FV(WebIgTrustedDomains); READ_STRINGVECTOR_FV(WebIgTrustedDomains);
READ_INT_FV(CurlMaxConnections); READ_INT_FV(CurlMaxConnections);
if (ClientCfg.CurlMaxConnections < 0) if (ClientCfg.CurlMaxConnections < 0)

@ -321,7 +321,6 @@ struct CClientConfig
std::string RingReleaseNotePath; std::string RingReleaseNotePath;
std::string ReleaseNotePath; std::string ReleaseNotePath;
std::string WebIgMainDomain;
std::vector<string> WebIgTrustedDomains; std::vector<string> WebIgTrustedDomains;
sint32 CurlMaxConnections; sint32 CurlMaxConnections;

@ -373,62 +373,18 @@ string urlencode(const string &param)
// *************************************************************************** // ***************************************************************************
class CAHUIShowHide : public IActionHandler class CAHUIShowHide : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const string &Params) virtual void execute (CCtrlBase *pCaller, const string &Params)
{ {
string webapp, window = Params;
vector<string> res;
explode(Params, string("|"), res);
if(res[0]=="webig" || res[0]=="mailbox" || res[0]=="guild_forum" || res[0]=="profile")
{
window = "webig";
if(res[0]=="mailbox")
webapp = "mail";
else if(res[0]=="guild_forum")
webapp = "forum";
else if(res[0]=="profile")
webapp = "profile&pname="+urlencode(getParam(Params,"pname"))+"&ptype="+getParam(Params,"ptype");
else
webapp = "web";
}
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface", window)); CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface", Params));
if (pGC == NULL) if (pGC == NULL)
{ {
nlwarning("%s is not a container", window.c_str()); nlwarning("%s is not a container", Params.c_str());
return; return;
} }
if (!isContainerAuthorized(pGC)) return; if (!isContainerAuthorized(pGC)) return;
if(window == "webig")
{
if(pGC->getActive() && currentWebApp == webapp)
{
pGC->setActive(false);
currentWebApp.clear();
}
else
{
pGC->setActive(true);
currentWebApp = webapp;
}
if(!webapp.empty() && pGC->getActive())
{
CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html"));
if (pGH == NULL)
{
nlwarning("%s is not a group html", window.c_str());
return;
}
pGH->setURL(ClientCfg.WebIgMainDomain + "/index.php?app=" + webapp);
}
}
else
{
// normal open/close swap
pGC->setActive(!pGC->getActive()); pGC->setActive(!pGC->getActive());
} }
}
}; };
REGISTER_ACTION_HANDLER( CAHUIShowHide, "show_hide" ); REGISTER_ACTION_HANDLER( CAHUIShowHide, "show_hide" );

@ -120,13 +120,12 @@ string CGroupHTMLForum::home () const
void CGroupHTMLForum::handle () void CGroupHTMLForum::handle ()
{ {
/* // Do nothing if WebServer is not initialized // Do nothing if WebServer is not initialized
if (!WebServer.empty()) if (!WebServer.empty())
{ {
Home = WebServer+"forum.php"; Home = "/webig/forum.php";
CGroupHTML::handle (); CGroupHTML::handle ();
} }
*/
} }
// *************************************************************************** // ***************************************************************************

@ -90,12 +90,11 @@ string CGroupHTMLMail::home () const
void CGroupHTMLMail::handle () void CGroupHTMLMail::handle ()
{ {
// Do nothing if WebServer is not initialized // Do nothing if WebServer is not initialized
/* if (!WebServer.empty()) if (!WebServer.empty())
{ {
Home = WebServer+"mailbox.php"; Home = "/webig/mailbox.php";
CGroupHTML::handle (); CGroupHTML::handle ();
} }
*/
} }
// *************************************************************************** // ***************************************************************************

@ -75,6 +75,7 @@
#include "group_skills.h" #include "group_skills.h"
#include "group_compas.h" #include "group_compas.h"
#include "nel/gui/group_html.h" #include "nel/gui/group_html.h"
#include <nel/gui/url_parser.h>
// Misc // Misc
#include "../input.h" #include "../input.h"
@ -458,6 +459,13 @@ CInterfaceManager* CInterfaceManager::getInstance()
return _Instance; return _Instance;
} }
void setGroupHTMLWebServer(const std::string &webServer)
{
CUrlParser uri(webServer);
CGroupHTML::options.webServer = webServer;
CGroupHTML::options.webServerDomain = uri.host;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CInterfaceManager::CInterfaceManager() CInterfaceManager::CInterfaceManager()
{ {

@ -503,6 +503,7 @@ void impulseServerReady(NLMISC::CBitMemStream &impulse)
LoginSM.pushEvent(CLoginStateMachine::ev_ready_received); LoginSM.pushEvent(CLoginStateMachine::ev_ready_received);
} }
void setGroupHTMLWebServer(const std::string &webServer);
void impulseShardId(NLMISC::CBitMemStream &impulse) void impulseShardId(NLMISC::CBitMemStream &impulse)
{ {
// received SHARD_ID // received SHARD_ID
@ -513,9 +514,16 @@ void impulseShardId(NLMISC::CBitMemStream &impulse)
string webHost; string webHost;
impulse.serial(webHost); impulse.serial(webHost);
if (!webHost.empty())
{
if (webHost[webHost.size() - 1] == '/') // strip trailing slash
webHost.resize(webHost.size() - 1);
if (!webHost.empty()) if (!webHost.empty())
{ {
WebServer = webHost; WebServer = webHost;
setGroupHTMLWebServer(webHost);
}
} }
nlinfo("WEB: Received SHARD_ID %d, web hosted at '%s', using '%s'", shardId, webHost.c_str(), WebServer.c_str()); nlinfo("WEB: Received SHARD_ID %d, web hosted at '%s', using '%s'", shardId, webHost.c_str(), WebServer.c_str());
@ -3266,43 +3274,12 @@ private:
// get the content string (should have been received!) // get the content string (should have been received!)
string contentStr; string contentStr;
string titleStr;
if(!pSMC->getDynString(_TextId[ContentType], contentStr)) if(!pSMC->getDynString(_TextId[ContentType], contentStr))
return; return;
if(!pSMC->getDynString(_TextId[TitleType], titleStr))
return;
// if the string start with a @{Wxxxx} code, remove it and get the wanted window size // if the string start with a @{Wxxxx} code, remove it and get the wanted window size
sint w = 256; // default size to 256 !! sint w = 256; // default size to 256 !!
bool is_webig = false; if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W')
if(contentStr.size()>=6 && contentStr[0]=='W' && contentStr[1]=='E' && contentStr[2]=='B'
&& contentStr[3]==' ' && contentStr[4]==':' && contentStr[5]==' ' )
{
uint i;
const uint digitStart= 6;
const uint digitMaxEnd= (uint)contentStr.size();
is_webig = true;
for(i = digitStart; i < digitMaxEnd; i++)
{
if(contentStr[i] == ' ')
break;
}
if(i != digitMaxEnd)
{
string web_app = contentStr.substr(digitStart, i-digitStart);
contentStr = string(ClientCfg.WebIgMainDomain + "/") + web_app + string("/index.php?") + contentStr.substr((size_t)i + 1);
}
else
{
contentStr.clear();
i = digitStart;
}
}
else if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W')
{ {
uint i; uint i;
const uint digitStart= 3; const uint digitStart= 3;
@ -3322,45 +3299,9 @@ private:
} }
} }
// open the message box window or web ig // open the message box window
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if (is_webig)
{
CGroupHTML *groupHtml;
string group = titleStr;
// <missing:XXX>
group = group.substr(9, group.size()-10);
groupHtml = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html"));
if (!groupHtml)
{
groupHtml = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html"));
group = "webig";
}
if (groupHtml)
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group));
if (pGC)
{
if (contentStr.empty())
{
pGC->setActive(false);
}
else
{
if (group == "webig")
pGC->setActive(true);
string url = contentStr;
addWebIGParams(url, true);
groupHtml->browse(url.c_str());
CWidgetManager::getInstance()->setTopWindow(pGC);
}
}
}
}
else
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:server_message_box")); CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:server_message_box"));
if (pGC) if (pGC)
{ {

Loading…
Cancel
Save