Changeset a4c163f in github
- Timestamp:
- Apr 15, 2010 9:11:05 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 47b9294
- Parents:
- a446829
- File:
-
- 1 edited
-
program/js/app.js (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/js/app.js
rda8f11c ra4c163f 2592 2592 this.init_address_input_events($("[name='_bcc']")); 2593 2593 2594 if (!html_mode) 2594 if (!html_mode) { 2595 // add signature according to selected identity 2596 // if we have HTML editor, signature is added in callback 2597 if (input_from.attr('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '') { 2598 this.change_identity(input_from[0]); 2599 } 2595 2600 this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); 2596 2597 // add signature according to selected identity 2598 if (input_from.attr('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '' 2599 && !html_mode) { // if we have HTML editor, signature is added in callback 2600 this.change_identity(input_from[0]); 2601 } 2602 else if (!html_mode) 2603 this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); 2601 } 2604 2602 2605 2603 if (input_to.val() == '') … … 2636 2634 2637 2635 // check sender (if have no identities) 2638 if (input_from.attr('type') == 'text' && !rcube_check_email(input_from.val(), true)) 2639 { 2636 if (input_from.attr('type') == 'text' && !rcube_check_email(input_from.val(), true)) { 2640 2637 alert(this.get_label('nosenderwarning')); 2641 2638 input_from.focus(); 2642 2639 return false; 2643 }2640 } 2644 2641 2645 2642 // check for empty recipient 2646 2643 var recipients = input_to.val() ? input_to.val() : (input_cc.val() ? input_cc.val() : input_bcc.val()); 2647 if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true)) 2648 { 2644 if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true)) { 2649 2645 alert(this.get_label('norecipientwarning')); 2650 2646 input_to.focus(); 2651 2647 return false; 2652 }2648 } 2653 2649 2654 2650 // check if all files has been uploaded … … 2712 2708 2713 2709 $(this.env.spellcheck.spell_container).css('visibility', vis ? 'visible' : 'hidden'); 2714 }2710 } 2715 2711 }; 2716 2712 2717 2713 this.set_spellcheck_state = function(s) 2718 {2714 { 2719 2715 this.spellcheck_ready = (s == 'ready' || s == 'no_error_found'); 2720 2716 this.enable_command('spellcheck', this.spellcheck_ready); 2721 };2717 }; 2722 2718 2723 2719 this.set_draft_id = function(id) 2724 {2720 { 2725 2721 $("input[name='_draft_saveid']").val(id); 2726 };2722 }; 2727 2723 2728 2724 this.auto_save_start = function() 2729 {2725 { 2730 2726 if (this.env.draft_autosave) 2731 2727 this.save_timer = self.setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000); … … 2733 2729 // Unlock interface now that saving is complete 2734 2730 this.busy = false; 2735 };2731 }; 2736 2732 2737 2733 this.compose_field_hash = function(save) 2738 {2734 { 2739 2735 // check input fields 2740 2736 var value_to = $("[name='_to']").val(); … … 2767 2763 2768 2764 return str; 2769 };2765 }; 2770 2766 2771 2767 this.change_identity = function(obj, show_sig) … … 2899 2895 2900 2896 this.show_attachment_form = function(a) 2901 {2897 { 2902 2898 if (!this.gui_objects.uploadbox) 2903 2899 return false; 2904 2900 2905 2901 var elm, list; 2906 if (elm = this.gui_objects.uploadbox) 2907 { 2908 if (a && (list = this.gui_objects.attachmentlist)) 2909 { 2902 if (elm = this.gui_objects.uploadbox) { 2903 if (a && (list = this.gui_objects.attachmentlist)) { 2910 2904 var pos = $(list).offset(); 2911 2905 elm.style.top = (pos.top + list.offsetHeight + 10) + 'px'; 2912 2906 elm.style.left = pos.left + 'px'; 2913 }2907 } 2914 2908 2915 2909 $(elm).toggle(); 2916 }2910 } 2917 2911 2918 2912 // clear upload form … … 2924 2918 2925 2919 return true; 2926 };2920 }; 2927 2921 2928 2922 // upload attachment file 2929 2923 this.upload_file = function(form) 2930 {2924 { 2931 2925 if (!form) 2932 2926 return false; … … 2935 2929 var send = false; 2936 2930 for (var n=0; n<form.elements.length; n++) 2937 if (form.elements[n].type=='file' && form.elements[n].value) 2938 { 2931 if (form.elements[n].type=='file' && form.elements[n].value) { 2939 2932 send = true; 2940 2933 break; 2941 }2934 } 2942 2935 2943 2936 // create hidden iframe and post upload form 2944 if (send) 2945 { 2937 if (send) { 2946 2938 var ts = new Date().getTime(); 2947 2939 var frame_name = 'rcmupload'+ts; … … 2949 2941 // have to do it this way for IE 2950 2942 // otherwise the form will be posted to a new window 2951 if(document.all) 2952 { 2943 if (document.all) { 2953 2944 var html = '<iframe name="'+frame_name+'" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; 2954 2945 document.body.insertAdjacentHTML('BeforeEnd',html); 2955 } 2956 else // for standards-compilant browsers 2957 { 2946 } 2947 else { // for standards-compilant browsers 2958 2948 var frame = document.createElement('iframe'); 2959 2949 frame.name = frame_name; … … 2963 2953 frame.style.visibility = 'hidden'; 2964 2954 document.body.appendChild(frame); 2965 }2955 } 2966 2956 2967 2957 // handle upload errors, parsing iframe content in onload … … 3001 2991 content = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+ts+'\', \''+frame_name+'\');" href="#cancelupload"><img src="'+this.env.cancelicon+'" alt="" /></a>'+content; 3002 2992 this.add2attachment_list(ts, { name:'', html:content, complete:false }); 3003 }2993 } 3004 2994 3005 2995 // set reference to the form object 3006 2996 this.gui_objects.attachmentform = form; 3007 2997 return true; 3008 };2998 }; 3009 2999 3010 3000 // add file name to attachment list … … 3049 3039 3050 3040 this.remove_attachment = function(name) 3051 {3041 { 3052 3042 if (name && this.env.attachments[name]) 3053 3043 this.http_post('remove-attachment', '_file='+urlencode(name)); 3054 3044 3055 3045 return true; 3056 };3046 }; 3057 3047 3058 3048 this.cancel_attachment_upload = function(name, frame_name) 3059 {3049 { 3060 3050 if (!name || !frame_name) 3061 3051 return false; … … 3064 3054 $("iframe[name='"+frame_name+"']").remove(); 3065 3055 return false; 3066 };3056 }; 3067 3057 3068 3058 // send remote request to add a new contact 3069 3059 this.add_contact = function(value) 3070 {3060 { 3071 3061 if (value) 3072 3062 this.http_post('addcontact', '_address='+value); 3073 3063 3074 3064 return true; 3075 };3065 }; 3076 3066 3077 3067 // send remote request to search mail or contacts 3078 3068 this.qsearch = function(value) 3079 { 3080 if (value != '') 3081 { 3069 { 3070 if (value != '') { 3082 3071 var addurl = ''; 3083 3072 if (this.message_list) { … … 3090 3079 head_arr.push(n); 3091 3080 addurl += '&_headers='+head_arr.join(','); 3092 }3093 3081 } 3094 } else if (this.contact_list) { 3082 } 3083 } else if (this.contact_list) { 3095 3084 this.contact_list.clear(true); 3096 3085 this.show_contentframe(false); 3097 }3086 } 3098 3087 3099 3088 if (this.gui_objects.search_filter) … … 3108 3097 + (this.env.group ? '&_gid='+urlencode(this.env.group) : '') 3109 3098 + (addurl ? addurl : ''), true); 3110 }3099 } 3111 3100 return true; 3112 };3101 }; 3113 3102 3114 3103 // reset quick-search form 3115 3104 this.reset_qsearch = function() 3116 {3105 { 3117 3106 if (this.gui_objects.qsearchbox) 3118 3107 this.gui_objects.qsearchbox.value = ''; … … 3120 3109 this.env.search_request = null; 3121 3110 return true; 3122 };3111 }; 3123 3112 3124 3113 this.sent_successfully = function(type, msg) 3125 {3114 { 3126 3115 this.list_mailbox(); 3127 3116 this.display_message(msg, type, true); 3128 }3117 }; 3129 3118 3130 3119
Note: See TracChangeset
for help on using the changeset viewer.
