Skip to content

Commit

Permalink
Add search-type selector to bulk assigner.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 2, 2023
1 parent 15aef9e commit 9e787b7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/pages/p_bulkassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function complete_assignment($callback) {
$ssel = SearchSelection::make($this->qreq, $this->user);
$aset = new AssignmentSet($this->user);
$aset->set_override_conflicts(true);
if (isset($this->qreq->t)) {
$aset->set_search_type($this->qreq->t);
}
if ($callback) {
$aset->add_progress_handler($callback);
}
Expand Down Expand Up @@ -101,6 +104,9 @@ private function handle_upload() {

$aset = new AssignmentSet($this->user);
$aset->set_override_conflicts(true);
if ($this->qreq->t) {
$aset->set_search_type($this->qreq->t);
}
$aset->set_csv_context(true);
$aset->add_progress_handler([$this, "keep_browser_alive"]);
$defaults = $this->assignment_defaults();
Expand Down Expand Up @@ -256,8 +262,8 @@ function print() {
echo '<div class="mb-3"><strong>OR</strong> &nbsp;',
'<input type="file" name="file" accept="text/plain,text/csv" size="30"></div>';

echo '<div id="foldoptions" class="mb-5 foldc fold2c fold3c"><label>',
'Default action:&nbsp; ',
echo '<div id="foldoptions" class="mb-5 foldc fold2c fold3c">',
'<label>Default action: ',
Ht::select("default_action", ["guess" => "guess from input",
"primary" => "assign primary reviews",
"secondary" => "assign secondary reviews",
Expand All @@ -270,10 +276,15 @@ function print() {
"settag" => "set tags",
"preference" => "set reviewer preferences"],
$qreq->default_action ?? "guess",
["id" => "tsel"]),
["id" => "k-action", "class" => "ml-1"]),
'</label> <span class="barsep">·</span> ';
$limits = PaperSearch::viewable_limits($this->user);
echo '<label>Paper selection: ',
PaperSearch::limit_selector($this->conf, $limits, in_array("all", $limits) ? "all" : PaperSearch::default_limit($this->user, $limits), ["class" => "ml-1"]),
'</label>';

Ht::stash_script('$(function(){
$("#tsel").on("change",function(){
$("#k-action").on("change",function(){
hotcrp.foldup.call(this,null,{open:this.value==="review"});
hotcrp.foldup.call(this,null,{open:/^(?:primary|secondary|(?:pc|meta)?review)$/.test(this.value),n:2});
}).trigger("change")})');
Expand Down Expand Up @@ -316,7 +327,7 @@ function print() {

$this->print_instructions();

Ht::stash_script('$("#tsel").trigger("change")');
Ht::stash_script('$("#k-action").trigger("change")');
$qreq->print_footer();
}

Expand Down

0 comments on commit 9e787b7

Please sign in to comment.