/home/bradarant/barant/HTTPServer/__viewlist.h
#ifndef ____viewlist_h__
#define ____viewlist_h__
#include "HTTPPage.h"
#include "Directory.h"
namespace http {
class __viewlist : public HTTPPage {
int processCommand(std::string request,
core::Session *session,
HTTPSession *httpSession,
HTTPRequest &httpRequest,
std::stringstream &data) override {
coreutils::Directory directory("/home/bradarant/jetserver/views");
data << "<div>" << std::endl;
data << " <div style=\"background: #484; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\"" << std::endl;
data << " onmousedown=\"getPage('/newview','main');\">" << std::endl;
data << " <span>Create new view</span>" << std::endl;
data << " </div>" << std::endl;
while(!directory.eod()) {
if(directory.get().getName().substr(0, 1) == ".") {
directory.next();
continue;
}
data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\"" << std::endl;
data << " onmousedown=\"getPage('/newview','main');\">" << std::endl;
data << " <span>" << directory.get().getName() << "</span>" << std::endl;
data << " </div>" << std::endl;
directory.next();
}
data << "</div>" << std::endl;
httpRequest.response.addHeader("Content-Type", "text/html");
return true;
}
};
}
#endif
http::__viewlist
Definition: __viewlist.h:9
http::HTTPSession
Definition: HTTPSession.h:9
http
Definition: __configure.h:4
http::HTTPPage
Definition: HTTPPage.h:11
http::HTTPRequest
Definition: HTTPRequest.h:11