/home/koen/project/wt/cvs/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/WSignalMapper>
#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 710 of file Home.C.

00711 {
00712   try {
00713     // support for old (< Wt-2.2) homepage URLS: redirect from "states"
00714     // to "internal paths"
00715     // this contains the initial "history state" in old Wt versions
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     // unknown history key, just continue
00764   } catch (std::runtime_error) {
00765     // no "historyKey argument, simply continue
00766   }
00767 
00768   return new Home(env);
00769 }

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

Definition at line 71 of file Home.C.

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

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

int main ( int  argc,
char **  argv 
)

Definition at line 771 of file Home.C.

00772 {
00773   return WRun(argc, argv, &createApplication);
00774 }


Variable Documentation

std::string code

Definition at line 35 of file Home.C.

Lang l[] [static]

Initial value:

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

Definition at line 38 of file Home.C.

std::string longDescription

Definition at line 35 of file Home.C.

std::string path

Definition at line 35 of file Home.C.

std::string shortDescription

Definition at line 35 of file Home.C.


Generated on Mon Jan 26 14:14:20 2009 for Wt by doxygen 1.5.6