Skip to content

Commit

Permalink
Styles: Introduce .form-hg, use echo_subhead to automate its use.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Mar 11, 2021
1 parent fd2a76c commit c195a6c
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 43 deletions.
46 changes: 25 additions & 21 deletions autoassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,12 @@ function echo_result() {
}

$Conf->header("Assignments", "autoassign", ["subtitle" => "Automatic"]);
echo '<div class="psmode">',
echo '<div class="mb-5 clearfix">',
'<div class="papmode active"><a href="', $Conf->hoturl("autoassign"), '">Automatic</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("manualassign"), '">Manual</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("conflictassign"), '">Conflicts</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("bulkassign"), '">Bulk update</a></div>',
'</div><hr class="c">';
'</div>';

if (isset($Qreq->a) && isset($Qreq->pctyp) && $Qreq->valid_post()) {
if (isset($Qreq->assignment) && isset($Qreq->showassignment)) {
Expand Down Expand Up @@ -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 '<div class="' . $c . '">';
} else {
return '<div>';
}
}

echo Ht::form($Conf->hoturl_post("autoassign", array("profile" => $Qreq->profile, "seed" => $Qreq->seed, "XDEBUG_PROFILE" => $Qreq->XDEBUG_PROFILE)), ["id" => "autoassignform"]),
'<div class="helpside"><div class="helpinside">
Assignment methods:
Expand All @@ -610,7 +602,8 @@ function divClass($name, $classes = null) {
echo Ht::unstash_script("hotcrp.highlight_form_children(\"#autoassignform\")");

// paper selection
echo divClass("pap"), "<h3 class=\"form-h\">Paper selection</h3>";
echo '<div class="form-hg">',
'<h3 class="', Ht::control_class("pap", "form-h", "is-"), 'Paper selection</h3>';
if (!isset($Qreq->q)) { // XXX redundant
$Qreq->q = join(" ", $SSel->selection());
}
Expand Down Expand Up @@ -644,8 +637,10 @@ function divClass($name, $classes = null) {


// action
echo '<div>';
echo divClass("ass"), "<h3 class=\"form-h\">Action</h3>", "</div>";
echo '<div class="form-hg">',
'<h3 class="', Ht::control_class("ass", "form-h", "is-"), "\">Action</h3>\n";

echo '<div class="form-g">';
echo_radio_row("a", "rev", "Ensure each selected paper has <i>at least</i>", ["open" => true]);
echo "&nbsp; ",
Ht::entry("revct", $Qreq->revct ?? 1,
Expand Down Expand Up @@ -686,30 +681,36 @@ function divClass($name, $classes = null) {
echo "</div>";
}

echo "</div>\n";
echo "</div>"; // revpc container
echo "</div>"; // .form-g

// conflicts, clear reviews
echo '<div class="form-g">';
echo_radio_row("a", "prefconflict", "Assign conflicts when PC members have review preferences of &minus;100 or less", ["divclass" => "mt-3"]);
echo_radio_row("a", "clear", "Clear all &nbsp;", ["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),
" &nbsp;assignments for selected papers and PC members</div>\n";
" &nbsp;assignments for selected papers and PC members</div></div>\n";

// leads, shepherds
echo '<div class="form-g">';
echo_radio_row("a", "lead", "Assign discussion lead from reviewers, preferring&nbsp; ", ["open" => true, "divclass" => "mt-3"]);
echo Ht::select("leadscore", $scoreselector, $Qreq->leadscore), "</div>\n";

echo_radio_row("a", "shepherd", "Assign shepherd from reviewers, preferring&nbsp; ", ["open" => true]);
echo Ht::select("shepherdscore", $scoreselector, $Qreq->shepherdscore), "</div>\n";
echo Ht::select("shepherdscore", $scoreselector, $Qreq->shepherdscore), "</div></div>\n";

// discussion order
echo '<div class="form-g">';
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</div>";
", grouping papers with similar PC conflicts</div></div>";

echo "</div>\n\n"; // .form-hg


// PC
echo "<h3 class=\"form-h\">PC members</h3>\n";
echo '<div class="form-hg"><h3 class="form-h">PC members</h3>';

echo '<div class="js-radio-focus checki"><label>',
'<span class="checkc">', Ht::radio("pctyp", "all", $Qreq->pctyp === "all"), '</span>',
Expand Down Expand Up @@ -778,18 +779,19 @@ function bpSelector($i, $which) {
}
echo "</td></tr>\n";
}
echo "</tbody></table></div>\n";
echo "</tbody></table></div></div>\n";
$Conf->stash_hotcrp_pc($Me);


// Load balancing
echo "<h3 class=\"form-h\">Load balancing</h3>\n";
echo '<div class="form-hg"><h3 class="form-h">Load balancing</h3>';
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 '</div>';


// Method
echo "<h3 class=\"form-h\">Assignment method</h3>\n";
echo '<div class="form-hg"><h3 class="form-h">Assignment method</h3>';
echo_radio_row("method", "mcmf", "Globally optimal assignment");
echo_radio_row("method", "random", "Random good assignment");

Expand All @@ -805,6 +807,8 @@ function bpSelector($i, $which) {
echo "</div>\n";
}

echo "</div>\n";


// Create assignment
echo '<div class="aab aabig">', Ht::submit("assign", "Prepare assignments", ["class" => "btn-primary"]),
Expand Down
4 changes: 2 additions & 2 deletions bulkassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ function complete_assignment($qreq, $callback) {


$Conf->header("Assignments", "bulkassign", ["subtitle" => "Bulk update"]);
echo '<div class="psmode">',
echo '<div class="mb-5 clearfix">',
'<div class="papmode"><a href="', $Conf->hoturl("autoassign"), '">Automatic</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("manualassign"), '">Manual</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("conflictassign"), '">Conflicts</a></div>',
'<div class="papmode active"><a href="', $Conf->hoturl("bulkassign"), '">Bulk update</a></div>',
'</div><hr class="c" />';
'</div>';


// upload review form action
Expand Down
4 changes: 2 additions & 2 deletions conflictassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
$Me->add_overrides(Contact::OVERRIDE_CONFLICT);

$Conf->header("Assignments", "assignpc", ["subtitle" => "Conflicts"]);
echo '<div class="psmode">',
echo '<div class="mb-5 clearfix">',
'<div class="papmode"><a href="', hoturl("autoassign"), '">Automatic</a></div>',
'<div class="papmode"><a href="', hoturl("manualassign"), '">Manual</a></div>',
'<div class="papmode active"><a href="', hoturl("conflictassign"), '">Conflicts</a></div>',
'<div class="papmode"><a href="', hoturl("bulkassign"), '">Bulk update</a></div>',
'</div><hr class="c" />';
'</div>';

echo '<div class="w-text mt-5 mb-5">';

Expand Down
4 changes: 2 additions & 2 deletions manualassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ function saveAssignments($qreq, $reviewer) {


$Conf->header("Assignments", "assignpc", ["subtitle" => "Manual"]);
echo '<div class="psmode">',
echo '<div class="mb-5 clearfix">',
'<div class="papmode"><a href="', $Conf->hoturl("autoassign"), '">Automatic</a></div>',
'<div class="papmode active"><a href="', $Conf->hoturl("manualassign"), '">Manual</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("conflictassign"), '">Conflicts</a></div>',
'<div class="papmode"><a href="', $Conf->hoturl("bulkassign"), '">Bulk update</a></div>',
'</div><hr class="c">';
'</div>';


// Help list
Expand Down
2 changes: 1 addition & 1 deletion scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<p><strong>This user cannot be deleted</strong> 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.</p>');
hc.push('<p><strong>This user cannot be deleted</strong> 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.</p>');
hc.push_actions(['<button type="button" name="cancel">Cancel</button>']);
hc.show();
});
Expand Down
1 change: 1 addition & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div class="aab aabig mt-7">',
Expand Down
2 changes: 1 addition & 1 deletion src/settings/s_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private function render_option(SettingValues $sv, PaperOption $io = null, $ipos,

static function render(SettingValues $sv) {
$self = new Options_SettingRenderer;
echo "<h3 class=\"form-h\">Submission fields</h3>\n";
$sv->echo_subhead("Submission fields");
echo "<hr class=\"g\">\n",
Ht::hidden("has_options", 1),
Ht::hidden("options:version", (int) $sv->conf->setting("options")),
Expand Down
2 changes: 1 addition & 1 deletion src/settings/s_reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static function render(SettingValues $sv) {


// Deadlines
echo "<h3 id=\"rounds\" class=\"form-h\">Deadlines &amp; rounds</h3>\n";
$sv->echo_subhead("Deadlines &amp; rounds", ["id" => "rounds"]);
echo '<p>Reviews are due by the deadline, but <em>cannot be modified</em> after the hard deadline. Most conferences don’t use hard deadlines for reviews.</p>';
echo '<p class="f-h">', ($sv->type_hint("date") ? : ""), '</p>';

Expand Down
6 changes: 3 additions & 3 deletions src/settings/s_subform.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static function parse($suffix, $sv, $check) {

class SubForm_SettingRenderer {
static function render(SettingValues $sv) {
echo "<h3 class=\"form-h\">Abstract and PDF</h3>\n";
$sv->echo_subhead("Abstract and PDF");

echo '<div id="foldpdfupload" class="fold2o fold3o">';
echo '<div class="f-i">',
Expand All @@ -246,8 +246,8 @@ static function render(SettingValues $sv) {

echo '</div>';

echo "<h3 class=\"form-h\">Conflicts and collaborators</h3>\n",
'<div id="foldpcconf" class="form-g fold',
$sv->echo_subhead("Conflicts and collaborators");
echo '<div id="foldpcconf" class="form-g fold',
($sv->curv("sub_pcconf") ? "o" : "c"), "\">\n";
$sv->echo_checkbox("sub_pcconf", "Collect authors’ PC conflicts", ["class" => "uich js-foldup"]);
$cflt = array();
Expand Down
6 changes: 3 additions & 3 deletions src/settings/s_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static function render_tag_rank(SettingValues $sv) {
static function render(SettingValues $sv) {
// Tags
$tagmap = $sv->conf->tags();
echo "<h3 class=\"form-h\">Tags</h3>\n";
$sv->echo_subhead("Tags");

echo '<div class="form-g">';
$sv->render_group("tags/main");
Expand All @@ -55,7 +55,7 @@ static function render(SettingValues $sv) {
echo "</div>\n";
}
static function render_tag_seeall(SettingValues $sv) {
echo '<div class="form-g-1">';
echo '<div class="form-g-2">';
$sv->echo_checkbox('tag_seeall', "PC can see tags for conflicted submissions");
echo '</div>';
}
Expand All @@ -80,8 +80,8 @@ static function render_styles(SettingValues $sv) {
. "</td><td class=\"remargin-right\"></td></tr>";
}

$sv->echo_subhead("Colors and styles", ["id" => "colors-and-styles"]);
echo Ht::hidden("has_tag_color", 1),
'<h3 class="form-h" id="colors-and-styles">Colors and styles</h3>',
"<p>Submissions tagged with a style name, or with an associated tag, appear in that style in lists. This also applies to PC tags.</p>",
'<table class="demargin"><tr><th></th><th class="settings-simplehead" style="min-width:8rem">Style name</th><th class="settings-simplehead">Tags</th><th></th></tr>',
join("", $tag_colors_rows), "</table>\n";
Expand Down
2 changes: 1 addition & 1 deletion src/settings/s_topics.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static function render(SettingValues $sv) {
}
Dbl::free($result);

echo "<h3 class=\"form-h\" id=\"topics\">Topics</h3>\n";
$sv->echo_subhead("Topics", ["id" => "topics"]);
echo "<p>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.";
Expand Down
2 changes: 1 addition & 1 deletion src/settings/s_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Users_SettingRenderer {
static function render(SettingValues $sv) {
echo "<h3 class=\"form-h\">Program committee &amp; system administrators</h3>";
$sv->echo_subhead("Program committee &amp; system administrators");
echo '<p><a href="', $sv->conf->hoturl("profile", "u=new&amp;role=pc"), '" class="btn">Create PC accounts</a> <span class="barsep">·</span> ',
"Select a user’s name to edit a profile.</p>\n";
$pl = new ContactList($sv->user, false);
Expand Down
21 changes: 20 additions & 1 deletion src/settingvalues.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 '<div class="form-hg"><h3 class="form-h';
if ($opts["id"] ?? null) {
echo '" id="', htmlspecialchars($opts["id"]);
}
echo '">', $html, '</h3>';
$this->_in_subhead = true;
}
function echo_close_subhead() {
if ($this->_in_subhead) {
echo "</div>\n\n";
$this->_in_subhead = false;
}
}


/** @return bool */
Expand Down
10 changes: 6 additions & 4 deletions stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c195a6c

Please sign in to comment.