forked from science-ation/science-ation
- new htabs
- beginnings of a jquery award editor - sfiab->sfiab award downloading - move most javascript into a sfiab.js file, so it can be cached and only pulled from the server once (instead of inline with the code each time)
This commit is contained in:
parent
d91ac62015
commit
62941df880
@ -22,10 +22,97 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
require_once('../common.inc.php');
|
||||
require_once('../user.inc.php');
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
switch($_GET['action']) {
|
||||
case 'getawardinfo':
|
||||
$id = intval($_GET['id']);
|
||||
$q=mysql_query("SELECT award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards.criteria,
|
||||
award_awards.description,
|
||||
award_awards.order,
|
||||
award_awards.presenter,
|
||||
award_awards.excludefromac,
|
||||
award_awards.cwsfaward,
|
||||
award_awards.self_nominate,
|
||||
award_awards.schedule_judges,
|
||||
award_types.id AS award_types_id,
|
||||
award_types.type,
|
||||
sponsors.id AS sponsors_id,
|
||||
sponsors.organization
|
||||
FROM
|
||||
award_awards,
|
||||
award_types,
|
||||
sponsors
|
||||
WHERE
|
||||
award_awards.id='$id'
|
||||
AND award_awards.sponsors_id=sponsors.id
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
");
|
||||
echo mysql_error();
|
||||
$r = mysql_fetch_assoc($q);
|
||||
$ret = array();
|
||||
$ret['id'] = $r['id'];
|
||||
$ret['name'] = $r['name'];
|
||||
$ret['order'] = $r['order'];
|
||||
$ret['criteria'] = $r['criteria'];
|
||||
$ret['description'] = $r['description'];
|
||||
$ret['presenter'] = $r['presenter'];
|
||||
$ret['award_types_id'] = $r['award_types_id'];
|
||||
$ret['sponsors_id'] = $r['sponsors_id'];
|
||||
$ret['excludefromac'] = $r['excludefromac'];
|
||||
$ret['cwsfaward'] = $r['cwsfaward'];
|
||||
$ret['self_nominate'] = $r['self_nominate'];
|
||||
$ret['schedule_judges'] = $r['schedule_judges'];
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
case 'saveawardinfo':
|
||||
print_r($_POST);
|
||||
|
||||
$in=fopen("/tmp/p.txt", "wt");
|
||||
fwrite($in, "post".print_r($_POST, true));
|
||||
fwrite($in, "get".print_r($_GET, true));
|
||||
fclose($in);
|
||||
|
||||
/*
|
||||
$r=mysql_fetch_object($q);
|
||||
$award_awards_id=$r->id;
|
||||
$award_awards_name=$r->name;
|
||||
$award_awards_order=$r->order;
|
||||
$award_awards_criteria=$r->criteria;
|
||||
$award_awards_description=$r->description;
|
||||
$award_types_id=$r->award_types_id;
|
||||
$award_type=$r->type;
|
||||
$sponsors_id=$r->sponsors_id;
|
||||
$award_sponsor=$r->organization;
|
||||
$award_awards_presenter=$r->presenter;
|
||||
$award_awards_excludefromac=$r->excludefromac;
|
||||
$award_awards_cwsfaward=$r->cwsfaward;
|
||||
$award_awards_self_nominate=$r->self_nominate;
|
||||
$award_awards_schedule_judges=$r->schedule_judges;*/
|
||||
|
||||
exit;
|
||||
case 'geteligibility':
|
||||
$id = intval($_GET['id']);
|
||||
//select the current categories that this award is linked to
|
||||
$reg = array();
|
||||
$q=mysql_query("SELECT * FROM award_awards_projectcategories WHERE award_awards_id='$id'");
|
||||
while($r=mysql_fetch_assoc($q)) {
|
||||
$ret['categories'][] = $r['projectcategories_id'];
|
||||
}
|
||||
|
||||
//select the current categories that this award is linked to
|
||||
$q=mysql_query("SELECT * FROM award_awards_projectdivisions WHERE award_awards_id='$id'");
|
||||
while($r=mysql_fetch_assoc($q)) {
|
||||
$ret['divisions'][] = $r['projectdivisions_id'];
|
||||
}
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_GET['action']=="edit" || $_GET['action']=="add") {
|
||||
send_header(($_GET['action']=="edit") ? "Edit Award" : "Add Award",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
@ -39,6 +126,7 @@
|
||||
'Awards Main' => 'admin/awards.php') );
|
||||
}
|
||||
|
||||
|
||||
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
|
||||
$_SESSION['sponsors_id']=$_GET['sponsors_id'];
|
||||
else if($_GET['sponsors_id']=="all")
|
||||
@ -65,8 +153,183 @@
|
||||
$sponsors_id=$_SESSION['sponsors_id'];
|
||||
//$award_sponsors_confirmed=$_SESSION['award_sponsors_confirmed'];
|
||||
|
||||
if($_POST['save']=="edit" || $_POST['save']=="add")
|
||||
{
|
||||
|
||||
function popup_begin($name, $title, $width=0, $height=0)
|
||||
{
|
||||
$size= $width ? "style=\"width:$width%; height:$height%\"" : '';
|
||||
echo "<div id=\"popup_{$name}_background\" class=\"popup_background\"></div>";
|
||||
echo "<div id=\"popup_$name\" class=\"popup\" $size>
|
||||
<a id=\"popup_{$name}_close\" class=\"popup_close\">x</a>
|
||||
<h1>{$title}</h1>
|
||||
<p id=\"popup_{$name}_body\" class=\"popup_body\">";
|
||||
}
|
||||
function popup_end()
|
||||
{
|
||||
echo "</p></div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once('../htabs.inc.php');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
var award_id = 0;
|
||||
function popup_editor(id)
|
||||
{
|
||||
award_id = id;
|
||||
popup_open("editor");
|
||||
htabs_open("editortabs");
|
||||
|
||||
}
|
||||
|
||||
function update_awardinfo()
|
||||
{
|
||||
var id = award_id;
|
||||
// alert("id="+award_id);
|
||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=getawardinfo&id="+id,
|
||||
function(json){
|
||||
$("#awardinfo_name").val(json.name);
|
||||
$("#awardinfo_order").val(json.order);
|
||||
$("#awardinfo_sponsors_id").val(json.sponsors_id);
|
||||
$("#awardinfo_presenter").val(json.presenter);
|
||||
$("#awardinfo_description").val(json.description);
|
||||
$("#awardinfo_criteria").val(json.criteria);
|
||||
$("#awardinfo_award_types_id").val(json.award_types_id);
|
||||
// For some reason, with checkboxes, these have to be arrays
|
||||
|
||||
$("#awardinfo_excludefromac").val([json.excludefromac]);
|
||||
$("#awardinfo_cwsfaward").val([json.cwsfaward]);
|
||||
$("#awardinfo_selfnominate").val([json.self_nominate]);
|
||||
$("#awardinfo_schedulejudges").val([json.schedule_judges]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function save_awardinfo()
|
||||
{
|
||||
$.post("<?$_SERVER['PHP_SELF']?>?action=saveawardinfo", $("#awardinfo").serialize());
|
||||
return 0;
|
||||
}
|
||||
|
||||
function update_eligibility()
|
||||
{
|
||||
var id = award_id;
|
||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=geteligibility&id="+id,
|
||||
function(json){
|
||||
$("[name=eligiblecategories]").val(json.categories);
|
||||
$("[name=eligibledivisions]").val(json.divisions);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
|
||||
|
||||
popup_begin('editor', "Award Editor", 80, 80);
|
||||
|
||||
htabs_begin('editortabs', array('awardinfo' => array('label' =>'Award',
|
||||
'title' => 'Award Info',
|
||||
'callback' => 'update_awardinfo'),
|
||||
'eligibility' => array('label' =>'Eligibility',
|
||||
'title' => 'Eligibility',
|
||||
'callback' => 'update_eligibility'),
|
||||
'prizes'=> array('label' => 'Prizes',
|
||||
'title' => 'Prizes',
|
||||
'callback' => ''),
|
||||
),'awardinfo');
|
||||
|
||||
htabs_tab_begin('awardinfo');
|
||||
echo "<form id=\"awardinfo\">";
|
||||
echo "<table class=\"tableedit\">\n";
|
||||
// echo "<tr><td class=\"left\"><hr /></td><td class=\"right\"><hr /></td></tr>\n";
|
||||
echo "<tr><td class=\"left\">".i18n("Name").":</td><td class=\"right\"><input type=\"text\" id=\"awardinfo_name\" name=\"name\" value=\"Loading...\" size=\"50\" maxlength=\"128\"><script type=\"text/javascript\">translateButton('name');</script></td></tr>\n";
|
||||
echo "<tr><td class=\"left\">".i18n("Order").":</td><td class=\"right\"><input type=\"text\" id=\"awardinfo_order\" name=\"order\" value=\"\" size=\"5\" maxlength=\"5\" />(".i18n("presentation order").")</td></tr>\n";
|
||||
|
||||
echo "<tr><td class=\"left\">".i18n("Sponsor").":</td><td class=\"right\">";
|
||||
$sq=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
|
||||
echo "<select id=\"awardinfo_sponsors_id\" name=\"sponsors_id\">";
|
||||
//only show the "choose a sponsor" option if we are adding,if we are editing, then they must have already chosen one.
|
||||
echo $firstsponsor;
|
||||
while($sr=mysql_fetch_object($sq)) {
|
||||
echo "<option value=\"$sr->id\">".i18n($sr->organization)."</option>";
|
||||
}
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr><td class=\"left\">".i18n("Presenter").":</td><td class=\"right\"><input type=\"text\" id=\"awardinfo_presenter\" name=\"presenter\" value=\"Loading...\" size=\"50\" maxlength=\"128\" /></td></tr>\n";
|
||||
|
||||
echo "<tr><td class=\"left\">".i18n("Type").":</td><td class=\"right\">";
|
||||
$tq=mysql_query("SELECT id,type FROM award_types WHERE year='{$config['FAIRYEAR']}' ORDER BY type");
|
||||
echo "<select id=\"awardinfo_award_types_id\" name=\"award_types_id\">";
|
||||
//only show the "choose a type" option if we are adding,if we are editing, then they must have already chosen one.
|
||||
echo $firsttype;
|
||||
while($tr=mysql_fetch_object($tq)) {
|
||||
echo "<option value=\"$tr->id\">".i18n($tr->type)."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td class=\"left\">".i18n("Criteria").":</td><td class=\"right\"><textarea id=\"awardinfo_criteria\" name=\"criteria\" rows=\"3\" cols=\"50\">Loading...</textarea><script type=\"text/javascript\">translateButton('criteria');</script></td></tr>\n";
|
||||
echo "<tr><td class=\"left\">".i18n("Description").":</td><td class=\"right\"><textarea id=\"awardinfo_description\" name=\"description\" rows=\"3\" cols=\"50\">Loading...</textarea><script type=\"text/javascript\">translateButton('description');</script></td></tr>\n";
|
||||
echo "</table>";
|
||||
echo "<h1>Options</h1>";
|
||||
echo '<table class="tableedit">';
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_excludefromac\" name=\"excludefromac\" value=\"1\"></td><td class=\"right\">".i18n("Exclude this award from the award ceremony script")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_cwsfaward\" name=\"cwsfaward\" value=\"1\"></td><td class=\"right\">".i18n("This award identifies the students that will be attending the Canada-Wide Science Fair")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_selfnominate\" name=\"self_nominate\" value=\"yes\"></td><td class=\"right\">".i18n("Students can self-nominate for this award (this is usually checked for special awards)")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_schedulejudges\" name=\"schedule_judges\" value=\"yes\"></td><td class=\"right\">".i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)")."</td></tr>";
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
echo "<input type=\"submit\" onClick=\"save_awardinfo();\" value=\"Save\" />\n";
|
||||
|
||||
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_tab_begin('eligibility');
|
||||
echo "<table class=\"tableedit\">";
|
||||
echo "<tr><td class=\"left\">".i18n("Age Categories").":</td><td class=\"right\">";
|
||||
// if(count($currentcategories)==0) $class="class=\"error\""; else $class="";
|
||||
|
||||
//now select all the categories so we can list them all
|
||||
$cq=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
|
||||
echo mysql_error();
|
||||
while($cr=mysql_fetch_object($cq)) {
|
||||
echo "<input type=\"checkbox\" id=\"eligibility_categories_{$cr->id}\" name=\"eligiblecategories\" value=\"$cr->id\" />".i18n($cr->category)."<br />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td class=\"left\">".i18n("Divisions").":</td><td class=\"right\">";
|
||||
$dq=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division");
|
||||
echo mysql_error();
|
||||
while($dr=mysql_fetch_object($dq)) {
|
||||
echo "<input type=\"checkbox\" id=\"eligibility_divisions_{$dr->id}\" name=\"eligibledivisions\" value=\"$dr->id\" />".i18n($dr->division)."<br />";
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
// if(count($currentcategories)==0 || count($currentdivisions)==0)
|
||||
// echo "<tr><td colspan=\"2\" class=\"error\">".i18n("At least one age category and one division must be selected")."</td></tr>";
|
||||
echo "</table>";
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_tab_begin('prizes');
|
||||
echo 'Prize info!<br>';
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_end();
|
||||
|
||||
|
||||
popup_end();
|
||||
|
||||
|
||||
if($_POST['save']=="edit" || $_POST['save']=="add")
|
||||
{
|
||||
if(!$_POST['award_types_id']) {
|
||||
echo error(i18n("Award Type is required"));
|
||||
$_GET['action']=$_POST['save'];
|
||||
@ -435,7 +698,7 @@ echo mysql_error();
|
||||
award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards.order,
|
||||
award_awards.award_sources_id,
|
||||
award_awards.award_source_fairs_id,
|
||||
award_types.type,
|
||||
sponsors.organization
|
||||
|
||||
@ -474,12 +737,12 @@ echo mysql_error();
|
||||
$hasexternal=false;
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->award_sources_id){ $cl="class=\"externalaward\""; $hasexternal=true; } else $cl="";
|
||||
if($r->award_source_fairs_id){ $cl="class=\"externalaward\""; $hasexternal=true; } else $cl="";
|
||||
echo "<tr $cl>\n";
|
||||
echo " <td><input type=\"text\" name=\"reorder[$r->id]\" value=\"$r->order\" size=\"3\" /></td>\n";
|
||||
echo " <td>$r->organization</td>\n";
|
||||
echo " <td>$r->type</td>\n";
|
||||
echo " <td>$r->name</td>\n";
|
||||
echo " <td><a onclick=\"popup_editor({$r->id});\">$r->name</a></td>\n";
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_prizes WHERE award_awards_id='$r->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
|
@ -28,42 +28,42 @@
|
||||
|
||||
|
||||
$tabs = array( 'fairinfo' => array(
|
||||
'name' => 'Fair Information',
|
||||
'label' => 'Fair Information',
|
||||
'types' => array('fair'),
|
||||
'file' => '../fair_info.php',
|
||||
'enabled' => true,),
|
||||
'personal' => array(
|
||||
'name' => 'Personal',
|
||||
'label' => 'Personal',
|
||||
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
|
||||
'file' => '../user_personal.php',
|
||||
'enabled' => true),
|
||||
'roles' => array(
|
||||
'name' => 'Roles/Account',
|
||||
'label' => 'Roles/Account',
|
||||
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
|
||||
'file' => '../user_activate.php',
|
||||
'enabled' => true),
|
||||
'judgeother' => array(
|
||||
'name' => 'Judge Other',
|
||||
'label' => 'Judge Other',
|
||||
'types' => array('judge'),
|
||||
'file' => '../judge_other.php',
|
||||
'enabled' => true),
|
||||
'judgeexpertise' => array(
|
||||
'name' => 'Expertise',
|
||||
'label' => 'Expertise',
|
||||
'types' => array('judge'),
|
||||
'file' => '../judge_expertise.php',
|
||||
'enabled' => true),
|
||||
'judgeavailability' => array(
|
||||
'name' => 'Time Avail.',
|
||||
'label' => 'Time Avail.',
|
||||
'types' => array('judge'),
|
||||
'file' => '../judge_availability.php',
|
||||
'enabled' => $config['judges_availability_enable'] == 'yes' ? true : false),
|
||||
'judgesa' => array(
|
||||
'name' => 'Special Awards',
|
||||
'label' => 'Special Awards',
|
||||
'types' => array('judge'),
|
||||
'file' => '../judge_special_awards.php',
|
||||
'enabled' => true,),
|
||||
'volunteerpos' => array(
|
||||
'name' => 'Volunteer Positions',
|
||||
'label' => 'Volunteer Positions',
|
||||
'types' => array('volunteer'),
|
||||
'file' => '../volunteer_position.php',
|
||||
'enabled' => true,),
|
||||
@ -107,11 +107,9 @@ if(!array_key_exists($selected, $tabs)) {
|
||||
|
||||
send_popup_header(i18n("User Editor").": {$u['name']}");
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?=$config['SFIABDIRECTORY']?>/htabs.css" />
|
||||
<?
|
||||
//require_once('../htabs.inc.php');
|
||||
|
||||
echo '<ul id="htabs">';
|
||||
echo '<ul class="htabs">';
|
||||
foreach($tabs as $k=>$t) {
|
||||
/* Make sure the tab is enabled */
|
||||
if($t['enabled'] == false) continue;
|
||||
@ -119,11 +117,13 @@ foreach($tabs as $k=>$t) {
|
||||
$i = array_intersect($t['types'], $u['types']);
|
||||
if(count($i) == 0) continue;
|
||||
/* Show the tab */
|
||||
$sel = ($selected == $k) ? 'htabsel' : '';
|
||||
$href = "$PHP_SELF?id=$id&tab=$k";
|
||||
echo "<li class=\"$sel\"><a href=\"$href\">".i18n($t['name'])."</a></li>";
|
||||
$sel = ($selected == $k) ? 'htabs_sel' : '';
|
||||
$href = "{$_SERVER['PHP_SELF']}?id=$id&tab=$k";
|
||||
echo "<li class=\"$sel\"><a href=\"$href\">".i18n($t['label'])."</a></li>";
|
||||
}
|
||||
echo '</ul>';
|
||||
echo '<span style="clear: both; height: 0; visibility: hidden; display: block;"></span>';
|
||||
|
||||
|
||||
$t = $tabs[$selected];
|
||||
|
||||
@ -132,7 +132,7 @@ $_SESSION['embed'] = true;
|
||||
$_SESSION['embed_submit_url'] = "{$_SERVER['PHP_SELF']}?id=$id&tab=$selected";
|
||||
$_SESSION['embed_edit_id'] = $id;
|
||||
|
||||
echo '<div id="htabmain">';
|
||||
echo '<div class="htabs">';
|
||||
include("{$t['file']}");
|
||||
echo '</div>';
|
||||
|
||||
|
@ -383,51 +383,8 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false)
|
||||
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
//useful function that we'll be using throughout
|
||||
function confirmClick(msg)
|
||||
{
|
||||
var okay=confirm(msg);
|
||||
if(okay)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function el(str,domain,name)
|
||||
{
|
||||
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + name + '</a>');
|
||||
}
|
||||
|
||||
function em(str,domain)
|
||||
{
|
||||
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + str + '@' + domain + '</a>');
|
||||
}
|
||||
|
||||
var anyFieldHasBeenChanged=false;
|
||||
|
||||
function fieldChanged()
|
||||
{
|
||||
anyFieldHasBeenChanged=true;
|
||||
}
|
||||
|
||||
function confirmChanges()
|
||||
{
|
||||
if(anyFieldHasBeenChanged)
|
||||
{
|
||||
var okay=confirm('<?=i18n("You have unsaved changes. Click \"Cancel\" to return so you can save your changes, or press \"OK\" to discard your changes and continue")?>');
|
||||
if(okay)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/sfiab.js"></script>
|
||||
|
||||
<?
|
||||
//if we're under /admin or /config we also want the translationDropdown javascript stuff
|
||||
|
64
htabs.css
64
htabs.css
@ -1,64 +0,0 @@
|
||||
/* Ideas borrowed from: http://unraveled.com/projects/assets/css_tabs/ */
|
||||
ul#htabs {
|
||||
text-align: left; /* set to left, right or center */
|
||||
margin: 1em 0 0 0; /* set margins as desired */
|
||||
font-family: Verdana, Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
/* border-color: defined in sfiab.css */
|
||||
list-style-type: none;
|
||||
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
|
||||
}
|
||||
|
||||
ul#htabs li { /* do not change */
|
||||
display: inline;
|
||||
margin-right: 5px; /* set additional spacing between tabs as desired */
|
||||
}
|
||||
|
||||
ul#htabs li.htabsel { /* settings for selected tab */
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
/* border-bottom-color: defined in sfiab.css */
|
||||
/* background-color: defined in sfiab.css */
|
||||
}
|
||||
|
||||
ul#htabs li a { /* settings for all tab links */
|
||||
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
/* border-color: defined in sfiab.css */
|
||||
/* background-color: defined in sfiab.css */
|
||||
/* color: defined in sfiab.css */
|
||||
margin-right: 0px; /* Use margin-right in the li def to change spacing */
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
ul#htabs li.htabsel a { /* settings for selected tab link */
|
||||
/* background-color: defined in sfiab.css */
|
||||
/* color: defined in sfiab.css */
|
||||
position: relative;
|
||||
top: 1px;
|
||||
padding-top: 4px; /* must change with respect to padding (X) above and below */
|
||||
}
|
||||
|
||||
|
||||
ul#htabs a:hover { /* settings for hover effect */
|
||||
/* background: defined in sfiab.css */
|
||||
}
|
||||
|
||||
#htabmain {
|
||||
margin-top: 0;
|
||||
margin-right: 10px;
|
||||
/* background: defined in sfiab.css */
|
||||
padding: 3px;
|
||||
padding-top: 0;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
/* border-color: defined in sfiab.css */
|
||||
border-top: none;
|
||||
}
|
||||
|
79
htabs.inc.php
Normal file
79
htabs.inc.php
Normal file
@ -0,0 +1,79 @@
|
||||
<script type="text/javascript">
|
||||
var htabs_current = new Array();
|
||||
|
||||
function htabs_open(tab)
|
||||
{
|
||||
var cur = htabs_current[tab];
|
||||
$("#htabs_"+tab+"_"+cur).click();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?
|
||||
$htabs_current = "";
|
||||
$htabs_tabs = array();
|
||||
|
||||
function htabs_begin($name, $tabs, $selected)
|
||||
{
|
||||
global $htabs_current, $htabs_tabs;
|
||||
echo "<ul id=\"htabs_$name\" class=\"htabs\">";
|
||||
foreach($tabs as $t=>$d) {
|
||||
$sel = ($t == $selected) ? 'class=\"htabs_sel\"' : '';
|
||||
echo "<li id=\"htabs_{$name}_$t\" $sel>".i18n($d['label']).'</li>';
|
||||
$tabs[$t]['selected'] = false;
|
||||
}
|
||||
echo '</ul>';
|
||||
/* Force the upcoming divs below this UL */
|
||||
echo '<span style="clear: both; height: 0; visibility: hidden; display: block;"></span>';
|
||||
$tabs[$selected]['selected'] = true;
|
||||
$htabs_current = $name;
|
||||
$htabs_tabs = $tabs;
|
||||
}
|
||||
|
||||
function htabs_tab_begin($tab)
|
||||
{
|
||||
global $htabs_current, $htabs_tabs;
|
||||
echo "<div id=\"htabs_tab_{$htabs_current}_$tab\" class=\"htabs\"
|
||||
style=\"display:none;\">";
|
||||
echo '<h1>'.i18n($htabs_tabs[$tab]['title']).'</h1>';
|
||||
echo "<div id=\"htabs_tab_{$htabs_current}_{$tab}_body\">";
|
||||
|
||||
}
|
||||
function htabs_tab_end()
|
||||
{
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
function htabs_end()
|
||||
{
|
||||
global $htabs_current, $htabs_tabs;
|
||||
$default = '';
|
||||
$first = '';
|
||||
echo '<script type="text/javascript">';
|
||||
foreach($htabs_tabs as $t=>$d) {
|
||||
echo "\$(\"#htabs_{$htabs_current}_$t\").click(function() {
|
||||
\$(\"#htabs_{$htabs_current}_$t\").addClass(\"htabs_sel\");
|
||||
\$(\"#htabs_tab_{$htabs_current}_$t\").css(\"display\", \"block\");\n";
|
||||
foreach($htabs_tabs as $tt=>$dd) {
|
||||
if($tt == $t) continue;
|
||||
echo "\$(\"#htabs_{$htabs_current}_$tt\").removeClass(\"htabs_sel\");\n";
|
||||
echo "\$(\"#htabs_tab_{$htabs_current}_$tt\").css(\"display\", \"none\");\n";
|
||||
}
|
||||
if(trim($d['callback']) != '') {
|
||||
echo "{$d['callback']}();\n";
|
||||
}
|
||||
echo "htabs_current['$htabs_current'] = \"{$t}\";";
|
||||
|
||||
echo "});\n";
|
||||
if($d['selected'] == true) $default = $t;
|
||||
if($first == '') $first = $t;
|
||||
}
|
||||
if($default == '') $default = $first;
|
||||
|
||||
echo "htabs_current['$htabs_current'] = \"{$default}\";";
|
||||
|
||||
echo '</script>';
|
||||
$htabs_current = "";
|
||||
$htabs_tabs = array();
|
||||
}
|
||||
?>
|
105
sfiab.js
Normal file
105
sfiab.js
Normal file
@ -0,0 +1,105 @@
|
||||
//useful function that we'll be using throughout
|
||||
function confirmClick(msg)
|
||||
{
|
||||
var okay=confirm(msg);
|
||||
if(okay)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function el(str,domain,name)
|
||||
{
|
||||
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + name + '</a>');
|
||||
}
|
||||
|
||||
function em(str,domain)
|
||||
{
|
||||
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + str + '@' + domain + '</a>');
|
||||
}
|
||||
|
||||
var anyFieldHasBeenChanged=false;
|
||||
|
||||
function fieldChanged()
|
||||
{
|
||||
anyFieldHasBeenChanged=true;
|
||||
}
|
||||
|
||||
function confirmChanges()
|
||||
{
|
||||
if(anyFieldHasBeenChanged)
|
||||
{
|
||||
var okay=confirm('<?=i18n("You have unsaved changes. Click \"Cancel\" to return so you can save your changes, or press \"OK\" to discard your changes and continue")?>');
|
||||
if(okay)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Popups using jQuery */
|
||||
var popup_current = null;
|
||||
function popup_open(name)
|
||||
{
|
||||
if(popup_current == null) {
|
||||
var w = document.documentElement.clientWidth;
|
||||
var h = document.documentElement.clientHeight;
|
||||
var ph = $("#popup_"+name).height();
|
||||
var pw = $("#popup_"+name).width();
|
||||
/* Center the popup */
|
||||
$("#popup_"+name).css({
|
||||
"position": "absolute",
|
||||
"top": (h - ph)/2,
|
||||
"left": (w - pw)/2
|
||||
});
|
||||
|
||||
/* IE6 hack */
|
||||
$("#popup_"+name+"_background").css({
|
||||
"height": h
|
||||
});
|
||||
|
||||
/* Display the popup */
|
||||
$("#popup_"+name+"_background").css({
|
||||
"opacity": "0.7"
|
||||
});
|
||||
$("#popup_"+name+"_background").fadeIn("fast");
|
||||
$("#popup_"+name).fadeIn("fast");
|
||||
popup_current = name;
|
||||
}
|
||||
}
|
||||
|
||||
function popup_close()
|
||||
{
|
||||
//disables popup only if it is enabled
|
||||
if(popup_current != null){
|
||||
$("#popup_"+popup_current+"_background").fadeOut("fast");
|
||||
$("#popup_"+popup_current).fadeOut("fast");
|
||||
popup_current = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hook ESC to cancel a popup */
|
||||
$(document).keypress(function(e)
|
||||
{
|
||||
if(e.keyCode==27 && popup_current != null) {
|
||||
popup_close();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* Stuff to do after the document loads */
|
||||
$(document).ready(function()
|
||||
{
|
||||
/* Hook close buttons on all popups (which may not be defined
|
||||
* until the HTML is finished parsing, so we have to do it
|
||||
* in the document.ready function ) */
|
||||
$(".popup_close").click(function()
|
||||
{
|
||||
popup_close();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -59,10 +59,28 @@ input {
|
||||
font-size: 0.8em;
|
||||
border: 0px;
|
||||
border-collapse: collapse;
|
||||
/* width: 100%;*/
|
||||
}
|
||||
|
||||
.tableedit td {
|
||||
padding: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* vertical align top, then use top padding to bring it down
|
||||
* so that the text is in the middle of the first line compared
|
||||
* to an input box */
|
||||
.tableedit td.left {
|
||||
width: 25%;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
.tableedit td.right {
|
||||
width: 75%;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tableedit th {
|
||||
@ -76,3 +94,4 @@ input {
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -382,7 +382,6 @@ tr.externalaward {
|
||||
}
|
||||
|
||||
#FadeScreenDiv {
|
||||
filter:alpha(opacity=50);
|
||||
-moz-opacity:.50;
|
||||
opacity:.50;
|
||||
position: fixed;
|
||||
@ -423,43 +422,73 @@ tr.externalaward {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/* Tab colours, boy this will be nice when CSS variables exist */
|
||||
|
||||
/* Tab Line Colour */
|
||||
ul#htabs {
|
||||
/* Horizontal Tabs */
|
||||
/* For the whole UL */
|
||||
ul.htabs {
|
||||
list-style: none;
|
||||
list-style-position: outside;
|
||||
border-bottom-color: #A5B5C6; /* Line colour */
|
||||
}
|
||||
|
||||
/* Non-selected tab */
|
||||
ul#htabs li a {
|
||||
background-color: #D0D0FF; /* Background Colour */
|
||||
/* Unselected Tab */
|
||||
ul.htabs li {
|
||||
display: block;
|
||||
float: left;
|
||||
position: relative;
|
||||
margin-right: 5px;
|
||||
margin-bottom: -1px;
|
||||
border: 1px solid #A5B5C6;
|
||||
border-width: 1px 1px 1px 1px;
|
||||
padding: 3px 5px 3px 5px;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
background: #D0D0FF; /* Background Colour */
|
||||
color: #000000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ul.htabs li a {
|
||||
color: #000000; /* Font colour */
|
||||
border-color: #A5B5C6;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
/* Selected tab */
|
||||
ul#htabs li.htabsel {
|
||||
background-color: #EEEEFF; /* Backgroudn Colour */
|
||||
border-bottom-color: #EEEEFF; /* Bottom border colour, should match the bkgrnd */
|
||||
}
|
||||
|
||||
/* Selected tab link */
|
||||
ul#htabs li.htabsel a {
|
||||
background-color: #EEEEFF; /* Background Colour */
|
||||
/* Overrides for selected tab */
|
||||
ul.htabs li.htabs_sel {
|
||||
background: #EEEEFF;
|
||||
top: 1px;
|
||||
border-bottom: 0;
|
||||
color: #000000; /* Font colour */
|
||||
}
|
||||
}
|
||||
|
||||
/* Hover over colour */
|
||||
ul#htabs a:hover {
|
||||
/* Mouseover colour */
|
||||
ul.htabs li:hover {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
#htabmain {
|
||||
background: #EEEEFF; /* Should match selected tab background */
|
||||
border-color: #A5B5C6;/* Should match UL border */
|
||||
/* Don't change colour hovering over the selected tab */
|
||||
ul.htabs li.htabs_sel:hover {
|
||||
background: #EEEEFF;
|
||||
}
|
||||
|
||||
/* Body of the tab */
|
||||
div.htabs {
|
||||
margin: 0pt auto;
|
||||
background: #EEEEFF;
|
||||
border: 1px solid #A5B5C6;
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
padding-bottom: 20px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Header inside the body */
|
||||
div.htabs h1 {
|
||||
line-height: 1em;
|
||||
vertical-align: middle;
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
table.usereditor {
|
||||
@ -467,15 +496,66 @@ table.usereditor {
|
||||
}
|
||||
|
||||
table.usereditor td.left {
|
||||
width: 30%;
|
||||
width: 25%;
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
table.usereditor td.right {
|
||||
width: 70%;
|
||||
width: 75%;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Popups */
|
||||
div.popup_background {
|
||||
display:none;
|
||||
position:fixed;
|
||||
_position:absolute; /* hack for internet explorer 6*/
|
||||
height:100%;
|
||||
width:100%;
|
||||
top:0;
|
||||
left:0;
|
||||
background:#000000;
|
||||
border:1px solid #cecece;
|
||||
z-index:1;
|
||||
}
|
||||
div.popup {
|
||||
display:none;
|
||||
position:fixed;
|
||||
_position:absolute; /* hack for internet explorer 6*/
|
||||
height: 75%;
|
||||
width: 75%;
|
||||
background: #E0E0FF;
|
||||
border:2px solid Silver;
|
||||
z-index:2;
|
||||
padding:12px;
|
||||
font-size:13px;
|
||||
}
|
||||
/* Popup heading */
|
||||
div.popup h1 {
|
||||
text-align: left;
|
||||
color: #000000;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px;
|
||||
padding-bottom: 2px;
|
||||
/* margin-bottom: 20px;*/
|
||||
}
|
||||
|
||||
a.popup_close{
|
||||
font-size:14px;
|
||||
line-height:14px;
|
||||
right:6px;
|
||||
top:4px;
|
||||
position:absolute;
|
||||
color:#5C6F90;
|
||||
font-weight: bold;
|
||||
display:block;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
134
xmltransport.php
134
xmltransport.php
@ -23,8 +23,94 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once('common.inc.php');
|
||||
require_once('user.inc.php');
|
||||
require_once('common.inc.php');
|
||||
require_once('user.inc.php');
|
||||
|
||||
|
||||
function handle_getstats(&$u, $fair,&$data, &$response)
|
||||
{
|
||||
$year = $data['getstats']['year'];
|
||||
$vars = array('fair_stats_participation', 'fair_stats_schools_ext',
|
||||
'fair_stats_minorities', 'fair_stats_guests',
|
||||
'fair_stats_sffbc_misc', 'fair_stats_info',
|
||||
'fair_stats_next_chair', 'fair_stats_scholarships',
|
||||
'fair_stats_delegates',
|
||||
);
|
||||
foreach($vars as $v) {
|
||||
$response['statconfig'][$v] = $config[$v];
|
||||
}
|
||||
$q = mysql_query("SELECT * FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}'
|
||||
AND year='$year'");
|
||||
$response['stats'] = mysql_fetch_assoc($q);
|
||||
unset($response['stats']['id']);
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
function handle_stats(&$u,$fair, &$data, &$response)
|
||||
{
|
||||
$stats = $data['stats'];
|
||||
foreach($stats as $k=>$v) {
|
||||
$stats[$k] = mysql_escape_string($stats[$k]);
|
||||
}
|
||||
|
||||
// $str = join(',',$stats);
|
||||
$keys = '`fairs_id`,`'.join('`,`', array_keys($stats)).'`';
|
||||
$vals = "'{$u['fairs_id']}','".join("','", array_values($stats))."'";
|
||||
mysql_query("DELETE FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}'
|
||||
AND year='{$stats['year']}'");
|
||||
echo mysql_error();
|
||||
mysql_query("INSERT INTO fairs_stats (`id`,$keys) VALUES ('',$vals)");
|
||||
echo mysql_error();
|
||||
|
||||
$response['message'] = 'Stats saved';
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
function handle_getawards(&$u, $fair, &$data, &$response)
|
||||
{
|
||||
$awards = array();
|
||||
$year = $data['getawards']['year'];
|
||||
|
||||
$ids = unserialize($fair['award_awards_ids']);
|
||||
|
||||
$where = "id='".join("' OR id='", $ids)."'";
|
||||
|
||||
$q = mysql_query("SELECT * FROM award_awards WHERE $where");
|
||||
|
||||
while($a = mysql_fetch_assoc($q)) {
|
||||
$award = array();
|
||||
$award['identifier'] = "";
|
||||
$award['year'] = $a['year'];
|
||||
$award['name_en'] = $a['name'];
|
||||
$award['criteria_en'] = $a['criteria'];
|
||||
|
||||
if($a['sponsors_id']) {
|
||||
$sq = mysql_query("SELECT * FROM sponsors WHERE id='{$a['sponsors_id']}'");
|
||||
if(mysql_num_rows($sq)) {
|
||||
$s = mysql_fetch_assoc($sq);
|
||||
$award['sponsor'] = $s['organization'];
|
||||
}
|
||||
}
|
||||
|
||||
$award['prizes'] = array();
|
||||
$pq = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='{$a['id']}'");
|
||||
while($p = mysql_fetch_assoc($pq)) {
|
||||
$prize = array();
|
||||
$prize['identifier'] = "";
|
||||
$prize['cash'] = $p['cash'];;
|
||||
$prize['scholarship'] = $p['scholarship'];
|
||||
$prize['value'] = $p['value'];
|
||||
$prize['prize_en'] = $p['prize'];
|
||||
$prize['number'] = $p['number'];
|
||||
$prize['ord'] = $p['order'];
|
||||
$award['prizes'][] = $prize;
|
||||
}
|
||||
$awards[] = $award;
|
||||
}
|
||||
$response['awards'] = $awards;
|
||||
$response['postback'] = 'http://localhost';
|
||||
}
|
||||
|
||||
|
||||
/* magic quotes DEPRECATED as of PHP 5.3.0, REMOVE as of 6.0, on by default *
|
||||
* for any PHP < 5.3.0. Pain in the ASS. php is running the urldecode for us,
|
||||
@ -42,7 +128,7 @@
|
||||
// echo "data:";print_r($data);
|
||||
// echo "<br />";
|
||||
// exit;
|
||||
|
||||
|
||||
$username = $data['auth']['username'];
|
||||
$password = $data['auth']['password'];
|
||||
|
||||
@ -74,43 +160,13 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
$q = mysql_query("SELECT * FROM fairs WHERE id='{$u['fairs_id']}'");
|
||||
$fair = mysql_fetch_assoc($q);
|
||||
|
||||
$response = array();
|
||||
if(array_key_exists('getstats', $data)) {
|
||||
$year = $data['getstats']['year'];
|
||||
$vars = array('fair_stats_participation', 'fair_stats_schools_ext',
|
||||
'fair_stats_minorities', 'fair_stats_guests',
|
||||
'fair_stats_sffbc_misc', 'fair_stats_info',
|
||||
'fair_stats_next_chair', 'fair_stats_scholarships',
|
||||
'fair_stats_delegates',
|
||||
);
|
||||
foreach($vars as $v) {
|
||||
$response['statconfig'][$v] = $config[$v];
|
||||
}
|
||||
$q = mysql_query("SELECT * FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}'
|
||||
AND year='$year'");
|
||||
$response['stats'] = mysql_fetch_assoc($q);
|
||||
unset($response['stats']['id']);
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
if(array_key_exists('stats', $data)) {
|
||||
$stats = $data['stats'];
|
||||
foreach($stats as $k=>$v) {
|
||||
$stats[$k] = mysql_escape_string($stats[$k]);
|
||||
}
|
||||
|
||||
// $str = join(',',$stats);
|
||||
$keys = '`fairs_id`,`'.join('`,`', array_keys($stats)).'`';
|
||||
$vals = "'{$u['fairs_id']}','".join("','", array_values($stats))."'";
|
||||
mysql_query("DELETE FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}'
|
||||
AND year='{$stats['year']}'");
|
||||
echo mysql_error();
|
||||
mysql_query("INSERT INTO fairs_stats (`id`,$keys) VALUES ('',$vals)");
|
||||
echo mysql_error();
|
||||
|
||||
$response['error'] = 0;
|
||||
$response['message'] = 'Stats saved';
|
||||
}
|
||||
if(array_key_exists('getstats', $data)) handle_getstats($u,$fair, $data, $response);
|
||||
if(array_key_exists('stats', $data)) handle_stats($u,$fair, $data, $response);
|
||||
if(array_key_exists('getawards', $data)) handle_getawards($u,$fair,$data, $response);
|
||||
|
||||
echo urlencode(json_encode($response));
|
||||
// echo "Success!<br />";
|
||||
|
Loading…
Reference in New Issue
Block a user