At last, composing messages with attachments is possible!!

It is a really simple implementation but I think it will be enough for a begining. Users can add multiple attachments with a message, each attachment must not be larger than a customizable limit.

see #38
This commit is contained in:
Antoine Nguyen
2011-09-08 09:13:13 +02:00
parent b33e6c0b25
commit 9ddb27573f
21 changed files with 710 additions and 163 deletions
@@ -0,0 +1,32 @@
#attachment_list {
border: 1px solid #ccc;
background-color: #eee;
position: absolute;
top: 140px;
left: 20px;
right: 20px;
bottom: 35px;
overflow-x: hidden;
overflow-y: auto;
padding: 2px;
}
#upload_status {
position: relative;
margin: 0 auto;
font-size: 0.9em;
width: 120px;
font-style: italic;
}
#done_container {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
img {
float: left;
margin-right: 5px;
}
+75 -9
View File
@@ -12,6 +12,29 @@ html > body #listing {
bottom: 35px;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
overflow: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
html[xmlns] .clearfix {
display: block;
}
* html .clearfix {
height: 1%;
overflow: visible;
}
/*thead tr {
position: relative;
top: expression(offsetParent.scrollTop);
@@ -66,27 +89,63 @@ ul.visible {
/* Compose mail page */
#compose-container {
margin: 0 auto;
width: 100%;
/*margin: 0 auto;*/
/*width: 100%;*/
position: absolute;
left: 0px;
right: 10px;
top: 0;
bottom: 0;
}
#attachments {
position: relative;
border: 1px solid #cccccc;
background-color: #eee;
margin-bottom: 5px;
padding: 5px 0;
cursor: pointer;
}
#attachments img {
float: left;
}
#list {
position: absolute;
top: 5px;
left: 130px;
font-weight: bold;
}
.shortlist {
font-weight: normal !important;
font-style: italic;
}
div.row {
margin: 3px;
clear: both;
width: 100%;
height: 40px;
margin: 5px 0;
}
div.row label {
float: left;
width: 120px;
font-size: small;
padding: 3px 0;
}
div.input_container {
position: absolute;
left: 130px;
right: 0;
}
textarea {
border: 1px solid #cccccc;
background-color: #eee;
width: 80%;
height: 30px;
width: 100%;
height: 40px;
word-wrap: break-word;
}
@@ -96,15 +155,22 @@ textarea:hover {
#id_body {
background: white;
width: 98%;
/*width: 98%;*/
position: absolute;
left: 0;
right: 10px;
}
#mailheader input {
width: 80%;
width: 100%;
padding: 0;
height: 20px;
clear: both;
}
#mailheader {
position: relative;
padding-bottom: 5px;
}
+2 -1
View File
@@ -33,7 +33,8 @@ var FdMenu = new Class({
evt.stop();
SqueezeBox.open(evt.target.get("href"), {
handler: "iframe",
size: {x: 350, y: 400}
size: {x: 350, y: 400},
closeBtn: true
});
$(document.body).fireEvent("click");
});
+45 -22
View File
@@ -86,6 +86,38 @@ function resize_window_callback(event) {
setDivHeight("id_body", $("mailheader").getSize().y, 0);
}
/*
* Callback of the 'sendmail' action.
*/
function sendmail_callback(evt) {
evt.stop();
infobox.show(gettext("Sending..."), {
profile : "gray",
spinner : true
});
disable_link(this);
$("composemail").set("send", {
onSuccess: function(resp) {
resp = JSON.decode(resp);
if (resp.status == "ko") {
current_anchor.get_callback("compose")(resp);
if ($defined(resp.respmsg)) {
infobox.error(resp.respmsg);
}
enable_link(this, sendmail_callback);
return;
}
current_anchor.parse_string(resp.url, true).setparams(navparams);
current_anchor.update();
this.eliminate("editormode");
}.bind(this)
});
if (this.retrieve("editormode") == "html") {
CKEDITOR.instances[editorid].updateElement();
}
$("composemail").send();
}
/*
* Callback of the 'compose' action
*/
@@ -108,33 +140,24 @@ function compose_callback(resp) {
height: $(editorid).getSize().y
});
}
if (resp.id) {
current_anchor.setparam("id", resp.id).update(0, 1);
}
$("attachments").addEvent("click", function(evt) {
SqueezeBox.open(this.get("name"), {
handler: "iframe",
size: {x: 350, y: 400},
closeBtn: false
});
});
$$("a[name=back]")
.removeEvents("click")
.addEvent("click", loadFolder);
$$("a[name=sendmail]")
.store("editormode", editormode)
.removeEvents("click")
.addEvent("click", function(evt) {
evt.stop();
$("composemail").set("send", {
onSuccess: function(resp) {
resp = JSON.decode(resp);
if (resp.status == "ko") {
current_anchor.get_callback("compose")(resp);
if ($defined(resp.error)) {
infobox.error(resp.error);
}
return;
}
current_anchor.parse_string(resp.url, true).setparams(navparams);
current_anchor.update();
}
});
if (editormode == "html") {
CKEDITOR.instances[editorid].updateElement();
}
$("composemail").send();
});
.addEvent("click", sendmail_callback);
}
/*