Skip to content

Commit c9563dc

Browse files
committed
Add support for submission round labels
And remove bogus old message about submission round tags needing to be readonly.
1 parent b3e619c commit c9563dc

File tree

11 files changed

+82
-56
lines changed

11 files changed

+82
-56
lines changed

etc/settinggroups.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@
103103
"print_function": "Sround_SettingParser::print_rounds",
104104
"settings": ["submission"]
105105
},
106-
{
107-
"name": "__crosscheck/submissionclasses", "order": 301,
108-
"crosscheck_function": "Sround_SettingParser::crosscheck"
109-
},
110106
{
111107
"name": "submissions/blind", "order": 40,
112108
"print_function": "Submissions_SettingParser::print_blind",

etc/settinginfo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@
488488
"type": "tag", "size": 20, "autogrow": true,
489489
"placeholder": "(Tag)"
490490
},
491+
{
492+
"name_pattern": "submission/$/label",
493+
"title": "Submission class title",
494+
"type": "string", "size": 30, "autogrow": true,
495+
"placeholder": "same as class tag"
496+
},
491497
{
492498
"name_pattern": "submission/$/title", "internal": true, "parser_class": "Sround_SettingParser"
493499
},

lib/tagger.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,8 @@ function sorted_settings_having($flags) {
832832
function is_chair($tag) {
833833
if ($tag[0] === "~") {
834834
return $tag[1] === "~";
835-
} else {
836-
return !!$this->find_having($tag, TagInfo::TF_CHAIR);
837835
}
836+
return !!$this->find_having($tag, TagInfo::TF_CHAIR);
838837
}
839838
/** @param string $tag
840839
* @return bool */
@@ -1873,10 +1872,9 @@ private function js_sq($tv, $always) {
18731872
} else if (!$always) {
18741873
return "";
18751874
} else if ($base === $tv) {
1876-
$q = "#{$base}";
1877-
} else {
1878-
$q = "order:#{$base}";
1875+
return "#{$base}";
18791876
}
1877+
return "order:#{$base}";
18801878
}
18811879

18821880
/** @param list<string>|string $viewable

scripts/settings.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,27 @@ handle_ui.on("js-settings-submission-round-new", function () {
657657
this.form.elements["submission/" + i + "/tag"].focus();
658658
});
659659

660+
handle_ui.on("input.js-settings-submission-round-name change.js-settings-submission-round-name", function () {
661+
const e = this.closest(".js-settings-submission-round").querySelector(".js-settings-submission-round-label");
662+
if (!e) {
663+
return;
664+
}
665+
if (!this.hasAttribute("data-submission-round-labelled")) {
666+
this.setAttribute("data-submission-round-labelled", input_default_value(this) !== input_default_value(e) ? "true" : "");
667+
}
668+
if (this.getAttribute("data-submission-round-labelled")) {
669+
return;
670+
}
671+
e.value = this.value;
672+
});
673+
674+
handle_ui.on("input.js-settings-submission-round-label", function (evt) {
675+
const e = this.closest(".js-settings-submission-round").querySelector(".js-settings-submission-round-name");
676+
if (e) {
677+
e.setAttribute("data-submission-round-labelled", "true");
678+
}
679+
});
680+
660681
handle_ui.on("js-settings-submission-round-delete", function () {
661682
var div = this.closest(".js-settings-submission-round"),
662683
ne = this.form.elements[div.id + "/tag"];

src/contact.php

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,28 +5402,38 @@ function can_edit_tag(PaperInfo $prow, $tag, $previndex, $index) {
54025402
$tw = strpos($tag, "~");
54035403
if ($tw === false || ($tw === 0 && $tag[1] === "~")) {
54045404
$t = $tagmap->find($tag);
5405-
return ($rights->allow_pc()
5406-
|| ($t && $t->is(TagInfo::TF_CONFLICT_FREE)))
5407-
&& ($tw === false || $this->privChair)
5408-
&& (!$t || !$t->is(TagInfo::TF_AUTOMATIC))
5409-
&& (!$t || !$t->is(TagInfo::TF_CHAIR) || $this->privChair)
5410-
&& (!$t || !$t->is(TagInfo::TF_HIDDEN) || $this->can_view_hidden_tags($prow))
5411-
&& (!$t
5412-
|| !$t->is(TagInfo::TF_READONLY | TagInfo::TF_RANK)
5405+
// chair tags can only be changed by chairs
5406+
if ($tw === 0 && !$this->privChair) {
5407+
return false;
5408+
}
5409+
// conflicted PC can only change conflict-free tags
5410+
if (!$rights->allow_pc() && (!$t || !$t->is(TagInfo::TF_CONFLICT_FREE))) {
5411+
return false;
5412+
}
5413+
// all other flags only limit rights
5414+
if (!$t) {
5415+
return true;
5416+
}
5417+
// check remaining flags
5418+
return !$t->is(TagInfo::TF_AUTOMATIC)
5419+
&& (!$t->is(TagInfo::TF_CHAIR)
5420+
|| $this->privChair)
5421+
&& (!$t->is(TagInfo::TF_HIDDEN)
5422+
|| $this->can_view_hidden_tags($prow))
5423+
&& (!$t->is(TagInfo::TF_READONLY | TagInfo::TF_RANK)
54135424
|| $rights->can_administer()
54145425
|| ($this->privChair && $t->is(TagInfo::TF_SITEWIDE)));
5415-
} else {
5416-
$t = $tagmap->find(substr($tag, $tw + 1));
5417-
return ($rights->allow_pc()
5418-
|| ($t && $t->is(TagInfo::TF_CONFLICT_FREE)))
5419-
&& ($tw === 0
5420-
|| $rights->can_administer()
5421-
|| ($tw === strlen((string) $this->contactId)
5422-
&& str_starts_with($tag, (string) $this->contactId)))
5423-
&& (!($index < 0)
5424-
|| !$t
5425-
|| !$t->allotment);
54265426
}
5427+
$t = $tagmap->find(substr($tag, $tw + 1));
5428+
return ($rights->allow_pc()
5429+
|| ($t && $t->is(TagInfo::TF_CONFLICT_FREE)))
5430+
&& ($tw === 0
5431+
|| $rights->can_administer()
5432+
|| ($tw === strlen((string) $this->contactId)
5433+
&& str_starts_with($tag, (string) $this->contactId)))
5434+
&& (!($index < 0)
5435+
|| !$t
5436+
|| !$t->allotment);
54275437
}
54285438

54295439
/** @param string $tag

src/failurereason.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private function submission_deadline_info() {
172172
$end = $sr->submit;
173173
}
174174
return ["sub_sub", $sr->open, $dn, $end, [
175-
new FmtArg("sclass", $sr->tag, 0),
175+
new FmtArg("sclass", $sr->label, 0),
176176
new FmtArg("sclass_prefix", $sr->prefix, 0)
177177
]];
178178
}

src/pages/p_home.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,11 @@ function print_review_requests(Contact $user, Qrequest $qreq, ComponentSet $gx)
552552
private function print_new_submission(Contact $user, SubmissionRound $sr) {
553553
$conf = $user->conf;
554554
if ($sr->register >= Conf::$now && $sr->register < $sr->submit) {
555-
$dname = $conf->_5("<5>{sclass} registration deadline", new FmtArg("sclass", $sr->tag, 0));
555+
$dname = $conf->_5("<5>{sclass} registration deadline", new FmtArg("sclass", $sr->label, 0));
556556
$dtime = $conf->unparse_time_with_local_span($sr->register);
557557
$dltx = "<em class=\"deadline\">{$dname}: {$dtime}</em>";
558558
} else if ($sr->submit > 0) {
559-
$dname = $conf->_5("<5>{sclass} deadline", new FmtArg("sclass", $sr->tag, 0));
559+
$dname = $conf->_5("<5>{sclass} deadline", new FmtArg("sclass", $sr->label, 0));
560560
$dtime = $conf->unparse_time_with_local_span($sr->submit);
561561
$dltx = "<em class=\"deadline\">{$dname}: {$dtime}</em>";
562562
} else {
@@ -567,7 +567,7 @@ private function print_new_submission(Contact $user, SubmissionRound $sr) {
567567
"p" => "new", "sclass" => $sr->unnamed ? null : $sr->tag
568568
]);
569569
$actions = [[
570-
"<a class=\"btn\" href=\"{$url}\">" . $conf->_c5("paper_edit", "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->tag)) . "</a>",
570+
"<a class=\"btn\" href=\"{$url}\">" . $conf->_c5("paper_edit", "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->label, 0)) . "</a>",
571571
$sr->time_register(true) ? "" : "(admin only)"
572572
]];
573573
if ($dltx !== "") {

src/papertable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static function print_header($paperTable, $qreq, $error = false) {
180180
$t .= '">' . $title;
181181
} else if (!$prow->paperId) {
182182
$sr = $prow->submission_round();
183-
$title = $conf->_c5("paper_edit", "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->tag, 0));
183+
$title = $conf->_c5("paper_edit", "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->label, 0));
184184
$t .= '">' . $title;
185185
} else {
186186
$paperTable->initialize_list();
@@ -2443,7 +2443,7 @@ private function _print_editable_body() {
24432443
$overrides = $this->user->add_overrides(Contact::OVERRIDE_EDIT_CONDITIONS);
24442444
$sr = $this->prow->submission_round();
24452445
echo '<div class="pedcard-head"><h2><span class="pedcard-header-name">',
2446-
$this->conf->_c5("paper_edit", $this->prow->paperId ? "<0>Edit {sclass} {submission}" : "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->tag), new FmtArg("draft", $this->prow->timeSubmitted <= 0)),
2446+
$this->conf->_c5("paper_edit", $this->prow->paperId ? "<0>Edit {sclass} {submission}" : "<0>New {sclass} {submission}", new FmtArg("sclass", $sr->label, 0), new FmtArg("draft", $this->prow->timeSubmitted <= 0)),
24472447
'</span></h2></div>';
24482448

24492449
$this->_print_pre_status_feedback();
@@ -2491,7 +2491,7 @@ function print_paper_info() {
24912491
htmlspecialchars($this->conf->short_name), '</span> ';
24922492
if ($this->prow->paperId <= 0) {
24932493
$sr = $this->prow->submission_round();
2494-
echo $this->conf->_c5("paper_edit", "<0>new {sclass} {submission}", new FmtArg("sclass", $sr->tag, 0));
2494+
echo $this->conf->_c5("paper_edit", "<0>new {sclass} {submission}", new FmtArg("sclass", $sr->label, 0));
24952495
} else if ($this->mode !== "re") {
24962496
echo "#", $this->prow->paperId;
24972497
} else if ($this->editrrow && $this->editrrow->reviewOrdinal) {

src/search/st_sclass.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ static function parse($word, SearchWord $sword, PaperSearch $srch) {
2828
return new Sclass_SearchTerm($srch->conf->unnamed_submission_round(), true);
2929
} else if (($sr = $srch->conf->submission_round_by_tag($tag, true))) {
3030
return new Sclass_SearchTerm($sr, false);
31-
} else {
32-
$srch->lwarning($sword, $srch->conf->_("<0>{Submission} class ‘{}’ not found", $tag));
33-
return new False_SearchTerm;
3431
}
32+
$srch->lwarning($sword, $srch->conf->_("<0>{Submission} class ‘{}’ not found", $tag));
33+
return new False_SearchTerm;
3534
}
3635
function sqlexpr(SearchQueryInfo $sqi) {
3736
if (!$this->sr->unnamed) {
3837
return Dbl::format_query($sqi->srch->conf->dblink,
3938
"exists (select * from PaperTag where paperId=Paper.paperId and tag=?)",
4039
$this->sr->tag);
41-
} else {
42-
return "true";
4340
}
41+
return "true";
4442
}
4543
function test(PaperInfo $row, $xinfo) {
4644
return ($row->submission_round() === $this->sr) !== $this->negate;

src/settings/s_sround.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class Sround_Setting {
88
public $id;
99
/** @var string */
1010
public $tag;
11+
/** @var string */
12+
public $label;
1113
/** @var int */
1214
public $open;
1315
public $register;
@@ -20,6 +22,7 @@ class Sround_Setting {
2022
static function make_json($jx) {
2123
$sr = new Sround_Setting;
2224
$sr->id = $sr->tag = $jx->tag;
25+
$sr->label = $jx->label ?? $jx->tag;
2326
$sr->open = $jx->open ?? 0;
2427
$sr->register = $jx->register ?? 0;
2528
$sr->submit = $jx->submit ?? 0;
@@ -30,6 +33,9 @@ static function make_json($jx) {
3033

3134
function export_json() {
3235
$j = ["tag" => $this->tag];
36+
if ($this->label !== null && $this->label !== $this->tag) {
37+
$j["label"] = $this->label;
38+
}
3339
if ($this->open > 0) {
3440
$j["open"] = $this->open;
3541
}
@@ -57,9 +63,8 @@ function placeholder(Si $si, SettingValues $sv) {
5763
if ($si->name0 === "submission/" && $si->name2 === "/name") {
5864
$idv = $sv->vstr("submission/{$si->name1}/id");
5965
return ctype_digit($idv) && $idv !== "0" ? "unnamed" : "(new round)";
60-
} else {
61-
return null;
6266
}
67+
return null;
6368
}
6469

6570
function set_oldv(Si $si, SettingValues $sv) {
@@ -112,6 +117,7 @@ private static function print_round($sv, $ctr) {
112117

113118
// deadlines
114119
echo "<div id=\"submission/{$ctr}/edit\"><div class=\"flex-grow-0\">";
120+
$sv->print_entry_group("submission/{$ctr}/label", "Title", ["horizontal" => true, "group_class" => "medium", "class" => "uii js-settings-submission-round-label"]);
115121
$sv->print_entry_group("submission/{$ctr}/registration", "Registration deadline", ["horizontal" => true, "group_class" => "medium"]);
116122
$sv->print_entry_group("submission/{$ctr}/done", "Submission deadline", ["horizontal" => true, "group_class" => "medium"]);
117123
echo '</div></div></fieldset>';
@@ -168,6 +174,7 @@ private function apply_submission_req(Si $si, SettingValues $sv) {
168174
// having parsed all names, check for duplicates
169175
foreach ($sv->oblist_keys("submission") as $ctr) {
170176
$sv->error_if_duplicate_member("submission", $ctr, "tag", "Submission class name");
177+
$sv->error_if_duplicate_member("submission", $ctr, "label", "Submission class label");
171178
}
172179

173180
// save
@@ -179,17 +186,4 @@ private function apply_submission_req(Si $si, SettingValues $sv) {
179186
$sv->request_store_value($si);
180187
}
181188
}
182-
183-
static function crosscheck(SettingValues $sv) {
184-
if ($sv->has_interest("submission") || $sv->has_interest("tag_readonly")) {
185-
foreach ($sv->conf->submission_round_list() as $i => $sr) {
186-
if (!$sr->unnamed
187-
&& !$sv->conf->tags()->is_readonly($sr->tag)) {
188-
$ctr = $i + 1;
189-
$sv->warning_at("submission/{$ctr}/tag", "<5>PC members can change the tag ‘" . htmlspecialchars($sr->tag) . "’. Tags used for submission classes should usually be " . $sv->setting_link("read-only", "tag_readonly") . ".");
190-
$sv->warning_at("tag_readonly");
191-
}
192-
}
193-
}
194-
}
195189
}

0 commit comments

Comments
 (0)