wip: UI refactoring

Fixes.

see #204
This commit is contained in:
Antoine Nguyen
2012-04-20 18:03:36 +02:00
parent fc8c36fb05
commit 934d1e6b7f
2 changed files with 12 additions and 7 deletions
+11 -5
View File
@@ -82,10 +82,11 @@ class BodyStructure(object):
params = dict(pnum=pnum, params=definition[2], cid=definition[3],
description=definition[4], encoding=definition[5],
size=definition[6])
mtype = definition[0].lower()
subtype = definition[1].lower()
mtype = "%s/%s" % (definition[0].lower(), subtype)
if mtype in ("text/plain", "text/html"):
if not self.contents.has_key(mtype):
ftype = "%s/%s" % (definition[0].lower(), subtype)
if ftype in ("text/plain", "text/html"):
if not self.contents.has_key(ftype):
self.contents[subtype] = params
return
elif multisubtype in ["related"]:
@@ -93,8 +94,13 @@ class BodyStructure(object):
return
if len(definition) > 7:
params.update(md5=definition[7], disposition=definition[8],
lang=definition[9], location=definition[10])
extensions = ["md5", "disposition", "language", "location"]
if mtype == "text":
extensions = ["textlines"] + extensions
elif ftype == "message/rfc822":
extensions = ["envelopestruct", "bodystruct", "textlines"] + extensions
for idx, value in enumerate(definition[7:]):
params[extensions[idx]] = value
self.attachments += [params]
def load_from_definition(self, definition, multisubtype=None):
+1 -2
View File
@@ -111,8 +111,7 @@ Webmail.prototype = {
$.proxy(this.sendmail, this));
$(document).on("click", "#attachments", $.proxy(function(e) {
var $div = $(e.target).parent();
modalbox(e, undefined, $div.attr("name"),
modalbox(e, undefined, $("#attachments").attr("name"),
$.proxy(this.attachments_init, this));
}, this));
},