forked from science-ation/science-ation
Updated to allow the deleting of contacts
Cleaned up the layout of the contact info form to be smaller and more aesthetic
This commit is contained in:
parent
bfb4c1c586
commit
50eebd3245
558
admin/donors.php
558
admin/donors.php
@ -13,7 +13,7 @@
|
|||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; see the file COPYING. If not, write to
|
along with this program; see the file COPYING. If not, write to
|
||||||
@ -27,74 +27,72 @@
|
|||||||
user_auth_required('committee', 'admin');
|
user_auth_required('committee', 'admin');
|
||||||
|
|
||||||
switch($_GET['action']) {
|
switch($_GET['action']) {
|
||||||
case 'organizationinfo_load':
|
case 'organizationinfo_load':
|
||||||
$id=intval($_GET['id']);
|
$id=intval($_GET['id']);
|
||||||
$q=mysql_query("SELECT * FROM sponsors WHERE id='$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;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'organizationinfo_save':
|
case 'organizationinfo_save':
|
||||||
$id=intval($_POST['sponsor_id']);
|
$id=intval($_POST['sponsor_id']);
|
||||||
if($id==-1) {
|
if($id==-1) {
|
||||||
$q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
|
$q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
|
||||||
$id=mysql_insert_id();
|
$id=mysql_insert_id();
|
||||||
echo json_encode(array("id"=>$id));
|
echo json_encode(array("id"=>$id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($id) {
|
if($id) {
|
||||||
$exec="UPDATE sponsors SET ".
|
$exec="UPDATE sponsors SET ".
|
||||||
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
|
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
|
||||||
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
|
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
|
||||||
"city='".mysql_escape_string(stripslashes($_POST['city']))."', ".
|
"city='".mysql_escape_string(stripslashes($_POST['city']))."', ".
|
||||||
"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']))."', ".
|
"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']))."', ".
|
||||||
"website='".mysql_escape_string(stripslashes($_POST['website']))."', ".
|
"website='".mysql_escape_string(stripslashes($_POST['website']))."', ".
|
||||||
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
||||||
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
|
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
|
||||||
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
|
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
|
||||||
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."', ".
|
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."', ".
|
||||||
"taxreceiptrequired='".mysql_escape_string(stripslashes($_POST['taxreceiptrequired']))."' ".
|
"taxreceiptrequired='".mysql_escape_string(stripslashes($_POST['taxreceiptrequired']))."' ".
|
||||||
"WHERE id='$id'";
|
"WHERE id='$id'";
|
||||||
mysql_query($exec);
|
mysql_query($exec);
|
||||||
|
|
||||||
//FIXME accept the logo
|
//FIXME accept the logo
|
||||||
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
|
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
|
||||||
|
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sponsorshipinfo_load':
|
case 'sponsorshipinfo_load':
|
||||||
$id=intval($_GET['id']);
|
$id=intval($_GET['id']);
|
||||||
$ret=array();
|
$ret=array();
|
||||||
echo json_encode($ret);
|
echo json_encode($ret);
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'contactsinfo_load':
|
case 'contactsinfo_load':
|
||||||
// make sure a donor id has been selected
|
// make sure a donor id has been selected
|
||||||
if($_GET['id']){
|
if($_GET['id']){
|
||||||
// $sql = "SELECT
|
draw_contactsinfo_form();
|
||||||
draw_contactsinfo_form();
|
}
|
||||||
}
|
exit;
|
||||||
exit;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'contactsinfo_save':
|
case 'contactsinfo_save':
|
||||||
save_contact();
|
save_contact();
|
||||||
|
exit;
|
||||||
// draw_contactsinfo_form();
|
break;
|
||||||
exit;
|
case 'contactsinfo_delete':
|
||||||
break;
|
delete_contact();
|
||||||
case 'contactsinfo_delete':
|
exit;
|
||||||
delete_contact();
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send_header("Donor/Sponsor Management",
|
send_header("Donor/Sponsor Management",
|
||||||
@ -103,9 +101,13 @@
|
|||||||
'Fundraising' => 'admin/fundraising.php')
|
'Fundraising' => 'admin/fundraising.php')
|
||||||
);
|
);
|
||||||
|
|
||||||
// #FIXME should delete the contact who has been submitted in _POST
|
//delete the contact who has been submitted in _POST
|
||||||
function delete_contact(){
|
function delete_contact(){
|
||||||
error_("Not Implemented");
|
if(array_key_exists('userid', $_POST)){
|
||||||
|
$uid = $_POST['userid'];
|
||||||
|
user_delete($uid);
|
||||||
|
happy_("User with ID #" . $uid . " deleted");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the contact info
|
// save the contact info
|
||||||
@ -123,7 +125,7 @@ function save_contact(){
|
|||||||
|
|
||||||
}else if($_POST['recordtype'] == 'existing'){
|
}else if($_POST['recordtype'] == 'existing'){
|
||||||
// this is an existing record being updated. Load the user.
|
// this is an existing record being updated. Load the user.
|
||||||
$successMessage = i18n("Contact updated successfully: " . $_POST['userid']);
|
$successMessage = i18n("Contact updated successfully");
|
||||||
|
|
||||||
$u = user_load($_POST['userid']);
|
$u = user_load($_POST['userid']);
|
||||||
$id = intval($_POST['userid']);
|
$id = intval($_POST['userid']);
|
||||||
@ -135,13 +137,13 @@ function save_contact(){
|
|||||||
if($p == 'no') {
|
if($p == 'no') {
|
||||||
/* Make sure this sponsor ($sponsor_id) has a primary */
|
/* Make sure this sponsor ($sponsor_id) has a primary */
|
||||||
$query = "SELECT users_id
|
$query = "SELECT users_id
|
||||||
FROM users_sponsor, users
|
FROM users_sponsor, users
|
||||||
WHERE
|
WHERE
|
||||||
users_sponsor.users_id=users.id
|
users_sponsor.users_id=users.id
|
||||||
AND sponsors_id='$sponsor_id'
|
AND sponsors_id='$sponsor_id'
|
||||||
AND `primary`='yes'
|
AND `primary`='yes'
|
||||||
AND year='".$config['FAIRYEAR']."'
|
AND year='".$config['FAIRYEAR']."'
|
||||||
AND users_id!='$id'";
|
AND users_id!='$id'";
|
||||||
$q = mysql_query($query);
|
$q = mysql_query($query);
|
||||||
if(mysql_num_rows($q) == 0) {
|
if(mysql_num_rows($q) == 0) {
|
||||||
/* This has to be the primary since there isn't one already */
|
/* This has to be the primary since there isn't one already */
|
||||||
@ -216,7 +218,8 @@ function draw_contactsinfo_form($contact = null){
|
|||||||
WHERE year='" . $config['FAIRYEAR'] . "'
|
WHERE year='" . $config['FAIRYEAR'] . "'
|
||||||
AND sponsors_id='" . $sponsor_id . "'
|
AND sponsors_id='" . $sponsor_id . "'
|
||||||
AND deleted='no'
|
AND deleted='no'
|
||||||
ORDER BY lastname,firstname");
|
ORDER BY users_sponsor.primary DESC,lastname,firstname");
|
||||||
|
|
||||||
while($contact = mysql_fetch_array($query)){
|
while($contact = mysql_fetch_array($query)){
|
||||||
// draw a header for this user
|
// draw a header for this user
|
||||||
echo "<h3><a href=\"#\">";
|
echo "<h3><a href=\"#\">";
|
||||||
@ -235,50 +238,71 @@ function draw_contactsinfo_form($contact = null){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw a form in which to enter contact info
|
// draw a form in which to enter contact info
|
||||||
//FIXME - this form needs to be pretty
|
|
||||||
function draw_contact_form($sponsor_id, $contact = null){
|
function draw_contact_form($sponsor_id, $contact = null){
|
||||||
if($contact != null){
|
if($contact != null){
|
||||||
$id = $contact["id"];
|
$id = $contact["id"];
|
||||||
}else{
|
}else{
|
||||||
$id = "new";
|
$id = "new";
|
||||||
}
|
}
|
||||||
echo "<form id=\"contact_" . $id . "\" method=\"post\" action=\"donors.php?action=contactsinfo_save\">\n";
|
echo "<form id=\"contact_" . $id . "\" method=\"post\" action=\"donors.php?action=contactsinfo_save\">\n";
|
||||||
echo "<input type=\"hidden\" name=\"sponsor_id\" value=\"$sponsor_id\">\n";
|
echo "<input type=\"hidden\" name=\"sponsor_id\" value=\"$sponsor_id\">\n";
|
||||||
if($id == "new"){
|
if($id == "new"){
|
||||||
echo "<input type=\"hidden\" name=\"recordtype\" value=\"new\">\n";
|
echo "<input type=\"hidden\" name=\"recordtype\" value=\"new\">\n";
|
||||||
}else{
|
}else{
|
||||||
echo "<input type=\"hidden\" name=\"recordtype\" value=\"existing\">\n";
|
echo "<input type=\"hidden\" name=\"recordtype\" value=\"existing\">\n";
|
||||||
echo "<input type=\"hidden\" name=\"userid\" value=\"" . $id . "\">\n";
|
echo "<input type=\"hidden\" name=\"userid\" value=\"" . $id . "\">\n";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
echo "<table>\n";
|
<table>
|
||||||
echo "<tr><td>".i18n("Salutation")."</td><td><input type=\"text\" name=\"salutation\" value=\"".htmlspecialchars($contact['salutation'])."\" size=\"4\" maxlength=\"8\" /></td></tr>\n";
|
<tr>
|
||||||
echo "<tr><td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"".htmlspecialchars($contact['firstname'])."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
<td><?=i18n("Salutation"); ?></td>
|
||||||
echo "<tr><td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"".htmlspecialchars($contact['lastname'])."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
<td><input type="text" name="salutation" value = "<?=htmlspecialchars($contact['salutation'])?>"></td>
|
||||||
echo "<tr><td>".i18n("Position")."</td><td><input type=\"text\" name=\"position\" value=\"".htmlspecialchars($contact['position'])."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
|
<td><?=i18n("Position"); ?></td>
|
||||||
echo "<tr><td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"".htmlspecialchars($contact['phonework'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
<td><input type="text" name="position" value = "<?=htmlspecialchars($contact['position'])?>"></td>
|
||||||
echo "<tr><td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"".htmlspecialchars($contact['phonecell'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
</tr>
|
||||||
echo "<tr><td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"".htmlspecialchars($contact['phonehome'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
<tr>
|
||||||
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($contact['fax'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
<td><?=i18n("First Name"); ?></td>
|
||||||
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($contact['email'])."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
<td><input type="text" name="firstname" value = "<?=htmlspecialchars($contact['firstname'])?>"></td>
|
||||||
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($contact['notes'])."</textarea></td></tr>\n";
|
<td><?=i18n("Last Name"); ?></td>
|
||||||
echo "<tr><td>".i18n("Primary Contact")."</td><td><select name=\"primary\">";
|
<td><input type="text" name="lastname" value = "<?=htmlspecialchars($contact['lastname'])?>"></td>
|
||||||
$sel = ($contact['primary'] == 'yes') ? 'selected="selected"': '';
|
</tr>
|
||||||
echo "<option value=\"yes\" $sel>".i18n('Yes')."</option>";
|
<tr>
|
||||||
$sel = ($contact['primary'] == 'no') ? 'selected="selected"': '';
|
<td><?=i18n("Phone (Work)"); ?></td>
|
||||||
echo "<option value=\"no\" $sel>".i18n('No')."</option>";
|
<td><input type="text" name="phonework" value = "<?=htmlspecialchars($contact['phonework'])?>"></td>
|
||||||
echo "</select></td></tr>\n";
|
<td><?=i18n("Phone (Cell)"); ?></td>
|
||||||
echo "<tr>";
|
<td><input type="text" name="phonecell" value = "<?=htmlspecialchars($contact['phonecell'])?>"></td>
|
||||||
echo "<td align=\"center\"><input type=\"submit\" value=\"" . i18n("Save") . "\" onClick=\"return contactsinfo_save('" . $id . "')\" /></td>";
|
</tr>
|
||||||
if( $id == "new"){
|
<tr>
|
||||||
echo "<td></td>";
|
<td><?=i18n("Phone (Home)"); ?></td>
|
||||||
}else{
|
<td><input type="text" name="phonehome" value = "<?=htmlspecialchars($contact['phonehome'])?>"></td>
|
||||||
echo "<td align=\"center\"><input type=\"submit\" value=\"" . i18n("Remove") . "\" onClick=\"return contactsinfo_delete('" . $id . "')\" /></td>";
|
<td><?=i18n("Fax"); ?></td>
|
||||||
}
|
<td><input type="text" name="fax" value = "<?=htmlspecialchars($contact['fax'])?>"></td>
|
||||||
|
</tr>
|
||||||
echo "</tr>\n";
|
<tr>
|
||||||
echo "</table>\n";
|
<td><?=i18n("Email"); ?></td>
|
||||||
echo "</form>\n";
|
<td colspan="3"><input type="text" name="email" size="60" value = "<?=htmlspecialchars($contact['email'])?>"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?=i18n("Notes"); ?></td>
|
||||||
|
<td colspan="3"><textarea name="notes" cols="60" rows="4"><?=htmlspecialchars($contact['notes'])?></textarea></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?=i18n("Primary Contact")?></td>
|
||||||
|
<td>
|
||||||
|
<label><?=i18n("Yes")?><input type="radio" name="primary" value="yes" <?php if($contact['primary'] == 'yes') echo "CHECKED";?></label>
|
||||||
|
<label><?=i18n("No")?><input type="radio" name="primary" value="no" <?php if($contact['primary'] != 'yes') echo "CHECKED";?>></label>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
echo "<td align=\"center\"><input type=\"submit\" value=\"" . i18n("Save") . "\" onClick=\"return contactsinfo_save('" . $id . "')\" /></td>";
|
||||||
|
echo "<td>";
|
||||||
|
if($id != "new")
|
||||||
|
echo "<input type=\"submit\" value=\"" . i18n("Remove") . "\" onClick=\"return contactsinfo_delete('" . $id . "')\" />";
|
||||||
|
echo "</td>";
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -286,159 +310,169 @@ function draw_contact_form($sponsor_id, $contact = null){
|
|||||||
/* Setup the popup window */
|
/* Setup the popup window */
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/*`
|
/*`
|
||||||
$("#open_editor").dialog({
|
$("#open_editor").dialog({
|
||||||
bgiframe: true, autoOpen: false,
|
bgiframe: true, autoOpen: false,
|
||||||
modal: true, resizable: false,
|
modal: true, resizable: false,
|
||||||
draggable: false
|
draggable: false
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$("#editor_tabs").tabs({
|
$("#editor_tabs").tabs({
|
||||||
show: function(event, ui) {
|
show: function(event, ui) {
|
||||||
switch(ui.panel.id) {
|
switch(ui.panel.id) {
|
||||||
case 'editor_tab_organization':
|
case 'editor_tab_organization':
|
||||||
update_organizationinfo();
|
update_organizationinfo();
|
||||||
break;
|
break;
|
||||||
case 'editor_tab_sponsorship':
|
case 'editor_tab_sponsorship':
|
||||||
update_sponsorshipinfo();
|
update_sponsorshipinfo();
|
||||||
break;
|
break;
|
||||||
case 'editor_tab_contacts':
|
case 'editor_tab_contacts':
|
||||||
update_contactsinfo();
|
update_contactsinfo();
|
||||||
break;
|
break;
|
||||||
case 'editor_tab_activity':
|
case 'editor_tab_activity':
|
||||||
update_activityinfo();
|
update_activityinfo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selected: 0,
|
selected: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#organizationinfo_fundingselectiondate").datepicker({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonText: "<?=i18n("calendar")?>" });
|
$("#organizationinfo_fundingselectiondate").datepicker({ dateFormat: 'yy-mm-dd', showOn: 'button', buttonText: "<?=i18n("calendar")?>" });
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var sponsor_id=0;
|
var sponsor_id=0;
|
||||||
function open_editor(id) {
|
function open_editor(id) {
|
||||||
sponsor_id=id;
|
sponsor_id=id;
|
||||||
$("#donor_editor").show();
|
$("#donor_editor").show();
|
||||||
$("#searchbrowse").hide();
|
$("#searchbrowse").hide();
|
||||||
$("#searchresults").hide();
|
$("#searchresults").hide();
|
||||||
|
|
||||||
if(id==-1) {
|
if(id==-1) {
|
||||||
$('#editor_tabs').tabs('option', 'selected', 0);
|
$('#editor_tabs').tabs('option', 'selected', 0);
|
||||||
$('#editor_tabs').tabs('option', 'disabled', [1,2,3]);
|
$('#editor_tabs').tabs('option', 'disabled', [1,2,3]);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#editor_tabs').tabs('option', 'selected', 0);
|
$('#editor_tabs').tabs('option', 'selected', 0);
|
||||||
$('#editor_tabs').tabs('option', 'disabled', []);
|
$('#editor_tabs').tabs('option', 'disabled', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_organizationinfo();
|
update_organizationinfo();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function open_search() {
|
function open_search() {
|
||||||
$("#donor_editor").hide();
|
$("#donor_editor").hide();
|
||||||
$("#searchbrowse").show();
|
$("#searchbrowse").show();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function update_organizationinfo()
|
function update_organizationinfo()
|
||||||
{
|
{
|
||||||
var id=sponsor_id;
|
var id=sponsor_id;
|
||||||
if(!sponsor_id)
|
if(!sponsor_id)
|
||||||
return false;
|
return false;
|
||||||
if(sponsor_id==-1) {
|
if(sponsor_id==-1) {
|
||||||
$("#sponsor_id").val(-1);
|
$("#sponsor_id").val(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=organizationinfo_load&id="+id,
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=organizationinfo_load&id="+id,
|
||||||
function(json){
|
function(json){
|
||||||
$("#sponsor_id").val(json.id);
|
$("#sponsor_id").val(json.id);
|
||||||
$("#organizationinfo_organization").val(json.organization);
|
$("#organizationinfo_organization").val(json.organization);
|
||||||
$("#organizationinfo_address").val(json.address);
|
$("#organizationinfo_address").val(json.address);
|
||||||
$("#organizationinfo_city").val(json.city);
|
$("#organizationinfo_city").val(json.city);
|
||||||
$("#organizationinfo_province_code").val(json.province_code);
|
$("#organizationinfo_province_code").val(json.province_code);
|
||||||
$("#organizationinfo_postalcodd").val(json.postalcode);
|
$("#organizationinfo_postalcodd").val(json.postalcode);
|
||||||
$("#organizationinfo_phone").val(json.phone);
|
$("#organizationinfo_phone").val(json.phone);
|
||||||
$("#organizationinfo_tollfree").val(json.tollfree);
|
$("#organizationinfo_tollfree").val(json.tollfree);
|
||||||
$("#organizationinfo_fax").val(json.fax);
|
$("#organizationinfo_fax").val(json.fax);
|
||||||
$("#organizationinfo_email").val(json.email);
|
$("#organizationinfo_email").val(json.email);
|
||||||
$("#organizationinfo_website").val(json.website);
|
$("#organizationinfo_website").val(json.website);
|
||||||
$("#organizationinfo_donationpolicyurl").val(json.donationpolicyurl);
|
$("#organizationinfo_donationpolicyurl").val(json.donationpolicyurl);
|
||||||
$("#organizationinfo_fundingselectiondate").val(json.fundingselectiondate);
|
$("#organizationinfo_fundingselectiondate").val(json.fundingselectiondate);
|
||||||
$("#organizationinfo_notes").val(json.notes);
|
$("#organizationinfo_notes").val(json.notes);
|
||||||
// For some reason, with checkboxes, these have to be arrays
|
// For some reason, with checkboxes, these have to be arrays
|
||||||
$("[name=waiveraccepted]").val([json.waiveraccepted]);
|
$("[name=waiveraccepted]").val([json.waiveraccepted]);
|
||||||
$("[name=taxreceiptrequired]").val([json.taxreceiptrequired]);
|
$("[name=taxreceiptrequired]").val([json.taxreceiptrequired]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function organizationinfo_save() {
|
function organizationinfo_save() {
|
||||||
|
|
||||||
//if we're creating we need to do the post, and get the id it returns, so we can re-open the popup window with that id
|
//if we're creating we need to do the post, and get the id it returns, so we can re-open the popup window with that id
|
||||||
if($("#sponsor_id").val()==-1) {
|
if($("#sponsor_id").val()==-1) {
|
||||||
$.post("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray(),
|
$.post("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray(),
|
||||||
function(json) {
|
function(json) {
|
||||||
open_editor(json.id);
|
open_editor(json.id);
|
||||||
},
|
},
|
||||||
"json");
|
"json");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray());
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=organizationinfo_save", $("#organizationinfo").serializeArray());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_sponsorshipinfo()
|
function update_sponsorshipinfo()
|
||||||
{
|
{
|
||||||
var id=sponsor_id;
|
var id=sponsor_id;
|
||||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_load&id="+id,
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_load&id="+id,
|
||||||
function(json){
|
function(json){
|
||||||
$("#sponsor_id").val(json.id);
|
$("#sponsor_id").val(json.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sponsorshipinfo_save() {
|
function sponsorshipinfo_save() {
|
||||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_save", $("#sponsorshipinfo").serializeArray());
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_save", $("#sponsorshipinfo").serializeArray());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_contactsinfo()
|
function update_contactsinfo()
|
||||||
{
|
{
|
||||||
var id=sponsor_id;
|
var id=sponsor_id;
|
||||||
$("#editor_tab_contacts").load("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id, null,
|
$("#editor_tab_contacts").load("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id, null,
|
||||||
function() {
|
function() {
|
||||||
$("#levelaccordion").accordion();
|
$("#levelaccordion").accordion();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function contactsinfo_save(id) {
|
function contactsinfo_save(uid) {
|
||||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save", $("#contact_" + id).serializeArray());
|
var id=sponsor_id;
|
||||||
return false;
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save&id="+id, $("#contact_" + uid).serializeArray(),
|
||||||
|
function() {
|
||||||
|
$("#levelaccordion").accordion();
|
||||||
|
update_contactsinfo();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function contactsinfo_delete(id) {
|
function contactsinfo_delete(uid) {
|
||||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_delete", $("#contact_" + id).serializeArray());
|
var id=sponsor_id;
|
||||||
return false;
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_delete&id="+id, $("#contact_" + uid).serializeArray(),
|
||||||
|
function() {
|
||||||
|
$("#levelaccordion").accordion();
|
||||||
|
update_contactsinfo();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_activityinfo()
|
function update_activityinfo()
|
||||||
{
|
{
|
||||||
var id=sponsor_id;
|
var id=sponsor_id;
|
||||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=activityinfo_load&id="+id,
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=activityinfo_load&id="+id,
|
||||||
function(json){
|
function(json){
|
||||||
$("#sponsor_id").val(json.id);
|
$("#sponsor_id").val(json.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function activityinfo_save() {
|
function activityinfo_save() {
|
||||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save", $("#activityinfo").serializeArray());
|
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save", $("#activityinfo").serializeArray());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function donorsearch() {
|
function donorsearch() {
|
||||||
@ -471,61 +505,61 @@ echo "<hr />";
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="donor_editor" title="Donor/Sponsor Editor" style="display: none">
|
<div id="donor_editor" title="Donor/Sponsor Editor" style="display: none">
|
||||||
<div id="editor_tabs">
|
<div id="editor_tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#editor_tab_organization"><span><?=i18n('Donor/Sponsor Details')?></span></a></li>
|
<li><a href="#editor_tab_organization"><span><?=i18n('Donor/Sponsor Details')?></span></a></li>
|
||||||
<li><a href="#editor_tab_sponsorship"><span><?=i18n('Donations/Sponsorships')?></span></a></li>
|
<li><a href="#editor_tab_sponsorship"><span><?=i18n('Donations/Sponsorships')?></span></a></li>
|
||||||
<li><a href="#editor_tab_contacts"><span><?=i18n('Contacts')?></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>
|
<li><a href="#editor_tab_activity"><span><?=i18n('Activity Log')?></span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="editor_tab_organization">
|
<div id="editor_tab_organization">
|
||||||
<form enctype="multipart/form-data" id="organizationinfo">
|
<form enctype="multipart/form-data" id="organizationinfo">
|
||||||
<input type="hidden" name="sponsor_id" id="sponsor_id" value="0">
|
<input type="hidden" name="sponsor_id" id="sponsor_id" value="0">
|
||||||
<table class="tableedit" border=0>
|
<table class="tableedit" border=0>
|
||||||
<tr><td><?=i18n("Donor Type")?></td><td>
|
<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_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>
|
<input id="donortype_organization" type="radio" name="donortype" value="organization" checked="checked"/><label for="donortype_organization"><?=i18n("Organization")?></label>
|
||||||
</td></tr>
|
</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("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 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("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>
|
<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>
|
<td><?=i18n($config['provincestate'])?></td><td>
|
||||||
<? emit_province_selector("province_code","","id=\"organizationinfo_province_code\""); ?>
|
<? emit_province_selector("province_code","","id=\"organizationinfo_province_code\""); ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?=i18n($config['postalzip'])?></td><td><input id="organizationinfo_postalcode" type="text" name="postalcode" size="8" maxlength="7" /></td></tr>
|
<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>
|
<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("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>
|
<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>
|
<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("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>
|
<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>
|
<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>
|
<td><?=i18n("Logo")?></td><td colspan="3"><input type="file" name="logo" size="16" /></td></tr>
|
||||||
<tr><td><?=i18n("Waiver Accepted")?></td><td>
|
<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>
|
<input type="radio" id="organizationinfo_waiveraccepted_no" name="waiveraccepted" value="no"><label for="organizationinfo_waiveraccepted_no"><?=i18n("No")?></label>
|
||||||
<input type="radio" id="organizationinfo_waiveraccepted_yes" name="waiveraccepted" value="yes"><label for="organizationinfo_waiveraccepted_yes"><?=i18n("Yes")?></label>
|
<input type="radio" id="organizationinfo_waiveraccepted_yes" name="waiveraccepted" value="yes"><label for="organizationinfo_waiveraccepted_yes"><?=i18n("Yes")?></label>
|
||||||
</td>
|
</td>
|
||||||
<td><?=i18n("Tax Receipt Required")?></td><td colspan="3">
|
<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>
|
<input type="radio" id="organizationinfo_taxreceiptrequired_no" name="taxreceiptrequired" value="no"><label for="organizationinfo_taxreceiptrequired_no"><?=i18n("No")?></label>
|
||||||
<input type="radio" id="organizationinfo_taxreceiptrequired_yes" name="taxreceiptrequired" value="yes"><label for="organizationinfo_taxreceiptrequired_yes"><?=i18n("Yes")?></label>
|
<input type="radio" id="organizationinfo_taxreceiptrequired_yes" name="taxreceiptrequired" value="yes"><label for="organizationinfo_taxreceiptrequired_yes"><?=i18n("Yes")?></label>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr><td><?=i18n("Notes")?></td><td colspan="5"><textarea id="organizationinfo_notes" name="notes" rows="4" cols="60"></textarea></td></tr>
|
<tr><td><?=i18n("Notes")?></td><td colspan="5"><textarea id="organizationinfo_notes" name="notes" rows="4" cols="60"></textarea></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<input type="submit" value="Save" onClick="return organizationinfo_save()" />
|
<input type="submit" value="Save" onClick="return organizationinfo_save()" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="editor_tab_sponsorship">
|
<div id="editor_tab_sponsorship">
|
||||||
sponsorship
|
sponsorship
|
||||||
</div>
|
</div>
|
||||||
<div id="editor_tab_contacts">
|
<div id="editor_tab_contacts">
|
||||||
</div>
|
</div>
|
||||||
<div id="editor_tab_activity">
|
<div id="editor_tab_activity">
|
||||||
activity
|
activity
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user