Commit 90379d02 authored by Gabriel Monnerat's avatar Gabriel Monnerat

2011-02-10 gabriel

* Add script ERP5Site_loadEmailThreadData to load the data of selected email. This script is used to open one email in the current page.
* Refactor ERP5Site_createNewEmailThread to do not create a new email if  it already exist one Email Thread created.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43274 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 72ba44ba
......@@ -61,7 +61,12 @@ if person and person.getEmail():\n
sender_email = person.getEmailText()\n
\n
email_thread_module = context.email_thread_module\n
email = email_thread_module.newContent(portal_type="Email Thread")\n
event_id = form.get("event_id")\n
if event_id:\n
email = context.portal_catalog.getResultValue(portal_type="Email Thread", id=event_id)\n
else:\n
email = email_thread_module.newContent(portal_type="Email Thread")\n
\n
email.setStartDate(DateTime())\n
email.setSender(sender_email)\n
email.setRecipient(form.get("to"))\n
......@@ -71,6 +76,8 @@ email.setTitle(form.get("subject"))\n
email.setTextContent(form.get("text-content"))\n
if form.get("action") == "send-mail":\n
context.portal_workflow.doActionFor(email, \'post_action\')\n
\n
return email.getId()\n
</string> </value>
</item>
<item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
\n
portal = context.getPortalObject()\n
form = context.REQUEST.form\n
\n
data_dict = {}\n
\n
email_thread_uid = form.get("email_thread_uid")\n
\n
email = portal.portal_catalog.getResultValue(portal_type="Email Thread",\n
uid=email_thread_uid)\n
\n
data_dict["subject"] = email.getTitle()\n
data_dict["to"] = email.getRecipient()\n
data_dict["cc"] = email.getCcRecipient()\n
data_dict["bcc"] = email.getBccRecipient()\n
data_dict["text_content"] = email.getTextContent()\n
data_dict["state"] = email.getValidationState()\n
data_dict["id"] = email.getId()\n
\n
return dumps(data_dict)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_loadEmailThreadData</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -216,7 +216,6 @@ div.main-right div.main-status a {\n
}\n
\n
.listbox th {\n
border-left: 1px solid #bbccff;\n
border-right: 1px solid #bbccff;\n
}\n
\n
......
......@@ -28,24 +28,46 @@
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>function saveEmailThread(event){\n
<value> <string>function loadEmailFormActions(){\n
$("button#discard-mail").click(function(){\n
window.location.reload();\n
});\n
$("span#add-cc-field").click(function(){\n
$(this).hide();\n
$("tr#cc").show();\n
});\n
$("span#add-bcc-field").click(function(){\n
$(this).hide();\n
$("tr#bcc").show();\n
});\n
}\n
\n
function saveEmailThread(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: event.currentTarget.id});\n
var divMail = $("div.compose-mail-page");\n
var eventId = divMail.data("event_uid") != undefined ? divMail.data("event_uid") : "";\n
formData.push({name: "event_id", value: eventId});\n
$.ajax({\n
type: "post",\n
url: "ERP5Site_createNewEmailThread",\n
data: formData,\n
mediaType: "json",\n
success: function(data){\n
if (event.currentTarget.id == "send-mail"){\n
$("div.compose-mail-page").removeDate("event_id");\n
var baseUrl = window.location.href.split("?")[0];\n
window.location.href = baseUrl + "?reset:int=1";\n
}\n
if (event.currentTarget.id == "save-mail"){\n
$("div.compose-mail-page").data("event_uid", data);\n
}\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
$().ready(function(){\n
......@@ -55,19 +77,8 @@ $().ready(function(){\n
$("div.main-right fieldset.widget").hide();\n
$("div.main-right").css("background-color", "#BBCCFF");\n
$("div.main-right").load("EmailThread_formView", {}, function(){\n
$("button#discard-mail").click(function(){\n
window.location.reload();\n
});\n
$("span#add-cc-field").click(function(){\n
$(this).hide();\n
$("tr#cc").show();\n
});\n
$("span#add-bcc-field").click(function(){\n
$(this).hide();\n
$("tr#bcc").show();\n
});\n
$("button#save-mail, button#send-mail").click(saveEmailThread);\n
\n
loadEmailFormActions();\n
$("button#save-mail, button#send-mail").click(saveEmailThread); \n
});\n
});\n
$("img[alt=\'mail_logo_box\']").click(function(){\n
......@@ -81,6 +92,38 @@ $().ready(function(){\n
$("input[name=\'searchable-text\']").keypress(function(event){\n
(event.which == 13) ? $("input#submit-search").click() : null;\n
});\n
$("div.listbox-body table.listbox td.listbox-table-data-cell a").click(function(event){\n
event.preventDefault();\n
var emailThreadUId = $(this).parent().parent().find("input").attr("value");\n
var emailUid = [{name: "email_thread_uid", value: emailThreadUId}];\n
$.ajax({\n
type: "post",\n
url: "ERP5Site_loadEmailThreadData",\n
data: emailUid,\n
mediaType: "json",\n
success: function(data){\n
var data = jQuery.parseJSON(data);\n
$("div.main-right fieldset.widget").hide();\n
$("div.main-right").css("background-color", "#BBCCFF");\n
$("div.main-right").load("EmailThread_formView", {}, function(){\n
if (data.state != "draft"){\n
$("button#discard-mail").hide();\n
}\n
$("button#save-mail, button#send-mail").click(saveEmailThread);\n
$(this).ready(function(){\n
(data.cc != null) ? $("textarea#cc").attr("value", data.cc) : null;\n
(data.bcc != null) ? $("textarea#bcc").attr("value", data.bcc) : null;\n
(data.to != null) ? $("textarea#to").attr("value", data.to) : null;\n
(data.text_content != null) ? $("textarea#text-content").attr("value", data.text_content) : null;\n
(data.subject != null) ? $("input#subject").attr("value", data.subject) : null;\n
(data.id != null) ? $("div.compose-mail-page").data("event_id", data.id) : null;\n
loadEmailFormActions();\n
});\n
});\n
}\n
});\n
$("div.compose-mail-page").data("event_uid", emailThreadUId);\n
});\n
});</string> </value>
</item>
<item>
......
2011-02-10 gabriel
* Add script ERP5Site_loadEmailThreadData to load the data of selected email. This script is used to open one email in the current page.
* Refactor ERP5Site_createNewEmailThread to do not create a new email if it already exist one Email Thread created.
2011-02-09 gabriel
* Add logo to UNG Mail
* Add Form to compose a new email
......
248
\ No newline at end of file
249
\ 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