Add new fields to sponsor editor, dont let sponsor be edited on a sponsorship, and adjust the dialog box sizes a bit

This commit is contained in:
james 2008-10-28 21:19:21 +00:00
parent 82d9e16dea
commit 2bd3201196
3 changed files with 45 additions and 22 deletions

View File

@ -53,7 +53,7 @@ require_once("../dialog.inc.php");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
echo "<tr>"; echo "<tr>";
echo "<th><a title=\"".i18n("Edit fund details")."\" onclick=\"return SFIABDialog(event,'fundraising_types.php?id=$r->id',300,200)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>"; echo "<th><a title=\"".i18n("Edit fund details")."\" onclick=\"return SFIABDialog(event,'fundraising_types.php?id=$r->id',300,230)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
if($r->system=="no") { if($r->system=="no") {
echo "<a title=\"".i18n("Remove Fund")."\" onclick=\"return confirmClick('Are you sure you want to remove this fund and all sponsorships inside it?')\" href=\"fundraising.php?action=funddelete&delete=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>"; echo "<a title=\"".i18n("Remove Fund")."\" onclick=\"return confirmClick('Are you sure you want to remove this fund and all sponsorships inside it?')\" href=\"fundraising.php?action=funddelete&delete=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
} }
@ -75,7 +75,7 @@ require_once("../dialog.inc.php");
ORDER BY status DESC, probability DESC, organization"); ORDER BY status DESC, probability DESC, organization");
while($sr=mysql_fetch_object($sq)) { while($sr=mysql_fetch_object($sq)) {
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">"; echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
echo "<td><a title=\"".i18n("Edit sponsorship details")."\" onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type',400,200)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>"; echo "<td><a title=\"".i18n("Edit sponsorship details")."\" onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type',400,250)\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
echo "<a title=\"".i18n("Remove sponsorship")."\" onclick=\"return confirmClick('Are you sure you want to remove this sponsorship?')\" href=\"fundraising.php?action=sponsorshipdelete&delete=$sr->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>"; echo "<a title=\"".i18n("Remove sponsorship")."\" onclick=\"return confirmClick('Are you sure you want to remove this sponsorship?')\" href=\"fundraising.php?action=sponsorshipdelete&delete=$sr->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "</td>"; echo "</td>";
@ -112,7 +112,7 @@ require_once("../dialog.inc.php");
$typetotal+=$probval; $typetotal+=$probval;
} }
echo "<tr>"; echo "<tr>";
echo "<td><a onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?fundraising_type=$r->type',400,200)\" href=\"#\">add</a></td>"; echo "<td><a onclick=\"return SFIABDialog(event,'fundraising_sponsorship.php?fundraising_type=$r->type',400,250)\" href=\"#\">add</a></td>";
echo "<td colspan=\"4\" style=\"text-align: right; font-weight: bold;\">".i18n("%1 Total",array($r->name),array("Fundraising type total, eg) Award Sponsorship Total"))."</td>\n"; echo "<td colspan=\"4\" style=\"text-align: right; font-weight: bold;\">".i18n("%1 Total",array($r->name),array("Fundraising type total, eg) Award Sponsorship Total"))."</td>\n";
echo "<td style=\"font-weight: bold; text-align: right;\">".format_money($typetotal)."</td>\n"; echo "<td style=\"font-weight: bold; text-align: right;\">".format_money($typetotal)."</td>\n";
$typediff=$typetotal-$r->goal; $typediff=$typetotal-$r->goal;
@ -124,7 +124,7 @@ require_once("../dialog.inc.php");
echo "<tr><td colspan=\"7\">&nbsp;</td></tr>\n"; echo "<tr><td colspan=\"7\">&nbsp;</td></tr>\n";
} }
echo "<tr>"; echo "<tr>";
echo "<td colspan=\"2\"><a onclick=\"return SFIABDialog(event,'fundraising_types.php',300,200)\" href=\"#\">add fund type</a></td>"; echo "<td colspan=\"2\"><a onclick=\"return SFIABDialog(event,'fundraising_types.php',300,230)\" href=\"#\">add fund type</a></td>";
echo "<td colspan=\"4\" style=\"font-weight: bold; text-align: right;\">".i18n("Total Net Position")."</td><td style=\"text-align: right; font-weight: bold;\">".format_money($totaldiff)."</td></tr>\n"; echo "<td colspan=\"4\" style=\"font-weight: bold; text-align: right;\">".i18n("Total Net Position")."</td><td style=\"text-align: right; font-weight: bold;\">".format_money($totaldiff)."</td></tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "<br />\n"; echo "<br />\n";

View File

