Exemplo n.º 1
0
  AuthApplication(const Wt::WEnvironment& env)
    : Wt::WApplication(env),
      session_(appRoot() + "auth.db")
  {
    /*
     * For better support for a mobile device. Note this requires
     * progressive bootstrap being enabled (see wt_config.xml).
     */
    addMetaHeader("viewport",
		  "width=device-width, initial-scale=1, maximum-scale=1");

    session_.login().changed().connect(this, &AuthApplication::authEvent);

    useStyleSheet("css/style.css");
    messageResourceBundle().use(appRoot() + "templates");

    QRAuthWidget *authWidget = new QRAuthWidget(session_.login());

    Wt::Auth::AuthModel *model
      = new Wt::Auth::AuthModel(Session::auth(), session_.users(), this);

    model->addPasswordAuth(&Session::passwordAuth());
    model->addOAuth(Session::oAuth());
    authWidget->setModel(model);
    authWidget->setRegistrationEnabled(true);
    authWidget->configureQRAuth(Session::qrAuth(), session_.qrTokenDatabase());

    authWidget->processEnvironment();

    root()->addWidget(authWidget);
  }
Exemplo n.º 2
0
App::App(const WEnvironment& environment) :
    BaseApp(environment, my_appCookieName) {
    // Set up the db
    string postgresConnectionString;
    readConfigurationProperty("DB", postgresConnectionString);
    postgres.connect(postgresConnectionString);
    dbSession().setConnection(postgres);
    log("notice") << "Mapping classes";
    mapModels(dbSession());
    // Load the message bundles
    messageResourceBundle().use(appRoot() + "messages/App");
    messageResourceBundle().use(appRoot() + "messages/MainWindow");
    messageResourceBundle().use(appRoot() + "messages/LoginWindow");
    messageResourceBundle().use(appRoot() + "messages/ButtonBar");
    messageResourceBundle().use(appRoot() + "messages/AdminIndex", false);
    messageResourceBundle().use(appRoot() + "messages/UserList", false);
    messageResourceBundle().use(appRoot() + "messages/UserEdit", false);
    // Set up our signals
    _userChanged = new UserChangedSignal(this);
    _statusTextChanged = new MessageSignal(this);
    internalPathChanged().connect(this, &App::rememberHistory);
    // Set up the general URL handling
    _url2ActionMapper = new URL2Action(this);
    // Set up the UI
    useStyleSheet(resourcesUrl() + "/themes/" + cssTheme() + "/forms.css");
    useStyleSheet(resourcesUrl() + "/themes/" + cssTheme() + "/fonts.css");
    useStyleSheet(resourcesUrl() + "/themes/" + cssTheme() + "/controlPanel.css");
    setTitle(WString::tr("main-title"));
    _mainWindow = new MainWindow(root());
    _statusTextChanged->connect(_mainWindow, &MainWindow::setStatusText);
    setBodyClass("yui-skin-sam");
    // Fire an internal path changed event off as user may have navigated straight here
    internalPathChanged().emit(app()->internalPath());
}
Exemplo n.º 3
0
Arquivo: Auth2.C Projeto: LifeGo/wt
  AuthApplication(const Wt::WEnvironment& env)
    : Wt::WApplication(env),
      session_(appRoot() + "auth.db")
  {
    session_.login().changed().connect(this, &AuthApplication::authEvent);

    useStyleSheet("css/style.css");
    messageResourceBundle().use("strings");
    messageResourceBundle().use("templates");

    AuthWidget *authWidget = new AuthWidget(session_);

    authWidget->model()->addPasswordAuth(&Session::passwordAuth());
    authWidget->model()->addOAuth(Session::oAuth());
    authWidget->setRegistrationEnabled(true);

    authWidget->processEnvironment();

    root()->addWidget(authWidget);
  }
Exemplo n.º 4
0
App::App(const Wt::WEnvironment& env) : wittyPlus::App(env) {
    setTheme(new Wt::WCssTheme("polished", this));
    messageResourceBundle().use(appRoot() + "messages/MainWindow");
    useStyleSheet("/css/footprint.css");
    // Ensure that any users from the config file exist
    std::string users;
    readConfigurationProperty("users", users);
    ensureUsers(users);
    // Run!
    new widgets::MainWindow(root());
};
Exemplo n.º 5
0
      WebApp::WebApp(const Wt::WEnvironment & env) : WApplication(env) {
        if (string(org::esb::config::Config::getProperty("hive.mode")) == "setup") {
          WApplication::instance()->redirect("/setup");
          WApplication::instance()->quit();
        }
        setTitle("Hive Webadmin");
        _isAuthenticated = false;
        Wt::Ext::Container *viewPort = new Wt::Ext::Container(root());
        Wt::WBorderLayout *layout = new Wt::WBorderLayout(viewPort);


        Wt::Ext::Panel *north = new Wt::Ext::Panel();
        north->setBorder(false);
        std::string h = "MediaEncodingCluster V-";
        h += MHIVE_VERSION;
        h += "($Rev$-"__DATE__ "-" __TIME__")";
        Wt::WText *head = new Wt::WText(h);
        head->setStyleClass("north");
        north->setLayout(new Wt::WFitLayout());
        north->layout()->addWidget(head);
        north->resize(Wt::WLength(), 35);
        layout->addWidget(north, Wt::WBorderLayout::North);

        /* West */
        west = new Wt::Ext::Panel();

        west->setTitle("Menu");
        west->resize(200, Wt::WLength());
        west->setResizable(true);
        west->collapse();
        west->setAnimate(true);
        west->setAutoScrollBars(true);
        layout->addWidget(west, Wt::WBorderLayout::West);


        /* Center */
        Wt::Ext::Panel *center = new Wt::Ext::Panel();
        center->setTitle("MediaEncodingCluster");
        center->layout()->addWidget(exampleContainer_ = new Wt::WContainerWidget());
        center->setAutoScrollBars(true);
        layout->addWidget(center, Wt::WBorderLayout::Center);

        exampleContainer_->setPadding(5);

        currentExample_ = login = new Login(exampleContainer_);
        login->authenticated.connect(SLOT(this, WebApp::authenticated));
        //        useStyleSheet("ext/resources/css/xtheme-gray.css");
        useStyleSheet("filetree.css");
        useStyleSheet("main.css");
        std::string res = std::string(Config::getProperty("hive.path"));
        res.append("/../res/messages");
        messageResourceBundle().use(res.c_str(), false);

      }
