forked from science-ation/science-ation
- Turn fair_save into an ajax query
- Add notification area and debug to the popup window, still an ugly hack. - Add a checkbox to the feeder fair config to enable/disable the whole thing (will confuse people less, needs to be implemented) - Also add a checkbox for signaling the feeder fair if there are additional materials for an assigned award.
This commit is contained in:
parent
3c8b72a40f
commit
b0e7715fb9
@ -709,14 +709,16 @@ $(document).ready(function() {
|
||||
<h4><?=i18n("Feeder Fairs")?></h4>
|
||||
<form id="feeder_form">
|
||||
<input type="hidden" id="feeder_id" name="award_awards_id" value=""/>
|
||||
<p><?=i18n("Give this award a unique name to distinguish it from any other awards the fair may download.")?></p>
|
||||
<p><input type="checkbox" id="feeder_enable" name="enable" value="yes" />
|
||||
<?=i18n("Allow feeder fairs to download this award.")?></p>
|
||||
<table class="tableedit">
|
||||
<tr><td class="left"><?=i18n('Unique Name')?>:</td>
|
||||
<td class="right"><input type="text" id="feeder_identifier" name="identifier" value="" size="40" maxlength="128" /></td></tr>
|
||||
<tr><td class="left"></td>
|
||||
<td class="right"><input type="checkbox" id="feeder_advance" name="advance" value="yes" ><?=i18n("Winners uploaded by a feeder fair will be registered as participants at this fair (both download award and upload winners should be turned on below)")?></td></tr>
|
||||
|
||||
</tr></table>
|
||||
<tr><td><?=i18n('Unique Name')?>:</td>
|
||||
<td><input type="text" id="feeder_identifier" name="identifier" value="" size="40" maxlength="128" /></td></tr>
|
||||
<tr><td><input type="checkbox" id="feeder_advance" name="advance" value="yes" /></td>
|
||||
<td><?=i18n("Winners uploaded by a feeder fair should be registered as participants at this fair (both download award and upload winners should be turned on below)")?></td></tr>
|
||||
<tr><td><input type="checkbox" id="feeder_additional" name="additional" value="yes" /></td>
|
||||
<td><?=i18n("There is additional material for this award (e.g. forms, instructions). If a feeder fair assigns a winner to this award, they will be told they need to contact this fair to get the additional material.")?></td></tr>
|
||||
</table>
|
||||
<p><?=i18n("Select which feeder fairs can download this award and upload winners.")?></p>
|
||||
<table class="tableview">
|
||||
<tr><th><?=i18n("Fair")?></th>
|
||||
|
@ -634,6 +634,8 @@ function send_popup_header($title="")
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/sfiab.js"></script>
|
||||
<div id="notice_area" class="notice_area"></div>
|
||||
|
||||
<?
|
||||
if($title)
|
||||
echo "<h2>".i18n($title)."</h2>";
|
||||
@ -657,7 +659,7 @@ if($lastdigit%2!=0)
|
||||
echo "SFIAB Version ".$config['version'];
|
||||
?>
|
||||
</div>
|
||||
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>"></div>
|
||||
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>">Debug...</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -23,34 +23,23 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once("common.inc.php");
|
||||
require_once("user.inc.php");
|
||||
require_once("fair.inc.php");
|
||||
require_once('common.inc.php');
|
||||
require_once('user.inc.php');
|
||||
require_once('fair.inc.php');
|
||||
|
||||
$fair_type = array('feeder' => 'Feeder Fair', 'sfiab' => 'SFIAB Upstream', 'ysc' => 'YSC/CWSF Upstream');
|
||||
|
||||
function yesno($name, $val)
|
||||
{
|
||||
echo "<select name=\"$name\">";
|
||||
$sel = ($val == 'yes') ? 'selected="selected"' : '';
|
||||
echo "<option $sel value=\"yes\">".i18n("Yes")."</option>";
|
||||
$sel = ($val == 'no') ? 'selected="selected"' : '';
|
||||
echo "<option $sel value=\"no\">".i18n("No")."</option>";
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
// user_auth_required('committee','admin');
|
||||
$u = user_load($_SESSION['embed_edit_id']);
|
||||
} else {
|
||||
user_auth_required('fair');
|
||||
$u = user_load($_SESSION['users_id']);
|
||||
}
|
||||
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
$id = $_POST['id'];
|
||||
switch($_GET['action']) {
|
||||
case 'save':
|
||||
$id = intval($_POST['id']);
|
||||
if(trim($id) == '') {
|
||||
$q = mysql_query("INSERT INTO fairs(`id`,`name`) VALUES('','new entry')");
|
||||
$id = mysql_insert_id();
|
||||
@ -78,12 +67,24 @@
|
||||
`enable_awards`='$enable_awards',
|
||||
`enable_winners`='$enable_winners'
|
||||
WHERE id=$id");
|
||||
|
||||
echo mysql_error();
|
||||
$u['fairs_id'] = $id;
|
||||
user_save($u);
|
||||
message_push(notice(i18n("Fair Informaiton successfully updated")));
|
||||
happy_("Fair Informaiton successfully updated");
|
||||
exit;
|
||||
}
|
||||
|
||||
function yesno($name, $val)
|
||||
{
|
||||
echo "<select name=\"$name\">";
|
||||
$sel = ($val == 'yes') ? 'selected="selected"' : '';
|
||||
echo "<option $sel value=\"yes\">".i18n("Yes")."</option>";
|
||||
$sel = ($val == 'no') ? 'selected="selected"' : '';
|
||||
echo "<option $sel value=\"no\">".i18n("No")."</option>";
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
|
||||
/* update overall status */
|
||||
fair_status_update($u);
|
||||
|
||||
@ -107,6 +108,18 @@ if($_SESSION['embed'] == true) {
|
||||
array("Science Fair Main" => "fair_main.php")
|
||||
);
|
||||
}
|
||||
|
||||
$s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'].'&' : 'fair_info.php?';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function fairinfo_save(id)
|
||||
{
|
||||
$("#debug").load("<?=$s?>sub=1&action=save", $("#fairinfo_form").serializeArray());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?
|
||||
/* Load the fair info */
|
||||
$q = mysql_query("SELECT * FROM fairs WHERE id={$u['fairs_id']}");
|
||||
if(mysql_num_rows($q)) {
|
||||
@ -115,8 +128,7 @@ if($_SESSION['embed'] == true) {
|
||||
$f = array();
|
||||
}
|
||||
|
||||
$s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'fair_info.php';
|
||||
echo "<form name=\"fairinfo\" method=\"post\" action=\"$s\">\n";
|
||||
echo "<form name=\"fairinfo\" id=\"fairinfo_form\" >\n";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"{$f['id']}\" />\n";
|
||||
echo "<table class=\"tableedit\">\n";
|
||||
@ -176,7 +188,7 @@ if($_SESSION['embed'] == true) {
|
||||
their own SFIAB to upload data to this SFIAB.'); echo '</div>';
|
||||
|
||||
echo "<br />";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Fair Information")."\" />\n";
|
||||
echo "<input type=\"submit\" onclick=\"fairinfo_save({$f['id']});return false;\" value=\"".i18n("Save Fair Information")."\" />\n";
|
||||
echo "</form>";
|
||||
|
||||
echo "<br />";
|
||||
|
Loading…
x
Reference in New Issue
Block a user