From cb12e1b2b328706dea73c91412301c8cbe991887 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 2 Dec 2008 01:04:22 -0700 Subject: [PATCH] Fix JS error. --- imp/js/compose.js | 2 +- imp/js/src/compose.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/imp/js/compose.js b/imp/js/compose.js index 76fbae225..035ce1309 100644 --- a/imp/js/compose.js +++ b/imp/js/compose.js @@ -1 +1 @@ -var display_unload_warning=true,textarea_ready=true;function confirmCancel(A){if(window.confirm(IMP.text.compose_cancel)){display_unload_warning=false;if(popup){if(cancel_url){self.location=cancel_url}else{self.close()}}else{window.location=cancel_url}return true}else{Event.extend(A);A.stop();return false}}function setCursorPosition(C,A){if(C.setSelectionRange){Field.focus(C);C.setSelectionRange(A,A)}else{if(C.createTextRange){var B=C.createTextRange();B.collapse(true);B.moveStart("character",A);B.moveEnd("character",0);Field.select(B);B.scrollIntoView(true)}}}function redirectSubmit(A){if($F("to")==""){alert(IMP.text.compose_recipient);$("to").focus();Event.extend(A);A.stop();return false}$("redirect").setStyle({cursor:"wait"});display_unload_warning=false;return true}function change_identity(A){var L=identities[$F("last_identity")],D=identities[A],B,E,G,K;if(rtemode){E=FCKeditorAPI.GetInstance("message");B=E.GetHTML.replace(/\r\n/g,"\n");G="

";K="

"+D[0].replace(/^ ?
\n/,"").replace(/ +/g," ")+"

";B=B.replace(/

\s*[\s\S]*?\s*<\/p>/,G)}else{B=$F("message").replace(/\r\n/g,"\n");G=L[0].replace(/^\n/,"");K=D[0].replace(/^\n/,"")}var J=(L[1])?B.indexOf(G):B.lastIndexOf(G);if(J!=-1){if(D[1]==L[1]){B=B.substring(0,J)+K+B.substring(J+G.length,B.length)}else{if(D[1]){B=K+B.substring(0,J)+B.substring(J+G.length,B.length)}else{B=B.substring(0,J)+B.substring(J+G.length,B.length)+K}}B=B.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n");$("last_identity").setValue(A);window.status=IMP.text.compose_sigreplace}else{window.status=IMP.text.compose_signotreplace}if(rtemode){E.SetHTML(B)}else{$("message").setValue(B)}var I=$("sent_mail_folder");if(smf_check){var C=0;$A(I.options).detect(function(N){if(N.value==D[2]){I.selectedIndex=C;return true}++C})}else{if(I.firstChild){I.replaceChild(document.createTextNode(D[2]),I.firstChild)}else{I.appendChild(document.createTextNode(D[2]))}}var H=$("ssm");if(H){H.checked=D[3]}var F=$("bcc");if(F){bccval=F.value;if(L[4]){var M=new RegExp(L[4]+",? ?","gi");bccval=bccval.replace(M,"");if(bccval){bccval=bccval.replace(/, ?$/,"")}}if(D[4]){if(bccval){bccval+=", "}bccval+=D[4]}F.setValue(bccval)}}function uniqSubmit(B,A){if(A){Event.extend(A);A.stop()}if(B=="send_message"){if(($F("subject")=="")&&!window.confirm(IMP.text.compose_nosubject)){return}if(compose_spellcheck&&IMP.SpellCheckerObject&&!IMP.SpellCheckerObject.isActive()){IMP.SpellCheckerObject.spellCheck();return}}if(IMP.SpellCheckerObject){IMP.SpellCheckerObject.resume()}if(!Prototype.Browser.WebKit){$("compose").setStyle({cursor:"wait"})}display_unload_warning=false;$("actionID").setValue(B);_uniqSubmit()}function _uniqSubmit(){if(textarea_ready){$("compose").submit()}else{_uniqSubmit.defer()}}function attachmentChanged(){var A=[],E=0;$("upload_atc").select('input[type="file"]').each(function(G){A[A.length]=G});if(max_attachments!==null&&A.length==max_attachments){return}A.each(function(G){if(G.value.length>0){E++}});if(E==A.length){var D=$("attachment_row_"+E);if(D){var F=new Element("TD",{align:"left"}).insert(new Element("STRONG").insert(IMP.text.compose_file+" "+(E+1)+":")).insert(" ");var C=new Element("INPUT",{type:"file",name:"upload_"+(E+1),size:25});C.observe("change",attachmentChanged);F.insert(C);var B=new Element("TR",{id:"attachment_row_"+(E+1)}).insert(F).insert(new Element("TD",{align:"left"}).insert(select));D.parentNode.insertBefore(B,D.nextSibling)}}}function initializeSpellChecker(){if(typeof IMP.SpellCheckerObject!="object"){initializeSpellChecker.defer();return}IMP.SpellCheckerObject.onBeforeSpellCheck=function(){IMP.SpellCheckerObject.htmlAreaParent="messageParent";IMP.SpellCheckerObject.htmlArea=$("message").adjacent("iframe[id*=message]").first();$("message").setValue(FCKeditorAPI.GetInstance("message").GetHTML());textarea_ready=false};IMP.SpellCheckerObject.onAfterSpellCheck=function(){IMP.SpellCheckerObject.htmlArea=IMP.SpellCheckerObject.htmlAreaParent=null;var A=FCKeditorAPI.GetInstance("message");A.SetHTML($("message").value);A.Events.AttachEvent("OnAfterSetHTML",function(){textarea_ready=true})}}document.observe("dom:loaded",function(){$$("INPUT").each(function(A){if(A.type!="submit"&&A.type!="button"){A.observe("keydown",function(B){if(B.keyCode==10||B.keyCode==Event.KEY_RETURN){B.stop();return false}})}});if(cursor_pos!==null&&$("message")){setCursorPosition($("message"),cursor_pos)}if(redirect){$("to").focus()}else{if(Prototype.Browser.IE){$("subject").observe("keydown",function(A){if(A.keyCode==Event.KEY_TAB&&!A.shiftKey){A.stop();$("message").focus()}})}if(rtemode){initializeSpellChecker()}if($("to")&&!$F("to")){$("to").focus()}else{if(!$F("subject")){if(rtemode){$("subject").focus()}else{$("message").focus()}}}}});Event.observe(window,"load",function(){if(compose_popup&&!reloaded){var B,A=redirect?$("redirect"):$("compose");B=Math.min(A.getHeight(),screen.height-100)-document.viewport.getHeight();if(B>0){window.resizeBy(0,B)}}});Event.observe(window,"beforeunload",function(){if(display_unload_warning){return IMP.text.compose_discard}}); \ No newline at end of file +var display_unload_warning=true,textarea_ready=true;function confirmCancel(A){if(window.confirm(IMP.text.compose_cancel)){display_unload_warning=false;if(popup){if(cancel_url){self.location=cancel_url}else{self.close()}}else{window.location=cancel_url}return true}else{Event.extend(A);A.stop();return false}}function setCursorPosition(C,A){if(C.setSelectionRange){Field.focus(C);C.setSelectionRange(A,A)}else{if(C.createTextRange){var B=C.createTextRange();B.collapse(true);B.moveStart("character",A);B.moveEnd("character",0);Field.select(B);B.scrollIntoView(true)}}}function redirectSubmit(A){if($F("to")==""){alert(IMP.text.compose_recipient);$("to").focus();Event.extend(A);A.stop();return false}$("redirect").setStyle({cursor:"wait"});display_unload_warning=false;return true}function change_identity(A){var L=identities[$F("last_identity")],D=identities[A],B,E,G,K;if(rtemode){E=FCKeditorAPI.GetInstance("message");B=E.GetHTML.replace(/\r\n/g,"\n");G="

";K="

"+D[0].replace(/^ ?
\n/,"").replace(/ +/g," ")+"

