[imp] new mail notification in mailbox.php

Nick Ustinov Nick.Ustinov@videinfra.lv
Thu, 26 Apr 2001 11:46:48 +0300


sorry, small update :)   use this code in the bottom of the mailbox.php:

/* Check to see if user wants new mail notification and notify if new mails
arrived */                                          
if ($prefs->getValue('nav_popup')) {

    if (isset($imp['newmsgs'])) {

        $delta = $newmsgcount - $imp['newmsgs'];

        if ($delta > 0) {

            include $conf['paths']['templates'] . '/mailbox/alert.inc';

        }

    }

if (!isset($newmsgcount)) $newmsgcount = 0;

$imp['newmsgs'] = $newmsgcount;

}  


Nick Ustinov

nick@videinfra.com
http://www.videinfra.com


-----Original Message-----
From: Nick Ustinov [mailto:Nick.Ustinov@videinfra.lv]
Sent: Wednesday, April 25, 2001 11:51 PM
To: 'imp@lists.horde.org'
Subject: [imp] new mail notification in mailbox.php


as req'ed:

in mailbox.php, around line 605, comes one extra line $newmsgcount++:

                $style[] = $conf['mailbox']['unseen_style'];
                $bg = 'unseen';
	    $newmsgcount++;    // increment number of unseen messages
            }
            if ($h->Answered == 'A') {
                $flagbits |= IMP_ANSWERED;

at the bottom of mailbox.php, before $registry->shutdown():

/* Check to see if user wants new mail notification and notify if new mails
arrived */
if ($prefs->getValue('nav_popup')) {
    if (isset($imp['newmsgs'])) {
        $delta = $newmsgcount - $imp['newmsgs'];
        if ($delta > 0) {
            include $conf['paths']['templates'] . '/mailbox/alert.inc';
        }
    }
$imp['newmsgs'] = $newmsgcount;
}


and also in templates/mailbox, create alert.inc, containing:
<script language="JavaScript" type="text/javascript">

<!--

    alert('<?=_("You have ").$delta._(" new message(s)")?>');

// -->

</script> 


Guess this should work :)  Play around and report bugs. Of course, you have
to enable new mail notification in preferences.


Nick



-- 
IMP mailing list: http://horde.org/imp/
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: imp-unsubscribe@lists.horde.org