forked from science-ation/science-ation
Set the datepicker z-indez so its above the dialogs (so when used within a dialog it wont be below it)
Change the width of the translations dialog, so when used from within another dialog (at 0.8) it looks more distinctly a different dialog (at 0.6) First go at converting the sponsor editor to a tabbed interface, so far the sponsor info tab works and saves but thats it.
This commit is contained in:
parent
7b068cd83f
commit
b88e10120a
@ -26,12 +26,249 @@
|
|||||||
require_once("../user.inc.php");
|
require_once("../user.inc.php");
|
||||||
user_auth_required('committee', 'admin');
|
user_auth_required('committee', 'admin');
|
||||||
|
|
||||||
|
switch($_GET['action']) {
|
||||||
|
case 'organizationinfo_load':
|
||||||
|
$q=mysql_query("SELECT * FROM sponsors WHERE id='".intval($_GET['id'])."'");
|
||||||
|
$ret=mysql_fetch_assoc($q);
|
||||||
|
echo json_encode($ret);
|
||||||
|
exit;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'organizationinfo_save':
|
||||||
|
$id=$_POST['sponsor_id'];
|
||||||
|
if($id) {
|
||||||
|
$exec="UPDATE sponsors SET ".
|
||||||
|
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
|
||||||
|
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
|
||||||
|
"city='".mysql_escape_string(stripslashes($_POST['city']))."', ".
|
||||||
|
"province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', ".
|
||||||
|
"postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ".
|
||||||
|
"phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ".
|
||||||
|
"tollfree='".mysql_escape_string(stripslashes($_POST['tollfree']))."', ".
|
||||||
|
"fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ".
|
||||||
|
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
|
||||||
|
"website='".mysql_escape_string(stripslashes($_POST['website']))."', ".
|
||||||
|
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
||||||
|
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
|
||||||
|
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
|
||||||
|
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."', ".
|
||||||
|
"taxreceiptrequired='".mysql_escape_string(stripslashes($_POST['taxreceiptrequired']))."' ".
|
||||||
|
"WHERE id='$id'";
|
||||||
|
mysql_query($exec);
|
||||||
|
|
||||||
|
//FIXME accept the logo
|
||||||
|
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
|
||||||
|
|
||||||
|
happy_("Organization Info Saved");
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sponsorshipinfo_load':
|
||||||
|
$ret=array();
|
||||||
|
echo json_encode($ret);
|
||||||
|
exit;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
send_header("Sponsors",
|
send_header("Sponsors",
|
||||||
array('Committee Main' => 'committee_main.php',
|
array('Committee Main' => 'committee_main.php',
|
||||||
'Administration' => 'admin/index.php',
|
'Administration' => 'admin/index.php',
|
||||||
'Fundraising Main' => 'admin/fundraising.php')
|
'Fundraising Main' => 'admin/fundraising.php')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* Setup the popup window */
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#popup_editor").dialog({
|
||||||
|
bgiframe: true, autoOpen: false,
|
||||||
|
modal: true, resizable: false,
|
||||||
|
draggable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#editor_tabs").tabs({
|
||||||
|
show: function(event, ui) {
|
||||||
|
switch(ui.panel.id) {
|
||||||
|
case 'editor_tab_organization':
|
||||||
|
update_organizationinfo();
|
||||||
|
break;
|
||||||
|
case 'editor_tab_sponsorship':
|
||||||
|
update_sponsorshipinfo();
|
||||||
|
break;
|
||||||
|
case 'editor_tab_contacts':
|
||||||
|
update_contactsinfo();
|
||||||
|
break;
|
||||||
|
case 'editor_tab_activity':
|
||||||
|
update_activityinfo();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selected: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#organizationinfo_fundingselectiondate").datepicker({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonText: "<?=i18n("calendar")?>" });
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var sponsor_id=0;
|
||||||
|
|
||||||
|
function popup_editor(id)
|
||||||
|
{
|
||||||
|
var w = (document.documentElement.clientWidth * 0.8);
|
||||||
|
var h = (document.documentElement.clientHeight * 0.8);
|
||||||
|
|
||||||
|
sponsor_id=id;
|
||||||
|
|
||||||
|
$('#popup_editor').dialog('option', 'width', w);
|
||||||
|
$('#popup_editor').dialog('option', 'height', h);
|
||||||
|
$("#popup_editor").dialog('open');
|
||||||
|
|
||||||
|
$('#editor_tabs').tabs('option', 'disabled', []);
|
||||||
|
$('#editor_tabs').tabs('option', 'selected', 0);
|
||||||
|
|
||||||
|
update_organizationinfo();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_organizationinfo()
|
||||||
|
{
|
||||||
|
var id=sponsor_id;
|
||||||
|
if(!sponsor_id) return false;
|
||||||
|
|
||||||
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=organizationinfo_load&id="+id,
|
||||||
|
function(json){
|
||||||
|
$("#sponsor_id").val(json.id);
|
||||||
|
$("#organizationinfo_organization").val(json.organization);
|
||||||
|
$("#organizationinfo_address").val(json.address);
|
||||||
|
$("#organizationinfo_city").val(json.city);
|
||||||
|
$("#organizationinfo_province_code").val(json.province_code);
|
||||||
|
$("#organizationinfo_postalcodd").val(json.postalcode);
|
||||||
|
$("#organizationinfo_phone").val(json.phone);
|
||||||
|
$("#organizationinfo_tollfree").val(json.tollfree);
|
||||||
|
$("#organizationinfo_fax").val(json.fax);
|
||||||
|
$("#organizationinfo_email").val(json.email);
|
||||||
|
$("#organizationinfo_website").val(json.website);
|
||||||
|
$("#organizationinfo_donationpolicyurl").val(json.donationpolicyurl);
|
||||||
|
$("#organizationinfo_fundingselectiondate").val(json.fundingselectiondate);
|
||||||
|
$("#organizationinfo_notes").val(json.notes);
|
||||||
|
// For some reason, with checkboxes, these have to be arrays
|
||||||
|
$("[name=waiveraccepted]").val([json.waiveraccepted]);
|
||||||
|
$("[name=taxreceiptrequired]").val([json.taxreceiptrequired]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function organizationinfo_save() {
|
||||||
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_sponsorshipinfo()
|
||||||
|
{
|
||||||
|
var id=sponsor_id;
|
||||||
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_load&id="+id,
|
||||||
|
function(json){
|
||||||
|
$("#sponsor_id").val(json.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sponsorshipinfo_save() {
|
||||||
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_save", $("#sponsorshipinfo").serializeArray());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_contactsinfo()
|
||||||
|
{
|
||||||
|
var id=sponsor_id;
|
||||||
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id,
|
||||||
|
function(json){
|
||||||
|
$("#sponsor_id").val(json.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function contactsinfo_save() {
|
||||||
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save", $("#contactsinfo").serializeArray());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update_activityinfo()
|
||||||
|
{
|
||||||
|
var id=sponsor_id;
|
||||||
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=activityinfo_load&id="+id,
|
||||||
|
function(json){
|
||||||
|
$("#sponsor_id").val(json.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function activityinfo_save() {
|
||||||
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save", $("#activityinfo").serializeArray());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<div id="popup_editor" title="Sponsor Editor" style="display: none">
|
||||||
|
<div id="editor_tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#editor_tab_organization"><span><?=i18n('Organization Details')?></span></a></li>
|
||||||
|
<li><a href="#editor_tab_sponsorship"><span><?=i18n('Sponsorship Details')?></span></a></li>
|
||||||
|
<li><a href="#editor_tab_contacts"><span><?=i18n('Contacts')?></span></a></li>
|
||||||
|
<li><a href="#editor_tab_activity"><span><?=i18n('Activity Log')?></span></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div id="editor_tab_organization">
|
||||||
|
<form enctype="multipart/form-data" id="organizationinfo">
|
||||||
|
<input type="hidden" name="sponsor_id" id="sponsor_id" value="0">
|
||||||
|
<table class="tableedit">
|
||||||
|
<tr><th><?=i18n("Organization Name")?></th><td><input class="translatable" type="text" id="organizationinfo_organization" name="organization" size="60" maxlength="128" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Address")?></th><td><input id="organizationinfo_address" type="text" name="address" size="60" maxlength="64" /></td></tr>
|
||||||
|
<tr><th><?=i18n("City")?></th><td><input id="organizationinfo_city" type="text" name="city" size="32" maxlength="32" /></td></tr>
|
||||||
|
<tr><th><?=i18n($config['provincestate'])?></th><td>
|
||||||
|
<? emit_province_selector("province_code","","id=\"organizationinfo_province_code\""); ?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><th><?=i18n($config['postalzip'])?></th><td><input id="organizationinfo_postalcode" type="text" name="postalcode" size="8" maxlength="7" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Phone")?></th><td><input type="text" id="organizationinfo_phone" name="phone" size="16" maxlength="32" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Toll Free")?></th><td><input type="text" id="organizationinfo_tollfree" name="tollfree" size="16" maxlength="32" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Fax")?></th><td><input type="text" id="organizationinfo_fax" name="fax" size="16" maxlength="32" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Email")?></th><td><input type="text" id="organizationinfo_email" name="email" size="60" maxlength="128" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Website")?></th><td><input type="text" id="organizationinfo_website" name="website" size="60" maxlength="128" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Donation Policy URL")?></th><td><input id="organizationinfo_donationpolicyurl" type="text" name="donationpolicyurl" size="60" maxlength="128" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Funding Selection Date")?></th><td><input id="organizationinfo_fundingselectiondate" type="text" name="fundingselectiondate" size="10" maxlength="10" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Logo")?></th><td><input type="file" name="logo" size="16" /></td></tr>
|
||||||
|
<tr><th><?=i18n("Waiver Accepted")?></th><td>
|
||||||
|
<input type="radio" id="organizationinfo_waiveraccepted_no" name="waiveraccepted" value="no"><?=i18n("No")?>
|
||||||
|
<input type="radio" id="organizationinfo_waiveraccepted_yes" name="waiveraccepted" value="yes"><?=i18n("Yes")?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><th><?=i18n("Tax Receipt Required")?></th><td>
|
||||||
|
<input type="radio" id="organizationinfo_taxreceiptrequired_no" name="taxreceiptrequired" value="no"><?=i18n("No")?>
|
||||||
|
<input type="radio" id="organizationinfo_taxreceiptrequired_yes" name="taxreceiptrequired" value="yes"><?=i18n("Yes")?>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><th><?=i18n("Notes")?></th><td><textarea id="organizationinfo_notes" name="notes" rows="4" cols="60"></textarea></td></tr>
|
||||||
|
<tr><td colspan="2" align="center"><input type="submit" value="Save" onClick="return organizationinfo_save()" /></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div id="editor_tab_sponsorship">
|
||||||
|
sponsorship
|
||||||
|
</div>
|
||||||
|
<div id="editor_tab_contacts">
|
||||||
|
contacts
|
||||||
|
</div>
|
||||||
|
<div id="editor_tab_activity">
|
||||||
|
activity
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?
|
||||||
|
|
||||||
|
|
||||||
if($_POST['save']=="edit" || $_POST['save']=="add")
|
if($_POST['save']=="edit" || $_POST['save']=="add")
|
||||||
{
|
{
|
||||||
if($_POST['save']=="add")
|
if($_POST['save']=="add")
|
||||||
@ -160,7 +397,8 @@
|
|||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo " <td>$r->organization</td>\n";
|
$eh="style=\"cursor:pointer;\" onclick=\"popup_editor({$r->id});\"";
|
||||||
|
echo " <td $eh>$r->organization</td>\n";
|
||||||
|
|
||||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
||||||
$numr=mysql_fetch_object($numq);
|
$numr=mysql_fetch_object($numq);
|
||||||
@ -170,9 +408,11 @@
|
|||||||
$numr=mysql_fetch_object($numq);
|
$numr=mysql_fetch_object($numq);
|
||||||
$numsponsorships=$numr->num;
|
$numsponsorships=$numr->num;
|
||||||
|
|
||||||
$numq=mysql_query("SELECT COUNT(users_id) AS num FROM users_sponsor, users WHERE sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.year='".$config['FAIRYEAR']."' and users.deleted='no'");
|
$numq=mysql_query("SELECT uid,MAX(year),firstname,lastname,deleted FROM users,users_sponsor WHERE types LIKE '%sponsor%' AND sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.deleted='no' GROUP BY uid ORDER BY firstname");
|
||||||
$numr=mysql_fetch_object($numq);
|
// $numq=mysql_query("SELECT DISTINCT(uid) FROM users_sponsor, users WHERE sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.deleted='no'");
|
||||||
$numcontacts=$numr->num;
|
$numcontacts=mysql_num_rows($numq);
|
||||||
|
// $numr=mysql_fetch_object($numq);
|
||||||
|
// $numcontacts=$numr->num;
|
||||||
|
|
||||||
|
|
||||||
echo " <td align=\"center\" valign=\"top\">";
|
echo " <td align=\"center\" valign=\"top\">";
|
||||||
|
@ -433,3 +433,7 @@ div.ui-tabs ul.ui-tabs-nav {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.ui-datepicker {
|
||||||
|
z-index: 1003;
|
||||||
|
}
|
||||||
|
@ -33,7 +33,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function popup_translator(str) {
|
function popup_translator(str) {
|
||||||
var w = (document.documentElement.clientWidth * 0.8);
|
var w = (document.documentElement.clientWidth * 0.6);
|
||||||
var h = (document.documentElement.clientHeight * 0.4);
|
var h = (document.documentElement.clientHeight * 0.4);
|
||||||
|
|
||||||
$('#translation_editor').dialog('option','width',w);
|
$('#translation_editor').dialog('option','width',w);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user