PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/Emails/javascript/composeEmailTemplate.js

https://github.com/joshbhamilton/sugarcrm_dev
JavaScript | 246 lines | 211 code | 1 blank | 34 comment | 0 complexity | ea1469e2026811ebf263d49063971fc8 MD5 | raw file
  1. /*********************************************************************************
  2. * SugarCRM Community Edition is a customer relationship management program developed by
  3. * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU Affero General Public License version 3 as published by the
  7. * Free Software Foundation with the addition of the following permission added
  8. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  9. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  10. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  15. * details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License along with
  18. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  19. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301 USA.
  21. *
  22. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  23. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  24. *
  25. * The interactive user interfaces in modified source and object code versions
  26. * of this program must display Appropriate Legal Notices, as required under
  27. * Section 5 of the GNU Affero General Public License version 3.
  28. *
  29. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  30. * these Appropriate Legal Notices must retain the display of the "Powered by
  31. * SugarCRM" logo. If the display of the logo is not reasonably feasible for
  32. * technical reasons, the Appropriate Legal Notices must display the words
  33. * "Powered by SugarCRM".
  34. ********************************************************************************/
  35. SUGAR.email2.templates['compose'] = '<div id="composeLayout{idx}" class="ylayout-inactive-content"></div>' +
  36. '<div id="composeOverFrame{idx}" style="height:100%;width:100%">' +
  37. ' <form id="emailCompose{idx}" name="ComposeEditView{idx}" action="index.php" method="POST">' +
  38. ' <input type="hidden" id="email_id{idx}" name="email_id" value="">' +
  39. ' <input type="hidden" id="uid{idx}" name="uid" value="">' +
  40. ' <input type="hidden" id="ieId{idx}" name="ieId" value="">' +
  41. ' <input type="hidden" id="mbox{idx}" name="mbox" value="">' +
  42. ' <input type="hidden" id="type{idx}" name="type" value="">' +
  43. ' <input type="hidden" id="composeLayoutId" name="composeLayoutId" value="shouldNotSeeMe">' +
  44. ' <input type="hidden" id="composeType" name="composeType">' +
  45. ' <input type="hidden" id="fromAccount" name="fromAccount">' +
  46. ' <input type="hidden" id="sendSubject" name="sendSubject">' +
  47. ' <input type="hidden" id="sendDescription" name="sendDescription">' +
  48. ' <input type="hidden" id="sendTo" name="sendTo">' +
  49. ' <input type="hidden" id="sendBcc" name="sendBcc">' +
  50. ' <input type="hidden" id="sendCc" name="sendCc">' +
  51. ' <input type="hidden" id="setEditor" name="setEditor">' +
  52. ' <input type="hidden" id="saveToSugar" name="saveToSugar">' +
  53. ' <input type="hidden" id="parent_id" name="parent_id">' +
  54. ' <input type="hidden" id="parent_type" name="parent_type">' +
  55. ' <input type="hidden" id="attachments" name="attachments">' +
  56. ' <input type="hidden" id="documents" name="documents">' +
  57. ' <input type="hidden" id="outbound_email{idx}" name="outbound_email">' +
  58. ' <input type="hidden" id="templateAttachments" name="templateAttachments">' +
  59. ' <input type="hidden" id="templateAttachmentsRemove{idx}" name="templateAttachmentsRemove">' +
  60. ' <table id="composeHeaderTable{idx}" cellpadding="0" cellspacing="0" border="0" width="100%" class="list">' +
  61. ' <tr>' +
  62. ' <th><table cellpadding="0" cellspacing="0" border="0"><tbody><tr ><td style="padding: 0px !important;margin:0px; !important" >' +
  63. ' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.sendEmail({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_send.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SEND}</button>' +
  64. ' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.saveDraft({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_save.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SAVE_DRAFT}</button>' +
  65. ' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showAttachmentPanel({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_attach.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_ATTACHMENT}</button>' +
  66. ' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showOptionsPanel({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_options.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_OPTIONS}</button>' +
  67. '</td><td style="padding: 0px !important;margin:0px; !important">&nbsp;&nbsp;{mod_strings.LBL_EMAIL_RELATE}:&nbsp;&nbsp;<select class="select" id="data_parent_type{idx}" onchange="document.getElementById(\'data_parent_name{idx}\').value=\'\';document.getElementById(\'data_parent_id{idx}\').value=\'\'; SUGAR.email2.composeLayout.enableQuickSearchRelate(\'{idx}\');" name="data_parent_type{idx}">{linkbeans_options}</select>' +
  68. '&nbsp;</td><td style="padding: 0px !important;margin:0px; !important"><input id="data_parent_id{idx}" name="data_parent_id{idx}" type="hidden" value="">' +
  69. '<input class="sqsEnabled" id="data_parent_name{idx}" name="data_parent_name{idx}" type="text" value="">&nbsp;<button type="button" class="button" onclick="SUGAR.email2.composeLayout.callopenpopupForEmail2({idx});"><img src="index.php?entryPoint=getImage&themeName=default&imageName=id-ff-select.png" align="absmiddle" border="0"></button>' +
  70. ' </td></tr></tbody></table></th>' +
  71. ' </tr>' +
  72. ' <tr>' +
  73. ' <td>' +
  74. ' <div style="margin:5px;">' +
  75. ' <table cellpadding="4" cellspacing="0" border="0" width="100%">' +
  76. ' <tr>' +
  77. ' <td class="emailUILabel" NOWRAP >' +
  78. ' {app_strings.LBL_EMAIL_FROM}:' +
  79. ' </td>' +
  80. ' <td class="emailUIField" NOWRAP>' +
  81. ' <div>' +
  82. ' &nbsp;&nbsp;<select style="width: 500px;" class="ac_input" id="addressFrom{idx}" name="addressFrom{idx}"></select>' +
  83. ' </div>' +
  84. ' </td>' +
  85. ' </tr>' +
  86. ' <tr>' +
  87. ' <td class="emailUILabel" NOWRAP>' +
  88. ' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressTO{idx}\')">' +
  89. ' {app_strings.LBL_EMAIL_TO}:' +
  90. ' </button>' +
  91. ' </td>' +
  92. ' <td class="emailUIField" NOWRAP>' +
  93. ' <div class="ac_autocomplete">' +
  94. ' &nbsp;&nbsp;<input class="ac_input" type="text" size="96" id="addressTO{idx}" name="addressTO{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
  95. ' <span class="rolloverEmail"> <a id="MoreaddressTO{idx}" href="#" style="display: none;">+<span id="DetailaddressTO{idx}">&nbsp;</span></a> </span>' +
  96. ' <div class="ac_container" id="addressToAC{idx}"></div>' +
  97. ' </div>' +
  98. ' </td>' +
  99. ' </tr>' +
  100. ' <tr id="add_addr_options_tr{idx}">' +
  101. ' <td class="emailUILabel" NOWRAP>&nbsp;</td><td class="emailUIField" valign="top" NOWRAP>&nbsp;&nbsp;<span id="cc_span{idx}"><a href="#" onclick="SE.composeLayout.showHiddenAddress(\'cc\',\'{idx}\');">{mod_strings.LBL_ADD_CC}</a></span><span id="bcc_cc_sep{idx}">&nbsp;{mod_strings.LBL_ADD_CC_BCC_SEP}&nbsp;</span><span id="bcc_span{idx}"><a href="#" onclick="SE.composeLayout.showHiddenAddress(\'bcc\',\'{idx}\');">{mod_strings.LBL_ADD_BCC}</a></span></td>'+
  102. ' </tr>'+
  103. ' <tr class="yui-hidden" id="cc_tr{idx}">' +
  104. ' <td class="emailUILabel" NOWRAP>' +
  105. ' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressCC{idx}\')">' +
  106. ' {app_strings.LBL_EMAIL_CC}:' +
  107. ' </button>' +
  108. ' </td>' +
  109. ' <td class="emailUIField" NOWRAP>' +
  110. ' <div class="ac_autocomplete">' +
  111. ' &nbsp;&nbsp;<input class="ac_input" type="text" size="96" id="addressCC{idx}" name="addressCC{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
  112. ' <span class="rolloverEmail"> <a id="MoreaddressCC{idx}" href="#" style="display: none;">+<span id="DetailaddressCC{idx}">&nbsp;</span></a> </span>' +
  113. ' <div class="ac_container" id="addressCcAC{idx}"></div>' +
  114. ' </div>' +
  115. ' </td>' +
  116. ' </tr>' +
  117. ' <tr class="yui-hidden" id="bcc_tr{idx}">' +
  118. ' <td class="emailUILabel" NOWRAP>' +
  119. ' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressBCC{idx}\')">' +
  120. ' {app_strings.LBL_EMAIL_BCC}:' +
  121. ' </button>' +
  122. ' </td>' +
  123. ' <td class="emailUIField" NOWRAP>' +
  124. ' <div class="ac_autocomplete">' +
  125. ' &nbsp;&nbsp;<input class="ac_input" type="text" size="96" id="addressBCC{idx}" name="addressBCC{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
  126. ' <span class="rolloverEmail"> <a id="MoreaddressBCC{idx}" href="#" style="display: none;">+<span id="DetailaddressBCC{idx}">&nbsp;</span></a> </span>' +
  127. ' <div class="ac_container" id="addressBccAC{idx}"></div>' +
  128. ' </div>' +
  129. ' </td>' +
  130. ' </tr>' +
  131. ' <tr>' +
  132. ' <td class="emailUILabel" NOWRAP width="1%">' +
  133. ' {app_strings.LBL_EMAIL_SUBJECT}:' +
  134. ' </td>' +
  135. ' <td class="emailUIField" NOWRAP width="99%">' +
  136. ' <div class="ac_autocomplete">' +
  137. ' &nbsp;&nbsp;<input class="ac_input" type="text" size="96" id="emailSubject{idx}" name="subject{idx}" value="">' +
  138. ' </div>' +
  139. ' </td>' +
  140. ' </tr>' +
  141. ' </table>' +
  142. ' </div>' +
  143. ' </td>' +
  144. ' </tr>' +
  145. ' </table>' +
  146. ' <textarea id="htmleditor{idx}" name="htmleditor{idx}" style="width:100%; height: 100px;"></textarea>' +
  147. ' <div id="divAttachments{idx}" class="ylayout-inactive-content">' +
  148. ' <div style="padding:5px;">' +
  149. ' <table cellpadding="2" cellspacing="0" border="0">' +
  150. ' <tr>' +
  151. ' <th>' +
  152. ' <b>{app_strings.LBL_EMAIL_ATTACHMENTS}</b>' +
  153. ' <br />' +
  154. ' &nbsp;' +
  155. ' </th>' +
  156. ' </tr>' +
  157. ' <tr>' +
  158. ' <td>' +
  159. ' <input type="button" name="add_file_button" onclick="SUGAR.email2.composeLayout.addFileField();" value="{mod_strings.LBL_ADD_FILE}" class="button" />' +
  160. ' <div id="addedFiles{idx}" name="addedFiles{idx}"></div>' +
  161. ' </td>' +
  162. ' </tr>' +
  163. ' <tr>' +
  164. ' <td>' +
  165. ' &nbsp;' +
  166. ' <br />' +
  167. ' &nbsp;' +
  168. ' </td>' +
  169. ' </tr>' +
  170. ' <tr>' +
  171. ' <th>' +
  172. ' <b>{app_strings.LBL_EMAIL_ATTACHMENTS2}</b>' +
  173. ' <br />' +
  174. ' &nbsp;' +
  175. ' </th>' +
  176. ' </tr>' +
  177. ' <tr>' +
  178. ' <td>' +
  179. ' <input type="button" name="add_document_button" onclick="SUGAR.email2.composeLayout.addDocumentField({idx});" value="{mod_strings.LBL_ADD_DOCUMENT}" class="button" />' +
  180. ' <div id="addedDocuments{idx}"></div>' + //<input name="document{idx}0" id="document{idx}0" type="hidden" /><input name="documentId{idx}0" id="documentId{idx}0" type="hidden" /><input name="documentName{idx}0" id="documentName{idx}0" disabled size="30" type="text" /><input type="button" id="documentSelect{idx}0" onclick="SUGAR.email2.selectDocument({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_SELECT}" /><input type="button" id="documentRemove{idx}0" onclick="SUGAR.email2.deleteDocumentField({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_REMOVE}" /><br /></div>' +
  181. ' </td>' +
  182. ' </tr>' +
  183. ' <tr>' +
  184. ' <td>' +
  185. ' &nbsp;' +
  186. ' <br />' +
  187. ' &nbsp;' +
  188. ' </td>' +
  189. ' </tr>' +
  190. ' <tr>' +
  191. ' <th>' +
  192. ' <div id="templateAttachmentsTitle{idx}" style="display:none"><b>{app_strings.LBL_EMAIL_ATTACHMENTS3}</b></div>' +
  193. ' <br />' +
  194. ' &nbsp;' +
  195. ' </th>' +
  196. ' </tr>' +
  197. ' <tr>' +
  198. ' <td>' +
  199. ' <div id="addedTemplateAttachments{idx}"></div>' +
  200. ' </td>' +
  201. ' </tr>' +
  202. ' </table>' +
  203. ' </div>' +
  204. ' </div>' +
  205. ' </form>' +
  206. ' <div id="divOptions{idx}" class="ylayout-inactive-content"' +
  207. ' <div style="padding:5px;">' +
  208. ' <form name="composeOptionsForm{idx}" id="composeOptionsForm{idx}">' +
  209. ' <table border="0" width="100%">' +
  210. ' <tr>' +
  211. ' <td NOWRAP style="padding:2px;">' +
  212. ' <b>{app_strings.LBL_EMAIL_TEMPLATES}:</b>' +
  213. ' </td>' +
  214. ' </tr>' +
  215. ' <tr>' +
  216. ' <td NOWRAP style="padding:2px;">' +
  217. ' <select name="email_template{idx}" id="email_template{idx}" onchange="SUGAR.email2.composeLayout.applyEmailTemplate(\'{idx}\', this.options[this.selectedIndex].value);"></select>' +
  218. ' </td>' +
  219. ' </tr>' +
  220. ' </table>' +
  221. ' <br />' +
  222. ' <table border="0" width="100%">' +
  223. ' <tr>' +
  224. ' <td NOWRAP style="padding:2px;">' +
  225. ' <b>{app_strings.LBL_EMAIL_SIGNATURES}:</b>' +
  226. ' </td>' +
  227. ' </tr>' +
  228. ' <tr>' +
  229. ' <td NOWRAP style="padding:2px;">' +
  230. ' <select name="signatures{idx}" id="signatures{idx}" onchange="SUGAR.email2.composeLayout.setSignature(\'{idx}\');"></select>' +
  231. ' </td>' +
  232. ' </tr>' +
  233. ' </table>' +
  234. ' <table border="0" width="100%">' +
  235. ' <tr>' +
  236. ' <td NOWRAP style="padding:2px;">' +
  237. ' <input type="checkbox" id="setEditor{idx}" name="setEditor{idx}" value="1" onclick="SUGAR.email2.composeLayout.renderTinyMCEToolBar(\'{idx}\', this.checked);"/>&nbsp;' +
  238. ' <b>{mod_strings.LBL_SEND_IN_PLAIN_TEXT}</b>' +
  239. ' </td>' +
  240. ' </tr>' +
  241. ' </table>' +
  242. ' </form>' +
  243. ' </div> ' +
  244. ' </div>' +
  245. '</div>';