$commita = $hasha_mine ? $Info->recent_commits($hasha) : $hrecent[$hasha]; $commitb = $hashb_mine ? $Info->recent_commits($hashb) : $hrecent[$hashb]; if ($commita->hash === $Info->grading_hash()) { $commita->subject .= " ✱"; } // space, nbsp if ($commitb->hash === $Info->grading_hash()) { $commitb->subject .= " ✱"; } // space, nbsp $TABWIDTH = $Info->commit_info("tabwidth") ?: 4; echo "<table><tr><td><h2>diff</h2></td><td style=\"padding-left:10px;line-height:110%\">", "<div class=\"diffl61 gd\" style=\"padding:2px 5px\"><big><code>", substr($hasha, 0, 7), "</code> ", htmlspecialchars($commita->subject), "</big></div>", "<div class=\"diffl61 gi\" style=\"padding:2px 5px\"><big><code>", substr($hashb, 0, 7), "</code> ", htmlspecialchars($commitb->subject), "</big></div>", "</td></tr></table><hr>\n"; // collect diff and sort line notes $diff = $User->repo_diff($Info->repo, $hashb, $Pset, $diff_options); $all_linenotes = $hashb_mine ? $Info->commit_info("linenotes") : array(); $lnorder = new LinenotesOrder($all_linenotes, $Info->can_see_grades); $lnorder->set_diff($diff); // print line notes $notelinks = array(); foreach ($lnorder->seq() as $fl) { $f = str_starts_with($fl[0], $Pset->directory_slash) ? substr($fl[0], strlen($Pset->directory_slash)) : $fl[0]; $notelinks[] = '<a href="#L' . $fl[1] . '_' . html_id_encode($fl[0]) . '" onclick="return gotoline61(this)" class="noteref61' . (!$fl[2] && !$Info->user_can_see_grades ? " hiddennote61" : "") . '">' . htmlspecialchars($f) . ':' . substr($fl[1], 1) . '</a>'; } if (count($notelinks)) { ContactView::echo_group("notes", join(", ", $notelinks)); } // check for any linenotes $has_any_linenotes = false; foreach ($diff as $file => $dinfo) { if ($lnorder->file($file)) { $has_any_linenotes = true;
if ($Me->isPC && $Me != $User) { echo Ht::form($Info->hoturl_post("pset", array("saverunsettings" => 1, "ajax" => 1))), '<div class="f-contain"><div id="runsettings61"></div></div></form>', "\n"; // XXX always using grading commit's settings? if ($runsettings = $Info->commit_info("runsettings")) { echo '<script>runsetting61.load(', json_encode($runsettings), ')</script>'; } } Ht::stash_script("jQuery('button.runner61').prop('disabled',false)"); } // print current grader echo_grader(); // print grade entries echo_all_grades(); // collect diff and sort line notes $all_linenotes = $Info->can_see_comments ? $Info->commit_info("linenotes") : null; $lnorder = new LinenotesOrder($all_linenotes, $Info->can_see_grades); $diff = $User->repo_diff($Info->repo, $Info->commit_hash(), $Pset, array("wdiff" => $WDIFF, "needfiles" => $lnorder->note_files())); $lnorder->set_diff($diff); // print line notes $notelinks = array(); foreach ($lnorder->seq() as $fl) { $f = str_starts_with($fl[0], $Pset->directory_slash) ? substr($fl[0], strlen($Pset->directory_slash)) : $fl[0]; $notelinks[] = '<a href="#L' . $fl[1] . '_' . html_id_encode($fl[0]) . '" onclick="return gotoline61(this)" class="noteref61' . (!$fl[2] && !$Info->user_can_see_grades ? " hiddennote61" : "") . '">' . htmlspecialchars($f) . ':' . substr($fl[1], 1) . '</a>'; } if (count($notelinks)) { ContactView::echo_group("notes", join(", ", $notelinks)); } // print runners $crunners = $Info->commit_info("run"); $runclasses = []; foreach ($Pset->runners as $r) {
if ($Me->isPC && $Me != $User) { echo Ht::form($Info->hoturl_post("pset", array("saverunsettings" => 1, "ajax" => 1))), '<div class="f-contain"><div id="runsettings61"></div></div></form>', "\n"; // XXX always using grading commit's settings? if ($runsettings = $Info->commit_info("runsettings")) { echo '<script>runsetting61.load(', json_encode($runsettings), ')</script>'; } } $Conf->footerScript("jQuery('button.runner61').prop('disabled',false)"); } // print current grader echo_grader(); // print grade entries echo_all_grades(); // collect diff and sort line notes $all_linenotes = $Info->commit_info("linenotes"); $lnorder = new LinenotesOrder($all_linenotes, $Info->can_see_grades); $diff = $User->repo_diff($Info->repo, $Info->commit_hash(), $Pset, array("wdiff" => $WDIFF, "needfiles" => $lnorder->note_files())); $lnorder->set_diff($diff); // print line notes $notelinks = array(); foreach ($lnorder->seq() as $fl) { $f = str_starts_with($fl[0], $Pset->directory_slash) ? substr($fl[0], strlen($Pset->directory_slash)) : $fl[0]; $notelinks[] = '<a href="#L' . $fl[1] . '_' . html_id_encode($fl[0]) . '" onclick="return gotoline61(this)" class="noteref61' . (!$fl[2] && !$Info->user_can_see_grades ? " hiddennote61" : "") . '">' . htmlspecialchars($f) . ':' . substr($fl[1], 1) . '</a>'; } if (count($notelinks)) { ContactView::echo_group("notes", join(", ", $notelinks)); } // print runners $crunners = $Info->commit_info("run"); foreach ($Pset->runners as $r) { if (!$Me->can_view_run($Pset, $r, $User)) {
function echo_linenote($file, $lineid, $note, LinenotesOrder $lnorder = null) { $note_object = null; if (is_object($note)) { // How the f**k did this shit get in the DB, why does PHP suck $note_object = $note; $note = []; for ($i = 0; property_exists($note_object, $i); ++$i) { $note[] = $note_object->{$i}; } } if (!is_array($note)) { $note = array(false, $note); } if ($this->can_see_grades || $note[0]) { echo '<tr class="diffl61 gw">', '<td colspan="2" class="difflnoteborder61"></td>', '<td class="difflnote61">'; if ($lnorder) { $links = array(); //list($pfile, $plineid) = $lnorder->get_prev($file, $lineid); //if ($pfile) // $links[] = '<a href="#L' . $plineid . '_' // . html_id_encode($pfile) . '">← Prev</a>'; list($nfile, $nlineid) = $lnorder->get_next($file, $lineid); if ($nfile) { $links[] = '<a href="#L' . $nlineid . '_' . html_id_encode($nfile) . '">Next ></a>'; } else { $links[] = '<a href="#">Top</a>'; } if (!empty($links)) { echo '<div class="difflnoteptr61">', join(" ", $links), '</div>'; } } if ($this->pc_view && get($note, 2)) { global $Conf; $pcmembers = $Conf->pc_members_and_admins(); if (isset($pcmembers[$note[2]])) { $p = $pcmembers[$note[2]]; echo '<div class="difflnoteauthor61">[', htmlspecialchars($p->firstNameAmbiguous ? Text::name_text($p) : $p->firstName), ']</div>'; } } if (!is_string($note[1])) { error_log("fudge {$this->user->github_username} error: " . json_encode($note)); } echo '<div class="note61', $note[0] ? ' commentnote' : ' gradenote', '">', htmlspecialchars($note[1]), '</div>', '<div class="clear"></div></td></tr>'; } }
$commita = $hasha_mine ? $Info->recent_commits($hasha) : $hrecent[$hasha]; $commitb = $hashb_mine ? $Info->recent_commits($hashb) : $hrecent[$hashb]; if ($commita->hash === $Info->grading_hash()) { $commita->subject .= " ✱"; } // space, nbsp if ($commitb->hash === $Info->grading_hash()) { $commitb->subject .= " ✱"; } // space, nbsp $TABWIDTH = $Info->commit_info("tabwidth") ?: 8; echo "<table><tr><td><h2>diff</h2></td><td style=\"padding-left:10px;line-height:110%\">", "<div class=\"diffl61 gd\" style=\"padding:2px 5px\"><big><code>", substr($hasha, 0, 7), "</code> ", htmlspecialchars($commita->subject), "</big></div>", "<div class=\"diffl61 gi\" style=\"padding:2px 5px\"><big><code>", substr($hashb, 0, 7), "</code> ", htmlspecialchars($commitb->subject), "</big></div>", "</td></tr></table><hr>\n"; // collect diff and sort line notes $diff = $User->repo_diff($Info->repo, $hashb, $Pset, array("wdiff" => false, "basehash" => $hasha)); $all_linenotes = $hashb_mine ? $Info->commit_info("linenotes") : array(); $lnorder = new LinenotesOrder($all_linenotes, $diff, $Info->can_see_grades); // print line notes $notelinks = array(); foreach ($lnorder->seq() as $fl) { $f = str_starts_with($fl[0], $Pset->directory_slash) ? substr($fl[0], strlen($Pset->directory_slash)) : $fl[0]; $notelinks[] = '<a href="#L' . $fl[1] . '_' . html_id_encode($fl[0]) . '" onclick="return gotoline61(this)" class="noteref61' . (!$fl[2] && !$Info->user_can_see_grades ? " hiddennote61" : "") . '">' . htmlspecialchars($f) . ':' . substr($fl[1], 1) . '</a>'; } if (count($notelinks)) { ContactView::echo_group("notes", join(", ", $notelinks)); } // check for any linenotes $has_any_linenotes = false; foreach ($diff as $file => $dinfo) { if (defval($all_linenotes, $file, null)) { $has_any_linenotes = true; break;