Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (75 sloc) 3.41 KB
<?php
// settings.php -- HotCRP chair-only conference settings management page
// Copyright (c) 2006-2019 Eddie Kohler; see LICENSE.
require_once("src/initweb.php");
if (!$Me->privChair)
$Me->escape();
$Sv = SettingValues::make_request($Me, $Qreq);
$Sv->session_highlight();
function choose_setting_group($qreq, SettingValues $sv) {
global $Conf, $Me;
$req_group = $qreq->group;
if (!$req_group && preg_match(',\A/\w+\z,', Navigation::path()))
$req_group = substr(Navigation::path(), 1);
$want_group = $req_group;
if (!$want_group && isset($_SESSION["sg"])) // NB not conf-specific session, global
$want_group = $_SESSION["sg"];
$want_group = $sv->canonical_group($want_group);
if (!$want_group || !$sv->is_titled_group($want_group)) {
if ($sv->conf->can_some_author_view_review())
$want_group = $sv->canonical_group("decisions");
else if ($sv->conf->deadlinesAfter("sub_sub") || $sv->conf->time_review_open())
$want_group = $sv->canonical_group("reviews");
else
$want_group = $sv->canonical_group("sub");
}
if (!$want_group)
$Me->escape();
if ($want_group !== $req_group && !$qreq->post && $qreq->post_empty())
$Conf->self_redirect($qreq, ["group" => $want_group, "anchor" => $sv->group_anchorid($req_group)]);
$sv->mark_interesting_group($want_group);
return $want_group;
}
$Group = $Qreq->group = choose_setting_group($Qreq, $Sv);
$_SESSION["sg"] = $Group;
if (isset($Qreq->update) && $Qreq->post_ok()) {
if ($Sv->execute()) {
$Me->save_session("settings_highlight", $Sv->message_field_map());
if (!empty($Sv->changes))
$Sv->conf->confirmMsg("Changes saved.");
else
$Sv->conf->warnMsg("No changes.");
$Sv->report();
$Conf->self_redirect($Qreq);
}
}
if (isset($Qreq->cancel) && $Qreq->post_ok())
$Conf->self_redirect($Qreq);
$Sv->crosscheck();
$group_titles = $Sv->group_titles();
$Conf->header("Settings", "settings", ["subtitle" => $group_titles[$Group], "title_div" => '<hr class="c">', "body_class" => "leftmenu"]);
echo Ht::unstash(); // clear out other script references
echo $Conf->make_script_file("scripts/settings.js"), "\n";
echo Ht::form(hoturl_post("settings", "group=$Group"),
["id" => "settingsform", "class" => "need-unload-protection"]);
echo '<div class="leftmenu-left"><div class="leftmenu-menu"><h1 class="leftmenu">Settings</h1><div class="leftmenu-list">';
foreach ($group_titles as $name => $title) {
if ($name === $Group)
echo '<div class="leftmenu-item active">', $title, '</div>';
else
echo '<div class="leftmenu-item ui js-click-child">',
'<a href="', hoturl("settings", "group={$name}"), '">', $title, '</a></div>';
}
echo '</div><div class="leftmenu-if-left if-alert mt-5">',
Ht::submit("update", "Save changes", ["class" => "btn-primary"]),
"</div></div></div>\n",
'<div class="leftmenu-content">',
'<h2 class="leftmenu">', $group_titles[$Group], '</h2>';
$Sv->report(isset($Qreq->update) && $Qreq->post_ok());
$Sv->render_group($Group);
echo '<div class="aab aabig">',
'<div class="aabut">', Ht::submit("update", "Save changes", ["class" => "btn-primary"]), '</div>',
'<div class="aabut">', Ht::submit("cancel", "Cancel"), '</div>',
'<hr class="c" /></div></div></form>', "\n";
Ht::stash_script('hiliter_children("#settingsform")');
$Conf->footer();
You can’t perform that action at this time.