#include <webpage.h>
|
| WebPage () |
|
virtual void | servicePrivate (HttpRequest &request)=0 |
|
virtual void | service (HttpRequest &request, HttpResponse &response) |
|
void | redirect (const QString &location) |
|
Public Member Functions inherited from MRequestHandler |
| MRequestHandler () |
|
|
static QString | percentEncode (const QString &s) |
|
|
void | setStatus (int code, QByteArray description) |
|
void | setHeader (QByteArray name, QByteArray value) |
|
void | setHeader (QByteArray name, int value) |
|
void | write (QByteArray data) |
|
void | write (QString data) |
|
void | write (const char *data) |
|
void | about () |
|
HttpSession | getSession () |
|
virtual void | writeHeader (HttpRequest &request, HttpResponse &response) |
|
virtual void | writeFooter (HttpRequest &request, HttpResponse &response) |
|
Protected Member Functions inherited from MRequestHandler |
bool | needsLogin (HttpRequest &request, HttpResponse &response) |
|
|
QString | m_javascript |
|
Protected Attributes inherited from MRequestHandler |
bool | m_needs_access_data |
|
bool | m_needs_change_settings |
|
bool | m_cacheable |
|
|
HttpResponse * | m_response |
|
HttpRequest * | m_request |
|
QByteArray | m_body |
|
This controller demonstrates how to use sessions.
Definition at line 20 of file webpage.h.
Constructor
Definition at line 13 of file webpage.cpp.
14 m_needs_access_data =
true;
15 m_needs_change_settings =
true;
void WebPage::writeHeader |
( |
HttpRequest & |
request, |
|
|
HttpResponse & |
response |
|
) |
| |
|
protectedvirtual |
Aside from drawing login status, displays message from HTTP parameter "message" (percent-encoded)
Definition at line 60 of file webpage.cpp.
61 QString body (
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
62 " \"http://www.w3.org/TR/html4/strict.dtd\">\n"
64 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
65 "<title>Fotobot</title>\n"
66 "<link href=\"/style.css\" rel=\"stylesheet\" type=\"text/css\">\n"
67 "<script type=\"text/javascript\">\n");
68 body.append(m_javascript);
69 body.append(tr(
"</script>\n"
73 "<div id=\"header\">\n"
76 "<p>Collects data from your photovoltaic plant<br/>Made by <a href=\"http://hobrasoft.cz/\">Hobrasoft s.r.o.</a></p>\n"
77 "<p class=\"clear\"></p></div><!-- logo -->\n"
81 body.append(QString(
"<li><a href=\"/\">%1</a></li>\n").arg(tr(
"Main Page")));
82 body.append(QString(
"<li><a href=\"/export\">%1</a></li>\n").arg(tr(
"Current data")));
83 body.append(QString(
"<li><a href=\"/settings\">%1</a><ul>\n").arg(tr(
"Settings")));
84 body.append(QString(
"<li><a href=\"/lines\">%1</a></li>\n").arg(tr(
"Lines")));
85 body.append(QString(
"<li><a href=\"/invertors\">%1</a></li>\n").arg(tr(
"Invertors")));
86 body.append(QString(
"<li><a href=\"/interfaceboxes\">%1</a></li>\n").arg(tr(
"Interfaceboxes")));
87 body.append(QString(
"<li><a href=\"/interfaceboxes?action=restart\">%1</a></li>\n").arg(tr(
"Interfaceboxes restart")));
88 body.append(QString(
"<li><a href=\"/geocoordinates\">%1</a></li>\n").arg(tr(
"Geographical coordinates")));
90 body.append(QString(
"<li><a href=\"/network\">%1</a></li>\n").arg(tr(
"Network settings")));
92 body.append(QString(
"<li><a href=\"/login?action=chpw\">%1</a></li>\n").arg(tr(
"Change Password")));
93 body.append(QString(
"<li><a href=\"/users\">%1</a></li>\n").arg(tr(
"Users")));
94 body.append(
"</ul></li>\n");
97 if (session.contains(
"username")) {
98 body.append(QString(
"<li><a href=\"/login?logout=true\">%1</a></li>").arg(tr(
"Log out")));
100 body.append(QString(
"<li><a href=\"/login\">%1</a></li>\n").arg(tr(
"Log in")));
103 body.append(
"</ul><p class=\"clear\"></p></div><!-- menu -->\n");
104 body.append(
"</div><!-- header -->\n");
106 QString message = QString::fromUtf8(QByteArray::fromPercentEncoding(request.getParameter(
"message")));
107 if(!message.isEmpty()) {
108 body.append(QString(
"<p class=\"message\">%1</p>").arg(message));
111 body.append(
"<div id=\"content\">");
112 response.write(body.toUtf8());
static HttpSessionStore * sessionStore
The documentation for this class was generated from the following files: