diff options
author | Alexander Tkachev | 2016-07-29 12:22:42 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 712410496e4e59fe1ee1968a94eeb73b51223996 (patch) | |
tree | 52bb3eebf39c168cb1301c4b17bc021553f8ca99 /backends | |
parent | 4f0c071e53ed1be17bd9bdd0079e585f0a1bf55c (diff) | |
download | scummvm-rg350-712410496e4e59fe1ee1968a94eeb73b51223996.tar.gz scummvm-rg350-712410496e4e59fe1ee1968a94eeb73b51223996.tar.bz2 scummvm-rg350-712410496e4e59fe1ee1968a94eeb73b51223996.zip |
CLOUD: Fix UploadFileClientHandler
It now redirects user on success not only when file was the last field
in the content, but also when it was uploaded already and Handler worked
further to search for more files.
Diffstat (limited to 'backends')
-rw-r--r-- | backends/networking/sdl_net/uploadfileclienthandler.cpp | 32 | ||||
-rw-r--r-- | backends/networking/sdl_net/uploadfileclienthandler.h | 1 |
2 files changed, 19 insertions, 14 deletions
diff --git a/backends/networking/sdl_net/uploadfileclienthandler.cpp b/backends/networking/sdl_net/uploadfileclienthandler.cpp index e2832bcba5..ee02915d6f 100644 --- a/backends/networking/sdl_net/uploadfileclienthandler.cpp +++ b/backends/networking/sdl_net/uploadfileclienthandler.cpp @@ -167,18 +167,7 @@ void UploadFileClientHandler::handleBlockContent(Client *client) { if (client->noMoreContent()) { // success - redirect back to directory listing - HandlerUtils::setMessageHandler( - *client, - Common::String::format( - "%s<br/><a href=\"files?path=%s\">%s</a>", - _("Uploaded successfully!"), - client->queryParameter("path").c_str(), - _("Back to parent directory") - ), - (client->queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + - LocalWebserver::urlEncodeQueryParameterValue(client->queryParameter("path")) - ); - _state = UFH_STOP; + setSuccessHandler(*client); return; } } @@ -189,9 +178,8 @@ void UploadFileClientHandler::handleBlockContent(Client *client) { if (_uploadedFiles == 0) { setErrorMessageHandler(*client, _("No file was passed!")); } else { - _state = UFH_STOP; + setSuccessHandler(*client); } - return; } } @@ -200,4 +188,20 @@ void UploadFileClientHandler::setErrorMessageHandler(Client &client, Common::Str _state = UFH_ERROR; } +void UploadFileClientHandler::setSuccessHandler(Client &client) { + // success - redirect back to directory listing + HandlerUtils::setMessageHandler( + client, + Common::String::format( + "%s<br/><a href=\"files?path=%s\">%s</a>", + _("Uploaded successfully!"), + client.queryParameter("path").c_str(), + _("Back to parent directory") + ), + (client.queryParameter("ajax") == "true" ? "/filesAJAX?path=" : "/files?path=") + + LocalWebserver::urlEncodeQueryParameterValue(client.queryParameter("path")) + ); + _state = UFH_STOP; +} + } // End of namespace Networking diff --git a/backends/networking/sdl_net/uploadfileclienthandler.h b/backends/networking/sdl_net/uploadfileclienthandler.h index 4aa6929888..b6481cf18f 100644 --- a/backends/networking/sdl_net/uploadfileclienthandler.h +++ b/backends/networking/sdl_net/uploadfileclienthandler.h @@ -56,6 +56,7 @@ class UploadFileClientHandler: public ClientHandler { void handleBlockHeaders(Client *client); void handleBlockContent(Client *client); void setErrorMessageHandler(Client &client, Common::String message); + void setSuccessHandler(Client &client); public: UploadFileClientHandler(Common::String parentDirectoryPath); |