@ -28,7 +28,7 @@
if($_GET['id']) { if($_GET['id']) {
$id=intval($_GET['id']); $id=intval($_GET['id']);
$q=mysql_query("SELECT * FROM sponsorships WHERE id='$id'"); $q=mysql_query("SELECT sponsorships.*, sponsors.organization FROM sponsorships,sponsors WHERE sponsorships.id='$id' AND sponsorships.sponsors_id=sponsors.id");
echo "<h2>Edit Sponsorship</h2>"; echo "<h2>Edit Sponsorship</h2>";
$sponsorship=mysql_fetch_object($q); $sponsorship=mysql_fetch_object($q);
$formaction="sponsorshipedit"; $formaction="sponsorshipedit";
@ -46,6 +46,7 @@
echo "<tr><th>".i18n("Sponsor")."</th>"; echo "<tr><th>".i18n("Sponsor")."</th>";
echo "<td>"; echo "<td>";
if($formaction=="sponsorshipadd") {
$q=mysql_query("SELECT * FROM sponsors ORDER BY organization"); $q=mysql_query("SELECT * FROM sponsors ORDER BY organization");
echo mysql_error(); echo mysql_error();
echo "<select name=\"sponsors_id\">"; echo "<select name=\"sponsors_id\">";
@ -55,6 +56,10 @@
echo "<option $sel value=\"$r->id\">$r->organization</option>\n"; 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=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
}
else {
echo $sponsorship->organization;
}
echo "</td></tr>\n"; echo "</td></tr>\n";
echo "<tr><th>".i18n("Type")."</th>"; echo "<tr><th>".i18n("Type")."</th>";

View File

@ -4,7 +4,7 @@
SFIAB Website: http://www.sfiab.ca SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org> Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org> Copyright (C) 2008 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU General Public
@ -50,9 +50,16 @@
"province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', ". "province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', ".
"postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ". "postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ".
"phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ". "phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ".
"tollfree='".mysql_escape_string(stripslashes($_POST['tollfree']))."', ".
"fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ". "fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ".
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ". "email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."' ". "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']))."', ".
"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."', ".
"taxreceiptrequired='".mysql_escape_string(stripslashes($_POST['taxreceiptrequired']))."' ".
"WHERE id='$id'"; "WHERE id='$id'";
mysql_query($exec); mysql_query($exec);
@ -64,20 +71,10 @@
if($_GET['action']=="delete" && $_GET['delete']) if($_GET['action']=="delete" && $_GET['delete'])
{ {
mysql_query("DELETE FROM sponsors WHERE id='".$_GET['delete']."'"); //dont allow any deleting until we figure out what we need to do, infact, i think we never should hard delete
echo happy("Sponsor successfully deleted"); //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']=="confirm" && $_GET['confirm'])
{
mysql_query("UPDATE sponsors SET confirmed='yes' WHERE id='".$_GET['confirm']."'");
echo happy("Sponsor successfully confirmed");
}
if($_GET['action']=="unconfirm" && $_GET['unconfirm'])
{
mysql_query("UPDATE sponsors SET confirmed='no' WHERE id='".$_GET['unconfirm']."'");
echo happy("Sponsor successfully unconfirmed");
} }
if($_GET['action']=="edit" || $_GET['action']=="add") if($_GET['action']=="edit" || $_GET['action']=="add")
@ -113,8 +110,28 @@
echo "</td></tr>\n"; echo "</td></tr>\n";
echo "<tr><th>".i18n($config['postalzip'])."</th><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n"; echo "<tr><th>".i18n($config['postalzip'])."</th><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
echo "<tr><th>".i18n("Phone")."</th><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n"; echo "<tr><th>".i18n("Phone")."</th><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><th>".i18n("Toll Free")."</th><td><input type=\"text\" name=\"tollfree\" value=\"".htmlspecialchars($r->tollfree)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><th>".i18n("Fax")."</th><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n"; echo "<tr><th>".i18n("Fax")."</th><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><th>".i18n("Email")."</th><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n"; echo "<tr><th>".i18n("Email")."</th><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><th>".i18n("Website")."</th><td><input type=\"text\" name=\"website\" value=\"".htmlspecialchars($r->website)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><th>".i18n("Donation Policy URL")."</th><td><input type=\"text\" name=\"donationpolicyurl\" value=\"".htmlspecialchars($r->donationpolicyurl)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><th>".i18n("Funding Selection Date")."</th><td>";
emit_date_selector("fundingselectiondate",$r->fundingselectiondate);
echo "</td></tr>\n";
echo "<tr><th>".i18n("Logo")."</th><td><input type=\"file\" name=\"logo\" size=\"16\" /></td></tr>\n";
echo "<tr><th>".i18n("Waiver Accepted")."</th><td>";
if($r->waiveraccepted=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input type=\"radio\" $ch name=\"waiveraccepted\" value=\"no\">".i18n("No")." &nbsp;&nbsp;";
if($r->waiveraccepted=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input type=\"radio\" $ch name=\"waiveraccepted\" value=\"yes\">".i18n("Yes")." &nbsp;&nbsp;";
echo "</td></tr>\n";
echo "<tr><th>".i18n("Tax Receipt Required")."</th><td>";
if($r->taxreceiptrequired=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input type=\"radio\" $ch name=\"taxreceiptrequired\" value=\"no\">".i18n("No")." &nbsp;&nbsp;";
if($r->taxreceiptrequired=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input type=\"radio\" $ch name=\"taxreceiptrequired\" value=\"yes\">".i18n("Yes")." &nbsp;&nbsp;";
echo "</td></tr>\n";
echo "<tr><th>".i18n("Notes")."</th><td><textarea name=\"notes\" rows=\"4\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n"; echo "<tr><th>".i18n("Notes")."</th><td><textarea name=\"notes\" rows=\"4\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
@ -175,9 +192,10 @@
echo "</td>"; echo "</td>";
echo " <td align=\"center\">"; echo " <td align=\"center\">";
echo "<a href=\"sponsors.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>"; echo "<a href=\"sponsors.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
/* cannot delete sponsors, we need to be able to link to them from other years, etc... this could be turned back on as a soft delete eventually
echo "&nbsp;"; echo "&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this sponsor?')\" href=\"sponsors.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>"; echo "<a onclick=\"return confirmClick('Are you sure you want to remove this sponsor?')\" href=\"sponsors.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
*/
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";