public function build($runData) { $pl = $runData->getParameterList(); $revisionId = $pl->getParameterValue("revisionId"); $site = $runData->getTemp("site"); if ($revisionId == null || !is_numeric($revisionId)) { throw new ProcessException(_("No revision specified."), "no_post"); } $revision = DB_ForumPostRevisionPeer::instance()->selectByPrimaryKey($revisionId); if ($revision == null) { throw new ProcessException(_("No revision specified."), "no_post"); } $runData->ajaxResponseAdd("title", $revision->getTitle()); $source = $revision->getText(); $wt = new WikiTransformation(); $body = $wt->processSource($source); $runData->ajaxResponseAdd("content", $body); $runData->ajaxResponseAdd("postId", $revision->getPostId()); }
public function build($runData) { $pl = $runData->getParameterList(); $postId = $pl->getParameterValue("postId"); $site = $runData->getTemp("site"); if ($postId == null || !is_numeric($postId)) { throw new ProcessException(_("No post specified."), "no_post"); } $post = DB_ForumPostPeer::instance()->selectByPrimaryKey($postId); if ($post == null || $post->getSiteId() != $site->getSiteId()) { throw new ProcessException(_("No post specified."), "no_post"); } // get all revisions $c = new Criteria(); $c->add("post_id", $postId); $c->addOrderDescending("revision_id"); $revs = DB_ForumPostRevisionPeer::instance()->select($c); $runData->contextAdd("revisions", $revs); $runData->contextAdd("post", $post); $runData->ajaxResponseAdd("postId", $postId); }
public function getRevision() { $r = DB_ForumPostRevisionPeer::instance()->selectByPrimaryKey($this->getRevisionId()); return $r; }