Skip to content
Permalink
Browse files

Help topics, page partials, setting groups prefer alias to synonym.

- Remove synonym support from GroupedExtensions.
- Prefix "__" is a page partial that can't be rendered.
  • Loading branch information
kohler committed Dec 8, 2019
1 parent fbd36ce commit d4bcb757b1d5a7d0680c08f42147bdb6b0147ed7
Showing with 51 additions and 51 deletions.
  1. +4 −2 etc/helptopics.json
  2. +5 −1 etc/pagepartials.json
  3. +15 −7 etc/settinggroups.json
  4. +2 −4 index.php
  5. +21 −33 src/groupedextensions.php
  6. +1 −1 src/partials/p_home.php
  7. +3 −3 src/partials/p_signin.php
@@ -194,11 +194,12 @@
"position": 1000
},
{
"name": "keywords", "title": "Search keywords", "synonym": ["syntax"],
"name": "keywords", "title": "Search keywords",
"description": "Quick reference to search keywords and syntax.",
"render_callback": "Keywords_HelpTopic::render",
"position": 2000
},
{ "name": "syntax", "alias": "keywords" },
{
"name": "tags", "title": "Tags",
"description": "How to use tags to define paper sets and discussion orders.",
@@ -271,11 +272,12 @@
"position": 6000
},
{
"name": "reviewratings", "title": "Review ratings", "synonym": ["revrate"],
"name": "reviewratings", "title": "Review ratings",
"description": "Rating the quality of reviews.",
"render_callback": "RevRate_HelpTopic::render",
"position": 7000
},
{ "name": "revrate", "alias": "reviewratings" },
{
"name": "votetags", "title": "Voting",
"description": "PC members can vote for papers using tags.",
@@ -1,9 +1,10 @@
[
{
"name": ":footer", "render_callback": "*Conf::footer"
"name": "__footer", "render_callback": "*Conf::footer"
},


{ "name": "home" },
{
"name": "home/profile_redirect", "position": 100,
"request_callback": "Home_Partial::profile_redirect_request"
@@ -103,6 +104,7 @@
},


{ "name": "newaccount" },
{
"name": "newaccount/request", "position": 100,
"request_callback": "*Signin_Partial::create_request"
@@ -124,6 +126,7 @@
},


{ "name": "forgotpassword" },
{
"name": "forgotpassword/request", "position": 100,
"request_callback": "*Signin_Partial::forgot_request"
@@ -139,6 +142,7 @@
},


{ "name": "resetpassword" },
{
"name": "resetpassword/request", "position": 100,
"request_callback": "*Signin_Partial::reset_request"
@@ -1,8 +1,9 @@
[
{
"name": "basics", "synonym": ["info"], "position": 0,
"name": "basics", "position": 0,
"title": "Basics"
},
{ "name": "info", "alias": "basics" },
{
"name": "basics/names", "position": 10,
"render_callback": "Basics_SettingParser::render_names",
@@ -20,14 +21,16 @@
},

{
"name": "decisions", "synonym": ["dec"], "position": 800,
"name": "decisions", "position": 800,
"title": "Decisions"
},
{ "name": "dec", "alias": "decisions" },
{
"name": "decisions/responses", "synonym": ["responses"], "position": 10,
"name": "decisions/responses", "position": 10,
"title": "Responses",
"render_callback": "Responses_SettingParser::render"
},
{ "name": "responses", "alias": "decisions/responses" },
{
"name": "responses/properties/name", "position": 10,
"render_response_property_callback": "Responses_SettingParser::render_name_property"
@@ -86,14 +89,17 @@
"render_callback": "Messages_SettingRenderer::render"
},
{
"name": "reviewform", "synonym": ["rfo"], "position": 600,
"name": "reviewform", "position": 600,
"title": "Review form",
"render_callback": "ReviewForm_SettingRenderer::render"
},
{ "name": "rfo", "alias": "reviewform" },
{
"name": "reviews", "synonym": ["rev", "review"], "position": 500,
"name": "reviews", "position": 500,
"title": "Reviews"
},
{ "name": "rev", "alias": "reviews" },
{ "name": "review", "alias": "reviews" },
{
"name": "__crosscheck/reviews", "position": 500,
"crosscheck_callback": "Reviews_SettingRenderer::crosscheck"
@@ -118,9 +124,10 @@
"render_callback": "Reviews_SettingRenderer::render_ratings"
},
{
"name": "submissions", "synonym": ["sub"], "position": 300,
"name": "submissions", "position": 300,
"title": "Submissions"
},
{ "name": "sub", "alias": "submissions" },
{
"name": "__crosscheck/submissions", "position": 300,
"crosscheck_callback": "Submissions_SettingRenderer::crosscheck"
@@ -152,9 +159,10 @@
"render_callback": "SubForm_SettingRenderer::render"
},
{
"name": "options", "group": "subform", "synonym": ["opt"], "position": 440,
"name": "options", "group": "subform", "position": 440,
"render_callback": "Options_SettingRenderer::render"
},
{ "name": "opt", "alias": "options" },
{
"name": "__crosscheck/options", "position": 400,
"crosscheck_callback": "Options_SettingRenderer::crosscheck"
@@ -39,13 +39,11 @@

if ($page_template) {
$group = $page_template->group;
} else if (!str_starts_with($nav->page, ":") && $gx->is_group($nav->page)) {
$group = $nav->page;
} else {
$group = null;
$group = $gx->canonical_group($nav->page);
}

if ($group) {
if ($group && !str_starts_with($group, "__")) {
// handle signin/signout -- may change $Me
if ($group === "index") {
$Me = Home_Partial::signin_requests($Me, $Qreq);
@@ -6,11 +6,9 @@ class GroupedExtensions {
private $user;
private $_groups;
private $_all;
private $_is_group;
private $_render_state;
private $_render_stack;
private $_render_classes;
private $_synonym_subgroups = [];
private $_annexes = [];
static private $next_placeholder;

@@ -26,11 +24,6 @@ function _add_json($fj) {
$fj->group = $fj->name;
}
}
if (!isset($fj->synonym)) {
$fj->synonym = [];
} else if (is_string($fj->synonym)) {
$fj->synonym = [$fj->synonym];
}
if (!isset($fj->anchorid)
&& !str_starts_with($fj->name, "__")
&& ($pos = strpos($fj->name, "/")) !== false) {
@@ -61,9 +54,6 @@ function __construct(Contact $user, $args /* ... */) {
if ($xt->name === $xt->group && !isset($xt->alias)) {
$this->_groups[$name] = $xt;
}
if (!empty($xt->synonym)) {
$this->_synonym_subgroups[] = $xt;
}
}
}
$this->reset_render();
@@ -85,30 +75,17 @@ function subgroup_compare($aj, $bj) {
return Conf::xt_position_compare($aj, $bj);
}
}
function is_group($name) {
if ($this->_is_group === null) {
$this->_is_group = [];
foreach ($this->_all as $gj) {
$this->_is_group[$gj->group] = true;
}
}
return isset($this->_is_group[$name]);
}
function get($name) {
if (isset($this->_all[$name])) {
return $this->_all[$name];
$gj = get($this->_all, $name);
for ($nalias = 0; $nalias < 5 && $gj && isset($gj->alias); ++$nalias) {
$gj = get($this->_all, $gj->alias);
}
foreach ($this->_synonym_subgroups as $gj) {
if (in_array($name, $gj->synonym))
return $gj;
}
return null;
return $gj;
}
function canonical_group($name) {
if (($gj = $this->get($name))) {
return $gj->group;
} else if ($this->is_group($name)) {
return $name;
$pos = strpos($gj->group, "/");
return $pos === false ? $gj->group : substr($gj->group, 0, $pos);
} else {
return false;
}
@@ -121,16 +98,27 @@ function members($name) {
$name = $gj->name;
}
$r = [];
$alias = false;
foreach ($this->_all as $gj) {
if ($gj->group === $name && $gj->name !== $name) {
while (isset($gj->alias) && ($xgj = $this->get($gj->alias))) {
$gj = $xgj;
if (!isset($gj->alias)) {
$r[] = $gj;
} else if (isset($gj->position)) {
$r[] = $gj;
$alias = true;
}
$r[] = $gj;
}
}
usort($r, [$this, "subgroup_compare"]);
return $r;
if ($alias) {
$rr = [];
foreach ($r as $gj) {
$rr[] = isset($gj->alias) ? $this->get($gj->alias) : $gj;
}
return $rr;
} else {
return $r;
}
}
function all() {
uasort($this->_all, [$this, "subgroup_compare"]);
@@ -129,7 +129,7 @@ function render_head(Contact $user, Qrequest $qreq, $gx) {
} else {
$user->conf->header("Home", "home");
}
$gx->push_render_cleanup(":footer");
$gx->push_render_cleanup("__footer");
echo '<noscript><div class="msg msg-error"><strong>This site requires JavaScript.</strong> Your browser does not support JavaScript.<br><a href="https://github.com/kohler/hotcrp/">Report bad compatibility problems</a></div></noscript>', "\n";
if ($user->privChair) {
echo '<div id="msg-clock-drift"></div>';
@@ -47,7 +47,7 @@ function create_request(Contact $user, Qrequest $qreq) {
}
function render_create_head(Contact $user, Qrequest $qreq, $gx) {
$user->conf->header("New account", "newaccount", ["action_bar" => false]);
$gx->push_render_cleanup(":footer");
$gx->push_render_cleanup("__footer");
return !$this->_stop;
}
function render_create_body(Contact $user, Qrequest $qreq, $gx, $gj) {
@@ -91,7 +91,7 @@ function forgot_request(Contact $user, Qrequest $qreq) {
}
function render_forgot_head(Contact $user, Qrequest $qreq, $gx) {
$user->conf->header("Forgot password", "resetpassword", ["action_bar" => false]);
$gx->push_render_cleanup(":footer");
$gx->push_render_cleanup("__footer");
return !$this->_stop;
}
function render_forgot_body(Contact $user, Qrequest $qreq, $gx, $gj) {
@@ -205,7 +205,7 @@ function reset_request(Contact $user, Qrequest $qreq) {
}
function render_reset_head(Contact $user, Qrequest $qreq, $gx, $gj) {
$user->conf->header($gj->htitle, "resetpassword", ["action_bar" => false]);
$gx->push_render_cleanup(":footer");
$gx->push_render_cleanup("__footer");
return !$this->_stop;
}
private function _render_reset_success($user, $qreq) {

0 comments on commit d4bcb75

Please sign in to comment.
You can’t perform that action at this time.