From c195a6c350b29492e1ea1331683d3c2f387c7738 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Thu, 11 Mar 2021 10:18:17 -0500 Subject: [PATCH] Styles: Introduce .form-hg, use echo_subhead to automate its use. --- autoassign.php | 46 +++++++++++++++++++++----------------- bulkassign.php | 4 ++-- conflictassign.php | 4 ++-- manualassign.php | 4 ++-- scripts/script.js | 2 +- settings.php | 1 + src/settings/s_options.php | 2 +- src/settings/s_reviews.php | 2 +- src/settings/s_subform.php | 6 ++--- src/settings/s_tags.php | 6 ++--- src/settings/s_topics.php | 2 +- src/settings/s_users.php | 2 +- src/settingvalues.php | 21 ++++++++++++++++- stylesheets/style.css | 10 +++++---- 14 files changed, 69 insertions(+), 43 deletions(-) diff --git a/autoassign.php b/autoassign.php index 4327e081c..a49fb3dce 100644 --- a/autoassign.php +++ b/autoassign.php @@ -544,12 +544,12 @@ function echo_result() { } $Conf->header("Assignments", "autoassign", ["subtitle" => "Automatic"]); -echo '
', +echo '
'; + '
'; if (isset($Qreq->a) && isset($Qreq->pctyp) && $Qreq->valid_post()) { if (isset($Qreq->assignment) && isset($Qreq->showassignment)) { @@ -583,14 +583,6 @@ function echo_radio_row($name, $value, $text, $extra = null) { } } -function divClass($name, $classes = null) { - if (($c = Ht::control_class($name, $classes))) { - return '
'; - } else { - return '
'; - } -} - echo Ht::form($Conf->hoturl_post("autoassign", array("profile" => $Qreq->profile, "seed" => $Qreq->seed, "XDEBUG_PROFILE" => $Qreq->XDEBUG_PROFILE)), ["id" => "autoassignform"]), '
Assignment methods: @@ -610,7 +602,8 @@ function divClass($name, $classes = null) { echo Ht::unstash_script("hotcrp.highlight_form_children(\"#autoassignform\")"); // paper selection -echo divClass("pap"), "

Paper selection

"; +echo '
', + '

'; if (!isset($Qreq->q)) { // XXX redundant $Qreq->q = join(" ", $SSel->selection()); } @@ -644,8 +637,10 @@ function divClass($name, $classes = null) { // action -echo '
'; -echo divClass("ass"), "

Action

", "
"; +echo '
', + '

Action

\n"; + +echo '
'; echo_radio_row("a", "rev", "Ensure each selected paper has at least", ["open" => true]); echo "  ", Ht::entry("revct", $Qreq->revct ?? 1, @@ -686,30 +681,36 @@ function divClass($name, $classes = null) { echo "
"; } -echo "
\n"; +echo "

"; // revpc container +echo "
"; // .form-g // conflicts, clear reviews +echo '
'; echo_radio_row("a", "prefconflict", "Assign conflicts when PC members have review preferences of −100 or less", ["divclass" => "mt-3"]); echo_radio_row("a", "clear", "Clear all  ", ["open" => true]); echo Ht::select("cleartype", [REVIEW_PRIMARY => "primary", REVIEW_SECONDARY => "secondary", REVIEW_PC => "optional", REVIEW_META => "metareview", "conflict" => "conflict", "lead" => "discussion lead", "shepherd" => "shepherd"], $Qreq->cleartype), - "  assignments for selected papers and PC members
\n"; + "  assignments for selected papers and PC members
\n"; // leads, shepherds +echo '
'; echo_radio_row("a", "lead", "Assign discussion lead from reviewers, preferring  ", ["open" => true, "divclass" => "mt-3"]); echo Ht::select("leadscore", $scoreselector, $Qreq->leadscore), "
\n"; echo_radio_row("a", "shepherd", "Assign shepherd from reviewers, preferring  ", ["open" => true]); -echo Ht::select("shepherdscore", $scoreselector, $Qreq->shepherdscore), "
\n"; +echo Ht::select("shepherdscore", $scoreselector, $Qreq->shepherdscore), "\n"; // discussion order +echo '
'; echo_radio_row("a", "discorder", "Create discussion order in tag #", ["open" => true, "divclass" => "mt-3"]); echo Ht::entry("discordertag", $Qreq->discordertag ?? "discuss", ["size" => 12, "class" => Ht::control_class("discordertag", "js-autosubmit")]), - ", grouping papers with similar PC conflicts
"; + ", grouping papers with similar PC conflicts"; + +echo "\n\n"; // .form-hg // PC -echo "

PC members

\n"; +echo '

PC members

'; echo '
\n"; +echo "
\n"; $Conf->stash_hotcrp_pc($Me); // Load balancing -echo "

Load balancing

\n"; +echo '

Load balancing

'; echo_radio_row("balance", "new", "New assignments—spread new assignments equally among selected PC members"); echo_radio_row("balance", "all", "All assignments—spread assignments so that selected PC members have roughly equal overall load"); +echo '
'; // Method -echo "

Assignment method

\n"; +echo '

Assignment method

'; echo_radio_row("method", "mcmf", "Globally optimal assignment"); echo_radio_row("method", "random", "Random good assignment"); @@ -805,6 +807,8 @@ function bpSelector($i, $which) { echo "
\n"; } +echo "\n"; + // Create assignment echo '
', Ht::submit("assign", "Prepare assignments", ["class" => "btn-primary"]), diff --git a/bulkassign.php b/bulkassign.php index ef347d8e4..72ab9c147 100644 --- a/bulkassign.php +++ b/bulkassign.php @@ -95,12 +95,12 @@ function complete_assignment($qreq, $callback) { $Conf->header("Assignments", "bulkassign", ["subtitle" => "Bulk update"]); -echo '
', +echo '
'; + '
'; // upload review form action diff --git a/conflictassign.php b/conflictassign.php index 6c481a7f6..389d7b4a0 100644 --- a/conflictassign.php +++ b/conflictassign.php @@ -9,12 +9,12 @@ $Me->add_overrides(Contact::OVERRIDE_CONFLICT); $Conf->header("Assignments", "assignpc", ["subtitle" => "Conflicts"]); -echo '
', +echo '
'; + '
'; echo '
'; diff --git a/manualassign.php b/manualassign.php index 728cfd40b..1359b8281 100644 --- a/manualassign.php +++ b/manualassign.php @@ -113,12 +113,12 @@ function saveAssignments($qreq, $reviewer) { $Conf->header("Assignments", "assignpc", ["subtitle" => "Manual"]); -echo '
', +echo '
'; + '
'; // Help list diff --git a/scripts/script.js b/scripts/script.js index 9eff3df13..07f8bbbb8 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -8652,7 +8652,7 @@ if (siteinfo.paperid) { // profile UI handle_ui.on("js-cannot-delete-user", function (event) { var hc = popup_skeleton({near: this}); - hc.push('

This user cannot be deleted because they are the sole contact for ' + $(this).data("soleAuthor") + '. To delete the user, first remove these papers from the database or give the papers more contacts.

'); + hc.push('

This user cannot be deleted because they are the sole contact for ' + $(this).data("soleAuthor") + '. To delete the user, first remove those submissions from the database or give them more contacts.

'); hc.push_actions(['']); hc.show(); }); diff --git a/settings.php b/settings.php index 18ad6d607..f86b81579 100644 --- a/settings.php +++ b/settings.php @@ -86,6 +86,7 @@ function choose_setting_group($qreq, SettingValues $sv) { $Sv->report(isset($Qreq->update) && $Qreq->valid_post()); $Sv->render_group(strtolower($Group), ["top" => true]); +$Sv->echo_close_subhead(); echo '
', diff --git a/src/settings/s_options.php b/src/settings/s_options.php index c3fdd8fb3..a5ebfd03c 100644 --- a/src/settings/s_options.php +++ b/src/settings/s_options.php @@ -317,7 +317,7 @@ private function render_option(SettingValues $sv, PaperOption $io = null, $ipos, static function render(SettingValues $sv) { $self = new Options_SettingRenderer; - echo "

Submission fields

\n"; + $sv->echo_subhead("Submission fields"); echo "
\n", Ht::hidden("has_options", 1), Ht::hidden("options:version", (int) $sv->conf->setting("options")), diff --git a/src/settings/s_reviews.php b/src/settings/s_reviews.php index 0b704154e..fdeeff41e 100644 --- a/src/settings/s_reviews.php +++ b/src/settings/s_reviews.php @@ -70,7 +70,7 @@ static function render(SettingValues $sv) { // Deadlines - echo "

Deadlines & rounds

\n"; + $sv->echo_subhead("Deadlines & rounds", ["id" => "rounds"]); echo '

Reviews are due by the deadline, but cannot be modified after the hard deadline. Most conferences don’t use hard deadlines for reviews.

'; echo '

', ($sv->type_hint("date") ? : ""), '

'; diff --git a/src/settings/s_subform.php b/src/settings/s_subform.php index b0e91a980..dd2e681f0 100644 --- a/src/settings/s_subform.php +++ b/src/settings/s_subform.php @@ -225,7 +225,7 @@ static function parse($suffix, $sv, $check) { class SubForm_SettingRenderer { static function render(SettingValues $sv) { - echo "

Abstract and PDF

\n"; + $sv->echo_subhead("Abstract and PDF"); echo '
'; echo '
', @@ -246,8 +246,8 @@ static function render(SettingValues $sv) { echo '
'; - echo "

Conflicts and collaborators

\n", - '
\n"; $sv->echo_checkbox("sub_pcconf", "Collect authors’ PC conflicts", ["class" => "uich js-foldup"]); $cflt = array(); diff --git a/src/settings/s_tags.php b/src/settings/s_tags.php index b804ff889..f0bdfe800 100644 --- a/src/settings/s_tags.php +++ b/src/settings/s_tags.php @@ -44,7 +44,7 @@ static function render_tag_rank(SettingValues $sv) { static function render(SettingValues $sv) { // Tags $tagmap = $sv->conf->tags(); - echo "

Tags

\n"; + $sv->echo_subhead("Tags"); echo '
'; $sv->render_group("tags/main"); @@ -55,7 +55,7 @@ static function render(SettingValues $sv) { echo "
\n"; } static function render_tag_seeall(SettingValues $sv) { - echo '
'; + echo '
'; $sv->echo_checkbox('tag_seeall', "PC can see tags for conflicted submissions"); echo '
'; } @@ -80,8 +80,8 @@ static function render_styles(SettingValues $sv) { . ""; } + $sv->echo_subhead("Colors and styles", ["id" => "colors-and-styles"]); echo Ht::hidden("has_tag_color", 1), - '

Colors and styles

', "

Submissions tagged with a style name, or with an associated tag, appear in that style in lists. This also applies to PC tags.

", '', join("", $tag_colors_rows), "
Style nameTags
\n"; diff --git a/src/settings/s_topics.php b/src/settings/s_topics.php index 68601007c..872cbcc82 100644 --- a/src/settings/s_topics.php +++ b/src/settings/s_topics.php @@ -16,7 +16,7 @@ static function render(SettingValues $sv) { } Dbl::free($result); - echo "

Topics

\n"; + $sv->echo_subhead("Topics", ["id" => "topics"]); echo "

Authors select the topics that apply to their submissions. PC members can indicate topics they’re interested in or search using the “topic:” keyword. Use a colon to create topic groups, as in “Systems: Correctness” and “Systems: Performance”."; if ($sv->conf->has_topics()) { echo " To delete an existing topic, remove its name."; diff --git a/src/settings/s_users.php b/src/settings/s_users.php index 35ab8dd64..70d91ff2e 100644 --- a/src/settings/s_users.php +++ b/src/settings/s_users.php @@ -4,7 +4,7 @@ class Users_SettingRenderer { static function render(SettingValues $sv) { - echo "

Program committee & system administrators

"; + $sv->echo_subhead("Program committee & system administrators"); echo '

Create PC accounts · ', "Select a user’s name to edit a profile.

\n"; $pl = new ContactList($sv->user, false); diff --git a/src/settingvalues.php b/src/settingvalues.php index d754d0ca2..8ff39fb90 100644 --- a/src/settingvalues.php +++ b/src/settingvalues.php @@ -555,7 +555,9 @@ class SettingValues extends MessageSet { private $null_mailer; /** @var ?GroupedExtensions */ - private $_gxt = null; + private $_gxt; + /** @var bool */ + private $_in_subhead = false; function __construct(Contact $user) { parent::__construct(); @@ -658,6 +660,23 @@ function crosscheck() { function render_group($g, $options = null) { $this->gxt()->render_group($g, $options); } + /** @param string $html + * @param array $opts */ + function echo_subhead($html, $opts = null) { + $this->echo_close_subhead(); + echo '

', $html, '

'; + $this->_in_subhead = true; + } + function echo_close_subhead() { + if ($this->_in_subhead) { + echo "
\n\n"; + $this->_in_subhead = false; + } + } /** @return bool */ diff --git a/stylesheets/style.css b/stylesheets/style.css index de9636efe..5a1cc90ce 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1365,17 +1365,19 @@ th.settings-simplehead { margin-top: 0; margin-bottom: 0; } -.form-g, .settings-rf, .settings-rf-deleted { margin-bottom: 2em; } -.settings-opt { +.form-hg, .settings-opt { margin-bottom: 3em; } -.form-g-2 { +.form-g, .form-g-5 { + margin-bottom: 2.25em; +} +.form-g-3 { margin-bottom: 1em; } -.form-g-1 { +.form-g-2 { margin-bottom: 0.5em; } .form-g + .form-nearby {