10 #include <boost/lexical_cast.hpp>
11 #include <boost/tokenizer.hpp>
12 #include <boost/algorithm/string.hpp>
15 #include <Wt/WApplication>
16 #include <Wt/WEnvironment>
19 #include <Wt/WPushButton>
20 #include <Wt/WStackedWidget>
21 #include <Wt/WTabWidget>
23 #include <Wt/WTableCell>
24 #include <Wt/WTemplate>
26 #include <Wt/WViewWidget>
27 #include <Wt/WVBoxLayout>
30 #include "view/BlogView.h"
39 const std::string& resourceBundle,
const std::string& cssPath)
91 layout->setContentsMargins(0, 0, 0, 0);
93 root()->setLayout(layout);
116 languagesDiv->
setId(
"top_languages");
118 for (
unsigned i = 0; i <
languages.size(); ++i) {
120 new WText(
"- ", languagesDiv);
129 WAnimation fade(WAnimation::Fade, WAnimation::Linear, 250);
131 contents->
setId(
"main_page");
146 WMenuItem::PreLoading);
154 WMenuItem::PreLoading);
161 WMenuItem::PreLoading);
172 result->bindWidget(
"languages", languagesDiv);
174 result->bindWidget(
"contents", contents);
185 std::string langPath = l.
path_;
190 blog->setInternalBasePath(langPath +
"blog/");
205 WText *a =
new WText(
tr(
"source-browser-link").arg(path));
206 a->setInternalPathEncoding(
true);
214 if (langPath.empty())
217 langPath =
'/' + langPath +
'/';
221 for (
unsigned i = 0; i <
languages.size(); ++i) {
245 if (path.size() >= 4 && path.substr(0, 4) ==
"/src") {
252 return new WText(
tr(
"home.intro"));
258 std::string langPath = l.
path_;
259 BlogView *
blog =
new BlogView(langPath +
"blog/",
260 appRoot() +
"blog.db",
"/wt/blog/feed/");
261 blog->setObjectName(
"blog");
263 if (!blog->user().empty())
273 WApplication::instance()->doJavaScript
274 (
"if (window.chat && window.chat.emit) {"
276 "" "window.chat.emit(window.chat, 'login', "
287 return new WText(
tr(
"home.status"));
292 return new WText(
tr(
"home.features"));
298 result->setInternalPathEncoding(
true);
304 return new WText(
tr(
"home.other-language"));
309 return makeStaticModel(boost::bind(createWidget,
this));
312 std::string
Home::href(
const std::string& url,
const std::string& description)
314 return "<a href=\"" + url +
"\" target=\"_blank\">" + description +
"</a>";
319 return new WText(
tr(
"home.community"));
324 std::ifstream f((
filePrefix() +
"releases.txt").c_str());
326 releaseTable->
clear();
329 ->addWidget(
new WText(
tr(
"home.download.version")));
331 ->addWidget(
new WText(
tr(
"home.download.date")));
333 ->addWidget(
new WText(
tr(
"home.download.description")));
347 typedef boost::tokenizer<boost::escaped_list_separator<char> >
349 CsvTokenizer tok(line);
351 CsvTokenizer::iterator i=tok.begin();
353 std::string fileName = *i;
354 std::string description = *(++i);
355 releaseTable->
elementAt(row, 0)->addWidget
356 (
new WText(
href(
"http://prdownloads.sourceforge.net/witty/"
357 + fileName +
"?download", description)));
366 #ifdef WT_EMWEB_BUILD
375 requestTemplate->bindWidget(
"button", quoteButton);
378 result->addWidget(quoteForm);
380 quoteButton->clicked().connect(quoteForm, &WWidget::show);
381 quoteButton->clicked().connect(requestTemplate, &WWidget::hide);
387 #endif // WT_EMWEB_BUILD
392 result->addWidget(
new WText(
tr(
"home.download")));
394 result->addWidget(
new WText(
tr(
"home.download.license")));
396 #ifdef WT_EMWEB_BUILD
398 #endif // WT_EMWEB_BUILD
400 result->addWidget(
new WText(
tr(
"home.download.packages")));
406 result->addWidget(
new WText(
tr(
"home.download.other")));
414 return WString::tr(key);
419 std::string googleCmd =
420 "if (window.pageTracker) {"
422 "" "setTimeout(function() {"
423 "" "window.pageTracker._trackPageview(\""