function reviewLinks($prow, $rrows, $crows, $rrow, $mode, &$allreviewslink) { global $Conf, $Me; $conflictType = $Me->view_conflict_type($prow); $allow_admin = $Me->allow_administer($prow); $any_comments = false; $admin = $Me->can_administer($prow); $xsep = ' <span class="barsep">·</span> '; $nvisible = 0; $myrr = null; if ($rrows) { foreach ($rrows as $rr) { if ($Me->can_view_review($prow, $rr, null)) { $nvisible++; } if ($rr->contactId == $Me->contactId || !$myrr && $Me->is_my_review($rr)) { $myrr = $rr; } } } // comments $pret = ""; if ($crows && count($crows) > 0 && !$rrow && $mode !== "edit") { $cids = array(); $cnames = array(); $tagger = new Tagger($Me); foreach ($crows as $cr) { if ($Me->can_view_comment($prow, $cr, null)) { if ($Me->can_view_comment_identity($prow, $cr, null)) { $n = Text::abbrevname_html($cr->user()); } else { $n = "anonymous"; } if ($cr->commentType & COMMENTTYPE_RESPONSE) { $rname = $Conf->resp_round_name($cr->commentRound); $n = $n === "anonymous" ? "" : " ({$n})"; if ($cr->commentType & COMMENTTYPE_DRAFT && $rname != "1") { $n = "<i>Draft {$rname} Response</i>{$n}"; } else { if ($cr->commentType & COMMENTTYPE_DRAFT) { $n = "<i>Draft Response</i>{$n}"; } else { if ($rname != "1") { $n = "<i>{$rname} Response</i>{$n}"; } else { $n = "<i>Response</i>{$n}"; } } } } $cids[] = $cid = CommentInfo::unparse_html_id($cr); $tclass = "cmtlink"; if ($cr->commentTags && ($tags = Tagger::strip_nonviewable($cr->commentTags, $Me)) && $Me->can_view_comment_tags($prow, $cr, null) && ($color = TagInfo::color_classes($tags))) { if (TagInfo::classes_have_colors($color)) { $tclass .= " tagcolorspan"; } $tclass .= " {$color} taghl"; } $cnames[] = '<a class="' . $tclass . '" href="#' . $cid . '">' . $n . '</a>'; } } if (count($cids) > 0) { $pret = '<div class="revnotes"><a href="#' . $cids[0] . '"><strong>' . plural(count($cids), "Comment") . '</strong></a>: <span class="nb">' . join(',</span> <span class="nb">', $cnames) . "</span></div>"; $any_comments = true; } } $t = ""; // see all reviews $allreviewslink = false; if (($nvisible > 1 || $nvisible > 0 && !$myrr) && ($mode !== "p" || $rrow)) { $allreviewslink = true; $x = '<a href="' . hoturl("paper", "p={$prow->paperId}") . '" class="xx">' . Ht::img("view24.png", "[All reviews]", "dlimg") . " <u>All reviews</u></a>"; $t .= ($t === "" ? "" : $xsep) . $x; } // edit paper if ($mode !== "edit" && $prow->conflictType >= CONFLICT_AUTHOR && !$Me->can_administer($prow)) { $x = '<a href="' . hoturl("paper", "p={$prow->paperId}&m=edit") . '" class="xx">' . Ht::img("edit24.png", "[Edit paper]", "dlimg") . " <u><strong>Edit paper</strong></u></a>"; $t .= ($t === "" ? "" : $xsep) . $x; } // edit review if ($mode === "re" || $mode === "assign" && $t !== "" || !$prow) { /* no link */ } else { if ($myrr && $rrow != $myrr) { $myrlink = unparseReviewOrdinal($myrr); $a = '<a href="' . hoturl("review", "p={$prow->paperId}&r={$myrlink}") . '" class="xx">'; if ($Me->can_review($prow, $myrr)) { $x = $a . Ht::img("review24.png", "[Edit review]", "dlimg") . " <u><b>Edit your review</b></u></a>"; } else { $x = $a . Ht::img("review24.png", "[Your review]", "dlimg") . " <u><b>Your review</b></u></a>"; } $t .= ($t === "" ? "" : $xsep) . $x; } else { if (!$myrr && !$rrow && $Me->can_review($prow, null)) { $x = '<a href="' . hoturl("review", "p={$prow->paperId}&m=re") . '" class="xx">' . Ht::img("review24.png", "[Write review]", "dlimg") . " <u><b>Write review</b></u></a>"; $t .= ($t === "" ? "" : $xsep) . $x; } } } // review assignments if ($mode !== "assign" && $mode !== "edit" && $Me->can_request_review($prow, true)) { $x = '<a href="' . hoturl("assign", "p={$prow->paperId}") . '" class="xx">' . Ht::img("assign24.png", "[Assign]", "dlimg") . " <u>" . ($admin ? "Assign reviews" : "External reviews") . "</u></a>"; $t .= ($t === "" ? "" : $xsep) . $x; } // new comment $nocmt = preg_match('/\\A(?:assign|contact|edit|re)\\z/', $mode); if (!$allreviewslink && !$nocmt && $Me->can_comment($prow, null)) { $x = '<a href="#cnew" onclick="return papercomment.edit_new()" class="xx">' . Ht::img("comment24.png", "[Add comment]", "dlimg") . " <u>Add comment</u></a>"; $t .= ($t === "" ? "" : $xsep) . $x; $any_comments = true; } // new response if (!$nocmt && ($prow->conflictType >= CONFLICT_AUTHOR || $allow_admin) && ($rrounds = $Conf->time_author_respond())) { foreach ($rrounds as $i => $rname) { $cid = ($i ? $rname : "") . "response"; $what = "Add"; if ($crows) { foreach ($crows as $cr) { if ($cr->commentType & COMMENTTYPE_RESPONSE && $cr->commentRound == $i) { $what = "Edit"; if ($cr->commentType & COMMENTTYPE_DRAFT) { $what = "Edit draft"; } } } } $x = '<a href="#' . $cid . '" onclick=\'return papercomment.edit_response(' . json_encode($rname) . ')\' class="xx">' . Ht::img("comment24.png", "[{$what} response]", "dlimg") . " " . ($conflictType >= CONFLICT_AUTHOR ? '<u style="font-weight:bold">' : '<u>') . $what . ($i ? " {$rname}" : "") . ' response</u></a>'; $t .= ($t === "" ? "" : $xsep) . $x; $any_comments = true; } } // override conflict if ($allow_admin && !$admin) { $x = '<a href="' . selfHref(array("forceShow" => 1)) . '" class="xx">' . Ht::img("override24.png", "[Override]", "dlimg") . " <u>Override conflict</u></a> to show reviewers and allow editing"; $t .= ($t === "" ? "" : $xsep) . $x; } else { if ($Me->privChair && !$allow_admin) { $x = "You can’t override your conflict because this paper has an administrator."; $t .= ($t === "" ? "" : $xsep) . $x; } } if ($any_comments) { CommentInfo::echo_script($prow); } if (($list = SessionList::active()) && ($pret || $t)) { return '<div class="has_hotcrp_list" data-hotcrp-list="' . $list->listno . '">' . $pret . $t . '</div>'; } else { return $pret . $t; } }
function goPaperForm($baseUrl = null, $args = array()) { global $Conf, $Me; if ($Me->is_empty()) { return ""; } $list = SessionList::active(); $x = Ht::form_div(hoturl($baseUrl ?: "paper", array("ls" => null)), array("method" => "get", "class" => "gopaper" . ($list ? " has_hotcrp_list" : ""), "data-hotcrp-list" => $list ? $list->listno : null)); if ($baseUrl == "profile") { $x .= Ht::entry("u", "(User)", array("id" => "quicksearchq", "size" => 10, "placeholder" => "(User)")); } else { $x .= Ht::entry("p", "(All)", array("id" => "quicksearchq", "size" => 10, "placeholder" => "(All)", "class" => "hotcrp_searchbox")); } foreach ($args as $what => $val) { $x .= Ht::hidden($what, $val); } $x .= " " . Ht::submit("Search") . "</div></form>"; return $x; }
private function header_head($title) { global $Me, $ConfSitePATH, $Opt; // load session list and clear its cookie $list = SessionList::active(); SessionList::set_requested(0); echo "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"google\" content=\"notranslate\" />\n"; if (isset($Opt["fontScript"])) { echo $Opt["fontScript"]; } echo $this->make_css_link("stylesheets/style.css"), "\n"; if (get($Opt, "mobileStylesheet")) { echo '<meta name="viewport" content="width=device-width, initial-scale=1">', "\n"; echo $this->make_css_link("stylesheets/mobile.css", "screen and (max-width: 768px)"), "\n"; } if (isset($Opt["stylesheets"])) { foreach (mkarray($Opt["stylesheets"]) as $css) { echo $this->make_css_link($css), "\n"; } } // favicon if ($favicon = defval($Opt, "favicon", "images/review24.png")) { if (strpos($favicon, "://") === false && $favicon[0] != "/") { if (get($Opt, "assetsUrl") && substr($favicon, 0, 7) === "images/") { $favicon = $Opt["assetsUrl"] . $favicon; } else { $favicon = Navigation::siteurl() . $favicon; } } if (substr($favicon, -4) == ".png") { echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".ico") { echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".gif") { echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n"; } else { echo "<link rel=\"icon\" href=\"{$favicon}\" />\n"; } } } } // title echo "<title>"; if ($title) { $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title); $title = preg_replace(",(?: | | )+,", " ", $title); $title = str_replace("∕", "-", $title); } if ($title) { echo $title, " - "; } echo htmlspecialchars($Opt["shortName"]), "</title>\n</head>\n"; // jQuery $stash = Ht::take_stash(); if (isset($Opt["jqueryUrl"])) { $jquery = $Opt["jqueryUrl"]; } else { if (get($Opt, "jqueryCdn")) { $jquery = "//code.jquery.com/jquery-1.12.3.min.js"; } else { $jquery = "scripts/jquery-1.12.3.min.js"; } } Ht::stash_html($this->make_script_file($jquery, true) . "\n"); // Javascript settings to set before script.js Ht::stash_script("siteurl=" . json_encode(Navigation::siteurl()) . ";siteurl_suffix=\"" . Navigation::php_suffix() . "\""); if (session_id() !== "") { Ht::stash_script("siteurl_postvalue=\"" . post_value() . "\""); } if ($list) { Ht::stash_script("hotcrp_list=" . json_encode(["num" => $list->listno, "id" => $list->listid]) . ";"); } if ($urldefaults = hoturl_defaults()) { Ht::stash_script("siteurl_defaults=" . json_encode($urldefaults) . ";"); } Ht::stash_script("assetsurl=" . json_encode($Opt["assetsUrl"]) . ";"); $huser = (object) array(); if ($Me && $Me->email) { $huser->email = $Me->email; } if ($Me && $Me->is_pclike()) { $huser->is_pclike = true; } if ($Me && $Me->has_database_account()) { $huser->cid = $Me->contactId; } Ht::stash_script("hotcrp_user="******";"); $pid = get($_REQUEST, "paperId"); $pid = $pid && ctype_digit($pid) ? (int) $pid : 0; if (!$pid && $this->paper) { $pid = $this->paper->paperId; } if ($pid) { Ht::stash_script("hotcrp_paperid={$pid}"); } if ($pid && $Me && $Me->is_admin_force()) { Ht::stash_script("hotcrp_want_override_conflict=true"); } // script.js if (!get($Opt, "noDefaultScript")) { Ht::stash_html($this->make_script_file("scripts/script.js") . "\n"); } // other scripts if (get($Opt, "scripts")) { foreach ($Opt["scripts"] as $file) { Ht::stash_html($this->make_script_file($file) . "\n"); } } if ($stash) { Ht::stash_html($stash); } }