forked from science-ation/science-ation
Use the happy_ and error_ functions and load the ajax into the debug div
This commit is contained in:
parent
c1d7b8fc24
commit
8aabd98fe0
@ -75,12 +75,12 @@ function popup_sponsorship_editor(url) {
|
||||
}
|
||||
|
||||
function save_sponsorship() {
|
||||
$.post("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
$("#fundraisingsponsorship").serialize(),
|
||||
function(data) {
|
||||
$('#sponsorship_editor').dialog('close');
|
||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
$("#fundraisingsponsorship").serializeArray(),
|
||||
function() {
|
||||
$('#sponsorship_editor').dialog('close');
|
||||
refresh_fundraising_table();
|
||||
});
|
||||
refresh_fundraising_table();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -102,31 +102,35 @@ function popup_fund_editor(url) {
|
||||
}
|
||||
|
||||
function save_fund() {
|
||||
$.post("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
$("#fundraisingfundraising").serialize(),
|
||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
$("#fundraisingfundraising").serializeArray(),
|
||||
function(data) {
|
||||
$('#fund_editor').dialog('close');
|
||||
$('#fund_editor').dialog('close');
|
||||
refresh_fundraising_table();
|
||||
});
|
||||
refresh_fundraising_table();
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_fund(id) {
|
||||
if(confirmClick('Are you sure you want to remove this fund?')) {
|
||||
$.post("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
{ action: 'funddelete', delete: id }
|
||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
{ action: 'funddelete', delete: id },
|
||||
function() {
|
||||
refresh_fundraising_table();
|
||||
}
|
||||
);
|
||||
refresh_fundraising_table();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_sponsorship(id) {
|
||||
if(confirmClick('Are you sure you want to remove this sponsorship?')) {
|
||||
$.post("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
{ action: 'sponsorshipdelete', delete: id }
|
||||
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
|
||||
{ action: 'sponsorshipdelete', delete: id },
|
||||
function() {
|
||||
refresh_fundraising_table();
|
||||
}
|
||||
);
|
||||
refresh_fundraising_table();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
if($_POST['action']=="sponsorshipdelete") {
|
||||
mysql_query("DELETE FROM sponsorships WHERE id='".intval($_POST['delete'])."'");
|
||||
if(mysql_affected_rows())
|
||||
message_push(happy(i18n("Successfully removed sponsorship")));
|
||||
happy_("Successfully removed sponsorship");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -50,15 +50,15 @@ if($_POST['action']=="sponsorshipedit") {
|
||||
|
||||
}
|
||||
if(mysql_error())
|
||||
message_push(error(mysql_error()));
|
||||
echo error_(mysql_error());
|
||||
else
|
||||
message_push(happy(i18n("Saved sponsorship changes")));
|
||||
echo happy_("Saved sponsorship changes");
|
||||
}
|
||||
else
|
||||
message_push(happy(i18n("No changes were made")));
|
||||
echo error_("No changes were made");
|
||||
}
|
||||
else {
|
||||
message_push(error(i18n("Required fields were missing, please try again")));
|
||||
echo error_("Required fields were missing, please try again");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
@ -70,12 +70,12 @@ if($_POST['action']=="sponsorshipadd") {
|
||||
NOW(),
|
||||
'".$_SESSION['users_id']."',
|
||||
'".mysql_real_escape_string("Created sponsorship: type=$fundraising_type, value=\$$value, status=$status, probability=$probability%")."')");
|
||||
message_push(happy(i18n("Added new sponsorship")));
|
||||
happy_("Added new sponsorship");
|
||||
}
|
||||
else
|
||||
message_push(error(i18n("Required fields were missing, please try again")));
|
||||
error_("Required fields were missing, please try again");
|
||||
if(mysql_error())
|
||||
message_push(error(mysql_error()));
|
||||
error_(mysql_error());
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ if($_POST['action']=="funddelete" && $_POST['delete']) {
|
||||
mysql_query("DELETE FROM sponsorships WHERE fundraising_type='".mysql_real_escape_string($f->type)."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM fundraising WHERE id='$id'");
|
||||
if(mysql_affected_rows())
|
||||
message_push(happy(i18n("Successfully removed fund %1",array($f->name))));
|
||||
happy_("Successfully removed fund %1",array($f->name));
|
||||
}
|
||||
else {
|
||||
message_push(error(i18n("Cannot remove system fund")));
|
||||
error_("Cannot remove system fund");
|
||||
}
|
||||
}
|
||||
exit;
|
||||
@ -40,12 +40,12 @@ if($_POST['action']=="fundedit") {
|
||||
mysql_query("UPDATE fundraising SET goal='$goal', description='$description', type='$type', name='$name' WHERE id='$fundraising_id'");
|
||||
}
|
||||
if(mysql_error())
|
||||
message_push(error(mysql_error()));
|
||||
error_("MySQL Error: %1",array(mysql_error()));
|
||||
else
|
||||
message_push(happy(i18n("Saved fund changes")));
|
||||
happy_("Saved fund changes");
|
||||
}
|
||||
else {
|
||||
message_push(error(i18n("Required fields were missing, please try again")));
|
||||
error_("Required fields were missing, please try again");
|
||||
}
|
||||
exit;
|
||||
|
||||
@ -53,12 +53,12 @@ if($_POST['action']=="fundedit") {
|
||||
if($_POST['action']=="fundadd") {
|
||||
if( $goal && $type && $name) {
|
||||
mysql_query("INSERT INTO fundraising (type,name,description,system,goal,year) VALUES ('$type','$name','$description','no','$goal','{$config['FAIRYEAR']}')");
|
||||
message_push(happy(i18n("Added new fund")));
|
||||
happy_("Added new fund");
|
||||
}
|
||||
else
|
||||
message_push(error(i18n("Required fields were missing, please try again")));
|
||||
error_("Required fields were missing, please try again");
|
||||
if(mysql_error())
|
||||
message_push(error(mysql_error()));
|
||||
error_("MySQL Error: %1",array(mysql_error()));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user