diff --git a/admin/donors.php b/admin/donors.php
index f2d8aa3..cd81595 100644
--- a/admin/donors.php
+++ b/admin/donors.php
@@ -81,8 +81,8 @@
// make sure a donor id has been selected
if($_GET['id']){
// $sql = "SELECT
- draw_contactsinfo_form();
- }
+ draw_contactsinfo_form();
+ }
exit;
break;
@@ -92,6 +92,9 @@
// draw_contactsinfo_form();
exit;
break;
+ case 'contactsinfo_delete':
+ delete_contact();
+ break;
}
send_header("Donor/Sponsor Management",
@@ -100,6 +103,11 @@
'Fundraising' => 'admin/fundraising.php')
);
+// #FIXME should delete the contact who has been submitted in _POST
+function delete_contact(){
+ error_("Not Implemented");
+}
+
// save the contact info
function save_contact(){
global $config;
@@ -117,11 +125,6 @@ function save_contact(){
// this is an existing record being updated. Load the user.
$successMessage = i18n("Contact updated successfully: " . $_POST['userid']);
- /////////////////////////////////////////////////////////////////////
- // FIXME: userid not yet getting posted, so the rest of this if won't work.
- /////////////////////////////////////////////////////////////////////
- happy_($successMessage);
- exit(1);
$u = user_load($_POST['userid']);
$id = intval($_POST['userid']);
@@ -188,21 +191,7 @@ function validate_contactdata(){
// draw a group of forms for editing and creating new contacts
function draw_contactsinfo_form($contact = null){
global $config;
-// echo "<< ".i18n("Back to %1 Contacts",array($sponsors_organization))."\n";
-/*
- if($_GET['action']=="edit")
- {
- echo "
".i18n("Edit %1 Contact",array($sponsors_organization))."
\n";
- $buttontext="Save Contact";
- $u=user_load(intval($_GET['edit']));
- }
- else if($_GET['action']=="add")
- {
- echo "".i18n("Add %1 Contact",array($sponsors_organization))."
\n";
- $buttontext="Add Contact";
- }
- $buttontext=i18n($buttontext);
-*/
+
// make sure we know what sponsor we're dealing with here
if(!isset($sponsor_id)){
if($_GET['id'])
@@ -215,6 +204,13 @@ function draw_contactsinfo_form($contact = null){
// start our accordion
echo "\n";
+ // draw an empty form in which to enter a new user
+ echo "
\n";
+ echo "
\n";
+ draw_contact_form($sponsor_id);
+ echo "
\n";
+
// loop through each contact and draw a form with their data in it.
$query = mysql_query("SELECT * FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
WHERE year='" . $config['FAIRYEAR'] . "'
@@ -232,14 +228,8 @@ function draw_contactsinfo_form($contact = null){
draw_contact_form($sponsor_id, $contact);
echo "
\n";
}
- // and then draw an empty form in which to enter a new user
- echo "\n";
- echo "\n";
- draw_contact_form($sponsor_id);
- echo "
\n";
- // end the accordion
+ // and finally end the accordion
echo "\n";
}
@@ -247,11 +237,20 @@ function draw_contactsinfo_form($contact = null){
// draw a form in which to enter contact info
//FIXME - this form needs to be pretty
function draw_contact_form($sponsor_id, $contact = null){
- echo "\n";
}
@@ -409,8 +416,13 @@ function update_contactsinfo()
);
}
-function contactsinfo_save() {
- $("#debug").load("$_SERVER['PHP_SELF']?>?action=contactsinfo_save", $("#createcontact").serializeArray());
+function contactsinfo_save(id) {
+ $("#debug").load("$_SERVER['PHP_SELF']?>?action=contactsinfo_save", $("#contact_" + id).serializeArray());
+ return false;
+}
+
+function contactsinfo_delete(id) {
+ $("#debug").load("$_SERVER['PHP_SELF']?>?action=contactsinfo_delete", $("#contact_" + id).serializeArray());
return false;
}