Пример #1
0
     }
 }
 echo "<table><tr><td><strong>Show:</strong> &nbsp;</td>\n  <td class='pad'>";
 $Conf->footerScript('foldmap.ul={"aff":2,"tags":3,"topics":1};');
 foreach (array("aff" => "Affiliations", "collab" => "Collaborators", "tags" => "Tags", "topics" => "Topics") as $fold => $text) {
     if (@$pl->have_folds[$fold] !== null) {
         echo Ht::checkbox("show{$fold}", 1, $pl->have_folds[$fold], array("onchange" => "fold('ul',!this.checked,'{$fold}')")), "&nbsp;", Ht::label($text), "<br />\n";
     }
 }
 echo "</td>";
 if (isset($pl->scoreMax)) {
     echo "<td class='pad'>";
     $revViewScore = $Me->aggregated_view_score_bound();
     foreach (ReviewForm::all_fields() as $f) {
         if ($f->view_score > $revViewScore && $f->has_options) {
             $checked = strpos(displayOptionsSet("uldisplay"), $f->id) !== false;
             echo Ht::checkbox("show{$f->id}", 1, $checked), "&nbsp;", Ht::label($f->name_html), "<br />";
         }
     }
     echo "</td>";
 }
 echo "<td>", Ht::submit("redisplay", "Redisplay"), "</td></tr>\n";
 if (isset($pl->scoreMax)) {
     $ss = array();
     foreach (array("A", "V", "D") as $k) {
         /* ghetto array_intersect_key */
         if (isset(ListSorter::$score_sorts[$k])) {
             $ss[$k] = ListSorter::$score_sorts[$k];
         }
     }
     echo "<tr><td colspan='3'><div class='g'></div><b>Sort scores by:</b> &nbsp;", Ht::select("scoresort", $ss, $Conf->session("scoresort", "A")), "</td></tr>";
Пример #2
0
                        }
                    }
                }
                $stack[] = $line;
            }
            error_log("JS error: {$url}via " . join(" ", $stack));
        }
    }
    json_exit(["ok" => true]);
}
if ($qreq->fn === "setsession") {
    if (preg_match('/\\A(foldpaper[abpt]|foldpscollab|foldhomeactivity|(?:pl|pf|ul)display)(|\\.[a-zA-Z0-9_]+)\\z/', (string) $qreq->var, $m)) {
        $val = $qreq->val;
        if ($m[2]) {
            $on = !($val !== null && intval($val) > 0);
            displayOptionsSet($m[1], substr($m[2], 1), $on);
        } else {
            $Conf->save_session($m[1], $val !== null ? intval($val) : null);
        }
        json_exit(["ok" => true]);
    } else {
        json_exit(["ok" => false]);
    }
}
if ($qreq->fn === "events" && $Me->is_reviewer()) {
    $from = $qreq->from;
    if (!$from || !ctype_digit($from)) {
        $from = $Now;
    }
    $entries = $Conf->reviewerActivity($Me, $from, 10);
    $when = $from;
if ($Qreq->fn === "get" && $SSel && !$SSel->is_empty()) {
    include "search.php";
    exit;
}
// set options to view
if (isset($_REQUEST["redisplay"])) {
    $pfd = " ";
    foreach ($_REQUEST as $k => $v) {
        if (substr($k, 0, 4) == "show" && $v) {
            $pfd .= substr($k, 4) . " ";
        }
    }
    $Conf->save_session("pfdisplay", $pfd);
    redirectSelf();
}
$pldisplay = displayOptionsSet("pfdisplay");
// Header and body
$Conf->header("Review preferences", "revpref", actionBar());
$Conf->infoMsg($Conf->message_html("revprefdescription"));
// search
$search = new PaperSearch($Me, array("t" => "rable", "urlbase" => hoturl_site_relative_raw("reviewprefs", "reviewer={$reviewer}"), "q" => defval($_REQUEST, "q", "")), $reviewer);
$pl = new PaperList($search, ["sort" => true, "list" => true, "row_id_pattern" => "p#", "foldtype" => "pf", "reviewer" => $reviewer_contact], make_qreq());
$pl_text = $pl->table_html("editReviewPreference", array("class" => "pltable_full", "table_id" => "foldpl", "attributes" => array("data-fold-session" => "pfdisplay.\$"), "footer_extra" => "<div id='plactr'>" . Ht::submit("update", "Save changes", array("class" => "hb")) . "</div>", "list_properties" => ["revprefs" => true]));
// DISPLAY OPTIONS
echo "<table id='searchform' class='tablinks1'>\n<tr><td>";
// <div class='tlx'><div class='tld1'>";
$showing_au = !$Conf->subBlindAlways() && strpos($pldisplay, " au ") !== false;
$showing_anonau = (!$Conf->subBlindNever() || $Me->privChair) && strpos($pldisplay, " anonau ") !== false;
echo Ht::form_div(hoturl("reviewprefs"), array("method" => "get", "id" => "redisplayform", "class" => $showing_au || $showing_anonau && $Conf->subBlindAlways() ? "fold10o" : "fold10c")), "<table>";
if ($Me->privChair) {
    echo "<tr><td class='lxcaption'><strong>Preferences:</strong> &nbsp;</td><td class='lentry'>";
 function table_html($listname, $url, $listtitle = "", $foldsession = null)
 {
     global $Conf, $contactListFields;
     // PC tags
     $listquery = $listname;
     $queryOptions = array();
     if (str_starts_with($listname, "#")) {
         $queryOptions["where"] = "(u.contactTags like " . Dbl::utf8ci("'% " . sqlq_for_like(substr($listname, 1)) . "#%'") . ")";
         $listquery = "pc";
     }
     // get paper list
     if (!($baseFieldId = $this->listFields($listquery))) {
         Conf::msg_error("There is no people list query named “" . htmlspecialchars($listquery) . "”.");
         return null;
     }
     $this->limit = array_shift($baseFieldId);
     // get field array
     $fieldDef = array();
     $acceptable_fields = array();
     $this->any = (object) array("sel" => false);
     $ncol = 0;
     foreach ($baseFieldId as $fid) {
         if ($this->selector($fid, $queryOptions) === false) {
             continue;
         }
         if (!($fieldDef[$fid] = @$contactListFields[$fid])) {
             $fieldDef[$fid] = $contactListFields[self::FIELD_SCORE];
         }
         $acceptable_fields[$fid] = true;
         if ($fieldDef[$fid][1] == 1) {
             $ncol++;
         }
     }
     // run query
     $rows = $this->_rows($queryOptions);
     if (!$rows || count($rows) == 0) {
         return "No matching people";
     }
     // list number
     if ($this->listNumber === true) {
         $this->listNumber = SessionList::allocate("u/" . $this->limit);
         $this->contactLinkArgs .= "&amp;ls=" . $this->listNumber;
     }
     // sort rows
     if (!@$acceptable_fields[$this->sortField]) {
         $this->sortField = null;
     }
     $srows = $this->_sort($rows);
     // count non-callout columns
     $firstcallout = $lastcallout = null;
     $n = 0;
     foreach ($fieldDef as $fieldId => $fdef) {
         if ($fdef[1] == 1) {
             if ($firstcallout === null && $fieldId < self::FIELD_SELECTOR) {
                 $firstcallout = $n;
             }
             if ($fieldId < self::FIELD_SCORE) {
                 $lastcallout = $n + 1;
             }
             ++$n;
         }
     }
     $firstcallout = $firstcallout ? $firstcallout : 0;
     $lastcallout = ($lastcallout ? $lastcallout : $ncol) - $firstcallout;
     // collect row data
     $this->count = 0;
     $show_colors = $this->contact->isPC;
     $anyData = array();
     $body = '';
     $extrainfo = $hascolors = false;
     $ids = array();
     foreach ($srows as $row) {
         if (($this->limit == "resub" || $this->limit == "extsub") && $row->numReviewsSubmitted == 0) {
             continue;
         }
         $trclass = "k" . $this->count % 2;
         if ($show_colors && ($m = $row->viewable_color_classes($this->contact))) {
             if (TagInfo::classes_have_colors($m)) {
                 $trclass = $m;
                 $hascolors = true;
             } else {
                 $trclass .= " {$m}";
             }
         }
         if ($row->disabled && $this->contact->isPC) {
             $trclass .= " graytext";
         }
         $this->count++;
         $ids[] = (int) $row->contactId;
         // First create the expanded callout row
         $tt = "";
         foreach ($fieldDef as $fieldId => $fdef) {
             if ($fdef[1] >= 2 && ($d = $this->content($fieldId, $row)) !== "") {
                 $tt .= "<div";
                 //$t .= "  <tr class=\"pl_$fdef[0] pl_callout $trclass";
                 if ($fdef[1] >= 3) {
                     $tt .= " class=\"fx" . ($fdef[1] - 2) . "\"";
                 }
                 $tt .= '><em class="plx">' . $this->header($fieldId, -1, $row) . ":</em> " . $d . "</div>";
             }
         }
         if ($tt !== "") {
             $x = "  <tr class=\"plx {$trclass}\">";
             if ($firstcallout > 0) {
                 $x .= "<td colspan=\"{$firstcallout}\"></td>";
             }
             $tt = $x . "<td class=\"plx\" colspan=\"" . ($lastcallout - $firstcallout) . "\">" . $tt . "</td></tr>\n";
         }
         // Now the normal row
         $t = "  <tr class=\"pl {$trclass}\">\n";
         $n = 0;
         foreach ($fieldDef as $fieldId => $fdef) {
             if ($fdef[1] == 1) {
                 $c = $this->content($fieldId, $row);
                 $t .= "    <td class=\"pl pl_{$fdef['0']}\"";
                 if ($n >= $lastcallout && $tt != "") {
                     $t .= " rowspan=\"2\"";
                 }
                 $t .= ">" . $c . "</td>\n";
                 if ($c != "") {
                     $anyData[$fieldId] = 1;
                 }
                 ++$n;
             }
         }
         $t .= "  </tr>\n";
         $body .= $t . $tt;
     }
     $foldclasses = array();
     foreach (self::$folds as $k => $fold) {
         if (@$this->have_folds[$fold] !== null) {
             $this->have_folds[$fold] = strpos(displayOptionsSet("uldisplay"), " {$fold} ") !== false;
             $foldclasses[] = "fold" . ($k + 1) . ($this->have_folds[$fold] ? "o" : "c");
         }
     }
     $x = "<table id=\"foldul\" class=\"pltable pltable_full plt_" . htmlspecialchars($listquery);
     if ($foldclasses) {
         $x .= " " . join(" ", $foldclasses);
     }
     if ($foldclasses && $foldsession) {
         $x .= "\" data-fold-session=\"{$foldsession}";
     }
     $x .= "\">\n";
     if ($this->showHeader) {
         $x .= "  <thead class=\"pltable\">\n  <tr class=\"pl_headrow\">\n";
         $ord = 0;
         if ($this->sortable && $url) {
             $sortUrl = htmlspecialchars($url) . (strpos($url, "?") ? "&amp;" : "?") . "sort=";
             $q = '<a class="pl_sort" rel="nofollow" href="' . $sortUrl;
             foreach ($fieldDef as $fieldId => $fdef) {
                 if ($fdef[1] != 1) {
                     continue;
                 } else {
                     if (!isset($anyData[$fieldId])) {
                         $x .= "    <th class=\"pl pl_{$fdef['0']}\"></th>\n";
                         continue;
                     }
                 }
                 $x .= "    <th class=\"pl pl_{$fdef['0']}\">";
                 $ftext = $this->header($fieldId, $ord++);
                 if ($this->sortField == null && $fieldId == 1) {
                     $this->sortField = $fieldId;
                 }
                 if ($fieldId == $this->sortField) {
                     $x .= '<a class="pl_sort_def' . ($this->reverseSort ? "_rev" : "") . '" rel="nofollow" href="' . $sortUrl . $fieldId . ($this->reverseSort ? "N" : "R") . '">' . $ftext . "</a>";
                 } else {
                     if ($fdef[2]) {
                         $x .= $q . $fieldId . "\">" . $ftext . "</a>";
                     } else {
                         $x .= $ftext;
                     }
                 }
                 $x .= "</th>\n";
             }
         } else {
             foreach ($fieldDef as $fieldId => $fdef) {
                 if ($fdef[1] == 1 && isset($anyData[$fieldId])) {
                     $x .= "    <th class=\"pl pl_{$fdef['0']}\">" . $this->header($fieldId, $ord++) . "</th>\n";
                 } else {
                     if ($fdef[1] == 1) {
                         $x .= "    <th class=\"pl pl_{$fdef['0']}\"></th>\n";
                     }
                 }
             }
         }
         $x .= "  </tr></thead>\n";
     }
     reset($fieldDef);
     if (key($fieldDef) == self::FIELD_SELECTOR) {
         $x .= $this->footer($ncol, $hascolors);
     }
     $x .= "<tbody class=\"pltable" . ($hascolors ? " pltable_colored" : "") . "\">" . $body . "</tbody></table>";
     if ($this->listNumber) {
         $l = SessionList::create("u/" . $listname, $ids, $listtitle ? $listtitle : "Users", hoturl_site_relative_raw("users", ["t" => $listname]));
         SessionList::change($this->listNumber, $l);
     }
     return $x;
 }