Exemplo n.º 1
0
 function run(Contact $user, $qreq, $ssel)
 {
     global $Conf;
     $result = Dbl::qe_raw($Conf->paperQuery($user, array("paperId" => $ssel->selection(), "topics" => 1)));
     $texts = array();
     while ($prow = PaperInfo::fetch($result, $user)) {
         if ($whyNot = $user->perm_view_paper($prow)) {
             Conf::msg_error(whyNotText($whyNot, "view"));
         } else {
             $text = "===========================================================================\n";
             $n = "Paper #" . $prow->paperId . ": ";
             $l = max(14, (int) ((75.5 - strlen($prow->title) - strlen($n)) / 2) + strlen($n));
             $text .= prefix_word_wrap($n, $prow->title, $l);
             $text .= "---------------------------------------------------------------------------\n";
             $l = strlen($text);
             if ($user->can_view_authors($prow, $qreq->t == "a")) {
                 $text .= prefix_word_wrap("Authors: ", $prow->pretty_text_author_list(), 14);
             }
             if ($prow->topicIds != "" && ($tt = $prow->unparse_topics_text())) {
                 $text .= prefix_word_wrap("Topics: ", $tt, 14);
             }
             if ($l != strlen($text)) {
                 $text .= "---------------------------------------------------------------------------\n";
             }
             $text .= rtrim($prow->abstract) . "\n\n";
             defappend($texts[$prow->paperId], $text);
             $rfSuffix = count($texts) == 1 ? $prow->paperId : "s";
         }
     }
     if (count($texts)) {
         downloadText(join("", $ssel->reorder($texts)), "abstract{$rfSuffix}");
     }
 }
Exemplo n.º 2
0
function downloadForm($editable)
{
    global $rf, $Conf, $Me, $prow, $paperTable, $Opt;
    $explicit = true;
    if ($paperTable->rrow) {
        $rrows = array($paperTable->rrow);
    } else {
        if ($editable) {
            $rrows = array();
        } else {
            $rrows = $paperTable->viewable_rrows;
            $explicit = false;
        }
    }
    $text = "";
    foreach ($rrows as $rr) {
        if ($rr->reviewSubmitted) {
            $text .= downloadView($prow, $rr, $editable);
        }
    }
    foreach ($rrows as $rr) {
        if (!$rr->reviewSubmitted && ($explicit || $rr->reviewModified)) {
            $text .= downloadView($prow, $rr, $editable);
        }
    }
    if (count($rrows) == 0 && $editable) {
        $text .= downloadView($prow, null, $editable);
    }
    if (!$explicit) {
        $paperTable->resolveComments();
        foreach ($paperTable->crows as $cr) {
            if ($Me->can_view_comment($prow, $cr, false)) {
                $text .= $cr->unparse_text($Me, true) . "\n";
            }
        }
    }
    if (!$text) {
        $whyNot = $Me->perm_view_review($prow, null, null);
        return Conf::msg_error(whyNotText($whyNot ?: array("fail" => 1), "review"));
    }
    if ($editable) {
        $text = ReviewForm::textFormHeader(count($rrows) > 1) . $text;
    }
    $filename = (count($rrows) > 1 ? "reviews" : "review") . "-" . $prow->paperId;
    if (count($rrows) == 1 && $rrows[0]->reviewSubmitted) {
        $filename .= unparseReviewOrdinal($rrows[0]->reviewOrdinal);
    }
    downloadText($text, $filename, !$editable);
}
Exemplo n.º 3
0
 function run(Contact $user, $qreq, $ssel)
 {
     global $Conf;
     $settingrank = $Conf->setting("tag_rank") && $qreq->tag == "~" . $Conf->setting_data("tag_rank");
     if (!$user->isPC && !($user->is_reviewer() && $settingrank)) {
         return self::EPERM;
     }
     $tagger = new Tagger($user);
     if ($tag = $tagger->check($qreq->tag, Tagger::NOVALUE | Tagger::NOCHAIR)) {
         $result = Dbl::qe_raw($Conf->paperQuery($user, array("paperId" => $ssel->selection(), "tagIndex" => $tag, "order" => "order by tagIndex, PaperReview.overAllMerit desc, Paper.paperId")));
         $real = "";
         $null = "\n";
         while ($prow = PaperInfo::fetch($result, $user)) {
             if ($user->can_change_tag($prow, $tag, null, 1)) {
                 if ($prow->tagIndex === null) {
                     $null .= "X\t{$prow->paperId}\t{$prow->title}\n";
                 } else {
                     if ($real === "" || $lastIndex == $row->tagIndex - 1) {
                         $real .= "\t{$prow->paperId}\t{$prow->title}\n";
                     } else {
                         if ($lastIndex == $row->tagIndex) {
                             $real .= "=\t{$prow->paperId}\t{$prow->title}\n";
                         } else {
                             $real .= str_pad("", min($prow->tagIndex - $lastIndex, 5), ">") . "\t{$prow->paperId}\t{$prow->title}\n";
                         }
                     }
                 }
                 $lastIndex = $prow->tagIndex;
             }
         }
         $text = "# Edit the rank order by rearranging this file's lines.\n\n# The first line has the highest rank. Lines starting with \"#\" are\n# ignored. Unranked papers appear at the end in lines starting with\n# \"X\", sorted by overall merit. Create a rank by removing the \"X\"s and\n# rearranging the lines. Lines starting with \"=\" mark papers with the\n# same rank as the preceding papers. Lines starting with \">>\", \">>>\",\n# and so forth indicate rank gaps between papers. When you are done,\n# upload the file at\n" . "#   " . hoturl_absolute("offline") . "\n\n" . "Tag: " . trim($qreq->tag) . "\n" . "\n" . $real . $null;
         downloadText($text, "rank");
     } else {
         Conf::msg_error($tagger->error_html);
     }
 }
Exemplo n.º 4
0
// offline.php -- HotCRP offline review management page
// HotCRP is Copyright (c) 2006-2016 Eddie Kohler and Regents of the UC
// Distributed under an MIT-like license; see LICENSE
require_once "src/initweb.php";
if ($Me->is_empty()) {
    $Me->escape();
}
$rf = ReviewForm::get();
// general error messages
if (defval($_REQUEST, "post") && !count($_POST)) {
    $Conf->post_missing_msg();
}
// download blank review form action
if (isset($_REQUEST["downloadForm"])) {
    $text = ReviewForm::textFormHeader("blank") . $rf->textForm(null, null, $Me, null) . "\n";
    downloadText($text, "review");
}
// upload review form action
if (isset($_REQUEST["uploadForm"]) && fileUploaded($_FILES["uploadedFile"]) && check_post()) {
    $tf = $rf->beginTextForm($_FILES["uploadedFile"]["tmp_name"], $_FILES["uploadedFile"]["name"]);
    while ($req = $rf->parseTextForm($tf)) {
        $rf->check_save_review($req, $tf, $Me);
    }
    $rf->textFormMessages($tf);
    // Uploading forms may have completed the reviewer's task; recheck roles.
    Contact::update_rights();
} else {
    if (isset($_REQUEST["uploadForm"])) {
        Conf::msg_error("Choose a file first.");
    }
}