From 33471e80ee141ac44a7a90c62f05327e04491120 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 23 Nov 2007 22:07:55 +0000 Subject: [PATCH] Add award source configuration Add stub for award downloader --- admin/award_download.php | 76 ++++++++++++++++++++++++++++++++++++++++ admin/awards.php | 2 ++ config/award_sources.php | 48 +++++++++++++++++++++++++ config/index.php | 1 + db/db.code.version.txt | 2 +- db/db.update.66.sql | 8 +++++ 6 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 admin/award_download.php create mode 100644 config/award_sources.php create mode 100644 db/db.update.66.sql diff --git a/admin/award_download.php b/admin/award_download.php new file mode 100644 index 0000000..f1fcf81 --- /dev/null +++ b/admin/award_download.php @@ -0,0 +1,76 @@ + + + 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. +*/ +?> + '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 "
"; + echo "
"; + + + //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 ""; + echo ""; + echo ""; + echo ""; + echo ""; + while($r=mysql_fetch_object($q)) { + echo ""; + echo "\n"; + echo ""; + echo ""; + echo ""; + $checkurl.="&check[]=$r->id"; + } + echo "
".i18n("Source Name")."".i18n("Source Location URL")."".i18n("Check")."
$r->name$r->urlid\">".i18n("check")."
\n"; + echo "
"; + + echo "".i18n("Check all sources").""; + + } + send_footer(); +?> diff --git a/admin/awards.php b/admin/awards.php index 2497627..8b5e2f5 100644 --- a/admin/awards.php +++ b/admin/awards.php @@ -40,6 +40,8 @@ echo "".i18n('Edit prizes for the generic prize template').""; echo "
"; echo "".i18n('Create divisional awards for all divisions & categories')."
"; + echo "
"; + echo "".i18n('Download awards from external sources')."
"; send_footer(); diff --git a/config/award_sources.php b/config/award_sources.php new file mode 100644 index 0000000..2fc98e4 --- /dev/null +++ b/config/award_sources.php @@ -0,0 +1,48 @@ + + + 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. +*/ +?> + "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(); +?> diff --git a/config/index.php b/config/index.php index bda2a96..62d4d47 100644 --- a/config/index.php +++ b/config/index.php @@ -41,6 +41,7 @@ echo "".i18n("Judge Registration Questions")."
"; echo "".i18n("Project Safety Questions")."
"; echo "".i18n("Images (Fair Logo)")."
"; + echo "".i18n("External Award Sources")."
"; echo "
"; echo "".i18n("Language Pack Installer")." (".i18n("install new language translations").")
"; echo "".i18n("New Version Checker")." (".i18n("check if you're using the latest version").")
"; diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 1479e19..69a893a 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -65 +66 diff --git a/db/db.update.66.sql b/db/db.update.66.sql new file mode 100644 index 0000000..0006981 --- /dev/null +++ b/db/db.update.66.sql @@ -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 ;