public static function echo_script($prow)
 {
     global $Conf, $Me;
     if (Ht::mark_stash("papercomment")) {
         $t = array("papercomment.commenttag_search_url=\"" . hoturl_raw("search", "q=cmt%3A%23\$") . "\"");
         if (!$prow->has_author($Me)) {
             $t[] = "papercomment.nonauthor=true";
         }
         foreach ($Conf->resp_round_list() as $i => $rname) {
             $isuf = $i ? "_{$i}" : "";
             $wl = $Conf->setting("resp_words{$isuf}", 500);
             $j = array("words" => $wl);
             $ix = false;
             if ($Me->can_respond($prow, (object) array("commentType" => COMMENTTYPE_RESPONSE, "commentRound" => $i))) {
                 if ($i) {
                     $ix = $Conf->message_html("resp_instrux_{$i}", array("wordlimit" => $wl));
                 }
                 if ($ix === false) {
                     $ix = $Conf->message_html("resp_instrux", array("wordlimit" => $wl));
                 }
                 if ($ix !== false) {
                     $j["instrux"] = $ix;
                 }
             }
             $t[] = "papercomment.set_resp_round(" . json_encode($rname) . "," . json_encode($j) . ")";
         }
         $Conf->echoScript(join($t, ";"));
     }
 }
예제 #2
0
 public function stash_hotcrp_pc(Contact $user)
 {
     if (!Ht::mark_stash("hotcrp_pc")) {
         return;
     }
     $sortbylast = opt("sortByLastName");
     $hpcj = $list = [];
     foreach (pcMembers() as $pcm) {
         $hpcj[$pcm->contactId] = $j = (object) ["name" => $user->name_html_for($pcm), "email" => $pcm->email];
         if ($color_classes = $user->reviewer_color_classes_for($pcm)) {
             $j->color_classes = $color_classes;
         }
         if ($sortbylast && $pcm->lastName) {
             $r = Text::analyze_name($pcm);
             if (strlen($r->lastName) !== strlen($r->name)) {
                 $j->lastpos = strlen(htmlspecialchars($r->firstName)) + 1;
             }
             if ($r->nameAmbiguous && $r->name && $r->email) {
                 $j->emailpos = strlen(htmlspecialchars($r->name)) + 1;
             }
         }
         $list[] = $pcm->contactId;
     }
     $hpcj["__order__"] = $list;
     if ($sortbylast) {
         $hpcj["__sort__"] = "last";
     }
     Ht::stash_script("hotcrp_pc=" . json_encode($hpcj) . ";");
 }