mr->getLastReviewInfo($file); $repoModule = isset($lastReview) && isset($lastReview->module) ? $lastReview->module : ''; /* Get product pairs. */ if(isset($repo->product) and $repo->product) { $products = $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('`id`')->in($repo->product)->fetchPairs(); } else { $products = $this->loadModel('product')->getPairs(); } /* get product by cookie or last review in this file. */ $repoProduct = isset($_COOKIE['repoPairs'][$repoID]) ? $_COOKIE['repoPairs'][$repoID] : ''; $repoProduct = isset($lastReview) && isset($lastReview->product) ? $lastReview->product : $repoProduct; $repoProduct = isset($products[$repoProduct]) ? $repoProduct : key($products); $executions = $this->mr->getExecutionPairs($repoProduct); $modules = $this->loadModel('tree')->getOptionMenu($repoProduct, $viewType = 'bug', $startModuleID = 0); $users = $this->loadModel('user')->getPairs('devfirst|nodeleted|noclosed'); $products = array('' => '') + $products; $executions = array('' => '') + $executions; $cwd = getcwd(); $commiters = $this->user->getCommiters(); $blamePairs = array(); if($suffix and $suffix != 'binary' and strpos($this->config->repo->images, "|$suffix|") === false) { $blames = $this->scm->blame($entry, $info->revision); foreach($blames as $line => $blame) { if(!isset($blame['committer'])) { if(isset($blamePairs[$line - 1])) $blamePairs[$line] = $blamePairs[$line - 1]; continue; } $blamePairs[$line] = zget($commiters, $blame['committer'], $blame['committer']); } } chdir($cwd); //$reviews = $this->mr->getReview($repoID, $file, $info->revision); $reviews = $this->mr->getReview($repoID, $file, ''); $v1 = isset($oldRevision) ? $oldRevision : 0; $this->loadModel('repo'); // $bugUrl = $this->repo->createLink('addBug', "repoID=$repoID&file=$file&v1=$v1&v2={$info->revision}"); $bugUrl = $this->createLink('mr', 'addBug', "repoID=$repoID&file=$file&v1=$v1&v2="); $commentUrl = $this->createLink('mr', 'addComment'); $productSelect = html::select('product', $products, $repoProduct, 'class="product form-control chosen" onchange="changeProduct(this)"'); $branches = $this->loadModel('branch')->getPairs($repoProduct); $moduleSelect = html::select('module', $modules, $repoModule, 'class="form-control chosen"'); $executionSelect = html::select('execution', $executions, '', 'class="form-control chosen"'); $typeSelect = html::select('repoType', $lang->repo->typeList, '', 'class="form-control chosen"'); $userSelect = html::select('assignedTo', $users, '', 'class="form-control chosen assignedTo"'); $bugs = array(); foreach($reviews as $line => $lineReview) { $lineBugs = array(); foreach ($lineReview['bugs'] as $bugID => $bug) { $lineBug = array(); $lineBug['id'] = $bugID; $lineBug['line'] = $line; $lineBug['title'] = $bug->title; $lineBug['steps'] = $bug->steps; $lineBug['realname'] = $bug->realname; $lineBug['openedDate'] = substr($bug->openedDate, 5, 11); $lineBug['lines'] = $bug->lines; if($bug->edit) $lineBug['edit'] = true; if($bug->delete) $lineBug['delete'] = true; if(isset($lineReview['comments'])) { if(isset($lineReview['comments'][$bugID])) { $comments = $lineReview['comments'][$bugID]; $bugComments = array(); foreach ($comments as $commentID => $comment) { $bugComment = array( 'id' => $comment->id, 'edit' => $comment->edit, 'realname' => $comment->realname, 'date' => substr($comment->date, 5, 11), 'comment' => $comment->comment, ); $bugComments[] = $bugComment; } $lineBug['comments'] = $bugComments; } } $lineBugs[] = $lineBug; } $bugs[$line] = $lineBugs; } js::set('bugs', $bugs); js::set('productError', $lang->repo->error->product); js::set('contentError', $lang->repo->error->commentText); js::set('titleError', $lang->repo->error->title); js::set('commentError', $lang->repo->error->comment); js::set('submit', $lang->repo->submit); js::set('cancel', $lang->repo->cancel); js::set('confirmDelete', $lang->repo->notice->deleteBug); js::set('confirmDeleteComment', $lang->repo->notice->deleteComment); js::set('repoID', $repoID); // js::set('revision', $info->revision); js::set('revision', ''); js::set('file', $file); js::set('blamePairs', $blamePairs); ?>