2009-09-09 00:26:12 +00:00
//useful function that we'll be using throughout
function confirmClick ( msg )
{
var okay = confirm ( msg ) ;
if ( okay )
return true ;
else
return false ;
}
function el ( str , domain , name )
{
document . write ( '<a href="ma' + 'il' + 'to:' + str + '@' + domain + '">' + name + '</a>' ) ;
}
function em ( str , domain )
{
document . write ( '<a href="ma' + 'il' + 'to:' + str + '@' + domain + '">' + str + '@' + domain + '</a>' ) ;
}
var anyFieldHasBeenChanged = false ;
function fieldChanged ( )
{
anyFieldHasBeenChanged = true ;
}
function confirmChanges ( )
{
if ( anyFieldHasBeenChanged )
{
var okay = confirm ( '<?=i18n("You have unsaved changes. Click \"Cancel\" to return so you can save your changes, or press \"OK\" to discard your changes and continue")?>' ) ;
if ( okay )
return true ;
else
return false ;
}
else
return true ;
}
2009-09-13 08:33:54 +00:00
var _notice _id = 0 ;
function notice _delete ( id )
{
2009-09-13 19:25:03 +00:00
$ ( "#notice_" + id ) . slideUp ( 'slow' , function ( ) {
$ ( "#notice_" + id ) . remove ( ) ;
} ) ;
2009-09-13 08:33:54 +00:00
}
function notice _create ( type , str , timeout )
{
2009-09-18 07:50:32 +00:00
if ( timeout == - 1 ) timeout = 5000 ;
2009-09-13 08:33:54 +00:00
_notice _id ++ ;
2009-09-20 18:45:32 +00:00
$ ( "#notice_area" ) . append ( "<div id=\"notice_" + _notice _id + "\" class=\"" + type + "\" >" + str + "</div>" ) ;
2009-09-18 06:35:01 +00:00
$ ( "#notice_" + _notice _id ) . show ( 'puff' ) ;
2009-09-20 18:54:22 +00:00
$ ( "#notice_" + _notice _id ) . fadeTo ( 'fast' , 0.95 ) ;
2009-09-13 19:25:03 +00:00
setTimeout ( "notice_delete(" + _notice _id + ")" , timeout ) ;
2009-09-13 08:33:54 +00:00
}
2009-09-18 07:50:32 +00:00
function notice _ ( str )
{
notice _create ( 'notice' , str , - 1 ) ;
}
2010-02-03 16:02:45 +00:00
function report _gen ( id ) {
2009-11-06 08:24:54 +00:00
var args = "id=" + id + "&action=dialog_gen" ;
$ ( "#debug" ) . load ( "reports_gen.php?" + args ) ;
2010-02-03 16:02:45 +00:00
return false ;
2009-11-06 08:24:54 +00:00
}
2009-09-09 00:26:12 +00:00
/* Stuff to do after the document loads */
$ ( document ) . ready ( function ( )
{
2009-10-01 04:42:55 +00:00
/* Do label/input styles on all edit tables */
$ ( ".editor tr td:first-child" ) . addClass ( 'label' ) ;
$ ( ".editor tr td:nth-child(2)" ) . addClass ( 'input' ) ;
/* Stripe tableviews */
$ ( ".tableview tr:even" ) . addClass ( 'even' ) ;
$ ( ".tableview tr:odd" ) . addClass ( 'odd' ) ;
2009-09-09 00:26:12 +00:00
} ) ;
2009-12-02 22:17:20 +00:00
//key is 'val' from emails table, or id is id, fcid simply gets passed in and saved if needed
//only id or key are used to lookup which to open
function opencommunicationeditor ( key , id , fcid ) {
var fcstr = "" ;
if ( fcid )
fcstr = "&fundraising_campaigns_id=" + fcid ;
if ( id ) {
2010-02-04 06:48:42 +00:00
$ ( "#debug" ) . load ( "communication.php?action=dialog_edit&id=" + id + fcstr , null , function ( ) {
2009-12-02 22:17:20 +00:00
} ) ;
} else {
2010-02-04 06:48:42 +00:00
$ ( "#debug" ) . load ( "communication.php?action=dialog_edit&key=" + key + fcstr , null , function ( ) {
2009-12-02 22:17:20 +00:00
} ) ;
}
return false ;
}
2009-09-09 00:26:12 +00:00