00001
00002
00003
00004
00005
00006
00007 #include <fstream>
00008 #include <iostream>
00009
00010 #include <boost/lexical_cast.hpp>
00011 #include <boost/tokenizer.hpp>
00012
00013 #include <Wt/WAnchor>
00014 #include <Wt/WApplication>
00015 #include <Wt/WEnvironment>
00016 #include <Wt/WIconPair>
00017 #include <Wt/WImage>
00018 #include <Wt/WLineEdit>
00019 #include <Wt/WLogger>
00020 #include <Wt/WMenu>
00021 #include <Wt/WPushButton>
00022 #include <Wt/WSignalMapper>
00023 #include <Wt/WStackedWidget>
00024 #include <Wt/WTabWidget>
00025 #include <Wt/WTable>
00026 #include <Wt/WTableCell>
00027 #include <Wt/WText>
00028 #include <Wt/WTreeNode>
00029 #include <Wt/WViewWidget>
00030
00031 #include "Home.h"
00032
00033 namespace {
00034 struct Lang {
00035 std::string code, path, shortDescription, longDescription;
00036 };
00037
00038 Lang l[] = {
00039 { "en", "/", "en", "English" },
00040 { "cn", "/cn/", "汉语", "中文 (Chinese)" }
00041 };
00042
00043 std::vector<Lang> languages(l, l + 2);
00044 }
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 template <typename Function>
00055 class DeferredWidget : public WContainerWidget
00056 {
00057 public:
00058 DeferredWidget(Function f)
00059 : f_(f) { }
00060
00061 private:
00062 void load() {
00063 WContainerWidget::load();
00064 addWidget(f_());
00065 }
00066
00067 Function f_;
00068 };
00069
00070 template <typename Function>
00071 DeferredWidget<Function> *deferCreate(Function f)
00072 {
00073 return new DeferredWidget<Function>(f);
00074 }
00075
00076
00077 class Div : public WContainerWidget
00078 {
00079 public:
00080 Div(WContainerWidget *parent, const std::string& id)
00081 : WContainerWidget(parent)
00082 {
00083 setId(id);
00084 }
00085 };
00086
00087 Home::Home(const WEnvironment& env)
00088 : WApplication(env),
00089 recentNews_(0),
00090 historicalNews_(0),
00091 releases_(0)
00092 {
00093 messageResourceBundle().use("wt-home", false);
00094 useStyleSheet("images/wt.css");
00095 useStyleSheet("images/wt_ie.css", "lt IE 7");
00096 useStyleSheet("home.css");
00097 setTitle("Wt, C++ Web Toolkit");
00098
00099 setLocale("");
00100 language_ = 0;
00101
00102 Div *topWrapper = new Div(root(), "top_wrapper");
00103 Div *topContent = new Div(topWrapper, "top_content");
00104
00105 Div *languagesDiv = new Div(topContent, "top_languages");
00106
00107 WSignalMapper<int> *lmap = new WSignalMapper<int>(this);
00108 lmap->mapped.connect(SLOT(this, Home::changeLanguage));
00109
00110 for (unsigned i = 0; i < languages.size(); ++i) {
00111 if (i != 0)
00112 new WText("- ", languagesDiv);
00113
00114 const Lang& l = languages[i];
00115
00116 WAnchor *a = new WAnchor(bookmarkUrl(l.path), l.longDescription,
00117 languagesDiv);
00118
00119 lmap->mapConnect(a->clicked, i);
00120 }
00121
00122 WText *topWt = new WText(tr("top_wt"), topContent);
00123 topWt->setInline(false);
00124 topWt->setId("top_wt");
00125
00126 WText *bannerWt = new WText(tr("banner_wrapper"), root());
00127 bannerWt->setId("banner_wrapper");
00128
00129 Div *mainWrapper = new Div(root(), "main_wrapper");
00130 Div *mainContent = new Div(mainWrapper, "main_content");
00131 Div *mainMenu = new Div(mainContent, "main_menu");
00132
00133 WStackedWidget *contents = new WStackedWidget();
00134 contents->setId("main_page");
00135
00136 mainMenu_ = new WMenu(contents, Vertical, mainMenu);
00137 mainMenu_->setRenderAsList(true);
00138
00139
00140 mainMenu_->addItem
00141 (tr("introduction"), introduction())->setPathComponent("");
00142 mainMenu_->addItem
00143 (tr("news"), deferCreate(boost::bind(&Home::news, this)),
00144 WMenuItem::PreLoading);
00145 mainMenu_->addItem
00146 (tr("features"), wrapViewOrDefer(&Home::features),
00147 WMenuItem::PreLoading);
00148 mainMenu_->addItem
00149 (tr("documentation"), wrapViewOrDefer(&Home::documentation),
00150 WMenuItem::PreLoading);
00151 mainMenu_->addItem
00152 (tr("examples"), examples(),
00153 WMenuItem::PreLoading);
00154 mainMenu_->addItem
00155 (tr("download"), deferCreate(boost::bind(&Home::download, this)),
00156 WMenuItem::PreLoading);
00157 mainMenu_->addItem
00158 (tr("community"), wrapViewOrDefer(&Home::community),
00159 WMenuItem::PreLoading);
00160
00161 mainMenu_->itemSelectRendered.connect(SLOT(this, Home::updateTitle));
00162 mainMenu_->itemSelected.connect(SLOT(this, Home::logInternalPath));
00163 mainMenu_->select((int)0);
00164
00165
00166 mainMenu_->setInternalPathEnabled();
00167 mainMenu_->setInternalBasePath("/");
00168
00169 sideBarContent_ = new WContainerWidget(mainMenu);
00170
00171 mainContent->addWidget(contents);
00172 WContainerWidget *clearAll = new WContainerWidget(mainContent);
00173 clearAll->setStyleClass("clearall");
00174
00175 WText *footerWrapper = new WText(tr("footer_wrapper"), root());
00176 footerWrapper->setId("footer_wrapper");
00177
00178 internalPathChanged.connect(SLOT(this, Home::setLanguageFromPath));
00179 }
00180
00181 void Home::changeLanguage(int index)
00182 {
00183 if (index == language_)
00184 return;
00185
00186 int prevLanguage = language_;
00187
00188 setLanguage(index);
00189
00190 std::string langPath = languages[index].path;
00191 if (internalPath().empty())
00192 setInternalPath(langPath);
00193 else {
00194 std::string prevLangPath = languages[prevLanguage].path;
00195 std::string path = internalPath().substr(prevLangPath.length());
00196 setInternalPath(langPath + path);
00197 }
00198 }
00199
00200 void Home::setLanguage(int index)
00201 {
00202 const Lang& l = languages[index];
00203
00204 setLocale(l.code);
00205
00206 std::string langPath = l.path;
00207 mainMenu_->setInternalBasePath(langPath);
00208 examplesMenu_->setInternalBasePath(langPath + "examples");
00209 updateTitle();
00210
00211 language_ = index;
00212 }
00213
00214 void Home::setLanguageFromPath(std::string prefix)
00215 {
00216 if (prefix == "/") {
00217 std::string langPath = internalPathNextPart(prefix);
00218
00219 if (langPath.empty())
00220 langPath = '/';
00221 else
00222 langPath = '/' + langPath + '/';
00223
00224 int newLanguage = 0;
00225
00226 for (unsigned i = 0; i < languages.size(); ++i) {
00227 if (languages[i].path == langPath) {
00228 newLanguage = i;
00229 break;
00230 }
00231 }
00232
00233 if (newLanguage != language_)
00234 setLanguage(newLanguage);
00235 }
00236 }
00237
00238 void Home::updateTitle()
00239 {
00240 setTitle(tr("wt") + " - " + mainMenu_->currentItem()->text());
00241 }
00242
00243 void Home::logInternalPath()
00244 {
00245
00246 log("path") << internalPath();
00247 }
00248
00249 WWidget *Home::introduction()
00250 {
00251 return new WText(tr("home.intro"));
00252 }
00253
00254 void Home::refresh()
00255 {
00256 if (recentNews_)
00257 readNews(recentNews_, "latest-news.txt");
00258
00259 if (historicalNews_)
00260 readNews(historicalNews_, "historical-news.txt");
00261
00262 if (releases_)
00263 readReleases(releases_, "releases.txt");
00264
00265 WApplication::refresh();
00266 }
00267
00268 WWidget *Home::news()
00269 {
00270 WContainerWidget *result = new WContainerWidget();
00271
00272 result->addWidget(new WText(tr("home.news")));
00273
00274 result->addWidget(new WText(tr("home.latest-news")));
00275 recentNews_ = new WTable();
00276 readNews(recentNews_, "latest-news.txt");
00277 result->addWidget(recentNews_);
00278
00279 result->addWidget(new WText(tr("home.historical-news")));
00280 historicalNews_ = new WTable();
00281 readNews(historicalNews_, "historical-news.txt");
00282 result->addWidget(historicalNews_);
00283
00284 return result;
00285 }
00286
00287 WWidget *Home::status()
00288 {
00289 return new WText(tr("home.status"));
00290 }
00291
00292 WWidget *Home::features()
00293 {
00294 return new WText(tr("home.features"));
00295 }
00296
00297 WWidget *Home::documentation()
00298 {
00299 return new WText(tr("home.documentation"));
00300 }
00301
00302 WWidget *Home::helloWorldExample()
00303 {
00304 WContainerWidget *result = new WContainerWidget();
00305
00306 new WText(tr("home.examples.hello"), result);
00307
00308 WTreeNode *tree = makeTreeMap("Hello world", 0);
00309 makeTreeFile("hello.C", tree);
00310
00311 tree->expand();
00312
00313 result->addWidget(tree);
00314
00315 return result;
00316 }
00317
00318 WWidget *Home::chartExample()
00319 {
00320 WContainerWidget *result = new WContainerWidget();
00321
00322 new WText(tr("home.examples.chart"), result);
00323
00324 WTreeNode *tree = makeTreeMap("Chart example", 0);
00325 WTreeNode *chartsExample = makeTreeMap("class ChartsExample", tree);
00326 makeTreeFile("ChartsExample.h", chartsExample);
00327 makeTreeFile("ChartsExample.C", chartsExample);
00328 WTreeNode *chartConfig = makeTreeMap("class ChartConfig", tree);
00329 makeTreeFile("ChartConfig.h", chartConfig);
00330 makeTreeFile("ChartConfig.C", chartConfig);
00331 WTreeNode *panelList = makeTreeMap("class PanelList", tree);
00332 makeTreeFile("PanelList.h", panelList);
00333 makeTreeFile("PanelList.C", panelList);
00334 makeTreeFile("CsvUtil.C", tree);
00335 makeTreeFile("charts.xml", tree);
00336 makeTreeFile("charts.css", tree);
00337
00338 tree->expand();
00339
00340 result->addWidget(tree);
00341
00342 return result;
00343 }
00344
00345 WWidget *Home::homepageExample()
00346 {
00347 WContainerWidget *result = new WContainerWidget();
00348
00349 new WText(tr("home.examples.wt"), result);
00350
00351 WTreeNode *tree = makeTreeMap("Wt Homepage", 0);
00352 WTreeNode *home = makeTreeMap("class Home", tree);
00353 makeTreeFile("Home.h", home);
00354 makeTreeFile("Home.C", home);
00355 WTreeNode *treeexample = makeTreeMap("class TreeListExample", tree);
00356 makeTreeFile("TreeListExample.h", treeexample);
00357 makeTreeFile("TreeListExample.C", treeexample);
00358 makeTreeFile("wt-home.xml", tree);
00359
00360 tree->expand();
00361
00362 result->addWidget(tree);
00363
00364 return result;
00365 }
00366
00367 WWidget *Home::treeviewExample()
00368 {
00369 WContainerWidget *result = new WContainerWidget();
00370
00371 new WText(tr("home.examples.treeview"), result);
00372
00373 WTreeNode *tree = makeTreeMap("Treeview example", 0);
00374
00375 WTreeNode *classMap;
00376 classMap = makeTreeMap("class FolderView", tree);
00377 makeTreeFile("FolderView.h", classMap);
00378 makeTreeFile("FolderView.C", classMap);
00379 makeTreeFile("TreeViewDragDrop.C", tree);
00380 makeTreeFile("CsvUtil.C", tree);
00381 makeTreeFile("about.xml", tree);
00382 makeTreeFile("styles.css", tree);
00383
00384 tree->expand();
00385
00386 result->addWidget(tree);
00387
00388 return result;
00389 }
00390
00391 WWidget *Home::gitExample()
00392 {
00393 WContainerWidget *result = new WContainerWidget();
00394
00395 new WText(tr("home.examples.git"), result);
00396
00397 WTreeNode *tree = makeTreeMap("Git example", 0);
00398
00399 WTreeNode *classMap;
00400 classMap = makeTreeMap("class GitModel", tree);
00401 makeTreeFile("GitModel.h", classMap);
00402 makeTreeFile("GitModel.C", classMap);
00403 classMap = makeTreeMap("class Git", tree);
00404 makeTreeFile("Git.h", classMap);
00405 makeTreeFile("Git.C", classMap);
00406 makeTreeFile("GitView.C", tree);
00407 makeTreeFile("gitview.css", tree);
00408
00409 tree->expand();
00410
00411 result->addWidget(tree);
00412
00413 return result;
00414 }
00415
00416 WWidget *Home::chatExample()
00417 {
00418 WContainerWidget *result = new WContainerWidget();
00419
00420 new WText(tr("home.examples.chat"), result);
00421
00422 WTreeNode *tree = makeTreeMap("Chat example", 0);
00423
00424 WTreeNode *classMap;
00425 classMap = makeTreeMap("class SimpleChatWidget", tree);
00426 makeTreeFile("SimpleChatWidget.h", classMap);
00427 makeTreeFile("SimpleChatWidget.C", classMap);
00428 classMap = makeTreeMap("class SimpleChatServer", tree);
00429 makeTreeFile("SimpleChatServer.h", classMap);
00430 makeTreeFile("SimpleChatServer.C", classMap);
00431 makeTreeFile("simpleChat.C", tree);
00432 makeTreeFile("simplechat.css", tree);
00433 makeTreeFile("simplechat.xml", tree);
00434
00435 tree->expand();
00436
00437 result->addWidget(tree);
00438
00439 return result;
00440 }
00441
00442 WWidget *Home::composerExample()
00443 {
00444 WContainerWidget *result = new WContainerWidget();
00445
00446 new WText(tr("home.examples.composer"), result);
00447
00448 WTreeNode *tree = makeTreeMap("Mail composer example", 0);
00449
00450 WTreeNode *classMap;
00451 classMap = makeTreeMap("class AddresseeEdit", tree);
00452 makeTreeFile("AddresseeEdit.h", classMap);
00453 makeTreeFile("AddresseeEdit.C", classMap);
00454 classMap = makeTreeMap("class AttachmentEdit", tree);
00455 makeTreeFile("AttachmentEdit.h", classMap);
00456 makeTreeFile("AttachmentEdit.C", classMap);
00457 classMap = makeTreeMap("class ComposeExample", tree);
00458 makeTreeFile("ComposeExample.h", classMap);
00459 makeTreeFile("ComposeExample.C", classMap);
00460 classMap = makeTreeMap("class Composer", tree);
00461 makeTreeFile("Composer.h", classMap);
00462 makeTreeFile("Composer.C", classMap);
00463 classMap = makeTreeMap("class ContactSuggestions", tree);
00464 makeTreeFile("ContactSuggestions.h", classMap);
00465 makeTreeFile("ContactSuggestions.C", classMap);
00466 classMap = makeTreeMap("class Label", tree);
00467 makeTreeFile("Label.h", classMap);
00468 makeTreeFile("Label.C", classMap);
00469 classMap = makeTreeMap("class Option", tree);
00470 makeTreeFile("Option.h", classMap);
00471 makeTreeFile("Option.C", classMap);
00472 classMap = makeTreeMap("class OptionList", tree);
00473 makeTreeFile("OptionList.h", classMap);
00474 makeTreeFile("OptionList.C", classMap);
00475 makeTreeFile("Contact.h", tree);
00476 makeTreeFile("Attachment.h", tree);
00477 makeTreeFile("composer.xml", tree);
00478 makeTreeFile("composer.css", tree);
00479
00480 tree->expand();
00481
00482 result->addWidget(tree);
00483
00484 return result;
00485 }
00486
00487 WWidget *Home::widgetGalleryExample()
00488 {
00489 WContainerWidget *result = new WContainerWidget();
00490
00491 new WText(tr("home.examples.widgetgallery"), result);
00492
00493 return result;
00494 }
00495
00496 WWidget *Home::wrapViewOrDefer(WWidget *(Home::*createWidget)())
00497 {
00498
00499
00500
00501
00502
00503
00504
00505
00506 if (!environment().agentIEMobile() && environment().javaScript())
00507 return makeStaticModel(boost::bind(createWidget, this));
00508 else
00509 return deferCreate(boost::bind(createWidget, this));
00510 }
00511
00512 WWidget *Home::examples()
00513 {
00514 WContainerWidget *result = new WContainerWidget();
00515
00516 result->addWidget(new WText(tr("home.examples")));
00517
00518 examplesMenu_ = new WTabWidget(result);
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540 examplesMenu_->addTab(wrapViewOrDefer(&Home::helloWorldExample),
00541 tr("hello-world"))->setPathComponent("");
00542
00543 examplesMenu_->addTab(wrapViewOrDefer(&Home::chartExample),
00544 tr("charts"));
00545 examplesMenu_->addTab(wrapViewOrDefer(&Home::homepageExample),
00546 tr("wt-homepage"));
00547 examplesMenu_->addTab(wrapViewOrDefer(&Home::treeviewExample),
00548 tr("treeview"));
00549 examplesMenu_->addTab(wrapViewOrDefer(&Home::gitExample),
00550 tr("git"));
00551 examplesMenu_->addTab(wrapViewOrDefer(&Home::chatExample),
00552 tr("chat"));
00553 examplesMenu_->addTab(wrapViewOrDefer(&Home::composerExample),
00554 tr("mail-composer"));
00555 examplesMenu_->addTab(wrapViewOrDefer(&Home::widgetGalleryExample),
00556 tr("widget-gallery"));
00557
00558 examplesMenu_->currentChanged.connect(SLOT(this, Home::logInternalPath));
00559
00560
00561 examplesMenu_->setInternalPathEnabled();
00562 examplesMenu_->setInternalBasePath("/examples");
00563
00564 return result;
00565 }
00566
00567 WWidget *Home::download()
00568 {
00569 WContainerWidget *result = new WContainerWidget();
00570 result->addWidget(new WText(tr("home.download")));
00571 result->addWidget(new WText(tr("home.download.license")));
00572 result->addWidget(new WText(tr("home.download.requirements")));
00573 result->addWidget(new WText(tr("home.download.cvs")));
00574 result->addWidget(new WText(tr("home.download.packages")));
00575
00576 releases_ = new WTable();
00577 readReleases(releases_, "releases.txt");
00578 result->addWidget(releases_);
00579
00580 result->addWidget
00581 (new WText("<p>Older releases are still available at "
00582 + href("http://sourceforge.net/project/showfiles.php?"
00583 "group_id=153710#files",
00584 "sourceforge.net")
00585 + "</p>"));
00586
00587 return result;
00588 }
00589
00590 std::string Home::href(const std::string url, const std::string description)
00591 {
00592 return "<a href=\"" + url + "\" target=\"_blank\">" + description + "</a>";
00593 }
00594
00595 WWidget *Home::community()
00596 {
00597 return new WText(tr("home.community"));
00598 }
00599
00600 void Home::readNews(WTable *newsTable, const std::string newsfile)
00601 {
00602 std::ifstream f(newsfile.c_str());
00603
00604 newsTable->clear();
00605
00606 int row = 0;
00607
00608 while (f) {
00609 std::string line;
00610 getline(f, line);
00611
00612 if (f) {
00613 typedef boost::tokenizer<boost::escaped_list_separator<char> >
00614 CsvTokenizer;
00615 CsvTokenizer tok(line);
00616
00617 CsvTokenizer::iterator i=tok.begin();
00618
00619 newsTable->elementAt(row, 0)->
00620 addWidget(new WText("<p><b>" + *i + "</b></p>"));
00621 newsTable->elementAt(row, 0)
00622 ->setContentAlignment(AlignCenter | AlignTop);
00623 newsTable->elementAt(row, 0)
00624 ->resize(WLength(16, WLength::FontEx), WLength());
00625 newsTable
00626 ->elementAt(row, 1)->addWidget(new WText("<p>" + *(++i) + "</p>"));
00627
00628 ++row;
00629 }
00630 }
00631 }
00632
00633 void Home::readReleases(WTable *releaseTable, const std::string releasefile)
00634 {
00635 std::ifstream f(releasefile.c_str());
00636
00637 releaseTable->clear();
00638
00639 releaseTable->elementAt(0, 0)
00640 ->addWidget(new WText(tr("home.download.version")));
00641 releaseTable->elementAt(0, 1)
00642 ->addWidget(new WText(tr("home.download.date")));
00643 releaseTable->elementAt(0, 2)
00644 ->addWidget(new WText(tr("home.download.description")));
00645
00646 releaseTable->elementAt(0, 0)->resize(WLength(10, WLength::FontEx),
00647 WLength());
00648 releaseTable->elementAt(0, 1)->resize(WLength(15, WLength::FontEx),
00649 WLength());
00650
00651 int row = 1;
00652
00653 while (f) {
00654 std::string line;
00655 getline(f, line);
00656
00657 if (f) {
00658 typedef boost::tokenizer<boost::escaped_list_separator<char> >
00659 CsvTokenizer;
00660 CsvTokenizer tok(line);
00661
00662 CsvTokenizer::iterator i=tok.begin();
00663
00664 std::string version = *i;
00665 releaseTable->elementAt(row, 0)->addWidget
00666 (new WText(href("http://prdownloads.sourceforge.net/witty/wt-"
00667 + version + ".tar.gz?download", "Wt " + version)));
00668 releaseTable->elementAt(row, 1)->addWidget(new WText(*(++i)));
00669 releaseTable->elementAt(row, 2)->addWidget(new WText(*(++i)));
00670
00671 ++row;
00672 }
00673 }
00674 }
00675
00676 WTreeNode *Home::makeTreeMap(const std::string name, WTreeNode *parent)
00677 {
00678 WIconPair *labelIcon
00679 = new WIconPair("icons/yellow-folder-closed.png",
00680 "icons/yellow-folder-open.png", false);
00681
00682 WTreeNode *node = new WTreeNode(name, labelIcon, parent);
00683 node->label()->setFormatting(WText::PlainFormatting);
00684
00685 if (!parent) {
00686 node->setImagePack("icons/");
00687 node->expand();
00688 node->setLoadPolicy(WTreeNode::NextLevelLoading);
00689 }
00690
00691 return node;
00692 }
00693
00694 WTreeNode *Home::makeTreeFile(const std::string name, WTreeNode *parent)
00695 {
00696 WIconPair *labelIcon
00697 = new WIconPair("icons/document.png",
00698 "icons/yellow-folder-open.png", false);
00699
00700 return new WTreeNode("<a href=\"" + fixRelativeUrl("wt/src/" + name)
00701 + "\" target=\"_blank\">"
00702 + name + "</a>", labelIcon, parent);
00703 }
00704
00705 WString Home::tr(const char *key)
00706 {
00707 return WString::tr(key);
00708 }
00709
00710 WApplication *createApplication(const WEnvironment& env)
00711 {
00712 try {
00713
00714
00715
00716 std::string historyKey = env.getArgument("historyKey")[0];
00717
00718 const char *mainStr[]
00719 = { "main:0", "/",
00720 "main:1", "/news",
00721 "main:2", "/features",
00722 "main:4", "/examples",
00723 "main:3", "/documentation",
00724 "main:5", "/download",
00725 "main:6", "/community" };
00726
00727 const char *exampleStr[]
00728 = { "example:0", "/examples",
00729 "example:1", "/examples/charts",
00730 "example:2", "/examples/wt-homepage",
00731 "example:3", "/examples/treelist",
00732 "example:4", "/examples/hangman",
00733 "example:5", "/examples/chat",
00734 "example:6", "/examples/mail-composer",
00735 "example:7", "/examples/drag-and-drop",
00736 "example:8", "/examples/file-explorer",
00737 "example:9", "/examples/calendar" };
00738
00739 if (historyKey.find("main:4") != std::string::npos) {
00740 for (unsigned i = 0; i < 10; ++i)
00741 if (historyKey.find(exampleStr[i*2]) != std::string::npos) {
00742 WApplication *app = new WApplication(env);
00743 app->log("notice") << "redirecting old style URL '"
00744 << historyKey << "' to internal path: '"
00745 << exampleStr[i*2+1] << "'";
00746 app->redirect(app->bookmarkUrl(exampleStr[i*2+1]));
00747 app->quit();
00748 return app;
00749 }
00750 } else
00751 for (unsigned i = 0; i < 6; ++i)
00752 if (historyKey.find(mainStr[i*2]) != std::string::npos) {
00753 WApplication *app = new WApplication(env);
00754
00755 app->log("notice") << "redirecting old style URL '"
00756 << historyKey << "' to internal path: '"
00757 << mainStr[i*2+1] << "'";
00758 app->redirect(app->bookmarkUrl(mainStr[i*2+1]));
00759 app->quit();
00760 return app;
00761 }
00762
00763
00764 } catch (std::runtime_error) {
00765
00766 }
00767
00768 return new Home(env);
00769 }
00770
00771 int main(int argc, char **argv)
00772 {
00773 return WRun(argc, argv, &createApplication);
00774 }
00775