/home/koen/project/wt/public-git/wt/examples/wt-homepage/Home.C File Reference

#include <fstream>
#include <iostream>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <Wt/WAnchor>
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WIconPair>
#include <Wt/WImage>
#include <Wt/WLineEdit>
#include <Wt/WLogger>
#include <Wt/WMenu>
#include <Wt/WPushButton>
#include <Wt/WStackedWidget>
#include <Wt/WTabWidget>
#include <Wt/WTable>
#include <Wt/WTableCell>
#include <Wt/WText>
#include <Wt/WTreeNode>
#include <Wt/WViewWidget>
#include "Home.h"

Go to the source code of this file.

Classes

class  DeferredWidget< Function >
class  Div

Functions

std::vector< Lang > languages (l, l+2)
template<typename Function>
DeferredWidget< Function > * deferCreate (Function f)
WApplicationcreateApplication (const WEnvironment &env)
int main (int argc, char **argv)

Variables

Lang l []


Function Documentation

WApplication* createApplication ( const WEnvironment env  ) 

Definition at line 685 of file Home.C.

00686 {
00687   // support for old (< Wt-2.2) homepage URLS: redirect from "states"
00688   // to "internal paths"
00689   // this contains the initial "history state" in old Wt versions
00690   const std::string *historyKey = env.getParameter("historyKey");
00691 
00692   if (historyKey) {
00693     const char *mainStr[]
00694       = { "main:0", "/",
00695           "main:1", "/news",
00696           "main:2", "/features",
00697           "main:4", "/examples",
00698           "main:3", "/documentation",
00699           "main:5", "/download",
00700           "main:6", "/community" };
00701 
00702     const char *exampleStr[]
00703       = { "example:0", "/examples",
00704           "example:1", "/examples/charts",
00705           "example:2", "/examples/wt-homepage",
00706           "example:3", "/examples/treelist",
00707           "example:4", "/examples/hangman",
00708           "example:5", "/examples/chat",
00709           "example:6", "/examples/mail-composer",
00710           "example:7", "/examples/drag-and-drop",
00711           "example:8", "/examples/file-explorer",
00712           "example:9", "/examples/calendar" };
00713 
00714     if (historyKey->find("main:4") != std::string::npos) {
00715       for (unsigned i = 0; i < 10; ++i)
00716         if (historyKey->find(exampleStr[i*2]) != std::string::npos) {
00717           WApplication *app = new WApplication(env);
00718           app->log("notice") << "redirecting old style URL '"
00719                              << *historyKey << "' to internal path: '"
00720                              << exampleStr[i*2+1] << "'";
00721           app->redirect(app->bookmarkUrl(exampleStr[i*2+1]));
00722           app->quit();
00723           return app;
00724         }
00725     } else
00726       for (unsigned i = 0; i < 6; ++i)
00727         if (historyKey->find(mainStr[i*2]) != std::string::npos) {
00728           WApplication *app = new WApplication(env);
00729 
00730           app->log("notice") << "redirecting old style URL '"
00731                              << *historyKey << "' to internal path: '"
00732                              << mainStr[i*2+1] << "'";
00733           app->redirect(app->bookmarkUrl(mainStr[i*2+1]));
00734           app->quit();
00735           return app;
00736         }
00737 
00738     // unknown history key, just continue
00739   }
00740 
00741   return new Home(env);
00742 }

template<typename Function>
DeferredWidget<Function>* deferCreate ( Function  f  )  [inline]

Definition at line 70 of file Home.C.

00071 {
00072   return new DeferredWidget<Function>(f);
00073 }

std::vector<Lang> @52::languages ( l  ,
l 2 
) [static]

int main ( int  argc,
char **  argv 
)

Definition at line 744 of file Home.C.

00745 {
00746   return WRun(argc, argv, &createApplication);
00747 }


Variable Documentation

std::string code

Definition at line 34 of file Home.C.

Lang l[] [static]

Initial value:

 {
    { "en", "/", "en", "English" },
    { "cn", "/cn/", "汉语", "中文 (Chinese)" }
  }

Definition at line 37 of file Home.C.

std::string longDescription

Definition at line 34 of file Home.C.

std::string path

Definition at line 34 of file Home.C.

std::string shortDescription

Definition at line 34 of file Home.C.


Generated on Mon Mar 9 08:28:56 2009 for Wt by doxygen 1.5.6