Changeset fda695f in github
- Timestamp:
- Sep 1, 2006 1:14:51 PM (7 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- bf04525
- Parents:
- 5cd296d
- Files:
-
- 5 edited
-
program/include/rcube_imap.inc (modified) (1 diff)
-
program/steps/mail/func.inc (modified) (1 diff)
-
program/steps/mail/quotaimg.inc (modified) (6 diffs)
-
skins/default/mail.css (modified) (1 diff)
-
skins/default/templates/mail.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_imap.inc
r3ea0e32 rfda695f 1464 1464 { 1465 1465 if ($this->get_capability('QUOTA')) 1466 return array('total' => 2048 * 1024, 'used' => 500 * 1024, 'percent' => 32); //iil_C_GetQuota($this->conn);1466 return iil_C_GetQuota($this->conn); 1467 1467 1468 1468 return FALSE; -
program/steps/mail/func.inc
r3ea0e32 rfda695f 634 634 if ($attrib['display'] == 'image' && function_exists('imagegif')) 635 635 { 636 $quota_text = sprintf('<img src="%s&_action=quotaimg&u=%s&q=%d" alt="%s" width="102" height="15" />', 636 $attrib += array('width' => 100, 'height' => 14); 637 $quota_text = sprintf('<img src="%s&_action=quotaimg&u=%s&q=%d&w=%d&h=%d" width="%d" height="%d" alt="%s" title="%s / %s" />', 637 638 $COMM_PATH, 638 639 $quota['used'], $quota['total'], 639 $quota_text); 640 $attrib['width'], $attrib['height'], 641 $attrib['width'], $attrib['height'], 642 $quota_text, 643 show_bytes($quota["used"] * 1024), 644 show_bytes($quota["total"] * 1024)); 640 645 } 641 646 } -
program/steps/mail/quotaimg.inc
r3ea0e32 rfda695f 22 22 $used = ((isset($_GET['u']) && !empty($_GET['u'])) || $_GET['u']=='0')?(int)$_GET['u']:'??'; 23 23 $quota = ((isset($_GET['q']) && !empty($_GET['q'])) || $_GET['q']=='0')?(int)$_GET['q']:'??'; 24 $width = empty($_GET['w']) ? 100 : (int)$_GET['w']; 25 $height = empty($_GET['h']) ? 14 : (int)$_GET['h']; 24 26 25 26 function genQuota($used, $total) 27 function genQuota($used, $total, $width, $height) 27 28 { 28 29 /** … … 53 54 54 55 $unknown = false; 55 $border = true;56 $border = 0; 56 57 57 $height = 15;58 $width = 102;59 58 $font = 2; 60 $padding = 1;59 $padding = 0; 61 60 62 61 $limit['high'] = 70; … … 65 64 66 65 // Fill Colors 67 $color['fill']['high'] = '2 27, 23, 13'; // Near quota fill color66 $color['fill']['high'] = '215, 13, 13'; // Near quota fill color 68 67 $color['fill']['mid'] = '126, 192, 238';// Mid-area of quota fill color 69 $color['fill']['low'] = ' 50, 205, 50'; // Far from quota fill color68 $color['fill']['low'] = '147, 225, 100'; // Far from quota fill color 70 69 71 70 // Background colors 72 $color['bg']['OL'] = '2 38, 99, 99'; // Over limit bbackground71 $color['bg']['OL'] = '215, 13, 13'; // Over limit bbackground 73 72 $color['bg']['Unknown'] = '238, 99, 99';// Unknown background 74 73 $color['bg']['quota'] = '255, 255, 255';// Normal quota background … … 76 75 // Misc. Colors 77 76 $color['border'] = '0, 0, 0'; 78 $color['text'] = ' 0, 0, 0';77 $color['text'] = '102, 102, 102'; 79 78 80 79 … … 92 91 } 93 92 93 $im = imagecreate($width, $height); 94 95 if($border) 96 { 97 list($r, $g, $b) = explode(',', $color['border']); 98 $borderc = imagecolorallocate($im, $r, $g, $b); 99 imageline($im, 0, 0, $width, 0, $borderc); 100 imageline($im, 0, $height-$border, 0, 0, $borderc); 101 imageline($im, $width-1, 0, $width-$border, $height, $borderc); 102 imageline($im, $width, $height-$border, 0, $height-$border, $borderc); 103 } 104 105 list($r, $g, $b) = explode(',', $color['text']); 106 $text = imagecolorallocate($im, $r, $g, $b); 107 94 108 if($unknown) 95 109 { 96 $im = imagecreate($width, $height);97 110 list($r, $g, $b) = explode(',', $color['bg']['Unknown']); 98 111 $background = imagecolorallocate($im, $r, $g, $b); 99 list($r, $g, $b) = explode(',', $color['text']); 100 $text = imagecolorallocate($im, $r, $g, $b); 112 imagefilledrectangle($im, 0, 0, $width, $height, $background); 101 113 102 if($border) 114 $string = 'Unknown'; 115 $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1; 116 imagestring($im, $font, $mid, $padding, $string, $text); 117 } 118 else if($used > $total) 119 { 120 list($r, $g, $b) = explode(',', $color['bg']['OL']); 121 $background = imagecolorallocate($im, $r, $g, $b); 122 imagefilledrectangle($im, 0, 0, $width, $height, $background); 123 124 $string = 'Over Limit'; 125 $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1; 126 imagestring($im, $font, $mid, $padding, $string, $text); 127 } 128 else 129 { 130 list($r, $g, $b) = explode(',', $color['bg']['quota']); 131 $background = imagecolorallocate($im, $r, $b, $g); 132 imagefilledrectangle($im, 0, 0, $width, $height, $background); 133 134 $quota = ($used==0)?0:(round($used/$total, 2)*100); 135 136 if($quota >= $limit['high']) 103 137 { 104 list($r, $g, $b) = explode(',', $color['border']); 105 $border = imagecolorallocate($im, $r, $g, $b); 106 imageline($im, 0, 0, $width, 0, $border); 107 imageline($im, 0, $height-1, 0, 0, $border); 108 imageline($im, $width-1, 0, $width-1, $height, $border); 109 imageline($im, $width, $height-1, 0, $height-1, $border); 138 list($r, $g, $b) = explode(',', $color['fill']['high']); 139 $fill = imagecolorallocate($im, $r, $g, $b); 140 } 141 elseif($quota >= $limit['mid']) 142 { 143 list($r, $g, $b) = explode(',', $color['fill']['mid']); 144 $fill = imagecolorallocate($im, $r, $g, $b); 145 } 146 else // if($quota >= $limit['low']) 147 { 148 list($r, $g, $b) = explode(',', $color['fill']['low']); 149 $fill = imagecolorallocate($im, $r, $g, $b); 110 150 } 111 151 112 $string = 'Unknown'; 152 $quota_width = $quota / 100 * $width; 153 imagefilledrectangle($im, $border, 0, $quota, $height-2*$border, $fill); 113 154 114 $mid = floor((100-(strlen($string)*imagefontwidth($font)))/2)+1; 115 116 imagestring($im, $font, $mid, $padding, $string, $text); 117 header('Content-type: image/gif'); 118 imagegif($im); 119 imagedestroy($im); 120 exit; 155 $string = $quota.'%'; 156 $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1; 157 imagestring($im, $font, $mid, $padding, $string, $text); // Print percent in black 121 158 } 122 159 123 if($used > $total)124 {125 $im = imagecreate($width, $height);126 list($r, $g, $b) = explode(',', $color['bg']['OL']);127 $background = imagecolorallocate($im, $r, $g, $b);128 list($r, $g, $b) = explode(',', $color['text']);129 $text = imagecolorallocate($im, $r, $g, $b);130 list($r, $g, $b) = explode(',', $color['border']);131 $border = imagecolorallocate($im, $r, $g, $b);132 133 imageline($im, 0, 0, $width, 0, $border);134 imageline($im, 0, $height-1, 0, 0, $border);135 imageline($im, $width-1, 0, $width-1, $height, $border);136 imageline($im, $width, $height-1, 0, $height-1, $border);137 138 $string = 'Over Limit';139 140 $mid = floor((100-(strlen($string)*imagefontwidth($font)))/2)+1;141 142 imagestring($im, $font, $mid, $padding, $string, $text);143 144 header('Content-type: image/gif');145 imagegif($im);146 exit;147 }148 149 $quota = ($used==0)?0:(round($used/$total, 2)*100);150 151 $im = imagecreate($width, $height);152 list($r, $g, $b) = explode(',', $color['bg']['quota']);153 $background = imagecolorallocate($im, $r, $b, $g);154 list($r, $g, $b) = explode(',', $color['border']);155 $border = imagecolorallocate($im, $r, $g, $b);156 list($r, $g, $b) = explode(',', $color['text']);157 $text = imagecolorallocate($im, $r, $g, $b);158 if($quota >= $limit['high'])159 {160 list($r, $g, $b) = explode(',', $color['fill']['high']);161 $fill = imagecolorallocate($im, $r, $g, $b);162 }163 elseif($quota >= $limit['mid'])164 {165 list($r, $g, $b) = explode(',', $color['fill']['mid']);166 $fill = imagecolorallocate($im, $r, $g, $b);167 }168 else // if($quota >= $limit['low'])169 {170 list($r, $g, $b) = explode(',', $color['fill']['low']);171 $fill = imagecolorallocate($im, $r, $g, $b);172 }173 174 175 imagefilledrectangle($im, 1, 0, $quota, $height-2, $fill);176 177 178 imageline($im, 0, 0, $width-2, 0, $border);179 imageline($im, $width-2, 0, $width-2, $height, $border);180 imageline($im, $width-2, $height-1, 0, $height-1, $border);181 imageline($im, 0, $height, 0, 0, $border);182 183 184 $string = $quota.'%';185 $mid = floor((100-(strlen($string)*imagefontwidth($font)))/2)+1;186 imagestring($im, $font, $mid, $padding, $string, $text); // Print percent in black187 188 160 header('Content-Type: image/gif'); 161 header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+86400)." GMT"); 162 header("Cache-Control: "); 163 header("Pragma: "); 164 189 165 imagegif($im); 190 166 imagedestroy($im); … … 192 168 193 169 194 genQuota($used, $quota );170 genQuota($used, $quota, $width, $height); 195 171 exit; 196 172 ?> -
skins/default/mail.css
r3ea0e32 rfda695f 565 565 { 566 566 vertical-align: middle; 567 padding-left: 4px; 567 margin-left: 4px; 568 border: 1px solid #666666; 568 569 } 569 570 -
skins/default/templates/mail.html
r3ea0e32 rfda695f 58 58 <roundcube:button command="select-all" prop="unread" label="unread" classAct="active" /> 59 59 <roundcube:button command="select-none" label="none" classAct="active" /> 60 <roundcube:label name="quota" />: <roundcube:object name="quotaDisplay" display=" text" id="quotadisplay" />60 <roundcube:label name="quota" />: <roundcube:object name="quotaDisplay" display="image" width="120" id="quotadisplay" /> 61 61 </div> 62 62
Note: See TracChangeset
for help on using the changeset viewer.
