Commit 9525bb40 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to send mail

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43258 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a24b51a1
......@@ -68,8 +68,9 @@ email.setRecipient(form.get("to"))\n
email.setCcRecipient(form.get("cc"))\n
email.setBccRecipient(form.get("bcc"))\n
email.setTitle(form.get("subject"))\n
if form.get("action") == "send":\n
context.portal_workflow.doActionFor(context, \'post_action\')\n
email.setTextContent(form.get("text-content"))\n
if form.get("action") == "send-mail":\n
context.portal_workflow.doActionFor(email, \'post_action\')\n
</string> </value>
</item>
<item>
......
......@@ -29,18 +29,24 @@
<item>
<key> <string>raw</string> </key>
<value> <string>function saveEmailThread(event){\n
console.log(event);\n
event.preventDefault();\n
var formData = new Array();\n
$("div.compose-mail-page textarea, div.compose-mail-page input").each(function(){\n
formData.push({name: $(this).attr("id"), value: $(this).attr("value")});\n
});\n
formData.push({name: "action", value: "save"});\n
formData.push({name: "action", value: event.currentTarget.id});\n
$.ajax({\n
type: "post",\n
url: "ERP5Site_createNewEmailThread",\n
data: formData,\n
mediaType: "json",\n
});\n
if (event.currentTarget.id == "send-mail"){\n
var baseUrl = window.location.href.split("?")[0];\n
window.location.href = baseUrl + "?reset:int=1";\n
}\n
\n
}\n
\n
$().ready(function(){\n
......@@ -61,7 +67,8 @@ $().ready(function(){\n
$(this).hide();\n
$("tr#bcc").show();\n
});\n
$("button#save-mail").click(saveEmailThread);\n
$("button#save-mail, button#send-mail").click(saveEmailThread);\n
\n
});\n
});\n
$("img[alt=\'mail_logo_box\']").click(function(){\n
......
246
\ No newline at end of file
247
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment