void handlePathChange(const std::string& path) { WApplication *app = wApp; if (app->internalPathMatches(basePath_)) { dbo::Transaction t(session_); std::string path = app->internalPathNextPart(basePath_); items_->clear(); if (users_) { delete users_; users_ = 0; } if (path.empty()) showPosts(session_.find<Post> ("where state = ? " "order by date desc " "limit 10").bind(Post::Published), items_); else if (path == "author") { std::string author = app->internalPathNextPart(basePath_ + path + '/'); dbo::ptr<User> user = findUser(author); if (user) showPosts(user); else showError(tr("blog-no-author").arg(author)); } else if (path == "edituser") { editUser(app->internalPathNextPart(basePath_ + path + '/')); } else if (path == "all") { showArchive(items_); } else { std::string remainder = app->internalPath().substr(basePath_.length()); showPostsByDateTopic(remainder, items_); } t.commit(); } }