many changes towards cgi handling for jetserver.
This commit is contained in:
parent
2a7c27dac5
commit
c5ec0732a1
BIN
Debug/main.cpp.o
BIN
Debug/main.cpp.o
Binary file not shown.
@ -8,10 +8,14 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
|
||||
../ServerCore/CommandList.h ../ServerCore/EPoll.h \
|
||||
../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
|
||||
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \
|
||||
HTTPSessions.h ../ServerCore/Header.h ../ServerCore/Response.h \
|
||||
PageList.h ../ServerCore/CommandList.h ../ServerCore/Session.h __index.h \
|
||||
HTTPPage.h HTTPSession.h __setupadmin.h __favicon_ico.h HTTPHandler.h \
|
||||
../ServerCore/Command.h
|
||||
HTTPSessions.h HTTPRequest.h ../CoreUtils/PString.h \
|
||||
../CoreUtils/includes ../CoreUtils/IMFMessage.h ../CoreUtils/PString.h \
|
||||
../CoreUtils/IMFHeader.h ../CoreUtils/IMFRequest.h \
|
||||
../CoreUtils/IMFBody.h ../CoreUtils/IMFRequest.h \
|
||||
../CoreUtils/IMFResponse.h ../CoreUtils/IMFMessage.h HTTPPageList.h \
|
||||
../ServerCore/Session.h __index.h HTTPPage.h HTTPSession.h __script.h \
|
||||
__editview.h __style.h __setupadmin.h __favicon_ico.h __welcome.h \
|
||||
__mainmenu.h __newview.h HTTPHandler.h ../ServerCore/Command.h
|
||||
|
||||
../ServerCore/includes:
|
||||
|
||||
@ -63,13 +67,29 @@ HTTPService.h:
|
||||
|
||||
HTTPSessions.h:
|
||||
|
||||
../ServerCore/Header.h:
|
||||
HTTPRequest.h:
|
||||
|
||||
../ServerCore/Response.h:
|
||||
../CoreUtils/PString.h:
|
||||
|
||||
PageList.h:
|
||||
../CoreUtils/includes:
|
||||
|
||||
../ServerCore/CommandList.h:
|
||||
../CoreUtils/IMFMessage.h:
|
||||
|
||||
../CoreUtils/PString.h:
|
||||
|
||||
../CoreUtils/IMFHeader.h:
|
||||
|
||||
../CoreUtils/IMFRequest.h:
|
||||
|
||||
../CoreUtils/IMFBody.h:
|
||||
|
||||
../CoreUtils/IMFRequest.h:
|
||||
|
||||
../CoreUtils/IMFResponse.h:
|
||||
|
||||
../CoreUtils/IMFMessage.h:
|
||||
|
||||
HTTPPageList.h:
|
||||
|
||||
../ServerCore/Session.h:
|
||||
|
||||
@ -79,10 +99,22 @@ HTTPPage.h:
|
||||
|
||||
HTTPSession.h:
|
||||
|
||||
__script.h:
|
||||
|
||||
__editview.h:
|
||||
|
||||
__style.h:
|
||||
|
||||
__setupadmin.h:
|
||||
|
||||
__favicon_ico.h:
|
||||
|
||||
__welcome.h:
|
||||
|
||||
__mainmenu.h:
|
||||
|
||||
__newview.h:
|
||||
|
||||
HTTPHandler.h:
|
||||
|
||||
../ServerCore/Command.h:
|
||||
|
@ -1,34 +1,35 @@
|
||||
#include "HTTPHandler.h"
|
||||
#include "HTTPSession.h"
|
||||
#include "HTTPService.h"
|
||||
#include "HTTPRequest.h"
|
||||
#include "PString.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
int HTTPHandler::processCommand(std::string request, core::Session *session, std::stringstream &data) {
|
||||
|
||||
core::Header header(request);
|
||||
core::Response response;
|
||||
coreutils::PString request1(request);
|
||||
HTTPRequest httpRequest(request1);
|
||||
|
||||
core::Log(core::LOG_DEBUG_1) << "Request: " << request;
|
||||
core::Log(core::LOG_DEBUG_2) << "Host value is " << httpRequest.getHeader("Host");
|
||||
core::Log(core::LOG_DEBUG_3) << "Request: " << request;
|
||||
|
||||
HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(header, response);
|
||||
HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(httpRequest);
|
||||
|
||||
std::stringstream content;
|
||||
if(((HTTPService &)session->service).pageList.processRequest(header.getPath() + " ", session, httpSession, content)) {
|
||||
response.setProtocol(header.requestProtocol());
|
||||
response.setCode("200");
|
||||
response.setText("OK");
|
||||
response.setMimeType("text/html");
|
||||
data << response.getResponse(content.str());
|
||||
if(((HTTPService &)session->service).pageList.processRequest(httpRequest.request.getURI(), session, httpSession, httpRequest, content)) {
|
||||
httpRequest.response.setProtocol(httpRequest.request.getProtocol());
|
||||
httpRequest.response.setCode("200");
|
||||
httpRequest.response.setText("OK");
|
||||
data << httpRequest.response.getResponse(content.str());
|
||||
}
|
||||
|
||||
else {
|
||||
response.setProtocol(header.requestProtocol());
|
||||
response.setCode("404");
|
||||
response.setText("Not Found");
|
||||
response.setMimeType("text/html");
|
||||
data << response.getResponse(content.str());
|
||||
httpRequest.response.setProtocol(httpRequest.request.getProtocol());
|
||||
httpRequest.response.setCode("404");
|
||||
httpRequest.response.setText("Not Found");
|
||||
data << httpRequest.response.getResponse(content.str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include "Command.h"
|
||||
#include "Session.h"
|
||||
#include "Header.h"
|
||||
#include "Response.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace http {
|
||||
|
20
HTTPPage.h
20
HTTPPage.h
@ -2,13 +2,29 @@
|
||||
#define __HTTPPage_h__
|
||||
|
||||
#include "HTTPSession.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class HTTPPage : public core::Object {
|
||||
|
||||
public:
|
||||
virtual int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) {
|
||||
public:
|
||||
bool check(std::string request) {
|
||||
if(request != "") {
|
||||
if(name.length() > 0) {
|
||||
if(name == request)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int processCommand(std::string request,
|
||||
core::Session *session,
|
||||
HTTPSession *httpSession,
|
||||
HTTPRequest &httpRequest,
|
||||
std::stringstream &data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
bool HTTPPageList::processRequest(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) {
|
||||
bool HTTPPageList::processRequest(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) {
|
||||
for(auto *page : pages) {
|
||||
if(page->check(request)) {
|
||||
page->processCommand(request, session, httpSession, data);
|
||||
page->processCommand(request, session, httpSession, httpRequest, data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,8 @@ namespace http {
|
||||
}
|
||||
|
||||
void HTTPPageList::add(HTTPPage &page, std::string name) {
|
||||
page.setName(name);
|
||||
pages.push_back(&command);
|
||||
page.name = name;
|
||||
pages.push_back(&page);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,16 @@
|
||||
#define __HTTPPageList_h__
|
||||
|
||||
#include "Session.h"
|
||||
#include "HTTPRequest.h"
|
||||
#include "__index.h"
|
||||
#include "__script.h"
|
||||
#include "__editview.h"
|
||||
#include "__style.h"
|
||||
#include "__setupadmin.h"
|
||||
#include "__favicon_ico.h"
|
||||
#include "__welcome.h"
|
||||
#include "__mainmenu.h"
|
||||
#include "__newview.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
@ -12,12 +19,18 @@ namespace http {
|
||||
|
||||
public:
|
||||
HTTPPageList() {
|
||||
add(index, "/ ");
|
||||
add(setupadmin, "/setupadmin ");
|
||||
add(index, "/");
|
||||
add(script, "/script");
|
||||
add(editview, "/editview");
|
||||
add(style, "/style");
|
||||
add(setupadmin, "/setupadmin");
|
||||
add(favicon_ico, "/favicon.ico");
|
||||
add(welcome, "/welcome");
|
||||
add(mainmenu, "/mainmenu");
|
||||
add(newview, "/newview");
|
||||
}
|
||||
|
||||
bool processRequest(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data);
|
||||
bool processRequest(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data);
|
||||
|
||||
void add(HTTPPage &page, std::string name = "");
|
||||
|
||||
@ -28,8 +41,14 @@ namespace http {
|
||||
|
||||
private:
|
||||
__index index;
|
||||
__script script;
|
||||
__style style;
|
||||
__editview editview;
|
||||
__setupadmin setupadmin;
|
||||
__favicon_ico favicon_ico;
|
||||
__welcome welcome;
|
||||
__mainmenu mainmenu;
|
||||
__newview newview;
|
||||
|
||||
};
|
||||
|
||||
|
27
HTTPRequest.h
Normal file
27
HTTPRequest.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __HTTPRequest_h__
|
||||
#define __HTTPRequest_h__
|
||||
|
||||
#include "PString.h"
|
||||
#include "IMFMessage.h"
|
||||
#include "IMFRequest.h"
|
||||
#include "IMFResponse.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class HTTPRequest : public coreutils::IMFMessage {
|
||||
|
||||
public:
|
||||
HTTPRequest();
|
||||
HTTPRequest(coreutils::PString &in) {
|
||||
request = coreutils::IMFRequest(in);
|
||||
parse(in);
|
||||
}
|
||||
|
||||
coreutils::IMFRequest request;
|
||||
coreutils::IMFResponse response;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -5,16 +5,16 @@
|
||||
## Debug
|
||||
ProjectName :=HTTPServer
|
||||
ConfigurationName :=Debug
|
||||
WorkspacePath :=/home/barant
|
||||
ProjectPath :=/home/barant/barant/HTTPServer
|
||||
WorkspacePath :=/home/bradarant/barant
|
||||
ProjectPath :=/home/bradarant/barant/HTTPServer
|
||||
IntermediateDirectory :=./Debug
|
||||
OutDir := $(IntermediateDirectory)
|
||||
CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=root
|
||||
Date :=05/31/19
|
||||
CodeLitePath :=/home/barant/.codelite
|
||||
User :=Brad Arant
|
||||
Date :=10/07/19
|
||||
CodeLitePath :=/home/bradarant/.codelite
|
||||
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
||||
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
||||
ObjectSuffix :=.o
|
||||
@ -36,12 +36,12 @@ ObjectsFileList :="HTTPServer.txt"
|
||||
PCHCompileFlags :=
|
||||
MakeDirCommand :=mkdir -p
|
||||
LinkOptions :=
|
||||
IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ServerCore/
|
||||
IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ServerCore/ $(IncludeSwitch)../CoreUtils
|
||||
IncludePCH :=
|
||||
RcIncludePath :=
|
||||
Libs := $(LibrarySwitch)ServerCore $(LibrarySwitch)pthread $(LibrarySwitch)uuid
|
||||
ArLibs := "ServerCore" "pthread" "uuid"
|
||||
LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)../ServerCore/Debug/
|
||||
Libs := $(LibrarySwitch)ServerCore $(LibrarySwitch)CoreUtils $(LibrarySwitch)pthread $(LibrarySwitch)uuid
|
||||
ArLibs := "ServerCore" "CoreUtils" "pthread" "uuid"
|
||||
LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)../ServerCore/Debug/ $(LibraryPathSwitch)../CoreUtils/Debug
|
||||
|
||||
##
|
||||
## Common variables
|
||||
@ -92,7 +92,7 @@ PreBuild:
|
||||
## Objects
|
||||
##
|
||||
$(IntermediateDirectory)/main.cpp$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/main.cpp$(DependSuffix): main.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/main.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/main.cpp$(DependSuffix) -MM main.cpp
|
||||
|
||||
@ -100,7 +100,7 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) main.cpp
|
||||
|
||||
$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix): HTTPSession.cpp $(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix): HTTPSession.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix) -MM HTTPSession.cpp
|
||||
|
||||
@ -108,7 +108,7 @@ $(IntermediateDirectory)/HTTPSession.cpp$(PreprocessSuffix): HTTPSession.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSession.cpp$(PreprocessSuffix) HTTPSession.cpp
|
||||
|
||||
$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix): HTTPSessions.cpp $(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix): HTTPSessions.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix) -MM HTTPSessions.cpp
|
||||
|
||||
@ -116,7 +116,7 @@ $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix): HTTPSessions.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix) HTTPSessions.cpp
|
||||
|
||||
$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix): HTTPHandler.cpp $(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/HTTPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix): HTTPHandler.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix) -MM HTTPHandler.cpp
|
||||
|
||||
@ -124,7 +124,7 @@ $(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix): HTTPHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix) HTTPHandler.cpp
|
||||
|
||||
$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix): HTTPPageList.cpp $(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/HTTPPageList.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPPageList.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix): HTTPPageList.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix) -MM HTTPPageList.cpp
|
||||
|
||||
|
@ -17,6 +17,13 @@
|
||||
<File Name="HTTPPage.h"/>
|
||||
<File Name="HTTPPageList.h"/>
|
||||
<File Name="HTTPPageList.cpp"/>
|
||||
<File Name="__welcome.h"/>
|
||||
<File Name="__script.h"/>
|
||||
<File Name="__style.h"/>
|
||||
<File Name="__editview.h"/>
|
||||
<File Name="__mainmenu.h"/>
|
||||
<File Name="__newview.h"/>
|
||||
<File Name="HTTPRequest.h"/>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="Debug"/>
|
||||
<Dependencies Name="Release"/>
|
||||
@ -34,10 +41,13 @@
|
||||
<Compiler Options="-g;-O0;-Wall" C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
|
||||
<IncludePath Value="."/>
|
||||
<IncludePath Value="../ServerCore/"/>
|
||||
<IncludePath Value="../CoreUtils"/>
|
||||
</Compiler>
|
||||
<Linker Options="" Required="yes">
|
||||
<LibraryPath Value="../ServerCore/Debug/"/>
|
||||
<LibraryPath Value="../CoreUtils/Debug"/>
|
||||
<Library Value="ServerCore"/>
|
||||
<Library Value="CoreUtils"/>
|
||||
<Library Value="pthread"/>
|
||||
<Library Value="uuid"/>
|
||||
</Linker>
|
||||
|
@ -1 +1 @@
|
||||
./Debug/main.cpp.o ./Debug/HTTPSession.cpp.o ./Debug/HTTPSessions.cpp.o ./Debug/HTTPHandler.cpp.o
|
||||
./Debug/main.cpp.o ./Debug/HTTPSession.cpp.o ./Debug/HTTPSessions.cpp.o ./Debug/HTTPHandler.cpp.o ./Debug/HTTPPageList.cpp.o
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
HTTPSession::HTTPSession() {
|
||||
sessionId = "";
|
||||
}
|
||||
|
||||
|
||||
HTTPSession::HTTPSession(std::string sessionId) {
|
||||
this->sessionId = sessionId;
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
#ifndef __HTTPSession_h__
|
||||
#define __HTTPSession_h__
|
||||
|
||||
#include "Response.h"
|
||||
#include "includes"
|
||||
|
||||
namespace http {
|
||||
|
||||
class HTTPSession {
|
||||
|
||||
public:
|
||||
HTTPSession();
|
||||
HTTPSession(std::string sessionId);
|
||||
std::string getSessionId();
|
||||
|
||||
jet::Variables sessionVariables;
|
||||
jet::Variables cgiFormVariables;
|
||||
|
||||
private:
|
||||
std::string sessionId;
|
||||
|
||||
|
@ -5,19 +5,27 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
HTTPSession * HTTPSessions::findSessionByHeader(core::Header &header, core::Response &response) {
|
||||
std::string sessionId = header.getCookie("sessionId");
|
||||
HTTPSession *session = findSessionById(sessionId, response);
|
||||
HTTPSession * HTTPSessions::findSessionByHeader(HTTPRequest &httpRequest) {
|
||||
std::string sessionId = httpRequest.getHeaderKeyPairValue("Cookie", "sessionId");
|
||||
HTTPSession *session = findSessionById(sessionId, httpRequest);
|
||||
return session;
|
||||
}
|
||||
|
||||
HTTPSession * HTTPSessions::findSessionById(std::string sessionId, core::Response &response) {
|
||||
HTTPSession * HTTPSessions::findSessionById(std::string sessionId, HTTPRequest &httpRequest) {
|
||||
HTTPSession *httpSession;
|
||||
if(sessionId.length() > 0) {
|
||||
httpSession = (HTTPSession *)sessions.find(sessionId)->second;
|
||||
std::map<std::string, HTTPSession*>::iterator ix;
|
||||
ix = sessions.find(sessionId);
|
||||
httpSession = ix->second;
|
||||
if(ix == sessions.end()) {
|
||||
httpSession = createHTTPSession();
|
||||
httpRequest.response.setCookie("sessionId", httpSession->getSessionId());
|
||||
}
|
||||
core::Log(core::LOG_DEBUG_1) << "http session: " << "(" << sessionId << ") " << httpSession;
|
||||
|
||||
} else {
|
||||
httpSession = createHTTPSession();
|
||||
response.setCookie("sessionId", httpSession->getSessionId());
|
||||
httpRequest.response.setCookie("sessionId", httpSession->getSessionId());
|
||||
}
|
||||
return httpSession;
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
#ifndef __HTTPSessions_h__
|
||||
#define __HTTPSessions_h__
|
||||
|
||||
#include "Header.h"
|
||||
#include "Response.h"
|
||||
#include "HTTPRequest.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
@ -11,8 +10,8 @@ namespace http {
|
||||
class HTTPSessions {
|
||||
|
||||
public:
|
||||
HTTPSession * findSessionByHeader(core::Header &header, core::Response &response);
|
||||
HTTPSession * findSessionById(std::string sessionId, core::Response &response);
|
||||
HTTPSession * findSessionByHeader(HTTPRequest &httpRequest);
|
||||
HTTPSession * findSessionById(std::string sessionId, HTTPRequest &httpRequest);
|
||||
|
||||
private:
|
||||
HTTPSession * createHTTPSession();
|
||||
|
Binary file not shown.
@ -7,9 +7,11 @@ Release/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
|
||||
../ServerCore/TCPServerSocket.h ../ServerCore/Service.h \
|
||||
../ServerCore/CommandList.h ../ServerCore/EPoll.h \
|
||||
../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
|
||||
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h _GET.h \
|
||||
../ServerCore/Command.h ../ServerCore/Session.h ../ServerCore/Header.h \
|
||||
../ServerCore/Response.h _POST.h
|
||||
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \
|
||||
HTTPSessions.h ../ServerCore/Header.h ../ServerCore/Response.h \
|
||||
HTTPPageList.h ../ServerCore/Session.h __index.h HTTPPage.h \
|
||||
HTTPSession.h __script.h __style.h __setupadmin.h __favicon_ico.h \
|
||||
__welcome.h HTTPHandler.h ../ServerCore/Command.h
|
||||
|
||||
../ServerCore/includes:
|
||||
|
||||
@ -59,14 +61,32 @@ HTTPService.h:
|
||||
|
||||
../ServerCore/Service.h:
|
||||
|
||||
_GET.h:
|
||||
|
||||
../ServerCore/Command.h:
|
||||
|
||||
../ServerCore/Session.h:
|
||||
HTTPSessions.h:
|
||||
|
||||
../ServerCore/Header.h:
|
||||
|
||||
../ServerCore/Response.h:
|
||||
|
||||
_POST.h:
|
||||
HTTPPageList.h:
|
||||
|
||||
../ServerCore/Session.h:
|
||||
|
||||
__index.h:
|
||||
|
||||
HTTPPage.h:
|
||||
|
||||
HTTPSession.h:
|
||||
|
||||
__script.h:
|
||||
|
||||
__style.h:
|
||||
|
||||
__setupadmin.h:
|
||||
|
||||
__favicon_ico.h:
|
||||
|
||||
__welcome.h:
|
||||
|
||||
HTTPHandler.h:
|
||||
|
||||
../ServerCore/Command.h:
|
||||
|
307
__editbiew.js
Normal file
307
__editbiew.js
Normal file
@ -0,0 +1,307 @@
|
||||
|
||||
|
||||
var mainpage;
|
||||
var result;
|
||||
var mousedownx;
|
||||
var mousedowny;
|
||||
var mouseDownWidth;
|
||||
var mouseDownHeight;
|
||||
var ismousedown = false;
|
||||
var dragobject;
|
||||
var dragHint = "move";
|
||||
var data;
|
||||
var showGrid = false;
|
||||
var snapToGrid = false;
|
||||
var gridSize = 10;
|
||||
var selected;
|
||||
var itemparameters;
|
||||
|
||||
function init() {
|
||||
mainpage = document.getElementById("mainpage");
|
||||
data = document.getElementById("data");
|
||||
itemparameters = document.getElementById("itemparameters");
|
||||
var gridsize = document.getElementById("gridsize");
|
||||
gridsize.value = gridSize;
|
||||
drawGrid();
|
||||
}
|
||||
|
||||
function drawGrid() {
|
||||
var grid = document.getElementById("grid");
|
||||
var context = grid.getContext("2d");
|
||||
if(showGrid == true) {
|
||||
context.clearRect(0,0,grid.width,grid.height);
|
||||
context.globalAlpha = 0.2;
|
||||
context.lineWidth = 0.5;
|
||||
for(ix = 0; ix < grid.width; ix += gridSize) {
|
||||
context.beginPath();
|
||||
context.moveTo(ix, 0);
|
||||
context.lineTo(ix, grid.height);
|
||||
context.stroke();
|
||||
context.beginPath();
|
||||
context.moveTo(0, ix);
|
||||
context.lineTo(grid.width, ix);
|
||||
context.stroke();
|
||||
}
|
||||
} else {
|
||||
context.clearRect(0,0,grid.width,grid.height);
|
||||
}
|
||||
}
|
||||
|
||||
function setDragHint(hint) {
|
||||
dragHint = hint;
|
||||
}
|
||||
|
||||
function getMouseX(e) {
|
||||
return e.clientX - mainpage.offsetLeft - parseFloat(mainpage.style.borderWidth);
|
||||
}
|
||||
|
||||
function getMouseY(e) {
|
||||
return e.clientY - mainpage.offsetTop - parseFloat(mainpage.style.borderWidth);
|
||||
}
|
||||
|
||||
function mousedown(obj, e) {
|
||||
var mouseX = getMouseX(e);
|
||||
var mouseY = getMouseY(e);
|
||||
mousedownx = mouseX - obj.offsetLeft;
|
||||
mousedowny = mouseY - obj.offsetTop;
|
||||
mouseDownLeft = parseFloat(obj.style.left);
|
||||
mouseDownTop = parseFloat(obj.style.top);
|
||||
mouseDownWidth = parseFloat(obj.style.width);
|
||||
mouseDownHeight = parseFloat(obj.style.height);
|
||||
dragobject = obj;
|
||||
selected = obj;
|
||||
ismousedown = true;
|
||||
displayParameters();
|
||||
}
|
||||
|
||||
function mouseup() {
|
||||
ismousedown = false;
|
||||
dragobject = null;
|
||||
console.log(mainpage.innerHTML);
|
||||
}
|
||||
|
||||
function mousemove(e) {
|
||||
var mouseX = getMouseX(e);
|
||||
var mouseY = getMouseY(e);
|
||||
if(ismousedown) {
|
||||
|
||||
if(dragHint == "move") {
|
||||
if(snapToGrid == false) {
|
||||
dragobject.style.left = (mouseX - mousedownx) + "px";
|
||||
dragobject.style.top = (mouseY - mousedowny) + "px";
|
||||
} else {
|
||||
dragobject.style.left = (Math.round((mouseX - mousedownx) / gridSize) * gridSize) + "px";
|
||||
dragobject.style.top = (Math.round((mouseY - mousedowny) / gridSize) * gridSize) + "px";
|
||||
}
|
||||
if((mouseX - mousedownx) < 0)
|
||||
dragobject.style.left = "0px";
|
||||
if((mouseY - mousedowny) < 0)
|
||||
dragobject.style.top = "0px";
|
||||
if((mouseX - mousedownx + parseFloat(dragobject.style.width)) > parseFloat(mainpage.style.width))
|
||||
dragobject.style.left = (mouseX - mousedownx) + "px";
|
||||
} else if(dragHint == "rightbottomresize") {
|
||||
dragobject.style.width = (mouseX - mouseDownLeft) + "px";
|
||||
dragobject.style.height = (mouseY - mouseDownTop) + "px";
|
||||
} else if(dragHint == "rightresize") {
|
||||
if(snapToGrid == false) {
|
||||
dragobject.style.width = (mouseX - mouseDownLeft) + "px";
|
||||
} else {
|
||||
dragobject.style.width = (Math.round((mouseX - mouseDownLeft) / gridSize) * gridSize) + "px";
|
||||
}
|
||||
} else if(dragHint == "bottomresize") {
|
||||
if(snapToGrid == false) {
|
||||
dragobject.style.height = (mouseY - mouseDownTop) + "px";
|
||||
} else {
|
||||
dragobject.style.height = (Math.round((mouseY - mouseDownTop) / gridSize) * gridSize) + "px";
|
||||
}
|
||||
} else if(dragHint == "leftresize") {
|
||||
dragobject.style.left = mouseX + "px";
|
||||
dragobject.style.width = (mouseDownWidth + (mouseDownLeft - mouseX)) + "px";
|
||||
} else if(dragHint == "topresize") {
|
||||
dragobject.style.top = mouseY + "px";
|
||||
dragobject.style.height = (mouseDownHeight + (mouseDownTop - mouseY)) + "px";
|
||||
}
|
||||
|
||||
data.innerHTML = "<p>" + dragobject.nodeName + "<br>" +
|
||||
"Action: " + dragHint + "<br>" +
|
||||
"MouseLocation: " + mouseX + ":" + mouseY + "<br>" +
|
||||
"MouseOver Location: " + (mouseX - dragobject.offsetLeft) + ":" + (mouseY - dragobject.offsetTop) + "<br>" +
|
||||
"Location: " + dragobject.style.left + ":" + dragobject.style.top + "<br>" +
|
||||
"Size: " + dragobject.style.width + ":" + dragobject.style.height + "<br>" +
|
||||
"</p>";
|
||||
|
||||
|
||||
} else {
|
||||
var mouseabove = document.elementFromPoint(mouseX + mainpage.offsetLeft, mouseY + mainpage.offsetTop);
|
||||
|
||||
if((mouseabove.id != "mainpage") && (mouseabove.id != "grid")) {
|
||||
|
||||
data.innerHTML = "<p>" + mouseabove.nodeName + "<br>" +
|
||||
"Action: " + dragHint + "<br>" +
|
||||
"MouseLocation: " + mouseX + ":" + mouseY + "<br>" +
|
||||
"MouseOver Location: " + (mouseX - mouseabove.offsetLeft) + ":" + (mouseY - mouseabove.offsetTop) + "<br>" +
|
||||
"Location: " + mouseabove.style.left + ":" + mouseabove.style.top + "<br>" +
|
||||
"Size: " + mouseabove.style.width + ":" + mouseabove.style.height + "<br>" +
|
||||
"</p>";
|
||||
|
||||
if((mouseabove.nodeName == "DIV") ||
|
||||
(mouseabove.nodeName == "IMG") ||
|
||||
(mouseabove.nodeName == "BUTTON") ||
|
||||
(mouseabove.nodeName == "INPUT") ||
|
||||
(mouseabove.nodeName == "SPAN")) {
|
||||
|
||||
if((parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) &&
|
||||
(parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {
|
||||
mouseabove.style.cursor = "nwse-resize";
|
||||
dragHint = "rightbottomresize";
|
||||
} else if((parseFloat(mouseabove.style.left) <= (mouseX - mouseabove.offsetLeft)) &&
|
||||
((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop))) {
|
||||
mouseabove.style.cursor = "nesw-resize";
|
||||
dragHint = "righttopresize";
|
||||
} else if(((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) &&
|
||||
(parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {
|
||||
mouseabove.style.cursor = "nesw-resize";
|
||||
dragHint = "leftbottomresize";
|
||||
} else if(parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) {
|
||||
mouseabove.style.cursor = "ew-resize";
|
||||
dragHint = "rightresize";
|
||||
} else if(parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop)) {
|
||||
mouseabove.style.cursor = "ns-resize";
|
||||
dragHint = "bottomresize";
|
||||
} else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) {
|
||||
mouseabove.style.cursor = "ew-resize";
|
||||
dragHint = "leftresize";
|
||||
} else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop)) {
|
||||
mouseabove.style.cursor = "ns-resize";
|
||||
dragHint = "topresize";
|
||||
} else {
|
||||
mouseabove.style.cursor = "move";
|
||||
dragHint = "move";
|
||||
}
|
||||
} else {
|
||||
mouseabove.style.cursor = "default";
|
||||
}
|
||||
} else {
|
||||
mouseabove.style.cursor = "default";
|
||||
dragHint = "";
|
||||
data.innerHTML = "<p></p>";
|
||||
}
|
||||
}
|
||||
displayParameters();
|
||||
}
|
||||
|
||||
function displayParameters() {
|
||||
|
||||
itemparameters.innerHTML = "<p>" + selected.nodeName + ": " + selected.id + "<br>" +
|
||||
"Location: " + selected.style.left + ":" + selected.style.top + "<br>" +
|
||||
"Size: " + selected.style.width + ":" + selected.style.height + "<br>" +
|
||||
"</p>";
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: bebasneue;
|
||||
src: url('http://68.108.72.78:8080/fonts/BebasNeue.otf');
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body ondragstart="return false;"
|
||||
ondrop="return false;"
|
||||
onload="init(); return true;">
|
||||
|
||||
<div style="position: relative;">
|
||||
|
||||
<div id="window1" style="position: absolute; left: 0px; top: 0px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;">
|
||||
|
||||
<span style="font: 20px bebasneue;">View Editor</span>
|
||||
|
||||
<div id="mainpage"
|
||||
style="width: 600px; height: 600px; border: 1px solid black; position: relative; background: #ffffff;"
|
||||
onmousemove="mousemove(event); return true;"
|
||||
onmouseup="mouseup(); return true;">
|
||||
|
||||
<canvas id="grid" width="600px" height="600px" style="position: absolute; left: 0px; top: 0px; alpha: 0.5; cursor: normal;"></canvas>
|
||||
|
||||
<img id="img1" style="position: absolute; user-select: none;" onmousedown="mousedown(this, event); return true;" src="images/barant_web_logo.png" width="336" height="69">
|
||||
|
||||
<img id="img2" style="position: absolute; user-select: none;" onmousedown="mousedown(this, event); return true;" src="images/barant_web_logo.png" width="336" height="69">
|
||||
|
||||
<button id="button1"
|
||||
style="width: 100px; height: 50px; border: 2px solid green; position: absolute;"
|
||||
onmousedown="mousedown(this, event); return true;">Press</button>
|
||||
|
||||
<div id="div1"
|
||||
style="width: 100px; height: 50px; border: 2px solid green; position: absolute;"
|
||||
onmousedown="mousedown(this, event); return true;">
|
||||
</div>
|
||||
|
||||
<div id="div2"
|
||||
style="width: 100px; height: 50px; border: 0px; position: absolute; background: #404040;"
|
||||
onmousedown="mousedown(this, event); return true;">
|
||||
</div>
|
||||
|
||||
<div id="div3"
|
||||
style="width: 100px; height: 100px; border: 10px solid red; position: absolute; background: #ffff80;"
|
||||
onmousedown="mousedown(this, event); return true;">
|
||||
</div>
|
||||
|
||||
<span id="text1" onmousedown="mousedown(this, event); return true;"
|
||||
style="position: absolute; user-select: none; border: 1pt solid black; background: #8080c0;">This is a text label</span>
|
||||
|
||||
<input id="input1" style="position: absolute;" onmousedown="mousedown(this, event); return true;" type="input" name="drag5" size="50">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="window3" style="position:absolute; top: 235px; left: 610px;
|
||||
border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;">
|
||||
|
||||
<span style="font: 20px bebasneue;">OPTIONS</span>
|
||||
|
||||
<div style="width: 150px; height: 300px; color: #000000; border: 1px solid black; position: relative; background: #ffffff;"
|
||||
onmousemove="mousemove(event); return true;"
|
||||
onmouseup="mouseup(); return true;">
|
||||
|
||||
<div id="controls">
|
||||
<input type="checkbox" name="grid" onchange="showGrid = this.checked; drawGrid(); return true;"><span style="font: 12px bebasneue; margin-bottom: 2px;">Show Grid</span><br>
|
||||
<input type="checkbox" name="snaptogrid" onchange="snapToGrid = this.checked; return true;"><span style="font: 12px bebasneue; margin-bottom: 2px;">Snap To Grid</span><br>
|
||||
<span style="font: 12px bebasneue; margin-bottom: 2px;">Grid Size: </span><input type="text" name="gridsize" id="gridsize" style="width: 20px;" size="3" onchange="gridSize = parseInt(this.value); drawGrid(); return true;"><br>
|
||||
</div>
|
||||
|
||||
<div id="itemparameters" style="font: 12px bebasneue;"></div>
|
||||
|
||||
<div id="data" style="font: 12px bebasneue;">
|
||||
<p>NO DATA</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="window2" style="position:absolute; top: 0px; left: 610px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;">
|
||||
|
||||
<span style="font: 20px bebasneue;">Toolbar</span>
|
||||
|
||||
<div id="toolbar"
|
||||
style="width: 80px; height: 200px; border: 1px solid black; position: relative; background: #ffffff;"
|
||||
onmousemove="mousemove(event); return true;"
|
||||
onmouseup="mouseup(); return true;">
|
||||
<button id="button1"
|
||||
style="width: 40px; height: 40px; border: 2px solid green; position: absolute;"
|
||||
onmousedown="mousedown(this, event); return true;">Press</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
223
__editview.h
Normal file
223
__editview.h
Normal file
@ -0,0 +1,223 @@
|
||||
#ifndef ____editview_h__
|
||||
#define ____editview_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __editview : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override {
|
||||
|
||||
data << "" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " var mainpage;" << std::endl;
|
||||
data << " var result;" << std::endl;
|
||||
data << " var mousedownx;" << std::endl;
|
||||
data << " var mousedowny;" << std::endl;
|
||||
data << " var mouseDownWidth;" << std::endl;
|
||||
data << " var mouseDownHeight;" << std::endl;
|
||||
data << " var ismousedown = false;" << std::endl;
|
||||
data << " var dragobject;" << std::endl;
|
||||
data << " var dragHint = \"move\";" << std::endl;
|
||||
data << " var data;" << std::endl;
|
||||
data << " var showGrid = false;" << std::endl;
|
||||
data << " var snapToGrid = false;" << std::endl;
|
||||
data << " var gridSize = 10;" << std::endl;
|
||||
data << " var selected;" << std::endl;
|
||||
data << " var itemparameters;" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " function init() {" << std::endl;
|
||||
data << " mainpage = document.getElementById(\"mainpage\");" << std::endl;
|
||||
data << " data = document.getElementById(\"data\");" << std::endl;
|
||||
data << " itemparameters = document.getElementById(\"itemparameters\");" << std::endl;
|
||||
data << " var gridsize = document.getElementById(\"gridsize\");" << std::endl;
|
||||
data << " gridsize.value = gridSize;" << std::endl;
|
||||
data << " drawGrid();" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " function drawGrid() {" << std::endl;
|
||||
data << " var grid = document.getElementById(\"grid\");" << std::endl;
|
||||
data << " var context = grid.getContext(\"2d\");" << std::endl;
|
||||
data << " if(showGrid == true) {" << std::endl;
|
||||
data << " context.clearRect(0,0,grid.width,grid.height);" << std::endl;
|
||||
data << " context.globalAlpha = 0.2;" << std::endl;
|
||||
data << " context.lineWidth = 0.5; " << std::endl;
|
||||
data << " for(ix = 0; ix < grid.width; ix += gridSize) {" << std::endl;
|
||||
data << " context.beginPath();" << std::endl;
|
||||
data << " context.moveTo(ix, 0);" << std::endl;
|
||||
data << " context.lineTo(ix, grid.height);" << std::endl;
|
||||
data << " context.stroke();" << std::endl;
|
||||
data << " context.beginPath();" << std::endl;
|
||||
data << " context.moveTo(0, ix);" << std::endl;
|
||||
data << " context.lineTo(grid.width, ix);" << std::endl;
|
||||
data << " context.stroke(); " << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " context.clearRect(0,0,grid.width,grid.height);" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " function setDragHint(hint) {" << std::endl;
|
||||
data << " dragHint = hint;" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " function getMouseX(e) {" << std::endl;
|
||||
data << " return e.clientX - mainpage.offsetLeft - parseFloat(mainpage.style.borderWidth);" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " function getMouseY(e) {" << std::endl;
|
||||
data << " return e.clientY - mainpage.offsetTop - parseFloat(mainpage.style.borderWidth);" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " function mousedown(obj, e) {" << std::endl;
|
||||
data << " var mouseX = getMouseX(e);" << std::endl;
|
||||
data << " var mouseY = getMouseY(e);" << std::endl;
|
||||
data << " mousedownx = mouseX - obj.offsetLeft;" << std::endl;
|
||||
data << " mousedowny = mouseY - obj.offsetTop;" << std::endl;
|
||||
data << " mouseDownLeft = parseFloat(obj.style.left);" << std::endl;
|
||||
data << " mouseDownTop = parseFloat(obj.style.top);" << std::endl;
|
||||
data << " mouseDownWidth = parseFloat(obj.style.width);" << std::endl;
|
||||
data << " mouseDownHeight = parseFloat(obj.style.height);" << std::endl;
|
||||
data << " dragobject = obj;" << std::endl;
|
||||
data << " selected = obj;" << std::endl;
|
||||
data << " ismousedown = true;" << std::endl;
|
||||
data << " displayParameters();" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " function mouseup() {" << std::endl;
|
||||
data << " ismousedown = false;" << std::endl;
|
||||
data << " dragobject = null;" << std::endl;
|
||||
data << " console.log(mainpage.innerHTML);" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " function mousemove(e) {" << std::endl;
|
||||
data << " var mouseX = getMouseX(e);" << std::endl;
|
||||
data << " var mouseY = getMouseY(e);" << std::endl;
|
||||
data << " if(ismousedown) {" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " if(dragHint == \"move\") {" << std::endl;
|
||||
data << " if(snapToGrid == false) {" << std::endl;
|
||||
data << " dragobject.style.left = (mouseX - mousedownx) + \"px\";" << std::endl;
|
||||
data << " dragobject.style.top = (mouseY - mousedowny) + \"px\";" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " dragobject.style.left = (Math.round((mouseX - mousedownx) / gridSize) * gridSize) + \"px\";" << std::endl;
|
||||
data << " dragobject.style.top = (Math.round((mouseY - mousedowny) / gridSize) * gridSize) + \"px\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " if((mouseX - mousedownx) < 0)" << std::endl;
|
||||
data << " dragobject.style.left = \"0px\";" << std::endl;
|
||||
data << " if((mouseY - mousedowny) < 0)" << std::endl;
|
||||
data << " dragobject.style.top = \"0px\";" << std::endl;
|
||||
data << " if((mouseX - mousedownx + parseFloat(dragobject.style.width)) > parseFloat(mainpage.style.width)) " << std::endl;
|
||||
data << " dragobject.style.left = (mouseX - mousedownx) + \"px\"; " << std::endl;
|
||||
data << " } else if(dragHint == \"rightbottomresize\") { " << std::endl;
|
||||
data << " dragobject.style.width = (mouseX - mouseDownLeft) + \"px\";" << std::endl;
|
||||
data << " dragobject.style.height = (mouseY - mouseDownTop) + \"px\";" << std::endl;
|
||||
data << " } else if(dragHint == \"rightresize\") { " << std::endl;
|
||||
data << " if(snapToGrid == false) {" << std::endl;
|
||||
data << " dragobject.style.width = (mouseX - mouseDownLeft) + \"px\"; " << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " dragobject.style.width = (Math.round((mouseX - mouseDownLeft) / gridSize) * gridSize) + \"px\"; " << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " } else if(dragHint == \"bottomresize\") { " << std::endl;
|
||||
data << " if(snapToGrid == false) {" << std::endl;
|
||||
data << " dragobject.style.height = (mouseY - mouseDownTop) + \"px\";" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " dragobject.style.height = (Math.round((mouseY - mouseDownTop) / gridSize) * gridSize) + \"px\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " } else if(dragHint == \"leftresize\") { " << std::endl;
|
||||
data << " dragobject.style.left = mouseX + \"px\";" << std::endl;
|
||||
data << " dragobject.style.width = (mouseDownWidth + (mouseDownLeft - mouseX)) + \"px\";" << std::endl;
|
||||
data << " } else if(dragHint == \"topresize\") { " << std::endl;
|
||||
data << " dragobject.style.top = mouseY + \"px\";" << std::endl;
|
||||
data << " dragobject.style.height = (mouseDownHeight + (mouseDownTop - mouseY)) + \"px\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " data.innerHTML = \"<p>\" + dragobject.nodeName + \"<br>\" + " << std::endl;
|
||||
data << " \"Action: \" + dragHint + \"<br>\" +" << std::endl;
|
||||
data << " \"MouseLocation: \" + mouseX + \":\" + mouseY + \"<br>\" +" << std::endl;
|
||||
data << " \"MouseOver Location: \" + (mouseX - dragobject.offsetLeft) + \":\" + (mouseY - dragobject.offsetTop) + \"<br>\" + " << std::endl;
|
||||
data << " \"Location: \" + dragobject.style.left + \":\" + dragobject.style.top + \"<br>\" + " << std::endl;
|
||||
data << " \"Size: \" + dragobject.style.width + \":\" + dragobject.style.height + \"<br>\" + " << std::endl;
|
||||
data << " \"</p>\";" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " var mouseabove = document.elementFromPoint(mouseX + mainpage.offsetLeft, mouseY + mainpage.offsetTop);" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " if((mouseabove.id != \"mainpage\") && (mouseabove.id != \"grid\")) {" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " data.innerHTML = \"<p>\" + mouseabove.nodeName + \"<br>\" + " << std::endl;
|
||||
data << " \"Action: \" + dragHint + \"<br>\" +" << std::endl;
|
||||
data << " \"MouseLocation: \" + mouseX + \":\" + mouseY + \"<br>\" +" << std::endl;
|
||||
data << " \"MouseOver Location: \" + (mouseX - mouseabove.offsetLeft) + \":\" + (mouseY - mouseabove.offsetTop) + \"<br>\" + " << std::endl;
|
||||
data << " \"Location: \" + mouseabove.style.left + \":\" + mouseabove.style.top + \"<br>\" + " << std::endl;
|
||||
data << " \"Size: \" + mouseabove.style.width + \":\" + mouseabove.style.height + \"<br>\" + " << std::endl;
|
||||
data << " \"</p>\";" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " if((mouseabove.nodeName == \"DIV\") || " << std::endl;
|
||||
data << " (mouseabove.nodeName == \"IMG\") || " << std::endl;
|
||||
data << " (mouseabove.nodeName == \"BUTTON\") ||" << std::endl;
|
||||
data << " (mouseabove.nodeName == \"INPUT\") ||" << std::endl;
|
||||
data << " (mouseabove.nodeName == \"SPAN\")) {" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " if((parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) && " << std::endl;
|
||||
data << " (parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"nwse-resize\";" << std::endl;
|
||||
data << " dragHint = \"rightbottomresize\"; " << std::endl;
|
||||
data << " } else if((parseFloat(mouseabove.style.left) <= (mouseX - mouseabove.offsetLeft)) && " << std::endl;
|
||||
data << " ((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop))) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"nesw-resize\";" << std::endl;
|
||||
data << " dragHint = \"righttopresize\"; " << std::endl;
|
||||
data << " } else if(((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) && " << std::endl;
|
||||
data << " (parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop))) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"nesw-resize\";" << std::endl;
|
||||
data << " dragHint = \"leftbottomresize\"; " << std::endl;
|
||||
data << " } else if(parseFloat(mouseabove.style.width) <= (mouseX - mouseabove.offsetLeft)) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"ew-resize\";" << std::endl;
|
||||
data << " dragHint = \"rightresize\";" << std::endl;
|
||||
data << " } else if(parseFloat(mouseabove.style.height) <= (mouseY - mouseabove.offsetTop)) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"ns-resize\";" << std::endl;
|
||||
data << " dragHint = \"bottomresize\";" << std::endl;
|
||||
data << " } else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseX - mouseabove.offsetLeft)) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"ew-resize\";" << std::endl;
|
||||
data << " dragHint = \"leftresize\";" << std::endl;
|
||||
data << " } else if((parseFloat(mouseabove.style.borderWidth) + 2) >= (mouseY - mouseabove.offsetTop)) {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"ns-resize\";" << std::endl;
|
||||
data << " dragHint = \"topresize\";" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"move\";" << std::endl;
|
||||
data << " dragHint = \"move\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"default\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " } else {" << std::endl;
|
||||
data << " mouseabove.style.cursor = \"default\";" << std::endl;
|
||||
data << " dragHint = \"\";" << std::endl;
|
||||
data << " data.innerHTML = \"<p></p>\";" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " displayParameters();" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " function displayParameters() {" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " itemparameters.innerHTML = \"<p>\" + selected.nodeName + \": \" + selected.id + \"<br>\" + " << std::endl;
|
||||
data << " \"Location: \" + selected.style.left + \":\" + selected.style.top + \"<br>\" + " << std::endl;
|
||||
data << " \"Size: \" + selected.style.width + \":\" + selected.style.height + \"<br>\" + " << std::endl;
|
||||
data << " \"</p>\";" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
data << "" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "script/javascript");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
208
__favicon_ico.h
208
__favicon_ico.h
@ -7,78 +7,150 @@ namespace http {
|
||||
|
||||
class __favicon_ico : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||
int processCommand(std::string request,
|
||||
core::Session *session,
|
||||
HTTPSession *httpSession,
|
||||
HTTPRequest &httpRequest,
|
||||
std::stringstream &data) override {
|
||||
|
||||
data << std::string(header_data);
|
||||
|
||||
data << std::string(header_data, 806);
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "image/x-icon");
|
||||
return true;
|
||||
}
|
||||
|
||||
char *header_data =
|
||||
"````````````````````````````````````````^PH_U/([J-@W@<4T3[4R+*TQ"
|
||||
"+ZTQ6+<SA\\@UK=LWVO8\\_@P_````````````````````````````````````````"
|
||||
"````````````````````````````````[`,^IM@W.JXR)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ2K(RL=XX]@@_````````````````````````````````"
|
||||
"````````````````````````_@T_L=XX,ZTQ)*HQ)*HQ)*HQ5;4RFM$VM-\\X.:\\R"
|
||||
"@<4TL=XXE,XU1K$R)*HQ)*HQ)*HQ0J`RPN@Y`@\\`````````````````````````"
|
||||
"````````````````````[`0^<K\\T)*HQ)*HQ-ZTQIM@WYOX]`@\\`````````1+(R"
|
||||
"L]\\X````````_`X`W_D\\F-$V**LQ)*HQ)*HQBLHU^0D_````````````````````"
|
||||
"````````````````Z?`]5;4R)*HQ)*HQD\\XU\\@0^`````````````````0X`/:`R"
|
||||
"L-TX`@\\`````````````````Z/\\]?<0T)*HQ)*HQ;;TS]0<^````````````````"
|
||||
"````````````[`0^5;4R)*HQ+:LQP^DY`P``````````\\00^N>(X@,4T-JXQ)*HQ"
|
||||
")JHQ/*\\RBLHUP.8Y]P@_`````````0X`KMPW):HQ)*HQ;[XS^@H_````````````"
|
||||
"````````_PT_=+`T)*HQ+*PQTO$[````````^0D_I-<W+JPQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ.ZXQM=`X_@T_````````O.0Y)*HQ)*HQD\\XU`P\\`````````"
|
||||
"````````M-\\X)*HQ)*HQP^@Y````````Y_X]7+<S)*HQ)*HQ*JPQB\\HUN.(XSNXZ"
|
||||
"S.TZL]\\X@,4T)*HQ)*HQ)*HQ=+`T\\P4^````````J=HW)*HQ)*HQS.XZ````````"
|
||||
"````\\00^,ZTQ)*HQD<TU`P``````Y_X]1K$R)*HQ)ZLQI-<W\\P4^````````````"
|
||||
"````````````Z`$]D,TU)*HQ)*HQ7[@S\\`8^````_PT_<K\\S)*HQ4[0R_0L_````"
|
||||
"````J-DW)*HQ,:PQ\\@0^````^0D_6[<S)*HQ-ZTQT_([````````````_`X`\\`<^"
|
||||
"]@@_`@\\``````````P``P.<Y*:LQ)*HQ>\\,T_`X`````W_H\\)*HQ)*HQP><Y````"
|
||||
"^`L_/*\\R)*HQIM@W````````I-<W)*HQ):HQT_([````````\\P4^I-<W1;$R)*HQ"
|
||||
")*HQ4;0RL=XX^0D_````````O>4Y)*HQ)*HQO^8Y````````A<@U)*HQ:KPS`P\\`"
|
||||
"UO,[)*HQ)*HQYOX]````[`0^+*LQ)*HQI=<W````````X/H\\2+$R)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ7[@S[@(]`````@\\`AL@U)*HQ2[(R_0P_````T.`[)*HQ)*HQZO`]"
|
||||
"J-DW)*HQ5+4R`@\\`````N.$X)*HQ+:PQ\\`8^````\\@0^1K$R)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ9+HS^`L_````XOL\\)*HQ)*HQT.`[````^0D_+:LQ)*HQQ.DY"
|
||||
"@\\8T)*HQFM$V````````?L4T)*HQD<TU````````H=4V)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ):HQ)*HQ)*HQN^,X`````P\\`9;LS)*HQH-0V````````;;XS)*HQHM4V"
|
||||
"4[8R)*HQMM`X`````0X`+JTQ)*HQO>0Y````_@T_-*TQ)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ;;XS`P```P\\`I-8W)*HQ=L$T````````F=$V)*HQA\\DU"
|
||||
"+:TQ)*HQP>8Y````]@@_)*HQ)*HQ6+<R<+\\T:+PS)*HQ)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ)*HQ3;0R2;,R-JXQ)*HQ0K,R````````JMDW)*HQ:;XS"
|
||||
"+:TQ)*HQP>8Y````]@@_)*HQ)*HQ>L,TG-,VE,\\V)*HQ)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ):HQL=\\XM-`X@,4T)*HQ0K,R````````JMDW)*HQ7KLS"
|
||||
"4[8S)*HQMM`X`````0X`+JTQ)*HQO.0Y````_@T_-*TQ)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ;;XS````````I-<W)*HQ=L$T````````F=$V)*HQB,DU"
|
||||
"@\\8T)*HQFM$V````````?\\4T)*HQD<TU````````H=4V)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQN^,X`````P\\`9+HS)*HQH-0V````````;;XS)*HQHM4V"
|
||||
"J=DW)*HQ5+4R`@\\`````N.$X)*HQ+:PQ\\`8^````\\@4^1K$R)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ9+HS^`L_````XOL\\)*HQ)*HQT>`[````^0D_+:LQ)*HQQ.DY"
|
||||
"UO0[)*HQ)*HQYOX]````[`0^+*LQ)*HQI=<W````````X/H\\2;(R)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ7[@S[@(]`````@\\`A<@U)*HQ3+(R_0P_````T.`Z)*HQ)*HQZO`]"
|
||||
"^`L_/*\\R)*HQIM<W````````I-<W)*HQ):HQT_([````````\\P4^I-<W1;$R)*HQ"
|
||||
")*HQ4;0RL=XX^0D_````````O.0Y)*HQ)*HQP.8Y````````A,<U)*HQ:KPS`P\\`"
|
||||
"````J-DW)*HQ,:PQ\\00^````^0D_7+@S)*HQ-ZTQT_([````````````_`X`\\`<^"
|
||||
"]@@_`@\\``````````P``O^8Y**LQ)*HQ>\\,T_`X`````W_D\\)*HQ)*HQP><Y````"
|
||||
"````\\00^-*TQ)*HQD<TU`P``````Y_X]1K$R)*HQ)ZLQI-8W\\P4^````````````"
|
||||
"````````````Z`$]D,PU)*HQ)*HQ7[@S\\`8^````_PT_<K\\S)*HQ4[4R_0L_````"
|
||||
"````````M-\\X)*HQ)*HQPN@Y````````Y_X]7;@S)*HQ)*HQ*JLQB\\HUM^(XSNXZ"
|
||||
"S.TZL]\\X?\\4T)*HQ)*HQ)*HQ=+`T\\P4^````````J=DW)*HQ)*HQS>XZ````````"
|
||||
"````````_PT_=;`T)*HQ+*LQTO$[````````^0D_I=<W+ZPQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ/*XQM=`X_@T_````````O.0Y)*HQ)*HQD\\XU`P``````````"
|
||||
"````````````\\00^5K4R)*HQ+:LQPN@Y`P``````````\\@4^NN(X@,8T-JXQ):HQ"
|
||||
")JHQ/:`RB\\HUP><Y]`@_`````````0X`KMPW):HQ)*HQ;[XS^@H_````````````"
|
||||
"````````````````Z?`]5K4R)*HQ)*HQDLXU\\00^`````````````````0\\`B,HU"
|
||||
"B<HU`@\\`````````````````Z/\\]?<0T)*HQ)*HQ;;TS]0<^````````````````"
|
||||
"````````````````````[`0^<[`T)*HQ)*HQ-:TQIM@WYOX]`@\\`````````C<PU"
|
||||
"C<PU````````_`X`W_D\\F,`V**LQ)*HQ)*HQB\\HU^0D_````````````````````"
|
||||
"````````````````````````_@T_LMXX,ZTQ)*HQ)*HQ)*HQ5;4RFM$VM-\\X:+PS"
|
||||
":+PSL=TXE,XU1;$R)*HQ)*HQ)*HQ0J`RPN@Y`@\\`````````````````````````"
|
||||
"````````````````````````````````[`,^I]@W.JXR)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||
")*HQ)*HQ)*HQ)*HQ)*HQ2[(RLMXX]P@_````````````````````````````````"
|
||||
"````````````````````````````````````````^PH_U/,[J-@W@<8T3[4R+*TQ"
|
||||
"+ZTQ6;@SA\\@UK=LWV_<\\_@P_````````````````````````````````````````";
|
||||
const char *header_data = {"\x00\x00\x01\x00\x01\x00\x20\x20\x00\x00\x01\x00\x08\x00\xA8\x08\x00"
|
||||
"\x00\x16\x00\x00\x00\x28\x00\x00\x00\x20\x00\x00\x00\x40\x00\x00\x00"
|
||||
"\x01\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0\x99\x20\x00\xF0\x99"
|
||||
"\x21\x00\xF0\x99\x22\x00\xF0\x9A\x23\x00\xF0\x9A\x24\x00\xF0\x9A\x25"
|
||||
"\x00\xF0\x9A\x26\x00\xF0\x9A\x28\x00\xF0\x9A\x29\x00\xF0\x9B\x26\x00"
|
||||
"\xF0\x9B\x28\x00\xF0\x9B\x29\x00\xF0\x9B\x2A\x00\xF0\x9B\x2B\x00\xF0"
|
||||
"\x9C\x28\x00\xF0\x9C\x29\x00\xF0\x9B\x2D\x00\xF0\x9C\x2A\x00\xF0\x9C"
|
||||
"\x2B\x00\xF0\x9C\x2F\x00\xF0\x9C\x30\x00\xF0\x9C\x31\x00\xF0\x9C\x33"
|
||||
"\x00\xF0\x9D\x32\x00\xF1\x9D\x36\x00\xF0\x9D\x37\x00\xF0\x9D\x38\x00"
|
||||
"\xF1\x9E\x35\x00\xF1\x9E\x38\x00\xF1\x9F\x39\x00\xF1\x9F\x3E\x00\xF1"
|
||||
"\xA0\x41\x00\xF1\xA0\x42\x00\xF1\xA1\x40\x00\xF1\xA0\x44\x00\xF1\xA2"
|
||||
"\x3E\x00\xF1\xA1\x45\x00\xF1\xA1\x46\x00\xF1\xA1\x47\x00\xF1\xA1\x48"
|
||||
"\x00\xF1\xA2\x45\x00\xF1\xA3\x49\x00\xF1\xA3\x4D\x00\xF1\xA4\x4B\x00"
|
||||
"\xF1\xA3\x4F\x00\xF1\xA4\x4F\x00\xF1\xA4\x50\x00\xF1\xA4\x51\x00\xF1"
|
||||
"\xA4\x52\x00\xF1\xA5\x4F\x00\xF2\xA5\x4F\x00\xF1\xA6\x54\x00\xF2\xA6"
|
||||
"\x54\x00\xF2\xA6\x57\x00\xF2\xA6\x58\x00\xF2\xA7\x55\x00\xF2\xA7\x58"
|
||||
"\x00\xF2\xA7\x59\x00\xF2\xA7\x5B\x00\xF2\xAA\x5A\x00\xF2\xA9\x60\x00"
|
||||
"\xF2\xAA\x61\x00\xF2\xAB\x64\x00\xF2\xAB\x66\x00\xF2\xAD\x65\x00\xF2"
|
||||
"\xAC\x69\x00\xF2\xAD\x69\x00\xF2\xAD\x6B\x00\xF3\xAE\x6C\x00\xF2\xAE"
|
||||
"\x6E\x00\xF3\xAE\x6E\x00\xF3\xAF\x6F\x00\xF3\xAF\x70\x00\xF3\xAF\x71"
|
||||
"\x00\xF3\xB0\x72\x00\xF3\xB2\x76\x00\xF3\xB2\x77\x00\xF3\xB3\x79\x00"
|
||||
"\xF3\xB4\x7A\x00\xF3\xB4\x7B\x00\xF3\xB4\x7C\x00\xF3\xB4\x7D\x00\xF3"
|
||||
"\xB5\x7C\x00\xF3\xB5\x7D\x00\xF3\xB5\x7F\x00\xF4\xB6\x80\x00\xF4\xB7"
|
||||
"\x81\x00\xF4\xB7\x82\x00\xF4\xB7\x83\x00\xF4\xB8\x83\x00\xF4\xB8\x84"
|
||||
"\x00\xF4\xB9\x84\x00\xF4\xB9\x85\x00\xF4\xB9\x86\x00\xF4\xB9\x87\x00"
|
||||
"\xF4\xBB\x89\x00\xF4\xBB\x8C\x00\xF4\xBC\x8C\x00\xF4\xBC\x8D\x00\xF4"
|
||||
"\xBD\x8E\x00\xF4\xBD\x8F\x00\xF4\xBD\x90\x00\xF5\xBE\x90\x00\xF5\xBF"
|
||||
"\x94\x00\xF5\xC0\x94\x00\xF5\xC0\x95\x00\xF5\xC0\x96\x00\xF5\xC2\x98"
|
||||
"\x00\xF5\xC3\x9C\x00\xF5\xC4\x9D\x00\xF5\xC4\x9E\x00\xF6\xC5\xA0\x00"
|
||||
"\xF6\xC6\xA0\x00\xF6\xC6\xA1\x00\xF6\xC6\xA2\x00\xF6\xC7\xA2\x00\xF6"
|
||||
"\xC7\xA3\x00\xF6\xC7\xA4\x00\xF6\xC8\xA4\x00\xF6\xC8\xA5\x00\xF6\xC8"
|
||||
"\xA6\x00\xF6\xC9\xA5\x00\xF6\xCA\xA9\x00\xF6\xCB\xAA\x00\xF7\xCC\xAC"
|
||||
"\x00\xF7\xCC\xAD\x00\xF7\xCD\xAD\x00\xF7\xCD\xAE\x00\xF7\xCE\xAD\x00"
|
||||
"\xF7\xCE\xAF\x00\xF7\xCE\xB0\x00\xF7\xCF\xB0\x00\xF7\xCF\xB1\x00\xF7"
|
||||
"\xCF\xB2\x00\xF7\xD0\xB4\x00\xF7\xD1\xB3\x00\xF7\xD1\xB4\x00\xF7\xD1"
|
||||
"\xB5\x00\xF7\xD1\xB6\x00\xF7\xD2\xB7\x00\xF8\xD3\xB8\x00\xF8\xD3\xB9"
|
||||
"\x00\xF8\xD4\xB9\x00\xF8\xD5\xBB\x00\xF8\xD5\xBC\x00\xF8\xD5\xBD\x00"
|
||||
"\xF8\xD6\xBC\x00\xF8\xD6\xBD\x00\xF8\xD7\xBE\x00\xF8\xD7\xBF\x00\xF8"
|
||||
"\xD8\xBF\x00\xF8\xD8\xC0\x00\xF9\xDC\xC8\x00\xF9\xDD\xC8\x00\xF9\xDD"
|
||||
"\xC9\x00\xF9\xDD\xCA\x00\xF9\xDF\xCC\x00\xFA\xDF\xCC\x00\xFA\xDF\xCD"
|
||||
"\x00\xFA\xE0\xCE\x00\xFA\xE1\xCF\x00\xFA\xE1\xD0\x00\xFA\xE2\xD0\x00"
|
||||
"\xFA\xE2\xD2\x00\xFA\xE3\xD2\x00\xFB\xE5\xD6\x00\xFB\xE6\xD7\x00\xFB"
|
||||
"\xE8\xDB\x00\xFB\xE9\xDB\x00\xFB\xE9\xDC\x00\xFB\xEA\xDE\x00\xFC\xED"
|
||||
"\xE2\x00\xFC\xED\xE3\x00\xFC\xEE\xE4\x00\xFC\xEF\xE5\x00\xFC\xEF\xE6"
|
||||
"\x00\xFC\xF0\xE7\x00\xFC\xF1\xE9\x00\xFD\xF2\xEB\x00\xFD\xF3\xEB\x00"
|
||||
"\xFD\xF3\xEC\x00\xFD\xF3\xED\x00\xFD\xF4\xED\x00\xFD\xF4\xEE\x00\xFD"
|
||||
"\xF5\xEF\x00\xFD\xF6\xEF\x00\xFD\xF6\xF0\x00\xFE\xF7\xF1\x00\xFE\xF7"
|
||||
"\xF2\x00\xFE\xF7\xF3\x00\xFE\xF8\xF4\x00\xFE\xF9\xF5\x00\xFE\xF9\xF6"
|
||||
"\x00\xFE\xFA\xF7\x00\xFE\xFA\xF8\x00\xFE\xFB\xF8\x00\xFE\xFB\xF9\x00"
|
||||
"\xFE\xFC\xF9\x00\xFE\xFC\xFA\x00\xFF\xFD\xFB\x00\xFF\xFD\xFC\x00\xFF"
|
||||
"\xFE\xFC\x00\xFF\xFE\xFD\x00\xFF\xFE\xFE\x00\xFF\xFF\xFE\x00\xFF\xFF"
|
||||
"\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xCD\xCD"
|
||||
"\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xC0\xA2\x75\x53\x2B\x0E\x12\x37\x58"
|
||||
"\x7A\xA6\xC4\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
|
||||
"\xCD\xCD\xCD\xCD\xB2\x74\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x26\x7F\xBC\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
|
||||
"\xC5\x7F\x13\x00\x00\x00\x2F\x6A\x82\x3E\x3E\x7D\x65\x1F\x00\x00\x00"
|
||||
"\x1E\x94\xCA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xB3\x47\x00"
|
||||
"\x00\x15\x73\xAB\xCA\xCD\xCD\x5F\x5F\xCD\xCD\xC7\xA7\x67\x04\x00\x00"
|
||||
"\x5E\xBE\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xAE\x30\x00\x00\x63\xB4"
|
||||
"\xCD\xCD\xCD\xCD\xC9\x5B\x5C\xCA\xCD\xCD\xCD\xCD\xAD\x4D\x00\x00\x41"
|
||||
"\xBA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xB4\x30\x00\x08\x94\xCC\xCD\xCD\xB6"
|
||||
"\x8A\x52\x17\x01\x02\x1D\x5E\x93\xBD\xCD\xCD\xC8\x7B\x01\x00\x43\xBF"
|
||||
"\xCD\xCD\xCD\xCD\xCD\xC6\x49\x00\x07\x9F\xCD\xCD\xBE\x71\x0D\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x1A\x84\xC5\xCD\xCD\x8C\x00\x00\x64\xCC\xCD"
|
||||
"\xCD\xCD\xCD\x82\x00\x00\x94\xCD\xCD\xAC\x39\x00\x00\x06\x5E\x87\x9B"
|
||||
"\x98\x81\x4F\x00\x00\x00\x48\xB7\xCD\xCD\x77\x00\x00\x9A\xCD\xCD\xCD"
|
||||
"\xB4\x14\x00\x62\xCC\xCD\xAC\x20\x00\x03\x6F\xB7\xCD\xCD\xCD\xCD\xCD"
|
||||
"\xCD\xB0\x60\x00\x00\x3A\xB8\xCD\xC6\x45\x00\x2D\xC2\xCD\xCD\x76\x00"
|
||||
"\x10\xB4\xCD\xBE\x38\x00\x16\xA0\xCD\xCD\xCD\xC7\xB9\xBB\xCA\xCD\xCD"
|
||||
"\xCC\x8F\x04\x00\x4C\xC7\xCD\xA7\x00\x00\x93\xCD\xC1\x1C\x00\x72\xCD"
|
||||
"\xCD\x70\x00\x01\xA0\xCD\xCD\xB7\x70\x1F\x00\x00\x2A\x7E\xBE\xCD\xCD"
|
||||
"\x8C\x00\x00\x90\xCD\xCD\x55\x00\x3F\xCB\xA4\x00\x00\xAB\xCD\xB3\x07"
|
||||
"\x00\x71\xCD\xCD\xA9\x24\x00\x00\x00\x00\x00\x00\x3A\xB1\xCD\xCA\x56"
|
||||
"\x00\x27\xC3\xCD\x9C\x00\x00\xAF\x77\x00\x2E\xCA\xCD\x86\x00\x0B\xB8"
|
||||
"\xCD\xB6\x20\x00\x00\x00\x00\x00\x00\x00\x00\x3C\xC1\xCD\xAA\x00\x00"
|
||||
"\x9E\xCD\xBE\x08\x00\x97\x54\x00\x6A\xCD\xCD\x4F\x00\x62\xCD\xCD\x6D"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8B\xCD\xCB\x3C\x00\x6C\xCD"
|
||||
"\xCD\x42\x00\x6E\x32\x00\x85\xCD\xC8\x11\x00\x8C\xCD\xC5\x14\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x42\xCD\xCD\x70\x00\x4A\xCD\xCD\x69"
|
||||
"\x00\x5A\x0F\x00\x91\xCD\xBB\x00\x00\x4B\x6B\x66\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x01\x80\x83\x50\x00\x23\xCD\xCD\x78\x00\x3B"
|
||||
"\x0F\x00\x91\xCD\xBB\x00\x00\x33\x44\x3E\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x29\x28\x17\x00\x23\xCD\xCD\x78\x00\x40\x31\x00"
|
||||
"\x85\xCD\xC8\x11\x00\x8D\xCD\xC5\x14\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x42\xCC\xCB\x6F\x00\x4A\xCD\xCD\x69\x00\x59\x54\x00\x6A\xCD"
|
||||
"\xCD\x4E\x00\x62\xCD\xCD\x6D\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00"
|
||||
"\x8B\xCD\xCB\x3D\x00\x6C\xCD\xCD\x42\x00\x6E\x76\x00\x2E\xCA\xCD\x86"
|
||||
"\x00\x0B\xB8\xCD\xB5\x20\x00\x00\x00\x00\x00\x00\x00\x00\x3C\xC1\xCD"
|
||||
"\xAA\x00\x00\x9D\xCD\xBE\x08\x00\x97\xA3\x00\x00\xAB\xCD\xB3\x07\x00"
|
||||
"\x71\xCD\xCD\xA9\x22\x00\x00\x00\x00\x00\x00\x3A\xB1\xCD\xCA\x57\x00"
|
||||
"\x26\xC3\xCD\x9D\x00\x00\xAF\xC1\x1C\x00\x73\xCD\xCD\x70\x00\x01\xA0"
|
||||
"\xCD\xCD\xB7\x70\x1F\x00\x00\x2A\x7E\xBE\xCD\xCD\x8E\x00\x00\x8F\xCD"
|
||||
"\xCD\x56\x00\x3F\xCB\xCD\x76\x00\x10\xB5\xCD\xBE\x35\x00\x16\xA0\xCD"
|
||||
"\xCD\xCD\xC7\xB9\xBB\xCA\xCD\xCD\xCC\x92\x05\x00\x4C\xC7\xCD\xA8\x00"
|
||||
"\x00\x93\xCD\xCD\xB4\x13\x00\x62\xCC\xCD\xAC\x20\x00\x03\x70\xB7\xCD"
|
||||
"\xCD\xCD\xCD\xCD\xCD\xB0\x61\x00\x00\x3A\xB8\xCD\xC6\x45\x00\x2C\xC2"
|
||||
"\xCD\xCD\xCD\x82\x00\x00\x95\xCD\xCD\xAC\x36\x00\x00\x09\x5E\x88\x9B"
|
||||
"\x98\x81\x50\x00\x00\x00\x48\xB7\xCD\xCD\x79\x00\x00\x99\xCD\xCD\xCD"
|
||||
"\xCD\xC6\x48\x00\x0A\x9F\xCD\xCD\xBE\x70\x0C\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x19\x84\xC5\xCD\xCD\x8C\x00\x00\x64\xCB\xCD\xCD\xCD\xCD\xCD"
|
||||
"\xB3\x2F\x00\x08\x96\xCC\xCD\xCD\xB4\x89\x50\x17\x00\x02\x1C\x5D\x90"
|
||||
"\xBC\xCD\xCD\xC8\x7B\x01\x00\x43\xBF\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xAE"
|
||||
"\x2F\x00\x00\x64\xB5\xCD\xCD\xCD\xCD\xC8\x1D\x7C\xCA\xCD\xCD\xCD\xCD"
|
||||
"\xAD\x4D\x00\x00\x41\xBA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xB3\x46"
|
||||
"\x00\x00\x16\x73\xAB\xCA\xCD\xCD\x21\x81\xCD\xCD\xC7\xA7\x68\x04\x00"
|
||||
"\x00\x5D\xBE\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xC5\x7E\x13"
|
||||
"\x00\x00\x00\x2F\x6A\x82\x1B\x51\x7E\x65\x20\x00\x00\x00\x1E\x94\xCA"
|
||||
"\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xB2\x73\x18"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x25\x7E\xBB\xCD\xCD\xCD\xCD"
|
||||
"\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xC0\xA1\x75"
|
||||
"\x51\x2B\x0E\x12\x34\x58\x7A\xA5\xC4\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD"
|
||||
"\xCD\xCD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"};
|
||||
|
||||
};
|
||||
}
|
||||
|
26
__index.h
26
__index.h
@ -2,20 +2,30 @@
|
||||
#define ____index_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
#include "HTTPRequest.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __index : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override {
|
||||
|
||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
<form action=\"setupadmin\" method=\"POST\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>You have successfully set up a JETServer.\
|
||||
<br>Session Id: " << httpSession->getSessionId() << "\
|
||||
<br>The configuration has not yet been established for this web site.</p>\
|
||||
<button>Configure</button>\
|
||||
</div></form></body></html>";
|
||||
|
||||
data << "<html>" << std::endl;
|
||||
data << " <head>" << std::endl;
|
||||
data << " <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />" << std::endl;
|
||||
data << " <link type=\"text/css\" rel=\"stylesheet\" href=\"/style\" />" << std::endl;
|
||||
data << " <script src=\"/script\"></script>" << std::endl;
|
||||
data << " <script src=\"/editview\"></script>" << std::endl;
|
||||
data << " </head>" << std::endl;
|
||||
|
||||
data << "<body ondragstart=\"return false;\" " << std::endl;
|
||||
data << " ondrop=\"return false;\" " << std::endl;
|
||||
data << " onLoad=\"getPage('/welcome','main');\">" << std::endl;
|
||||
data << " <div id=\"main\">If you see this then something is wrong.</div>" << std::endl;
|
||||
data << " </body>" << std::endl;
|
||||
data << "</html>" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/html");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
33
__mainmenu.h
Normal file
33
__mainmenu.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef ____mainmenu_h__
|
||||
#define ____mainmenu_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __mainmenu : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request,
|
||||
core::Session *session,
|
||||
HTTPSession *httpSession,
|
||||
HTTPRequest &httpRequest,
|
||||
std::stringstream &data) override {
|
||||
|
||||
data << "<div>" << std::endl;
|
||||
data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px;\">" << std::endl;
|
||||
data << " <span>Setup Server Parameters</span>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px;\"" << std::endl;
|
||||
data << " onmousedown=\"getPage('/newview','main');\">" << std::endl;
|
||||
data << " <span>View and Layout Designer</span>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "</div>" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/html");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
113
__newview.h
Normal file
113
__newview.h
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef ____newview_h__
|
||||
#define ____newview_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __newview : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request,
|
||||
core::Session *session,
|
||||
HTTPSession *httpSession,
|
||||
HTTPRequest &httpRequest,
|
||||
std::stringstream &data) override {
|
||||
|
||||
data << " <div style=\"position: relative;\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"window1\" style=\"position: absolute; left: 0px; top: 0px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <span style=\"font: 20px bebasneue;\">View Editor</span>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"mainpage\" " << std::endl;
|
||||
data << " style=\"width: 600px; height: 600px; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
|
||||
data << " onmousemove=\"mousemove(event); return true;\" " << std::endl;
|
||||
data << " onmouseup=\"mouseup(); return true;\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <canvas id=\"grid\" width=\"600px\" height=\"600px\" style=\"position: absolute; left: 0px; top: 0px; alpha: 0.5; cursor: normal;\"></canvas>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <img id=\"img1\" style=\"position: absolute; user-select: none;\" onmousedown=\"mousedown(this, event); return true;\" src=\"images/barant_web_logo.png\" width=\"336\" height=\"69\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <img id=\"img2\" style=\"position: absolute; user-select: none;\" onmousedown=\"mousedown(this, event); return true;\" src=\"images/barant_web_logo.png\" width=\"336\" height=\"69\">" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " <button id=\"button1\" " << std::endl;
|
||||
data << " style=\"width: 100px; height: 50px; border: 2px solid green; position: absolute;\"" << std::endl;
|
||||
data << " onmousedown=\"mousedown(this, event); return true;\">Press</button>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"div1\"" << std::endl;
|
||||
data << " style=\"width: 100px; height: 50px; border: 2px solid green; position: absolute;\"" << std::endl;
|
||||
data << " onmousedown=\"mousedown(this, event); return true;\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"div2\"" << std::endl;
|
||||
data << " style=\"width: 100px; height: 50px; border: 0px; position: absolute; background: #404040;\"" << std::endl;
|
||||
data << " onmousedown=\"mousedown(this, event); return true;\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"div3\"" << std::endl;
|
||||
data << " style=\"width: 100px; height: 100px; border: 10px solid red; position: absolute; background: #ffff80;\"" << std::endl;
|
||||
data << " onmousedown=\"mousedown(this, event); return true;\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " <span id=\"text1\" onmousedown=\"mousedown(this, event); return true;\"" << std::endl;
|
||||
data << " style=\"position: absolute; user-select: none; border: 1pt solid black; background: #8080c0;\">This is a text label</span>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <input id=\"input1\" style=\"position: absolute;\" onmousedown=\"mousedown(this, event); return true;\" type=\"input\" name=\"drag5\" size=\"50\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"window3\" style=\"position:absolute; top: 235px; left: 610px;" << std::endl;
|
||||
data << " border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <span style=\"font: 20px bebasneue;\">OPTIONS</span>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div style=\"width: 150px; height: 300px; color: #000000; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
|
||||
data << " onmousemove=\"mousemove(event); return true;\" " << std::endl;
|
||||
data << " onmouseup=\"mouseup(); return true;\"> " << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"controls\">" << std::endl;
|
||||
data << " <input type=\"checkbox\" name=\"grid\" onchange=\"showGrid = this.checked; drawGrid(); return true;\"><span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Show Grid</span><br>" << std::endl;
|
||||
data << " <input type=\"checkbox\" name=\"snaptogrid\" onchange=\"snapToGrid = this.checked; return true;\"><span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Snap To Grid</span><br>" << std::endl;
|
||||
data << " <span style=\"font: 12px bebasneue; margin-bottom: 2px;\">Grid Size: </span><input type=\"text\" name=\"gridsize\" id=\"gridsize\" style=\"width: 20px;\" size=\"3\" onchange=\"gridSize = parseInt(this.value); drawGrid(); return true;\"><br>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"itemparameters\" style=\"font: 12px bebasneue;\"></div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"data\" style=\"font: 12px bebasneue;\">" << std::endl;
|
||||
data << " <p>NO DATA</p>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"window2\" style=\"position:absolute; top: 0px; left: 610px; border: 1pt solid black; display: inline-block; padding: 2px; background: #808080; color: #ffffff;\">" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <span style=\"font: 20px bebasneue;\">Toolbar</span>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <div id=\"toolbar\" " << std::endl;
|
||||
data << " style=\"width: 80px; height: 200px; border: 1px solid black; position: relative; background: #ffffff;\" " << std::endl;
|
||||
data << " onmousemove=\"mousemove(event); return true;\" " << std::endl;
|
||||
data << " onmouseup=\"mouseup(); return true;\">" << std::endl;
|
||||
data << " <button id=\"button1\" " << std::endl;
|
||||
data << " style=\"width: 40px; height: 40px; border: 2px solid green; position: absolute;\"" << std::endl;
|
||||
data << " onmousedown=\"mousedown(this, event); return true;\">Press</button>" << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " " << std::endl;
|
||||
data << " </div> " << std::endl;
|
||||
data << "" << std::endl;
|
||||
data << " <script>alert('Loading...'); init(); return true;</script>" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/html");
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
54
__script.h
Normal file
54
__script.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef ____script_h__
|
||||
#define ____script_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __script : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override {
|
||||
|
||||
data << "function serverSend(url, type, receiver, formData, callback) {" << std::endl;
|
||||
data << " var server = new XMLHttpRequest();" << std::endl;
|
||||
data << " server.onload = function() {" << std::endl;
|
||||
data << " if(server.readyState == 4 && server.status == 200)" << std::endl;
|
||||
data << " callback(server.responseText, receiver);" << std::endl;
|
||||
data << " };" << std::endl;
|
||||
data << " server.open(type, url, true);" << std::endl;
|
||||
data << " server.send(formData);" << std::endl;
|
||||
data << "}" << std::endl;
|
||||
|
||||
data << "function getPage(url, receiver) {" << std::endl;
|
||||
data << " serverSend(url, \"GET\", receiver, null, function(data, receiver) {" << std::endl;
|
||||
data << " var panel1 = document.getElementById(receiver);" << std::endl;
|
||||
data << " panel1.innerHTML = data;" << std::endl;
|
||||
data << " });" << std::endl;
|
||||
data << "}" << std::endl;
|
||||
|
||||
data << "function process(url, formName, receiver) {" << std::endl;
|
||||
data << " var formElement = document.querySelector(\"form[name='\" + formName + \"']\");" << std::endl;
|
||||
data << " var formData = new FormData(formElement);" << std::endl;
|
||||
data << " serverSend(url, \"POST\", receiver, formData, function(data, receiver) {" << std::endl;
|
||||
data << " var panel1 = document.getElementById(receiver);" << std::endl;
|
||||
data << " panel1.innerHTML = data;" << std::endl;
|
||||
data << " });" << std::endl;
|
||||
data << "}" << std::endl;
|
||||
|
||||
// data << "var setInnerHTML = function(elm, html) {" << std::endl;
|
||||
// data << " lm.innerHTML = html;" << std::endl;
|
||||
// data << " Array.from(elm.querySelectorAll("script")).forEach( oldScript => {" << std::endl;
|
||||
// data << " const newScript = document.createElement("script");" << std::endl;
|
||||
// data << " Array.from(oldScript.attributes)" << std::endl;
|
||||
// data << " .forEach( attr => newScript.setAttribute(attr.name, attr.value) );" << std::endl;
|
||||
// data << " newScript.appendChild(document.createTextNode(oldScript.innerHTML));" << std::endl;
|
||||
// data << " oldScript.parentNode.replaceChild(newScript, oldScript);" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/javascript");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -5,15 +5,29 @@ namespace http {
|
||||
|
||||
class __setupadmin : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override {
|
||||
|
||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
<form action=\"setupadmin\" method=\"POST\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>Please enter credential information\
|
||||
for the security officer.<br><input type=\"text\" name=\"username\" size=\"50\">\
|
||||
<br>Session Id: " << httpSession->getSessionId() << "\
|
||||
<br>The configuration has not yet been established for this web site.</p>\
|
||||
<button>Configure</button>\
|
||||
</div></form></body></html>";
|
||||
data << "<form name=\"setupadmin\" action=\"setupadmin\" method=\"POST\">" << std::endl;
|
||||
data << " <div class=\"window\"><p>Please enter credential information" << std::endl;
|
||||
data << " for the security officer, then press Set Admin Profile button below:" << std::endl;
|
||||
data << " <div style=\"border: 1pt solid white; padding: 3px; margin-bottom: 5px;\">" << std::endl;
|
||||
data << " <div>User Name:</div>" << std::endl;
|
||||
data << " <input type=\"text\" name=\"username\" size=\"30\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " <div style=\"border: 1pt solid white; padding: 3px; margin-bottom: 5px;\">" << std::endl;
|
||||
data << " <div>Password:</div>" << std::endl;
|
||||
data << " <input type=\"password\" name=\"password\" size=\"30\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " <div style=\"border: 1pt solid white; padding: 3px; margin-bottom: 5px;\">" << std::endl;
|
||||
data << " <div>Verify Password:</div>" << std::endl;
|
||||
data << " <input type=\"password\" name=\"verify\" size=\"30\">" << std::endl;
|
||||
data << " </div>" << std::endl;
|
||||
data << " <br><br>Session Id: " << httpSession->getSessionId() << "" << std::endl;
|
||||
data << " <br>The configuration has not yet been established for this web site.</p>" << std::endl;
|
||||
data << " <input type=\"button\" onmousedown=\"process('/mainmenu','setupadmin', 'main'); return true;\" name=\"button1\" value=\"Set Admin Profile\">" << std::endl;
|
||||
data << " </div></form>" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/html");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
29
__style.h
Normal file
29
__style.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef ____style_h__
|
||||
#define ____style_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __style : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, HTTPRequest &httpRequest, std::stringstream &data) override {
|
||||
|
||||
data << "body {background: #006;" << std::endl;
|
||||
data << " color: #fff;" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
|
||||
data << ".window {background: #668;" << std::endl;
|
||||
data << " color: #fff;" << std::endl;
|
||||
data << " border: 1pt solid #f00;" << std::endl;
|
||||
data << " width: 400px;" << std::endl;
|
||||
data << " padding: 15px;" << std::endl;
|
||||
data << " }" << std::endl;
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/css");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
30
__welcome.h
Normal file
30
__welcome.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef ____welcome_h__
|
||||
#define ____welcome_h__
|
||||
|
||||
#include "HTTPPage.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class __welcome : public HTTPPage {
|
||||
|
||||
int processCommand(std::string request,
|
||||
core::Session *session,
|
||||
HTTPSession *httpSession,
|
||||
HTTPRequest &httpRequest,
|
||||
std::stringstream &data) override {
|
||||
|
||||
data << "<div class=\"window\">\
|
||||
<p>You have successfully set up a JETServer.\
|
||||
<br>Session Id: " << httpSession->getSessionId() << "\
|
||||
<br>The configuration has not yet been established for this web site.</p>\
|
||||
<input type=\"button\" onmousedown=\"getPage('/setupadmin','main'); return true;\" name=\"button1\" value=\"Configure\">\
|
||||
</div>";
|
||||
|
||||
httpRequest.response.addHeader("Content-Type", "text/html");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user