-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
preference_min
and preference_max
advanced settings.
- Loading branch information
Showing
5 changed files
with
122 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
// settings/s_preference.php -- HotCRP preference settings | ||
// Copyright (c) 2006-2024 Eddie Kohler; see LICENSE. | ||
|
||
class Preference_SettingParser extends SettingParser { | ||
function apply_req(Si $si, SettingValues $sv) { | ||
if ($si->name === "preference_min") { | ||
$v = $sv->newv($si); | ||
if ($v < -1000000) { | ||
$sv->error_at($si->name, "<0>Minimum preference must be at least -1000000"); | ||
} else if ($v > 0) { | ||
$sv->error_at($si->name, "<0>Minimum preference cannot be greater than 0"); | ||
} | ||
} else if ($si->name === "preference_max") { | ||
$v = $sv->newv($si); | ||
if ($v > 1000000) { | ||
$sv->error_at($si->name, "<0>Maximum preference must be at most 1000000"); | ||
} else if ($v < 0) { | ||
$sv->error_at($si->name, "<0>Maximum preference cannot be less than 0"); | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters