Fix webserver 'Test login' button
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8127 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d14f2cd4eee73201481babfea93fed5a875430c8 Former-commit-id: 9b5ff6d11c9c332acc0519f1fda0d309a8395688
This commit is contained in:
parent
7309853b9b
commit
71eb0cb878
2 changed files with 29 additions and 2 deletions
|
@ -740,9 +740,13 @@ int WebServer::sendLogin (int userId)
|
|||
int WebServer::sendLogin (const char* username, const char* password)
|
||||
{
|
||||
//if the webserver is disabled exit immediately
|
||||
/*
|
||||
if(!this->isWebServerEnabled){
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
// Commented out above to allow the 'Test login' button from Player config menu to work
|
||||
// for pre-race loginthe above check has already been done in WebServer::sendLogin (int userId)
|
||||
std::string serverReply;
|
||||
|
||||
//prepare the string to send
|
||||
|
|
|
@ -78,6 +78,7 @@ static int AutoReverseLabelId;
|
|||
static int WebUsernameEditId;
|
||||
static int WebPasswordEditId;
|
||||
static int WebServerCheckboxId;
|
||||
static int WebServerTestLoginId;
|
||||
#endif //WEBSERVER
|
||||
|
||||
/* Struct to define a generic ("internal name / id", "displayable name") pair */
|
||||
|
@ -292,6 +293,21 @@ static const char *Yn[] = {HM_VAL_YES, HM_VAL_NO};
|
|||
|
||||
static int ReloadValues = 1;
|
||||
|
||||
#ifdef WEBSERVER
|
||||
static void
|
||||
updateWebserverControls(int enabled)
|
||||
{
|
||||
int flag = GFUI_DISABLE;
|
||||
if(enabled)
|
||||
{
|
||||
flag = GFUI_ENABLE;
|
||||
}
|
||||
GfuiEnable(ScrHandle, WebServerTestLoginId, flag);
|
||||
GfuiEnable(ScrHandle, WebPasswordEditId, flag);
|
||||
GfuiEnable(ScrHandle, WebUsernameEditId, flag);
|
||||
}
|
||||
#endif //WEBSERVER
|
||||
|
||||
/* Load screen editable fields with relevant values :
|
||||
- all empty if no player selected,
|
||||
- from selected player current settings otherwise
|
||||
|
@ -330,6 +346,9 @@ refreshEditVal(void)
|
|||
|
||||
GfuiCheckboxSetChecked(ScrHandle, WebServerCheckboxId, 0);
|
||||
GfuiEnable(ScrHandle, WebPasswordEditId, GFUI_DISABLE);
|
||||
|
||||
GfuiEnable(ScrHandle, WebServerTestLoginId, GFUI_DISABLE);
|
||||
|
||||
#endif //WEBSERVER
|
||||
|
||||
} else {
|
||||
|
@ -368,7 +387,10 @@ refreshEditVal(void)
|
|||
GfuiEnable(ScrHandle, WebPasswordEditId, GFUI_ENABLE);
|
||||
|
||||
GfuiCheckboxSetChecked(ScrHandle, WebServerCheckboxId, (*CurrPlayer)->webserverenabled());
|
||||
GfuiEnable(ScrHandle, WebServerCheckboxId, GFUI_DISABLE);
|
||||
GfuiEnable(ScrHandle, WebServerCheckboxId, GFUI_ENABLE);
|
||||
|
||||
updateWebserverControls((*CurrPlayer)->webserverenabled());
|
||||
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
|
@ -917,6 +939,7 @@ onChangeWebserverenabled(tCheckBoxInfo* pInfo)
|
|||
if (CurrPlayer != PlayersInfo.end()) {
|
||||
isChecked = GfuiCheckboxIsChecked(ScrHandle, WebServerCheckboxId);
|
||||
(*CurrPlayer)->setWebserverEnabled(isChecked);
|
||||
updateWebserverControls(isChecked);
|
||||
//GfLogInfo("WebServer features: %i\n", isChecked);
|
||||
//GfLogInfo("WebServer features: %i\n", (*CurrPlayer)->webserverenabled());
|
||||
|
||||
|
@ -1147,7 +1170,7 @@ PlayerConfigMenuInit(void *prevMenu)
|
|||
WebPasswordEditId = GfuiMenuCreateEditControl(ScrHandle, param, "webpasswordedit", NULL, NULL, onChangeWebserverpassword);
|
||||
|
||||
/* Web test button */
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "weblogintest", NULL, onWebserverLoginTest);
|
||||
WebServerTestLoginId = GfuiMenuCreateButtonControl(ScrHandle, param, "weblogintest", NULL, onWebserverLoginTest);
|
||||
|
||||
WebServerCheckboxId =
|
||||
GfuiMenuCreateCheckboxControl(ScrHandle, param, "webservercheckbox", NULL, onChangeWebserverenabled);
|
||||
|
|
Loading…
Reference in a new issue