public function executeRepoSave() { $name = mfwRequest::get('name'); $project = mfwRequest::get('project'); if (!$name || !$project) { return $this->buildErrorPage("invalid argument (name={$name}, project={$project})", "/pulls/repoEdit?repo_id={$this->repo->getId()}", 'return'); } $this->repo->update($name, $project); return $this->redirect("/pulls/repoEdit?repo_id={$this->repo->getId()}"); }
public function executeAdd() { $name = mfwRequest::get('name'); $project = mfwRequest::get('project'); if (!$name || !$project) { return $this->buildErrorPage("invalid argument (name={$name}, project={$project})", "/pulls/add", 'return'); } $repo = new Repository(array('name' => $name, 'project' => $project)); $repo->save(); return $this->redirect("/pulls/index"); }
public function executeSave() { $arr = array(); $fid = (int) mfwRequest::get('id'); if ($fid) { $arr['id'] = $fid; } $arr['enable'] = (bool) mfwRequest::get('enable', true); $arr['name'] = mfwRequest::get('name'); $arr['target'] = mfwRequest::get('target'); $arr['pattern'] = mfwRequest::get('pattern'); $filter = new Filter($arr); $filter->save(); return $this->redirect('/filters/index'); }
public function executeView() { $pullid = (int) mfwRequest::get('pull_id'); $pull = PullRequestDb::retrieveByPK($pullid); if (!$pull) { return $this->buildErrorPage("pull request no found (id={$pullid})"); } $repo = $this->repolist[$pull->getRepoId()]; $rawpull = Github::getSinglePullRequest($repo->getName(), $pull->getNumber()); $comments = Github::getPullRequestComments($repo->getName(), $pull->getNumber()); $files = Github::getPullRequestFiles($repo->getName(), $pull->getNumber()); $alerts = PullRequestAlertDb::selectByPullRequest($pull); $filters = FilterDb::selectAll(); $alert_filters = array(); foreach ($alerts as $a) { $alert_filters[$a->getFileName()][] = $filters[$a->getFilterId()]; } $params = array('rawpull' => $rawpull, 'comments' => $comments, 'files' => $files, 'pull' => $pull, 'repo' => $repo, 'alert_filters' => $alert_filters); return $this->build($params); }