[Sitracker-devel] SF.net SVN: sitracker:[7464] branches/plugins/3x/mailbox_monitor/ mailbox_monitor
Open source support tracking in your browser
Brought to you by:
ivanlucas
From: <nic...@us...> - 2011-11-02 14:58:39
|
Revision: 7464 http://sitracker.svn.sourceforge.net/sitracker/?rev=7464&view=rev Author: nicdev007 Date: 2011-11-02 14:58:32 +0000 (Wed, 02 Nov 2011) Log Message: ----------- v1.06 Added code to only show the results in main.php and holding_queue.php Clean up the HTML a bit and changed some CSS for the progress bar Added meta tag to header to refresh the entire page thus also refreshing the progress bar Modified Paths: -------------- branches/plugins/3x/mailbox_monitor/mailbox_monitor.php Modified: branches/plugins/3x/mailbox_monitor/mailbox_monitor.php =================================================================== --- branches/plugins/3x/mailbox_monitor/mailbox_monitor.php 2011-10-28 14:52:03 UTC (rev 7463) +++ branches/plugins/3x/mailbox_monitor/mailbox_monitor.php 2011-11-02 14:58:32 UTC (rev 7464) @@ -11,7 +11,7 @@ // Please see the wiki! http://sitracker.org/wiki/ // -$PLUGININFO['mailbox_monitor']['version'] = 1.00; +$PLUGININFO['mailbox_monitor']['version'] = 1.06; $PLUGININFO['mailbox_monitor']['description'] = 'Verifies the mailbox size, and displays it in the header'; $PLUGININFO['mailbox_monitor']['author'] = 'Nicolaas du Toit'; $PLUGININFO['mailbox_monitor']['legal'] = 'GPL'; @@ -33,34 +33,42 @@ { global $CONFIG, $dbMailboxMonitorData, $now; - if (!$CONFIG['mailbox_monitor_max_mb_size']) $mb_max = 80000000;//Default is 80MB - else $mb_max = $CONFIG['mailbox_monitor_max_mb_size'];// + $current_page = $_SERVER['PHP_SELF']; + $pages_array = array($CONFIG['application_webpath']."main.php", $CONFIG['application_webpath']."holding_queue.php"); - if (!$CONFIG['mailbox_monitor_mb_displayname']) $mb_name = $CONFIG['email_address'];//Default is 80MB - else $mb_name = $CONFIG['mailbox_monitor_mb_displayname']; - - $sql = "SELECT last_size, last_status, date_checked FROM `$dbMailboxMonitorData` WHERE `id` = 1 "; - $result = mysql_query($sql); - - $saved_data = mysql_fetch_object($result); - $size = $saved_data->last_size; - $num_messages = $saved_data->last_status; - $timestamp = $saved_data->date_checked; - $display_size = round($size / 1000000, 2)." MB"; - $time_diff = $now - $timestamp; - $perc_full = round(($size / $mb_max) * 100); - echo "<div style='float: right;'>"; - echo "<table style='font-weight: bold;'>"; - echo "<tr><td style='color:white;'>Mailbox:</td>"; - echo "<td style='color:white;'>$mb_name</td></tr>"; - echo "<tr><td style='color:white;'>Updated:</td>"; - echo "<td style='color:white;'>".format_seconds($time_diff)." ago</td></tr>"; - echo "</table>"; - echo "<div style='padding-top:1px'>"; - echo mm_percent_bar($perc_full, $display_size); - echo "</div>"; - echo "</div>"; - + if (in_array ($current_page, $pages_array)) + { + echo "<meta http-equiv='refresh' content='1800' />";//TODO: NDT See id i can do this maybe with an Ajax call? + //We have to refresh the main page to be sure to reload the data, otherwise the data remains static. + + if (!$CONFIG['mailbox_monitor_max_mb_size']) $mb_max = 80000000;//Default is 80MB + else $mb_max = $CONFIG['mailbox_monitor_max_mb_size']; + + if (!$CONFIG['mailbox_monitor_mb_displayname']) $mb_name = $CONFIG['email_address'];//Default is email address + else $mb_name = $CONFIG['mailbox_monitor_mb_displayname']; + + $sql = "SELECT last_size, last_status, date_checked FROM `$dbMailboxMonitorData` WHERE `id` = 1 "; + $result = mysql_query($sql); + + $saved_data = mysql_fetch_object($result); + $size = $saved_data->last_size; + $num_messages = $saved_data->last_status; + $timestamp = $saved_data->date_checked; + $display_size = round($size / 1000000, 2)." MB"; + $time_diff = $now - $timestamp; + $perc_full = round(($size / $mb_max) * 100); + echo "<div style='float: right;'>"; + echo "<table style='font-weight: bold;'>"; + echo "<tr><td style='color:white;'>Mailbox:</td>"; + echo "<td style='color:white;'>$mb_name</td></tr>"; + echo "<tr><td style='color:white;'>Updated:</td>"; + echo "<td style='color:white;'>".format_seconds($time_diff)." ago</td></tr>"; + echo "</table>"; + echo "<div style='padding-top:1px'>"; + echo mm_percent_bar($perc_full, $display_size); + echo "</div>"; + echo "</div>"; + } } if(mailbox_monitor_create_table() === FALSE) return; @@ -251,7 +259,6 @@ debug_log("Mailbox_Monitor: Deleted: $check->Deleted", TRUE) ; debug_log("Mailbox_Monitor: Size: $check->Size", TRUE); - imap_close($mboxconnect); return $check; } else @@ -261,6 +268,7 @@ return FALSE; } } + imap_close($mboxconnect); } @@ -283,24 +291,30 @@ { $percent = 100; $overdue = 1; + $text = "Attention !"; } - - $html = "<div style ='width: 100px; border: 1px solid black; background-color: white; height: 12px;'>"; +//TODO: NDT Need to make a CSS for this now i think ;-) + $html = "<div style ='width: 100px; border: 1px solid black; background-color: white; height: 12px; margin-left: 7px;'>"; if ($percent <= 50) { - $html .= "<div style= 'text-align: center; height: 12px; font-size: 95%;background: #50C028;width: 0px;width: {$percent}%;'> {$text}"; + $html .= "<div style= 'text-align: center; white-space: nowrap; height: 12px; "; + $html .= "font-size: 95%;background: #50C028;width: 0px;width: {$percent}%;'> {$text}"; } if ($percent > 50 AND $percent <= 90) { - $html .= "<div style= 'text-align: center; height: 12px; font-size: 95%;background: #FF9933;width: 0px;width: {$percent}%;'> {$text}"; + $html .= "<div style= 'text-align: center; height: 12px; font-size: 95%; "; + $html .= "background: #FF9933; width: 0px; width: {$percent}%;'> {$text}"; } if ($percent > 90 AND $percent <= 100 AND $overdue == 0) { - $html .= "<div style= 'text-align: center; height: 12px; font-size: 90%;font-weight:bold;background: #d14040;width: 0px;width: {$percent}%;'> {$text}"; + $html .= "<div style= 'text-align: center; height: 12px; font-size: 90%; "; + $html .= "font-weight:bold; background: #d14040; width: 0px; width: {$percent}%;'> {$text}"; } if ($percent > 90 AND $percent <= 100 AND $overdue == 1) { - $html .= "<div style= 'color: white; text-align: center; height: 12px; font-size: 90%;font-weight:bold;background: #d14040;width: 0px;width: {$percent}%;'> Attention !"; + $text = "Attention !"; + $html .= "<div style= 'color: white; text-align: center; height: 12px; "; + $html .= "font-size: 90%;font-weight:bold; background: #d14040;width: 0px; width: {$percent}%;'> {$text}"; } $html .= "</div></div>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |