More renaming sponsors to donors and sponsorships to donations

Start on the donor management interface
Try to make the donor tab 'look pretty'
This commit is contained in:
james 2009-09-30 22:38:38 +00:00
parent 97887153b6
commit 40a49c8567
7 changed files with 196 additions and 124 deletions

View File

@ -35,7 +35,7 @@
echo "<br />";
echo "<a href=\"award_awards.php\">".i18n('Awards Management')."</a><br />";
echo "<a href=\"sponsors.php\">".i18n('Sponsors')."</a><br />";
echo "<a href=\"donors.php\">".i18n('Sponsors')."</a><br />";
echo "<br />";
echo "<a href=\"award_awards.php?action=edit_prize_template\">".i18n('Edit prize template for the divisional awards')."</a>";
echo "<br />";

View File

@ -31,9 +31,10 @@
include ("fundraising_types_handler.inc.php");
include ("fundraising_main.inc.php");
send_header("Fundraising",
send_header("Donations",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
'Administration' => 'admin/index.php',
'Fundraising' => 'admin/fundraising.php'),
"fundraising"
);
@ -49,7 +50,7 @@ $(document).ready(function() {
$("#fund_editor").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: false,
modal: true, resizable: falsefundraising
draggable: false
});
@ -157,7 +158,7 @@ echo "</div>";
echo "<br />\n";
echo "<a href=\"sponsorship_levels.php\">Manage Donation Levels</a>\n";
echo "<br />\n";
echo "<a href=\"sponsors.php\">Manage Donors</a>\n";
echo "<a href=\"donors.php\">Manage Donors</a>\n";
echo "<br />\n";
?>

View File

