Mostly working communications tab - now need to make the stuff on it work.

Also almost working donations entyr, which im going to finish right now
This commit is contained in:
james 2009-10-12 20:25:02 +00:00
parent 724c627db4
commit f4829bfd9e
2 changed files with 104 additions and 3 deletions

View File

@ -178,7 +178,7 @@ switch($_GET['action']) {
echo "<br />\n";
echo "<h4>".i18n("Add New Donation/Sponsorship")."</h4>\n";
echo "<form>";
echo "<form id=\"addnewdonationform\" onsubmit=\"return adddonation()\">";
echo "<table cellspacing=3 cellpadding=3>";
echo "<tr><td>";
echo i18n("Appeal").":";
@ -989,6 +989,10 @@ function donortypechange() {
$("#organizationinfo_save_button").attr('disabled','');
}
function adddonation() {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=donation_add", $("#donationaddform").serializeArray(),function() { update_contactsinfo(); });
}
</script>
<?

View File

@ -399,6 +399,50 @@ switch($_GET['action']){
if($r=mysql_fetch_object($q)) {
}
$communications=array("initial"=>"Initial Communication",
"followup"=>"Follow-Up Communication");
foreach($communications as $key=>$name) {
echo "<h4>".i18n($name)."</h4>\n";
//check if they have one in the emails database
$q=mysql_query("SELECT * FROM emails WHERE fundraising_campaigns_id='$campaign_id' AND val='$key'");
if($email=mysql_fetch_object($q)) {
echo "<div style=\"float: right; margin-right: 15px;\">";
echo "<a title=\"Edit\" href=\"#\" onclick=\"return opencommunicationeditor(null,$email->id)\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\" border=0></a>";
echo "&nbsp;&nbsp;";
echo "<a title=\"Remove\" onClick=\"return removecommunication($email->id);\" href=\"\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0></a>";
echo "</div>";
echo "<table cellspacing=0 cellpadding=3 border=1 style=\"margin-left: 30px; margin-right: 30px; width: 700px;\">";
echo "<tr><td>".i18n("Subject")."</td><td>$email->subject</td></tr>\n";
echo "<tr><td>".i18n("From")."</td><td>$email->from</td></tr>\n";
echo "<tr><td colspan=\"2\">".$email->bodyhtml."</td></tr>\n";
echo "<tr><td colspan=\"2\">";
echo "<table style=\"width: 100%;\"><tr>";
echo "<td style=\"text-align: center;\">";
if($email->lastsent) {
list($date,$time)=split(" ",$email->lastsent);
echo i18n("Sent %1 at %2",array(format_date($date), $time));
} else {
echo "<input type=\"button\" onclick=\"return opensendemaildialog()\" value=\"".i18n("Send as email")."\" />";
}
echo "</td>\n";
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendmaildialog()\" value=\"".i18n("General PDF for mailing")."\" /></td>\n";
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendlabelsdialog()\" value=\"".i18n("Generate mailing labels")."\" /></td>\n";
echo "</tr></table>\n";
echo "</td></tr>\n";
echo "</table>\n";
}
else {
echo "<ul>\n";
echo " <li><a href=\"#\" onclick=\"return opencommunicationchooser();\">".i18n("Start from an existing communication")."</a></li>\n";
echo " <li><a href=\"#\" onclick=\"return opencommunicationeditor('$key');\">".i18n("Create a new communication")."</a></li>\n";
echo "</ul>\n";
}
echo "<br />";
}
exit;
break;
@ -430,6 +474,22 @@ switch($_GET['action']){
exit;
break;
case "communication_remove":
$emails_id=$_POST['id'];
//check if its been sent, if so, it cannot be deleted, sorry!
$q=mysql_query("SELECT * FROM emails WHERE id='$emails_id'");
$e=mysql_fetch_object($q);
if($e->lastsent) {
error_("Cannot remove an email that has already been sent");
}
else {
mysql_query("DELETE FROM emails WHERE id='$emails_id'");
happy_("Communicaton removed");
}
break;
}
function save_campaign_info(){
@ -601,6 +661,43 @@ function prospect_removeall() {
return false;
}
//key is initial or followup
//start is either 'new' to start with a blank, or 'existing' to load an existing email to start from
function opencommunicationeditor(key,id) {
if(id) {
$("#dialog").load("communication.php?action=dialog_edit&id="+id,null,function() {
});
} else {
$("#dialog").load("communication.php?action=dialog_edit&key="+key,null,function() {
});
}
}
function opencommunicationchooser() {
$("#dialog").load("communication.php?action=dialog_choose&type=fundraising",null,function() {
});
}
function removecommunication(id) {
$("#debug").load("fundraising_campaigns.php?action=communication_remove",{id:id},function() {
update_tab_communications();
});
return false;
}
function comm_dialog_choose_select(id) {
alert('im back with email id: '+id);
//get rid of hte html
$("#dialog").html("");
$("#dialog").load("communication.php?action=dialog_edit&cloneid="+id,null,function() {
});
}
function comm_dialog_choose_cancel() {
alert('im cancelled');
}
</script>
<?
@ -657,8 +754,8 @@ function display_campaign_form($r=null) {
<a href="#" onclick="managecampaigns()">Appeal Management</a>
</td></tr></table>
<hr />
<div id="campaigndiv" style="width: 780px; display: none;">
</div>
<div id="campaigndiv" style="width: 780px; display: none;"></div>
<div id="dialog" style="width: 780px; display: none;"></div>
<?
send_footer();