forked from artyom-beilis/cppcms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaster.cpp
More file actions
37 lines (30 loc) · 680 Bytes
/
master.cpp
File metadata and controls
37 lines (30 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "master.h"
#include <cppcms/json.h>
#include <cppcms/session_interface.h>
#include <cppcms/url_mapper.h>
#include <iostream>
namespace apps {
master::master(cppcms::service &srv) : cppcms::application(srv)
{
conn_str_ = settings().get<std::string>("mb.connection_string");
media_=settings().get<std::string>("mb.media");
}
void master::init()
{
sql.open(conn_str_);
if(!session().is_set("view") || session()["view"]=="tree") {
parent()->mapper().set_value("method","tree");
}
else {
parent()->mapper().set_value("method","flat");
}
}
void master::clear()
{
sql.close();
}
void master::prepare(data::master &c)
{
c.media=media_;
}
} // namespace apps