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
No related merge requests found
...@@ -68,8 +68,9 @@ email.setRecipient(form.get("to"))\n ...@@ -68,8 +68,9 @@ email.setRecipient(form.get("to"))\n
email.setCcRecipient(form.get("cc"))\n email.setCcRecipient(form.get("cc"))\n
email.setBccRecipient(form.get("bcc"))\n email.setBccRecipient(form.get("bcc"))\n
email.setTitle(form.get("subject"))\n email.setTitle(form.get("subject"))\n
if form.get("action") == "send":\n email.setTextContent(form.get("text-content"))\n
context.portal_workflow.doActionFor(context, \'post_action\')\n if form.get("action") == "send-mail":\n
context.portal_workflow.doActionFor(email, \'post_action\')\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -29,18 +29,24 @@ ...@@ -29,18 +29,24 @@
<item> <item>
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string>function saveEmailThread(event){\n <value> <string>function saveEmailThread(event){\n
console.log(event);\n
event.preventDefault();\n event.preventDefault();\n
var formData = new Array();\n var formData = new Array();\n
$("div.compose-mail-page textarea, div.compose-mail-page input").each(function(){\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 formData.push({name: $(this).attr("id"), value: $(this).attr("value")});\n
});\n });\n
formData.push({name: "action", value: "save"});\n formData.push({name: "action", value: event.currentTarget.id});\n
$.ajax({\n $.ajax({\n
type: "post",\n type: "post",\n
url: "ERP5Site_createNewEmailThread",\n url: "ERP5Site_createNewEmailThread",\n
data: formData,\n data: formData,\n
mediaType: "json",\n mediaType: "json",\n
});\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
\n \n
$().ready(function(){\n $().ready(function(){\n
...@@ -61,7 +67,8 @@ $().ready(function(){\n ...@@ -61,7 +67,8 @@ $().ready(function(){\n
$(this).hide();\n $(this).hide();\n
$("tr#bcc").show();\n $("tr#bcc").show();\n
});\n });\n
$("button#save-mail").click(saveEmailThread);\n $("button#save-mail, button#send-mail").click(saveEmailThread);\n
\n
});\n });\n
});\n });\n
$("img[alt=\'mail_logo_box\']").click(function(){\n $("img[alt=\'mail_logo_box\']").click(function(){\n
......
246 247
\ No newline at end of file \ 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