@ -148,18 +148,20 @@
send_header("Donor Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Fundraising Main' => 'admin/fundraising.php')
'Fundraising' => 'admin/fundraising.php')
);
?>
<script type="text/javascript">
/* Setup the popup window */
$(document).ready(function() {
$("#popup_editor").dialog({
/*`
$("#open_editor").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: false,
draggable: false
});
*/
$("#editor_tabs").tabs({
show: function(event, ui) {
@ -188,16 +190,10 @@ $(document).ready(function() {
var sponsor_id=0;
function popup_editor(id)
{
var w = (document.documentElement.clientWidth * 0.8);
var h = (document.documentElement.clientHeight * 0.8);
function open_editor(id) {
sponsor_id=id;
$('#popup_editor').dialog('option', 'width', w);
$('#popup_editor').dialog('option', 'height', h);
$("#popup_editor").dialog('open');
$("#donor_editor").show();
$("#searchbrowse").hide();
if(id==-1) {
$('#editor_tabs').tabs('option', 'selected', 0);
@ -213,6 +209,12 @@ function popup_editor(id)
return false;
}
function open_search() {
$("#donor_editor").hide();
$("#searchbrowse").show();
}
function update_organizationinfo()
{
var id=sponsor_id;
@ -251,8 +253,7 @@ function organizationinfo_save() {
if($("#sponsor_id").val()==-1) {
$.post("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray(),
function(json) {
$("#popup_editor").dialog('close');
popup_editor(json.id);
open_editor(json.id);
},
"json");
}
@ -301,10 +302,35 @@ function activityinfo_save() {
return false;
}
function donorsearch() {
$("#searchresults").load("donors_search.php", $("#searchform").serializeArray());
return false;
}
</script>
<div id="popup_editor" title="Donor Editor" style="display: none">
<?
if($_GET['action']=="delete" && $_GET['delete'])
{
//dont allow any deleting until we figure out what we need to do, infact, i think we never should hard delete
//this should only soft-delete so things like awards from previous years are still all linked correctly.
// mysql_query("DELETE FROM sponsors WHERE id='".$_GET['delete']."'");
// echo happy("Sponsors cannot be deleted");
}
echo "<table cellspacing=2 width=740 border=0><tr>";
echo "<td>";
echo "<a href=\"#\" onclick=\"open_editor(-1)\">Add New Donor(s)</a>\n";
echo "</td>";
echo "<td>";
echo "<a href=\"#\" onclick=\"open_search()\">View/Modify Donor(s)</a>\n";
echo "</td>";
echo "</tr></table>";
echo "<hr />";
?>
<div id="donor_editor" title="Donor Editor" style="display: none">
<div id="editor_tabs">
<ul>
<li><a href="#editor_tab_organization"><span><?=i18n('Donor Details')?></span></a></li>
@ -316,35 +342,39 @@ function activityinfo_save() {
<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="">
<tr><th><?=i18n("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>
<table class="tableedit" border=0>
<tr><td><?=i18n("Donor Type")?></td><td>
<input id="donortype_individual" type="radio" name="donortype" value="individual" /><label for="donortype_individual"><?=i18n("Individual")?></label>
<input id="donortype_organization" type="radio" name="donortype" value="organization" checked="checked"/><label for="donortype_organization"><?=i18n("Organization")?></label>
</td></tr>
<tr><td><?=i18n("Name")?></td><td colspan="5"><input class="translatable" type="text" id="organizationinfo_organization" name="organization" size="60" maxlength="128" /></td></tr>
<tr><td><?=i18n("Address 1")?></td><td colspan="5"><input id="organizationinfo_address" type="text" name="address" size="60" maxlength="64" /></td></tr>
<tr><td><?=i18n("Address 2")?></td><td colspan="5"><input id="organizationinfo_address2" type="text" name="address2" size="60" maxlength="64" /></td></tr>
<tr><td><?=i18n("City")?></td><td><input id="organizationinfo_city" type="text" name="city" size="16" maxlength="32" /></td>
<td><?=i18n($config['provincestate'])?></td><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")?> &nbsp;&nbsp;
<input type="radio" id="organizationinfo_waiveraccepted_yes" name="waiveraccepted" value="yes"><?=i18n("Yes")?> &nbsp;&nbsp;
</td></tr>
<tr><th><?=i18n("Tax Receipt Required")?></th><td>
<input type="radio" id="organizationinfo_taxreceiptrequired_no" name="taxreceiptrequired" value="no"><?=i18n("No")?> &nbsp;&nbsp;
<input type="radio" id="organizationinfo_taxreceiptrequired_yes" name="taxreceiptrequired" value="yes"><?=i18n("Yes")?> &nbsp;&nbsp;
</td>
<td><?=i18n($config['postalzip'])?></td><td><input id="organizationinfo_postalcode" type="text" name="postalcode" size="8" maxlength="7" /></td></tr>
<tr><td><?=i18n("Phone")?></td><td><input type="text" id="organizationinfo_phone" name="phone" size="16" maxlength="32" /></td>
<td><?=i18n("Toll Free")?></td><td><input type="text" id="organizationinfo_tollfree" name="tollfree" size="16" maxlength="32" /></td>
<td><?=i18n("Fax")?></td><td><input type="text" id="organizationinfo_fax" name="fax" size="16" maxlength="32" /></td></tr>
<tr><td><?=i18n("Email")?></td><td><input type="text" id="organizationinfo_email" name="email" size="16" maxlength="128" /></td>
<td><?=i18n("Website")?></td><td><input type="text" id="organizationinfo_website" name="website" size="16" maxlength="128" /></td>
<td><?=i18n("Donation Policy")?></td><td><input id="organizationinfo_donationpolicyurl" type="text" name="donationpolicyurl" size="16" maxlength="128" /></td></tr>
<tr><td><?=i18n("Funding Selection Date")?></td><td><input id="organizationinfo_fundingselectiondate" type="text" name="fundingselectiondate" size="10" maxlength="10" /></td>
<td><?=i18n("Logo")?></td><td colspan="3"><input type="file" name="logo" size="16" /></td></tr>
<tr><td><?=i18n("Waiver Accepted")?></td><td>
<input type="radio" id="organizationinfo_waiveraccepted_no" name="waiveraccepted" value="no"><label for="organizationinfo_waiveraccepted_no"><?=i18n("No")?></label> &nbsp;&nbsp;
<input type="radio" id="organizationinfo_waiveraccepted_yes" name="waiveraccepted" value="yes"><label for="organizationinfo_waiveraccepted_yes"><?=i18n("Yes")?></label> &nbsp;&nbsp;
</td>
<td><?=i18n("Tax Receipt Required")?></td><td colspan="3">
<input type="radio" id="organizationinfo_taxreceiptrequired_no" name="taxreceiptrequired" value="no"><label for="organizationinfo_taxreceiptrequired_no"><?=i18n("No")?></label> &nbsp;&nbsp;
<input type="radio" id="organizationinfo_taxreceiptrequired_yes" name="taxreceiptrequired" value="yes"><label for="organizationinfo_taxreceiptrequired_yes"><?=i18n("Yes")?></label> &nbsp;&nbsp;
</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>
<tr><td><?=i18n("Notes")?></td><td colspan="5"><textarea id="organizationinfo_notes" name="notes" rows="4" cols="60"></textarea></td></tr>
</table>
<input type="submit" value="Save" onClick="return organizationinfo_save()" />
</form>
</div>
<div id="editor_tab_sponsorship">
@ -358,82 +388,29 @@ function activityinfo_save() {
</div>
</div>
<div id="searchbrowse" style="display: none;">
<form id="searchform" method="post" action="donors.php" onsubmit="return donorsearch()">
<?=i18n("Search")?>: <input type="text" name="search" />
<input id="donortype_individual" type="checkbox" name="donortype[]" value="individual" checked="checked" /><label for="donortype_individual"><?=i18n("Individual")?></label>
<input id="donortype_organization" type="checkbox" name="donortype[]" value="organization" checked="checked"/><label for="donortype_organization"><?=i18n("Organization")?></label>
<input type="submit" value="<?=i18n("Browse")?>" />
</form>
</div>
<div id="searchresults">
</div>
<?
if($_GET['action']=="delete" && $_GET['delete'])
{
//dont allow any deleting until we figure out what we need to do, infact, i think we never should hard delete
//this should only soft-delete so things like awards from previous years are still all linked correctly.
// mysql_query("DELETE FROM sponsors WHERE id='".$_GET['delete']."'");
// echo happy("Sponsors cannot be deleted");
}
if($_GET['action']=="add") {
?>
<script type="text/javascript">
$(document).ready(function() {
open_editor(-1);
});
</script>
<?
}
echo "<a href=\"#\" onclick=\"popup_editor(-1)\">Add New Donor</a>\n";
echo "<br />";
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>Organization</th>";
echo " <th># of Sponsorships</th>";
echo " <th># of Awards</th>";
echo " <th># of Contacts</th>";
// echo " <th>Action</th>";
echo "</tr>\n";
//$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization");
//we want to show all years, infact that year field probably shouldnt even be there.
$q=mysql_query("SELECT * FROM sponsors ORDER BY organization");
while($r=mysql_fetch_object($q))
{
echo "<tr>\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'");
$numr=mysql_fetch_object($numq);
$numawards=$numr->num;
$numq=mysql_query("SELECT COUNT(id) AS num FROM sponsorships WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
$numr=mysql_fetch_object($numq);
$numsponsorships=$numr->num;
$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");
// $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=mysql_num_rows($numq);
// $numr=mysql_fetch_object($numq);
// $numcontacts=$numr->num;
echo " <td align=\"center\" valign=\"top\">";
echo "$numsponsorships &nbsp;";
echo "<a href=\"fundraising.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo " <td align=\"center\" valign=\"top\">";
echo "$numawards &nbsp;";
echo "<a href=\"award_awards.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo " <td align=\"center\" valign=\"top\">";
echo "$numcontacts &nbsp;";
// echo "<a href=\"sponsor_contacts.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo "</tr>\n";
}
echo "</table>\n";
if($_GET['action']=="add") {
?>
<script type="text/javascript">
$(document).ready(function() {
popup_editor(-1);
});
</script>
<?
}
send_footer();
send_footer();
?>

95
admin/donors_search.php Normal file
View File

@ -0,0 +1,95 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2008 James Grant <james@lightbox.org>
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.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
//$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization");
//we want to show all years, infact that year field probably shouldnt even be there.
$sql="";
if($_POST['search']) $sql.=" AND organization LIKE '%".mysql_real_escape_string($_POST['search'])."%' ";
if(count($_POST['donortype'])) {
$sql.=" AND (0 ";
foreach($_POST['donortype'] AS $d) {
$sql.=" OR donortype='$d'";
}
$sql.=") ";
}
$query="SELECT * FROM sponsors WHERE 1 $sql ORDER BY organization";
echo "query=$query";
$q=mysql_query($query);
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>Organization</th>";
echo " <th># of Sponsorships</th>";
echo " <th># of Awards</th>";
echo " <th># of Contacts</th>";
// echo " <th>Action</th>";
echo "</tr>\n";
while($r=mysql_fetch_object($q))
{
echo "<tr>\n";
$eh="style=\"cursor:pointer;\" onclick=\"open_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'");
$numr=mysql_fetch_object($numq);
$numawards=$numr->num;
$numq=mysql_query("SELECT COUNT(id) AS num FROM sponsorships WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
$numr=mysql_fetch_object($numq);
$numsponsorships=$numr->num;
$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");
// $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=mysql_num_rows($numq);
// $numr=mysql_fetch_object($numq);
// $numcontacts=$numr->num;
echo " <td align=\"center\" valign=\"top\">";
echo "$numsponsorships &nbsp;";
echo "<a href=\"fundraising.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo " <td align=\"center\" valign=\"top\">";
echo "$numawards &nbsp;";
echo "<a href=\"award_awards.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo " <td align=\"center\" valign=\"top\">";
echo "$numcontacts &nbsp;";
// echo "<a href=\"sponsor_contacts.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo "</tr>\n";
}
echo "</table>\n";
?>

View File

@ -78,7 +78,7 @@ function typechange() {
if($r->id==$sponsorship->sponsors_id) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->id\">$r->organization</option>\n";
}
echo "</select>&nbsp;<a href=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
echo "</select>&nbsp;<a href=\"donors.php?action=add\">".i18n("Add")."</a>\n";
echo "</span>";
@ -91,7 +91,6 @@ function typechange() {
if($r->uid==$sponsorship->users_uid) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->uid\">[$r->year][$r->uid] $r->lastname, $r->firstname ($r->email)</option>\n";
}
// echo "</select>&nbsp;<a href=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
echo "</span>";

View File

@ -26,10 +26,10 @@
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
send_header("Sponsor Contacts",
send_header("Donor Contacts",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Sponsors' => 'admin/sponsors.php'));
'Donor' => 'admin/donors.php'));
if($_GET['sponsors_id'])
$sponsors_id=$_GET['sponsors_id'];

View File

@ -40,7 +40,7 @@
}
user_auth_required('committee', 'admin');
send_header("Sponsorship Levels",
send_header("Donation Levels",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Fundraising' => 'admin/fundraising.php'),