Exemplo n.º 6
0
OAuthAuthorizationEndpoint::OAuthAuthorizationEndpoint(const Wt::WEnvironment& env, Session* session)
  : Wt::WApplication(env), session_(session)
{
  messageResourceBundle().use("strings");
  messageResourceBundle().use("templates");

  OAuthWidget* authwidget = new OAuthWidget(*session);
  authwidget->model()->addPasswordAuth(&Session::passwordAuth());
  authwidget->setRegistrationEnabled(true);
  authwidget->processEnvironment();

  process_ = new Wt::Auth::OAuthAuthorizationEndpointProcess(
      session->login(),
      session->users());
  process_->authorized().connect(
      process_,
      &Wt::Auth::OAuthAuthorizationEndpointProcess::authorizeScope);
  process_->processEnvironment();

  if (process_->validRequest()) {
    root()->addWidget(authwidget);
  } else
    new Wt::WText("The request was invalid.", root());
}
Exemplo n.º 7
0
Application::Application(const Wt::WEnvironment& env, Server& server):
    Wt::WApplication(env), session_(server),
    fact_path_format_("/fact/%i/"),
    comment_path_format_("/fact/%i/comment/%i/"),
    ip_path_format_("/admin/ip/%s/"),
    admin_(false) {
    init_counters_();
    messageResourceBundle().use(Wt::WApplication::appRoot() +
                                "locales/facts");
    setCssTheme("polished");
    useStyleSheet("css/facts.css");
    facts_ = new FactsWidget(root());
    internalPathChanged().connect(this, &Application::path_changed_handler_);
    facts_->set_random_fact();
    WApplication::setInternalPath(environment().internalPath(), true);
}
Exemplo n.º 8
0
TableView::TableView(const Wt::WEnvironment& env, Table *t) :
        Wt::WApplication(env),
        table(t) {
    setTitle("Push Test");
    setCssTheme("");
    useStyleSheet("data/style.css");
    enableUpdates(true);

    messageResourceBundle().use(appRoot() + "i18n");

    table->connect(this);

    Wt::WPushButton* button = new Wt::WPushButton("Increment", root());

    sound = new Wt::WSound("data/click.mp3");

    button->clicked().connect(this, &TableView::increment);

    text = new Wt::WText("Number will appear here", root());
}
Exemplo n.º 9
0
  LocaleApplication(const Wt::WEnvironment& env)
    : WApplication(env)
  {
    messageResourceBundle().use("templates");

    new Wt::WLabel("Select your time zone: ", root());
    localeCombo_ = new Wt::WComboBox(root());

    info_ = new Wt::WTemplate(Wt::WString::tr("info"), root());

    Wt::WReadOnlyProxyModel *regions = new Wt::WReadOnlyProxyModel(this);
    regions->setSourceModel(&timeZones);
    localeCombo_->setModel(regions);

    localeCombo_->setCurrentIndex
      (timeZones.suggestedTimeZone(env.timeZoneOffset()));

    localeCombo_->changed().connect(this, &LocaleApplication::updateLocale);

    updateLocale();
  }
Exemplo n.º 10
0
Arquivo: Home.C Projeto: GuLinux/wt
Home::Home(const WEnvironment& env,
	   Wt::Dbo::SqlConnectionPool& blogDb,
	   const std::string& title, const std::string& resourceBundle,
	   const std::string& cssPath)
  : WApplication(env),
    releases_(0),
    blogDb_(blogDb),
    homePage_(0),
    sourceViewer_(0)
{
  messageResourceBundle().use(appRoot() + resourceBundle, false);

  useStyleSheet(cssPath + "/wt.css");
  useStyleSheet(cssPath + "/wt_ie.css", "lt IE 7", "all");
  useStyleSheet("css/home.css");
  useStyleSheet("css/sourceview.css");
  useStyleSheet("css/chatwidget.css");
  useStyleSheet("css/chatwidget_ie6.css", "lt IE 7", "all");
  setTitle(title);

  setLocale("");
  language_ = 0;
}