";B=B.replace(/

\s*[\s\S]*?\s*<\/p>/,G)}else{B=$F("message").replace(/\r\n/g,"\n");G=L[0].replace(/^\n/,"");K=D[0].replace(/^\n/,"")}var J=(L[1])?B.indexOf(G):B.lastIndexOf(G);if(J!=-1){if(D[1]==L[1]){B=B.substring(0,J)+K+B.substring(J+G.length,B.length)}else{if(D[1]){B=K+B.substring(0,J)+B.substring(J+G.length,B.length)}else{B=B.substring(0,J)+B.substring(J+G.length,B.length)+K}}B=B.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n");$("last_identity").setValue(A);window.status=IMP.text.compose_sigreplace}else{window.status=IMP.text.compose_signotreplace}if(rtemode){E.SetHTML(B)}else{$("message").setValue(B)}var I=$("sent_mail_folder");if(smf_check){var C=0;$A(I.options).detect(function(N){if(N.value==D[2]){I.selectedIndex=C;return true}++C})}else{if(I.firstChild){I.replaceChild(document.createTextNode(D[2]),I.firstChild)}else{I.appendChild(document.createTextNode(D[2]))}}var H=$("ssm");if(H){H.checked=D[3]}var F=$("bcc");if(F){bccval=F.value;if(L[4]){var M=new RegExp(L[4]+",? ?","gi");bccval=bccval.replace(M,"");if(bccval){bccval=bccval.replace(/, ?$/,"")}}if(D[4]){if(bccval){bccval+=", "}bccval+=D[4]}F.setValue(bccval)}}function uniqSubmit(B,A){if(A){Event.extend(A);A.stop()}if(B=="send_message"){if(($F("subject")=="")&&!window.confirm(IMP.text.compose_nosubject)){return}if(compose_spellcheck&&IMP.SpellCheckerObject&&!IMP.SpellCheckerObject.isActive()){IMP.SpellCheckerObject.spellCheck();return}}if(IMP.SpellCheckerObject){IMP.SpellCheckerObject.resume()}if(!Prototype.Browser.WebKit){$("compose").setStyle({cursor:"wait"})}display_unload_warning=false;$("actionID").setValue(B);_uniqSubmit()}function _uniqSubmit(){if(textarea_ready){$("compose").submit()}else{_uniqSubmit.defer()}}function attachmentChanged(){var A=[],E=0;$("upload_atc").select('input[type="file"]').each(function(G){A[A.length]=G});if(max_attachments!==null&&A.length==max_attachments){return}A.each(function(G){if(G.value.length>0){E++}});if(E==A.length){var D=$("attachment_row_"+E);if(D){var F=new Element("TD",{align:"left"}).insert(new Element("STRONG").insert(IMP.text.compose_file+" "+(E+1)+":")).insert(" ");var C=new Element("INPUT",{type:"file",name:"upload_"+(E+1),size:25});C.observe("change",attachmentChanged);F.insert(C);var B=new Element("TR",{id:"attachment_row_"+(E+1)}).insert(F);D.parentNode.insertBefore(B,D.nextSibling)}}}function initializeSpellChecker(){if(typeof IMP.SpellCheckerObject!="object"){initializeSpellChecker.defer();return}IMP.SpellCheckerObject.onBeforeSpellCheck=function(){IMP.SpellCheckerObject.htmlAreaParent="messageParent";IMP.SpellCheckerObject.htmlArea=$("message").adjacent("iframe[id*=message]").first();$("message").setValue(FCKeditorAPI.GetInstance("message").GetHTML());textarea_ready=false};IMP.SpellCheckerObject.onAfterSpellCheck=function(){IMP.SpellCheckerObject.htmlArea=IMP.SpellCheckerObject.htmlAreaParent=null;var A=FCKeditorAPI.GetInstance("message");A.SetHTML($("message").value);A.Events.AttachEvent("OnAfterSetHTML",function(){textarea_ready=true})}}document.observe("dom:loaded",function(){$$("INPUT").each(function(A){if(A.type!="submit"&&A.type!="button"){A.observe("keydown",function(B){if(B.keyCode==10||B.keyCode==Event.KEY_RETURN){B.stop();return false}})}});if(cursor_pos!==null&&$("message")){setCursorPosition($("message"),cursor_pos)}if(redirect){$("to").focus()}else{if(Prototype.Browser.IE){$("subject").observe("keydown",function(A){if(A.keyCode==Event.KEY_TAB&&!A.shiftKey){A.stop();$("message").focus()}})}if(rtemode){initializeSpellChecker()}if($("to")&&!$F("to")){$("to").focus()}else{if(!$F("subject")){if(rtemode){$("subject").focus()}else{$("message").focus()}}}}});Event.observe(window,"load",function(){if(compose_popup&&!reloaded){var B,A=redirect?$("redirect"):$("compose");B=Math.min(A.getHeight(),screen.height-100)-document.viewport.getHeight();if(B>0){window.resizeBy(0,B)}}});Event.observe(window,"beforeunload",function(){if(display_unload_warning){return IMP.text.compose_discard}}); \ No newline at end of file diff --git a/imp/js/src/compose.js b/imp/js/src/compose.js index 5102ab177..f015ac89d 100644 --- a/imp/js/src/compose.js +++ b/imp/js/src/compose.js @@ -237,7 +237,7 @@ function attachmentChanged() file.observe('change', attachmentChanged); td.insert(file); - var newRow = new Element('TR', { id: 'attachment_row_' + (usedFields + 1) }).insert(td).insert(new Element('TD', { align: 'left' }).insert(select)); + var newRow = new Element('TR', { id: 'attachment_row_' + (usedFields + 1) }).insert(td); lastRow.parentNode.insertBefore(newRow, lastRow.nextSibling); } -- 2.11.0