diff --git a/admin/award_awards.php b/admin/award_awards.php
index 0d7f33c..a89a80d 100644
--- a/admin/award_awards.php
+++ b/admin/award_awards.php
@@ -209,19 +209,62 @@
case 'feeder_load':
$id = intval($_GET['id']);
- $ret = array('ul'=>array(), 'dl'=>array());
/* Prepare two lists of fair IDs, for which fairs can upload and download this award */
$q=mysql_query("SELECT * FROM fairs_awards_link WHERE award_awards_id='$id'");
+ $ul = array();
+ $dl = array();
while($r=mysql_fetch_assoc($q)) {
- if($r['download_award'] == 'yes') $ret['dl'][] = $r['fairs_id'];
- if($r['upload_winners'] == 'yes') $ret['ul'][] = $r['fairs_id'];
+ if($r['upload_winners'] == 'yes') $ul[$r['fairs_id']] = true;
+ if($r['download_award'] == 'yes') $dl[$r['fairs_id']] = true;
}
$q = mysql_query("SELECT * FROM award_awards WHERE id='$id'");
$a = mysql_fetch_assoc($q);
- $ret['identifier'] = $a['external_identifier'];
- $ret['additional_materials'] = $a['external_additional_materials'];
- $ret['register_winners'] = $a['external_register_winners'];
- echo json_encode($ret);
+?>
+
=i18n("Feeder Fairs")?>
+
+
exit;
case 'feeder_save':
@@ -247,11 +290,14 @@
echo mysql_error();
}
$ident=mysql_escape_string(stripslashes($_POST['identifier']));
+ $per_fair = $_POST['per_fair'] == 'yes' ? 'yes' : 'no';
$mat = intval($_POST['additional_materials']);
$w = intval($_POST['register_winners']);
mysql_query("UPDATE award_awards SET external_identifier='$ident',
external_additional_materials='$mat',
- external_register_winners='$w' WHERE id='$id'");
+ external_register_winners='$w',
+ per_fair='$per_fair'
+ WHERE id='$id'");
happy_("Feeder Fair information saved");
exit;
@@ -479,19 +525,18 @@ function update_feeder()
{
if(award_tab_update['feeder'] == award_id) return;
award_tab_update['feeder'] = award_id;
- $.getJSON("=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+award_id,
- function(json) {
- $("#feeder_id").val(award_id);
- $("#feeder_identifier").val(json.identifier);
- $("#feeder_additional_materials").val([json.additional_materials]);
- $("#feeder_register_winners").val([json.register_winners]);
- $("[name=feeder_dl\\[\\]]").val(json.dl);
- $("[name=feeder_ul\\[\\]]").val(json.ul);
- if(json.dl.length == 0 && json.ul.length == 0)
- $('#feeder_enable').val([]);
- else
- $('#feeder_enable').val(['yes']);
+ $("#editor_tab_feeder").load("=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+award_id, '',
+ function(responseText, textStatus, XMLHttpRequest) {
+ /* Register buttons and handlers */
+ $("#feeder_enable").change(function() {
+ update_feeder_enable();
+ });
+ $("#feeder_save").click(function() {
+ $("#debug").load("$_SERVER['PHP_SELF']?>?action=feeder_save", $("#feeder_form").serializeArray());
+ return false;
+ });
+
update_feeder_enable();
});
}
@@ -500,20 +545,13 @@ function update_feeder_enable()
{
var checked = $('#feeder_enable:checkbox').is(':checked');
if(checked==true) {
- $('#feeder_form *').removeAttr('disabled');
+ $('#feeder_en *').removeAttr('disabled');
} else {
- $("#feeder_form *").attr('disabled', 'disabled');
+ $("#feeder_en *").attr('disabled', 'disabled');
$('#feeder_enable').removeAttr('disabled');
}
}
-function feeder_save()
-{
- $("#debug").load("$_SERVER['PHP_SELF']?>?action=feeder_save", $("#feeder_form").serializeArray());
- return false;
-}
-
-
/* Setup the popup window */
$(document).ready(function() {
$("#popup_editor").dialog({
@@ -733,41 +771,7 @@ $(document).ready(function() {
/* Next Tab */ ?>
-
-
=i18n("Feeder Fairs")?>
-
-
-
+
/* End tabs, end popup */ ?>
diff --git a/db/db.code.version.txt b/db/db.code.version.txt
index 91b629b..29e49a0 100644
--- a/db/db.code.version.txt
+++ b/db/db.code.version.txt
@@ -1 +1 @@
-156
+157
diff --git a/db/db.update.157.sql b/db/db.update.157.sql
new file mode 100644
index 0000000..9d7aa7a
--- /dev/null
+++ b/db/db.update.157.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `award_awards` ADD `per_fair` ENUM( 'no', 'yes' ) NOT NULL ;
+
+