Example #1
0
File: WMenu.C Project: LifeGo/wt
void WMenu::internalPathChanged(const std::string& path)
{
  WApplication *app = wApp;

  if (app->internalPathMatches(basePath_)) {
    std::string subPath = app->internalSubPath(basePath_);

    int bestI = -1, bestMatchLength = -1;

    for (int i = 0; i < count(); ++i) {
      if (!itemAt(i)->isEnabled() || itemAt(i)->isHidden())
	continue;

      int matchLength = match(subPath, itemAt(i)->pathComponent());

      if (matchLength > bestMatchLength) {
	bestMatchLength = matchLength;
	bestI = i;
      }
    }

    if (bestI != -1)
      itemAt(bestI)->setFromInternalPath(path);
    else {
      if (!subPath.empty())
	LOG_WARN("unknown path: '"<< subPath << "'");
      else
	select(-1, false);
    }
  }
}
Example #2
0
bool AuthWidget::handleRegistrationPath(const std::string& path)
{
  if (!basePath_.empty()) {
    WApplication *app = WApplication::instance();

    if (app->internalPathMatches(basePath_)) {
      std::string ap = app->internalSubPath(basePath_);

      if (ap == "register") {
	registerNewUser();
	return true;
      }
    }
  }

  return false;
}
Example #3
0
File: AuthWidget.C Project: bend/wt
void AuthWidget::closeDialog()
{
  if (dialog_) {
    delete dialog_;
    dialog_ = 0;
  } else {
    delete messageBox_;
    messageBox_ = 0;
  }
  
  /* Reset internal path */
  if(!basePath_.empty()) {
    WApplication *app = WApplication::instance();
    if (app->internalPathMatches(basePath_)) {
      std::string ap = app->internalSubPath(basePath_);

      if (ap == "register/") {
        app->setInternalPath(basePath_, false);
      }
    }
  }
}