46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#ifndef ____viewlist_h__
|
|
#define ____viewlist_h__
|
|
|
|
#include "HTTPPage.h"
|
|
#include "HTTPParameters.h"
|
|
#include "Directory.h"
|
|
|
|
namespace http {
|
|
|
|
class __viewlist : public HTTPPage {
|
|
|
|
int page(HTTPParameters &p) override {
|
|
|
|
coreutils::Directory directory("../../jetserver/views");
|
|
|
|
p.data << "<div>"
|
|
" <div style=\"background: #484; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\""
|
|
" onmousedown=\"getPage('/addview','app1');\">"
|
|
" <span>Create new view</span>"
|
|
" </div>";
|
|
|
|
while(!directory.eod()) {
|
|
|
|
if(directory.get().getName().substr(0, 1) == ".") {
|
|
directory.next();
|
|
continue;
|
|
}
|
|
|
|
p.data << " <div style=\"background: #448; color: #fff; width: 400px; margin: 5px; padding: 5px; cursor: pointer;\""
|
|
" onmousedown=\"getPage('/editview/testview1.view' + directory.get().getName(),'app1');\">"
|
|
" <span>" << directory.get().getName() << "</span>"
|
|
" </div>";
|
|
directory.next();
|
|
}
|
|
|
|
p.data << "</div>";
|
|
|
|
p.httpRequest.response.addHeader(coreutils::IMFHeader("Content-Type", "text/html"));
|
|
|
|
return true;
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif
|