Changeset 5915 in subversion
- Timestamp:
- Feb 27, 2012 3:43:16 AM (16 months ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
program/js/app.js (modified) (2 diffs)
-
skins/default/functions.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r5914 r5915 5672 5672 this.set_quota = function(content) 5673 5673 { 5674 if (content && this.gui_objects.quotadisplay) { 5675 if (typeof content === 'object' && content.type == 'image') 5676 this.percent_indicator(this.gui_objects.quotadisplay, content); 5677 else 5678 $(this.gui_objects.quotadisplay).html(content.percent+'%').attr('title', content.title); 5679 } 5674 if (this.gui_objects.quotadisplay && content && content.type == 'text') 5675 $(this.gui_objects.quotadisplay).html(content.percent+'%').attr('title', content.title); 5676 5680 5677 this.triggerEvent('setquota', content); 5678 this.env.quota_content = content; 5681 5679 }; 5682 5680 … … 5787 5785 }; 5788 5786 5789 // percent (quota) indicator5790 this.percent_indicator = function(obj, data)5791 {5792 if (!data || !obj)5793 return false;5794 5795 var limit_high = 80,5796 limit_mid = 55,5797 width = data.width ? data.width : this.env.indicator_width ? this.env.indicator_width : 100,5798 height = data.height ? data.height : this.env.indicator_height ? this.env.indicator_height : 14,5799 quota = data.percent ? Math.abs(parseInt(data.percent)) : 0,5800 quota_width = parseInt(quota / 100 * width),5801 pos = $(obj).position();5802 5803 // workarounds for Opera and Webkit bugs5804 pos.top = Math.max(0, pos.top);5805 pos.left = Math.max(0, pos.left);5806 5807 this.env.indicator_width = width;5808 this.env.indicator_height = height;5809 5810 // overlimit5811 if (quota_width > width) {5812 quota_width = width;5813 quota = 100;5814 }5815 5816 if (data.title)5817 data.title = this.get_label('quota') + ': ' + data.title;5818 5819 // main div5820 var main = $('<div>');5821 main.css({position: 'absolute', top: pos.top, left: pos.left,5822 width: width + 'px', height: height + 'px', zIndex: 100, lineHeight: height + 'px'})5823 .attr('title', data.title).addClass('quota_text').html(quota + '%');5824 // used bar5825 var bar1 = $('<div>');5826 bar1.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1,5827 width: quota_width + 'px', height: height + 'px', zIndex: 99});5828 // background5829 var bar2 = $('<div>');5830 bar2.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1,5831 width: width + 'px', height: height + 'px', zIndex: 98})5832 .addClass('quota_bg');5833 5834 if (quota >= limit_high) {5835 main.addClass(' quota_text_high');5836 bar1.addClass('quota_high');5837 }5838 else if(quota >= limit_mid) {5839 main.addClass(' quota_text_mid');5840 bar1.addClass('quota_mid');5841 }5842 else {5843 main.addClass(' quota_text_low');5844 bar1.addClass('quota_low');5845 }5846 5847 // replace quota image5848 $(obj).html('').append(bar1).append(bar2).append(main);5849 // update #quotaimg title5850 $('#quotaimg').attr('title', data.title);5851 };5852 5787 5853 5788 /********************************************************/ -
trunk/roundcubemail/skins/default/functions.js
r5895 r5915 560 560 561 561 562 var rcmail_ui;563 564 function rcube_init_mail_ui()565 {566 rcmail_ui = new rcube_mail_ui();567 rcube_event.add_listener({ object:rcmail_ui, method:'body_mouseup', event:'mouseup' });568 rcube_event.add_listener({ object:rcmail_ui, method:'body_keydown', event:'keydown' });569 570 $('iframe').load(iframe_events)571 .contents().mouseup(function(e){rcmail_ui.body_mouseup(e)});572 573 if (rcmail.env.task == 'mail') {574 rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui);575 rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui);576 rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui);577 rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui);578 rcmail.gui_object('message_dragmenu', 'dragmessagemenu');579 580 if (rcmail.gui_objects.mailboxlist) {581 rcmail.addEventListener('responseaftermark', rcube_render_mailboxlist);582 rcmail.addEventListener('responseaftergetunread', rcube_render_mailboxlist);583 rcmail.addEventListener('responseaftercheck-recent', rcube_render_mailboxlist);584 rcmail.addEventListener('aftercollapse-folder', rcube_render_mailboxlist);585 }586 587 if (rcmail.env.action == 'compose')588 rcmail_ui.init_compose_form();589 }590 else if (rcmail.env.task == 'addressbook') {591 rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); });592 }593 }594 595 562 // Events handling in iframes (eg. preview pane) 596 563 function iframe_events() … … 672 639 } 673 640 641 function update_quota(data) 642 { 643 percent_indicator(rcmail.gui_objects.quotadisplay, data); 644 } 645 646 // percent (quota) indicator 647 function percent_indicator(obj, data) 648 { 649 if (!data || !obj) 650 return false; 651 652 var limit_high = 80, 653 limit_mid = 55, 654 width = data.width ? data.width : rcmail.env.indicator_width ? rcmail.env.indicator_width : 100, 655 height = data.height ? data.height : rcmail.env.indicator_height ? rcmail.env.indicator_height : 14, 656 quota = data.percent ? Math.abs(parseInt(data.percent)) : 0, 657 quota_width = parseInt(quota / 100 * width), 658 pos = $(obj).position(); 659 660 // workarounds for Opera and Webkit bugs 661 pos.top = Math.max(0, pos.top); 662 pos.left = Math.max(0, pos.left); 663 664 rcmail.env.indicator_width = width; 665 rcmail.env.indicator_height = height; 666 667 // overlimit 668 if (quota_width > width) { 669 quota_width = width; 670 quota = 100; 671 } 672 673 if (data.title) 674 data.title = rcmail.get_label('quota') + ': ' + data.title; 675 676 // main div 677 var main = $('<div>'); 678 main.css({position: 'absolute', top: pos.top, left: pos.left, 679 width: width + 'px', height: height + 'px', zIndex: 100, lineHeight: height + 'px'}) 680 .attr('title', data.title).addClass('quota_text').html(quota + '%'); 681 // used bar 682 var bar1 = $('<div>'); 683 bar1.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1, 684 width: quota_width + 'px', height: height + 'px', zIndex: 99}); 685 // background 686 var bar2 = $('<div>'); 687 bar2.css({position: 'absolute', top: pos.top + 1, left: pos.left + 1, 688 width: width + 'px', height: height + 'px', zIndex: 98}) 689 .addClass('quota_bg'); 690 691 if (quota >= limit_high) { 692 main.addClass(' quota_text_high'); 693 bar1.addClass('quota_high'); 694 } 695 else if(quota >= limit_mid) { 696 main.addClass(' quota_text_mid'); 697 bar1.addClass('quota_mid'); 698 } 699 else { 700 main.addClass(' quota_text_low'); 701 bar1.addClass('quota_low'); 702 } 703 704 // replace quota image 705 $(obj).html('').append(bar1).append(bar2).append(main); 706 // update #quotaimg title 707 $('#quotaimg').attr('title', data.title); 708 } 709 674 710 // Optional parameters used by TinyMCE 675 711 var rcmail_editor_settings = { … … 677 713 skin_variant : "" // "", "silver", "black" 678 714 }; 715 716 var rcmail_ui; 717 718 function rcube_init_mail_ui() 719 { 720 rcmail_ui = new rcube_mail_ui(); 721 rcube_event.add_listener({ object:rcmail_ui, method:'body_mouseup', event:'mouseup' }); 722 rcube_event.add_listener({ object:rcmail_ui, method:'body_keydown', event:'keydown' }); 723 724 if (rcmail.env.quota_content) 725 update_quota(rcmail.env.quota_content); 726 rcmail.addEventListener('setquota', update_quota); 727 728 $('iframe').load(iframe_events) 729 .contents().mouseup(function(e){rcmail_ui.body_mouseup(e)}); 730 731 if (rcmail.env.task == 'mail') { 732 rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui); 733 rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); 734 rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); 735 rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); 736 rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 737 738 if (rcmail.gui_objects.mailboxlist) { 739 rcmail.addEventListener('responseaftermark', rcube_render_mailboxlist); 740 rcmail.addEventListener('responseaftergetunread', rcube_render_mailboxlist); 741 rcmail.addEventListener('responseaftercheck-recent', rcube_render_mailboxlist); 742 rcmail.addEventListener('aftercollapse-folder', rcube_render_mailboxlist); 743 } 744 745 if (rcmail.env.action == 'compose') 746 rcmail_ui.init_compose_form(); 747 } 748 else if (rcmail.env.task == 'addressbook') { 749 rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); }); 750 } 751 }
Note: See TracChangeset
for help on using the changeset viewer.
