Esempio n. 1
0
MainPage::MainPage( const WEnvironment& env)    
    : WApplication(env)
{

    setTitle("Main page");

    this->useStyleSheet(AppPaths::cssFile);

    // Remove this 2 lines???
    userList = new WContainerWidget(root());
    userList->setStyleClass("list");


    // Remove it?
    WContainerWidget *t = new WContainerWidget();
    t->setInline(false);
    t->show();
    t->setStyleClass("big");    

    // Remove it?
    WStackedWidget *main = new WStackedWidget(root());
    main->setStyleClass("");    

    root()->removeWidget(main);




    Wt::WHBoxLayout *loginLayout = new Wt::WHBoxLayout(root());
    LoginWidget *login = new LoginWidget();
    loginLayout->addWidget(login);
    login->loggedIn().connect(this,&MainPage::setMainPage);
}
Esempio n. 2
0
Crianca::Crianca(Wt::WContainerWidget *parent):
    WContainerWidget(parent)
{
    WTemplate *view = new WTemplate(WString::tr("App.nova-crianca"));
    WText *title = new WText("Cadastrar nova crianca:");
    view->bindWidget("action", title);

    name = new WLineEdit("Nome: ");
    view->bindWidget("name", name);

    WText *text = new WText("Sexo: ");
    view->bindWidget("sex", text);

    selectSexo = new WButtonGroup();
    WRadioButton *optionSexo = new WRadioButton("masculino");
    selectSexo->addButton(optionSexo, 1);

    optionSexo = new WRadioButton("feminino");
    selectSexo->addButton(optionSexo, 2);

    view->bindWidget("group", selectSexo);

    Wt::WPushButton *cadastrar = new Wt::WPushButton("Cadastrar");
    cadastrar->clicked().connect(this, &Crianca::salvarDadosCrianca);
    view->bindWidget("button", cadastrar);

    WContainerWidget *container = new WContainerWidget();
    WStackedWidget *stacked = new WStackedWidget(container);
    stacked->addWidget(view);
}
Esempio n. 3
0
File: BlogView.C Progetto: DTidd/wt
 bool checkAdministrator()
 {
   if (session_.user() && (session_.user()->role == User::Admin)) return true;
   panel_->show();
   if (!mustBeAdministratorWarning_)
     panel_->addWidget(mustBeAdministratorWarning_ = new WTemplate(tr("blog-mustbeadministrator")));
   panel_->setCurrentWidget(mustBeAdministratorWarning_);
   return false;
 }
Esempio n. 4
0
File: BlogView.C Progetto: DTidd/wt
 bool checkLoggedIn()
 {
   if (session_.user()) return true;
   panel_->show();
   if (!mustLoginWarning_)
     panel_->addWidget(mustLoginWarning_ = new WTemplate(tr("blog-mustlogin")));
   panel_->setCurrentWidget(mustLoginWarning_);
   return false;
 }
Esempio n. 5
0
File: BlogView.C Progetto: DTidd/wt
 void authorPanel() {
    panel_->show();
    if (!authorPanel_)
    {
      authorPanel_ = new WTemplate(tr("blog-author-panel"));
      panel_->addWidget(authorPanel_);
      bindPanelTemplates();
    }
    panel_->setCurrentWidget(authorPanel_);
  }
Esempio n. 6
0
File: BlogView.C Progetto: DTidd/wt
  void editUsers() {
    panel_->show();

    if (!users_) {
      users_ = new EditUsers(session_, basePath_);
      panel_->addWidget(users_);
      bindPanelTemplates();
    }

    panel_->setCurrentWidget(users_);
  }
Esempio n. 7
0
File: Tabs.C Progetto: DTidd/wt
DataConfig::DataConfig(WCartesian3DChart* chart)
  : chart_(chart)
{
  WTemplate *template_ = new WTemplate(Wt::WString::tr("totaldataconfig-template"), this);

  dataselection_ = new DataSelection(chart);
  template_->bindWidget("dataselection", dataselection_);

  WStackedWidget *sw = new WStackedWidget(this);
  sw->addWidget(new WText("Select data to configure it"));
  numgriddatasettings_ = new NumGridDataSettings();
  catgriddatasettings_ = new CatGridDataSettings();
  scatterdatasettings_ = new ScatterDataSettings();
  sw->addWidget(numgriddatasettings_);
  sw->addWidget(catgriddatasettings_);
  sw->addWidget(scatterdatasettings_);
  template_->bindWidget("dataconfig", sw);

  dataselection_->selectionChanged().connect(std::bind([=] (WAbstractDataSeries3D* data) {
	if (dynamic_cast<WAbstractGridData*>(data)) {
	  WAbstractGridData *gridData = dynamic_cast<WAbstractGridData*>(data);
	  if (gridData->type() == BarSeries3D) {
	    catgriddatasettings_->bindDataSet(gridData);
	    sw->setCurrentIndex(2);
	  } else {
	    numgriddatasettings_->bindDataSet(gridData);
	    sw->setCurrentIndex(1);
	  }
	} else if (dynamic_cast<WScatterData*>(data)) {
	  scatterdatasettings_->bindDataSet(dynamic_cast<WScatterData*>(data));
	  sw->setCurrentIndex(3);
	}
      }, std::placeholders::_1));
}
Esempio n. 8
0
File: BlogView.C Progetto: DTidd/wt
  void loggedOut() {
    loginStatus_->bindEmpty("profile-link");
    loginStatus_->bindEmpty("author-panel-link");
    loginStatus_->bindEmpty("userlist-link");

    loginStatus_->resolveWidget("login")->hide();
    loginStatus_->resolveWidget("login-link")->show();
    loginStatus_->resolveWidget("register-link")->show();
    
    refresh();
    panel_->hide();
  }
Esempio n. 9
0
File: BlogView.C Progetto: DTidd/wt
  void editUser(const std::string& ids) {
    if (!checkLoggedIn()) return;
    if (!checkAdministrator()) return;
    dbo::dbo_traits<User>::IdType id;
    try {
      id = boost::lexical_cast<dbo::dbo_traits<User>::IdType>(ids);
    } catch (boost::bad_lexical_cast&) {
      id = dbo::dbo_traits<User>::invalidId();
    }
    panel_->show();
    try {
      dbo::Transaction t(session_);
      dbo::ptr<User> target(session_.load<User>(id));
      if (!userEditor_)
	panel_->addWidget(userEditor_ = new EditUser(session_));
      userEditor_->switchUser(target);
      panel_->setCurrentWidget(userEditor_);
    }
    catch (Dbo::ObjectNotFoundException) {
      if (!invalidUser_)
	panel_->addWidget(invalidUser_ = new WTemplate(tr("blog-invaliduser")));
      panel_->setCurrentWidget(invalidUser_);
    }
  }
Esempio n. 10
0
File: Home.C Progetto: GuLinux/wt
void Home::createHome()
{
  WTemplate *result = new WTemplate(tr("template"), root());
  homePage_ = result;

  WContainerWidget *languagesDiv = new WContainerWidget();
  languagesDiv->setId("top_languages");

  for (unsigned i = 0; i < languages.size(); ++i) {
    if (i != 0)
      new WText("- ", languagesDiv);

    const Lang& l = languages[i];

    new WAnchor(WLink(WLink::InternalPath, l.path_),
		WString::fromUTF8(l.longDescription_), languagesDiv);
  }

  WStackedWidget *contents = new WStackedWidget();
  WAnimation fade(WAnimation::Fade, WAnimation::Linear, 250);
  contents->setTransitionAnimation(fade);
  contents->setId("main_page");

  mainMenu_ = new WMenu(contents, Vertical);

  mainMenu_->addItem
    (tr("introduction"), introduction())->setPathComponent("");

  mainMenu_->addItem
    (tr("blog"), deferCreate(boost::bind(&Home::blog, this)));

  mainMenu_->addItem
    (tr("features"), wrapView(&Home::features), WMenuItem::PreLoading);

  mainMenu_->addItem
    (tr("documentation"), wrapView(&Home::documentation),
     WMenuItem::PreLoading);

  mainMenu_->addItem
    (tr("examples"), examples(),
     WMenuItem::PreLoading)->setPathComponent("examples/");

  mainMenu_->addItem
    (tr("download"), deferCreate(boost::bind(&Home::download, this)),
     WMenuItem::PreLoading);

  mainMenu_->addItem
    (tr("community"), wrapView(&Home::community), WMenuItem::PreLoading);

  mainMenu_->addItem
    (tr("other-language"), wrapView(&Home::otherLanguage),
     WMenuItem::PreLoading);

  mainMenu_->itemSelectRendered().connect(this, &Home::updateTitle);

  mainMenu_->itemSelected().connect(this, &Home::googleAnalyticsLogger);

  // Make the menu be internal-path aware.
  mainMenu_->setInternalPathEnabled("/");

  sideBarContent_ = new WContainerWidget();

  result->bindWidget("languages", languagesDiv);
  result->bindWidget("menu", mainMenu_);
  result->bindWidget("contents", contents);
  result->bindWidget("sidebar", sideBarContent_);
}