List the sponsor contacts, all the links still go to the old sponsor_contacts page to be edited, its ugly and gross but at least its accessible

This commit is contained in:
james 2009-09-17 20:37:44 +00:00
parent ed72fb3944
commit ca9b2bb5a1

View File

@ -28,7 +28,8 @@
switch($_GET['action']) { switch($_GET['action']) {
case 'organizationinfo_load': case 'organizationinfo_load':
$q=mysql_query("SELECT * FROM sponsors WHERE id='".intval($_GET['id'])."'"); $id=intval($_GET['id']);
$q=mysql_query("SELECT * FROM sponsors WHERE id='$id'");
$ret=mysql_fetch_assoc($q); $ret=mysql_fetch_assoc($q);
echo json_encode($ret); echo json_encode($ret);
exit; exit;
@ -70,11 +71,78 @@
break; break;
case 'sponsorshipinfo_load': case 'sponsorshipinfo_load':
$id=intval($_GET['id']);
$ret=array(); $ret=array();
echo json_encode($ret); echo json_encode($ret);
exit; exit;
break; break;
case 'contactsinfo_load':
$sponsors_id=intval($_GET['id']);
$q=mysql_query("SELECT id,
uid,
year,
firstname,
lastname,
deleted,
salutation,
email,
phonework,
phonecell,
`primary`
FROM users,users_sponsor
WHERE
`types` LIKE '%sponsor%'
AND sponsors_id='$sponsors_id'
AND users_sponsor.users_id=users.id
AND users.deleted='no'
ORDER BY year DESC");
echo mysql_error();
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>".i18n("Year")."</th>";
echo " <th>".i18n("Name")."</th>";
echo " <th>".i18n("Email")."</th>";
echo " <th>".i18n("Phone (Work)")."</th>";
echo " <th>".i18n("Phone (Cell)")."</th>";
echo " <th>".i18n("Primary")."</th>";
echo " <th>Actions</th>";
echo "</tr>\n";
while($r=mysql_fetch_object($q)) {
echo "<tr>\n";
echo " <td>$r->year</td>\n";
echo " <td>";
if($r->salutation) echo $r->salutation." ";
echo "$r->firstname $r->lastname</td>\n";
echo " <td>";
if($r->email) {
list($eb,$ea)=split("@",$r->email);
echo $r->email;
}
else
echo "&nbsp;";
echo " </td>";
echo " <td>$r->phonework</td>\n";
echo " <td>$r->phonecell</td>\n";
$p = i18n(($r->primary=='yes')?'Yes':'No');
echo " <td>$p</td>\n";
echo " <td align=\"center\">";
//FIXME: should we just go to /user_personal.php here instead?
echo "<a href=\"sponsor_contacts.php?sponsors_id=$sponsors_id&action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
echo "&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this contact?')\" href=\"sponsor_contacts.php?sponsors_id=$sponsors_id&action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo " </td>\n";
echo "</tr>\n";
}
echo "</table>\n";
exit;
break;
} }
send_header("Sponsors", send_header("Sponsors",
@ -210,10 +278,7 @@ function sponsorshipinfo_save() {
function update_contactsinfo() function update_contactsinfo()
{ {
var id=sponsor_id; var id=sponsor_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id, $("#editor_tab_contacts").load("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id);
function(json){
$("#sponsor_id").val(json.id);
});
} }
function contactsinfo_save() { function contactsinfo_save() {
@ -286,7 +351,6 @@ function activityinfo_save() {
sponsorship sponsorship
</div> </div>
<div id="editor_tab_contacts"> <div id="editor_tab_contacts">
contacts
</div> </div>
<div id="editor_tab_activity"> <div id="editor_tab_activity">
activity activity
@ -352,7 +416,7 @@ function activityinfo_save() {
echo " <td align=\"center\" valign=\"top\">"; echo " <td align=\"center\" valign=\"top\">";
echo "$numcontacts &nbsp;"; 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 "<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 "</td>";
echo "</tr>\n"; echo "</tr>\n";
} }