Changeset 7415c02 in github
- Timestamp:
- Oct 24, 2009 3:09:23 PM (4 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 06e0757
- Parents:
- 1d7e4d3
- Files:
-
- 1 deleted
- 5 edited
-
CHANGELOG (modified) (1 diff)
-
bin/quotaimg.php (deleted)
-
program/js/app.js (modified) (3 diffs)
-
program/steps/mail/func.inc (modified) (2 diffs)
-
skins/default/mail.css (modified) (1 diff)
-
skins/default/templates/mail.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r49771b1 r7415c02 2 2 =========================== 3 3 4 - Fix quota indicator issues by content generation on client-size (#1486197, #1486220) 4 5 - Don't display disabled sections in Settings (#1486099) 5 6 - Added server-side e-mail address validation with 'email_dns_check' option (#1485857) -
program/js/app.js
r04dcf0d r7415c02 3915 3915 this.set_quota = function(content) 3916 3916 { 3917 if (content && this.gui_objects.quotadisplay) 3918 $(this.gui_objects.quotadisplay).html(content); 3917 if (content && this.gui_objects.quotadisplay) { 3918 if (typeof(content) == 'object') 3919 this.percent_indicator(this.gui_objects.quotadisplay, content); 3920 else 3921 $(this.gui_objects.quotadisplay).html(content); 3922 } 3919 3923 }; 3920 3924 … … 4045 4049 } 4046 4050 4051 // percent (quota) indicator 4052 this.percent_indicator = function(obj, data) 4053 { 4054 if (!data || !obj) 4055 return false; 4056 4057 var limit_high = 80; 4058 var limit_mid = 55; 4059 var width = data.width ? data.width : this.env.indicator_width ? this.env.indicator_width : 100; 4060 var height = data.height ? data.height : this.env.indicator_height ? this.env.indicator_height : 24; 4061 var quota = data.percent ? Math.abs(parseInt(data.percent)) : 0; 4062 var quota_width = parseInt(quota / 100 * width); 4063 var pos = $(obj).position(); 4064 4065 this.env.indicator_width = width; 4066 this.env.indicator_height = height; 4067 4068 // overlimit 4069 if (quota_width > width) { 4070 quota_width = width; 4071 quota = 100; 4072 } 4073 4074 // main div 4075 var main = $('<div>'); 4076 main.css({position: 'absolute', top: pos.top, left: pos.left, 4077 width: width + 'px', height: height + 'px', zIndex: 100, lineHeight: height + 'px'}) 4078 .attr('title', data.title).addClass('quota_text').html(quota + '%'); 4079 // used bar 4080 var bar1 = $('<div>'); 4081 bar1.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1, 4082 width: quota_width + 'px', height: height + 'px', zIndex: 99}); 4083 // background 4084 var bar2 = $('<div>'); 4085 bar2.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1, 4086 width: width + 'px', height: height + 'px', zIndex: 98}) 4087 .addClass('quota_bg'); 4088 4089 if (quota >= limit_high) { 4090 main.addClass(' quota_text_high'); 4091 bar1.addClass('quota_high'); 4092 } 4093 else if(quota >= limit_mid) { 4094 main.addClass(' quota_text_mid'); 4095 bar1.addClass('quota_mid'); 4096 } 4097 else { 4098 main.addClass(' quota_text_normal'); 4099 bar1.addClass('quota_low'); 4100 } 4101 4102 // replace quota image 4103 obj.innerHTML = ''; 4104 $(obj).append(bar1).append(bar2).append(main); 4105 } 4047 4106 4048 4107 /********************************************************/ … … 4327 4386 rcube_webmail.prototype.removeEventListener = rcube_event_engine.prototype.removeEventListener; 4328 4387 rcube_webmail.prototype.triggerEvent = rcube_event_engine.prototype.triggerEvent; 4329 -
program/steps/mail/func.inc
rb6673c4e r7415c02 518 518 519 519 $OUTPUT->add_gui_object('quotadisplay', $attrib['id']); 520 521 return html::span($attrib, rcmail_quota_content(NULL, $attrib)); 520 521 $quota = rcmail_quota_content(NULL, $attrib); 522 523 if (is_array($quota)) { 524 $OUTPUT->add_script('$(document).ready(function(){ 525 rcmail.set_quota('.json_serialize($quota).')});', 'foot'); 526 $quota = ''; 527 } 528 529 return html::span($attrib, $quota); 522 530 } 523 531 … … 529 537 $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; 530 538 531 if (is_array($quota) && !empty($quota['used']) && !empty($quota['total'])) 532 { 533 if (!isset($quota['percent'])) 534 $quota['percent'] = $quota['used'] / $quota['total']; 535 } 536 elseif (!$IMAP->get_capability('QUOTA')) 537 return rcube_label('unknown'); 538 else 539 $quota = $IMAP->get_quota(); 539 if (empty($quota)) { 540 if (!$IMAP->get_capability('QUOTA')) 541 return rcube_label('unknown'); 542 else 543 $quota = $IMAP->get_quota(); 544 } 540 545 541 546 if ($quota && !($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited'))) 542 547 { 543 $quota_text = sprintf('%s / %s (%.0f%%)', 544 show_bytes($quota['used'] * 1024), 545 show_bytes($quota['total'] * 1024), 546 $quota['percent']); 547 548 // show quota as image (by Brett Patterson) 549 if ($display == 'image' && function_exists('imagegif')) 550 { 551 if (!$attrib['width']) 552 $attrib['width'] = isset($_SESSION['quota_width']) ? $_SESSION['quota_width'] : 100; 553 else 554 $_SESSION['quota_width'] = $attrib['width']; 555 556 if (!$attrib['height']) 557 $attrib['height'] = isset($_SESSION['quota_height']) ? $_SESSION['quota_height'] : 14; 558 else 559 $_SESSION['quota_height'] = $attrib['height']; 560 561 $quota_text = sprintf('<img src="./bin/quotaimg.php?u=%s&q=%d&w=%d&h=%d" width="%d" height="%d" alt="%s" title="%s / %s" />', 562 $quota['used'], $quota['total'], 563 $attrib['width'], $attrib['height'], 564 $attrib['width'], $attrib['height'], 565 $quota_text, 566 show_bytes($quota['used'] * 1024), 567 show_bytes($quota['total'] * 1024)); 548 $quota_result = sprintf('%s / %s (%.0f%%)', 549 show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024), 550 $quota['percent']); 551 552 if ($display == 'image') { 553 $quota_result = array( 554 'percent' => $quota['percent'], 555 'title' => $quota_result, 556 ); 557 if ($attrib['width']) 558 $quota_result['width'] = $attrib['width']; 559 if ($attrib['height']) 560 $quota_result['height'] = $attrib['height']; 568 561 } 569 562 } 570 563 else 571 $quota_text =rcube_label('unlimited');572 573 return $quota_ text;564 return rcube_label('unlimited'); 565 566 return $quota_result; 574 567 } 575 568 -
skins/default/mail.css
rc3456e9 r7415c02 840 840 } 841 841 842 #quotadisplay img 843 { 844 margin-left: 4px; 842 .quota_text { 843 text-align: center; 844 font-size: 10px; 845 color: #666; 845 846 border: 1px solid #999; 846 } 847 847 cursor: default; 848 } 849 .quota_bg { background-color: white; } 850 .quota_high { background-color: #F33131; } 851 .quota_mid { background-color: #F5AD3C; } 852 .quota_low { background-color: #91E164; } 853 .quota_text_high { color: white; } 854 .quota_text_mid { color: #666; } 855 .quota_text_low { color: #666; } 856 848 857 849 858 /** message view styles */ -
skins/default/templates/mail.html
r05d18da6 r7415c02 85 85 <roundcube:container name="listcontrols" id="listcontrols" /> 86 86 <roundcube:if condition="env:quota" /> 87 <span style="margin-left: 20px "><roundcube:label name="quota" />:</span>87 <span style="margin-left: 20px; margin-right: 5px"><roundcube:label name="quota" />:</span> 88 88 <roundcube:object name="quotaDisplay" display="image" width="100" height="14" id="quotadisplay" /> 89 89 <roundcube:endif />
Note: See TracChangeset
for help on using the changeset viewer.
