Example #1
0
function echo_linenote_entry_row($file, $lineid, $note, $displayed, $lnorder)
{
    global $Pset, $Me, $User, $Info;
    if (!is_array($note)) {
        $note = array(false, $note);
    }
    if (!$Me->isPC || $Me == $User || $displayed) {
        if ($Info->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) . '">&larr; Prev</a>';
                list($nfile, $nlineid) = $lnorder->get_next($file, $lineid);
                if ($nfile) {
                    $links[] = '<a href="#L' . $nlineid . '_' . html_id_encode($nfile) . '">Next &gt;</a>';
                } else {
                    $links[] = '<a href="#">Top</a>';
                }
                if (count($links)) {
                    echo '<div class="difflnoteptr61">', join("&nbsp;&nbsp;&nbsp;", $links), '</div>';
                }
            }
            echo '<div class="note61', $note[0] ? ' commentnote' : ' gradenote', '">', htmlspecialchars($note[1]), '</div>', '<div class="clear"></div></td></tr>';
        }
        return;
    }
    echo '<tr class="diffl61 gw', $note[0] ? ' isgrade61' : ' iscomment61', '" savednote61="', htmlspecialchars($note[1]), '">', '<td colspan="2" class="difflnoteborder61"></td>', '<td class="difflnote61">', '<div class="diffnoteholder61"', $displayed ? "" : " style=\"display:none\"", ">", Ht::form($Info->hoturl_post("pset", array("savelinenote" => 1)), array("onsubmit" => "return savelinenote61(this)")), "<div class=\"f-contain\">", Ht::hidden("file", $file), Ht::hidden("line", $lineid), Ht::hidden("iscomment", "", array("class" => "iscomment")), "<textarea class=\"diffnoteentry61\" name=\"note\">", htmlspecialchars($note[1]), "</textarea><br />";
    echo Ht::submit("Comment", array("onclick" => "return setiscomment61(this,1)")), ' ', Ht::submit("Grade", array("onclick" => "return setiscomment61(this,'')")), '<span class="ajaxsave61"></span>', "</div></form></div></td></tr>";
}
Example #2
0
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;
        break;
    }
}
// line notes
foreach ($diff as $file => $dinfo) {
    $linenotes = $lnorder->file($file);
Example #3
0
 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) . '">&larr; Prev</a>';
             list($nfile, $nlineid) = $lnorder->get_next($file, $lineid);
             if ($nfile) {
                 $links[] = '<a href="#L' . $nlineid . '_' . html_id_encode($nfile) . '">Next &gt;</a>';
             } else {
                 $links[] = '<a href="#">Top</a>';
             }
             if (!empty($links)) {
                 echo '<div class="difflnoteptr61">', join("&nbsp;&nbsp;&nbsp;", $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>';
     }
 }