diff --git a/admin/judges.inc.php b/admin/judges.inc.php
index 08719e7..8dcec23 100644
--- a/admin/judges.inc.php
+++ b/admin/judges.inc.php
@@ -181,11 +181,10 @@ function getJudgingTeam($teamid)
function judges_scheduler_load_config()
{
global $config;
- $configq=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' AND var LIKE 'JSCHEDULER_%'");
+ $configq=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' AND category = 'Judge Scheduler'");
$data=array();
while($configr=mysql_fetch_object($configq)) {
- $v = substr($configr->var, 11);
- $data[$v]=$configr->val;
+ $data[$configr->var]=$configr->val;
}
return $data;
}
diff --git a/admin/judges_schedulerconfig.php b/admin/judges_schedulerconfig.php
index a53d147..f15a78c 100644
--- a/admin/judges_schedulerconfig.php
+++ b/admin/judges_schedulerconfig.php
@@ -34,7 +34,7 @@ ogram; see the file COPYING. If not, write to
echo "<< ".i18n("Back to Administration")."\n";
echo "<< ".i18n("Back to Judges")."\n";
- config_editor("JSCHEDULER_", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
+ config_editor("Judge Scheduler", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
echo "
";
$ok = 1;
diff --git a/config/variables.php b/config/variables.php
index 48393f1..5ad7d5d 100644
--- a/config/variables.php
+++ b/config/variables.php
@@ -23,6 +23,7 @@
?>
require("../common.inc.php");
+ require_once("../config_editor.inc.php");
auth_required('config');
send_header("Configuration - Variables");
echo "<< ".i18n("Back to Configuration")."
";
@@ -30,14 +31,16 @@
$q=mysql_query("SELECT * FROM config WHERE year='-1'");
while($r=mysql_fetch_object($q))
{
- mysql_query("INSERT INTO config (var,val,description,year) VALUES (
+ mysql_query("INSERT INTO config (var,val,category,ord,description,year) VALUES (
'".mysql_escape_string($r->var)."',
'".mysql_escape_string($r->val)."',
+ '".mysql_escape_string($r->category)."',
+ '".mysql_escape_string($r->ord)."',
'".mysql_escape_string($r->description)."',
'".$config['FAIRYEAR']."')");
}
-
+ //for the Special category
if($_POST['action']=="save")
{
if($_POST['specialconfig'])
@@ -47,46 +50,71 @@
mysql_query("UPDATE config SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='0' AND var='$key'");
}
}
- if($_POST['saveconfig'])
- {
- foreach($_POST['saveconfig'] as $key=>$val)
- {
- mysql_query("UPDATE config SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='".$config['FAIRYEAR']."' AND var='$key'");
- }
- }
echo happy(i18n("Configuration successfully saved"));
-
-
}
- $q=mysql_query("SELECT * FROM config WHERE year=0 ORDER BY var");
- echo "";
+}
+else
+{
+ echo i18n("Please choose a configuration category");
+}
send_footer();
?>
diff --git a/config_editor.inc.php b/config_editor.inc.php
index 0e32e81..853aa74 100644
--- a/config_editor.inc.php
+++ b/config_editor.inc.php
@@ -23,12 +23,9 @@
?>
-function config_editor_load($append, $year)
+function config_editor_load($category, $year)
{
- $query = "SELECT * FROM config WHERE year='$year' ";
- if($append != '') {
- $query .= " AND var LIKE '{$append}%'";
- }
+ $query = "SELECT * FROM config WHERE year='$year' AND category='$category' ORDER BY ord";
$q = mysql_query($query);
print(mysql_error());
@@ -36,6 +33,8 @@ function config_editor_load($append, $year)
while($r=mysql_fetch_object($q)) {
$var[$r->var]['val'] = $r->val;
$var[$r->var]['desc'] = $r->description;
+ $var[$r->var]['category'] = $r->category;
+ $var[$r->var]['ord'] = $r->ord;
}
return $var;
}
@@ -60,7 +59,7 @@ function config_editor_parse_from_http_headers($array_name)
* FUTURE WORK: it would be nice to hide the order, and just implement
* a bunch of up/down arrows, and dynamically compute the order for
* all elements */
-function config_editor($append, $year, $array_name, $self)
+function config_editor($category, $year, $array_name, $self)
{
global $config;
@@ -80,22 +79,33 @@ function config_editor($append, $year, $array_name, $self)
/* Load questions, then handle up and down, because with up and down we
* have to modify 2 questions to maintain the order */
- $var = config_editor_load($append, $year);
+ $var = config_editor_load($category, $year);
echo "