Add award source configuration

Add stub for award downloader
This commit is contained in:
james 2007-11-23 22:07:55 +00:00
parent 2305a44d57
commit 33471e80ee
6 changed files with 136 additions and 1 deletions

76
admin/award_download.php Normal file
View File

@ -0,0 +1,76 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2007 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
send_header("Download Awards",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Awards Main' => 'admin/awards.php' ));
if($_GET['action']=="check")
{
if(count($_GET['check'])) {
foreach($_GET['check'] AS $ch) {
$q=mysql_query("SELECT * FROM award_sources WHERE id='".intval($ch)."'");
$r=mysql_fetch_object($q);
echo i18n("Checking %1 for awards...",array($r->name));
echo "<br />";
echo "<br />";
//FIXME: do the check!
}
}
else
echo error(i18n("No sources available to check"));
}
else
{
$q=mysql_query("SELECT * FROM award_sources ORDER BY name");
echo "<table class=\"tableview\">";
echo "<tr><th>".i18n("Source Name")."</th>";
echo "<th>".i18n("Source Location URL")."</th>";
echo "<th>".i18n("Check")."</th>";
echo "</tr>";
while($r=mysql_fetch_object($q)) {
echo "<tr>";
echo "<td>$r->name</td>\n";
echo "<td>$r->url</td>";
echo "<td align=\"center\"><a href=\"award_download.php?action=check&check[]=$r->id\">".i18n("check")."</a></td>";
echo "</tr>";
$checkurl.="&check[]=$r->id";
}
echo "</table>\n";
echo "<br />";
echo "<a href=\"award_download.php?action=check$checkurl\">".i18n("Check all sources")."</a>";
}
send_footer();
?>

View File

@ -40,6 +40,8 @@
echo "<a href=\"award_prizes.php?award_awards_id=-1\">".i18n('Edit prizes for the generic prize template')."</a>";
echo "<br />";
echo "<a href=\"award_awardcreatedivisional.php\">".i18n('Create divisional awards for all divisions & categories')."</a><br />";
echo "<br />";
echo "<a href=\"award_download.php\">".i18n('Download awards from external sources')."</a><br />";
send_footer();

48
config/award_sources.php Normal file
View File

@ -0,0 +1,48 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2007 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
require("../tableeditor.class.php");
user_auth_required('committee', 'config');
send_header("External Award Sources Manager",
array("SFIAB Configuration" => "config/")
);
$editor=new TableEditor("award_sources",
array("name"=>"Name",
"url"=>"URL",
"username"=>"Username",
"password"=>"Password"
)
);
$editor->setPrimaryKey("id");
$editor->setDefaultSortField("name");
$editor->setRecordType("Award Source");
$editor->execute();
send_footer();
?>

View File

@ -41,6 +41,7 @@
echo "<a href=\"judges_questions.php\">".i18n("Judge Registration Questions")."</a> <br />";
echo "<a href=\"safetyquestions.php\">".i18n("Project Safety Questions")."</a> <br />";
echo "<a href=\"images.php\">".i18n("Images (Fair Logo)")."</a> <br />";
echo "<a href=\"award_sources.php\">".i18n("External Award Sources")."</a> <br />";
echo "<hr />";
echo "<a href=\"languagepacks.php\">".i18n("Language Pack Installer")."</a> (".i18n("install new language translations").")<br />";
echo "<a href=\"versionchecker.php\">".i18n("New Version Checker")."</a> (".i18n("check if you're using the latest version").")<br />";

View File

@ -1 +1 @@
65
66

8
db/db.update.66.sql Normal file
View File

@ -0,0 +1,8 @@
CREATE TABLE `award_sources` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 128 ) NOT NULL ,
`url` VARCHAR( 255 ) NOT NULL ,
`username` VARCHAR( 32 ) NOT NULL ,
`password` VARCHAR( 32 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM ;