Menu

[r501]: / wikipp / trunk / data.cpp  Maximize  Restore  History

Download this file

48 lines (42 with data), 1.1 kB

 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
38
39
40
41
42
43
44
45
46
47
/* Nothing meanwhile */
#include "cxxmarkdown/markdowncxx.h"
#include "wiki.h"
namespace data {
string master::markdown(string s)
{
string tmp;
markdown2html(s,tmp);
return tmp;
}
page_form::page_form(wiki *_w):
w(_w),
title("title",w->gettext("Title")),
content("content",w->gettext("Content")),
sidebar("sidebar",w->gettext("Sidebar")),
save("save",w->gettext("Save")),
save_cont("save_cont",w->gettext("Save and Continue")),
preview("preview",w->gettext("Preview")),
users_only("users_only",w->gettext("Only registered users may edit this page"))
{
*this & title & content & sidebar & save & save_cont & preview & users_only;
fields<<title<<content<<sidebar;
buttons<<save<<save_cont<<preview<<users_only;
users_only.error_msg=w->gettext("Only registered users may switch this state");
title.set_nonempty();
content.set_nonempty();
content.rows=30;
content.cols=80;
sidebar.rows=10;
sidebar.cols=80;
}
bool page_form::validate()
{
bool res=form::validate();
if(users_only.get() && !w->auth()) {
users_only.not_valid();
users_only.set(false);
return false;
}
return res;
}
}
MongoDB Logo MongoDB