diff options
author | thomascube <thomas@roundcube.net> | 2009-10-06 06:55:08 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2009-10-06 06:55:08 +0000 |
commit | 01ffe039089e08fd6faaf03f4170853defd41fc8 (patch) | |
tree | c90fab58963c2cf4cd37581372ada57c263d0eea /program/js/editor_images.js | |
parent | ffeab7fe7e0ccf1d458d6a863600359c38769950 (diff) |
Hold attachment info in a js list in order to simplify things + codestyle
Diffstat (limited to 'program/js/editor_images.js')
-rw-r--r-- | program/js/editor_images.js | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/program/js/editor_images.js b/program/js/editor_images.js index 36fc1ab59..2faafd339 100644 --- a/program/js/editor_images.js +++ b/program/js/editor_images.js @@ -1,22 +1,12 @@ var rc_client = tinyMCEPopup.getParam("rc_client"); -if (rc_client.gui_objects.attachmentlist) +if (rc_client.env.attachments) { var tinyMCEImageList = new Array(); - var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li"); - for (i = 0; i < attachElems.length; i++) + for (var id in rc_client.env.attachments) { - var liElem = attachElems[i]; - var fname = attachElems[i].id; - for (j = 0; j < liElem.childNodes.length; j++) - { - if (liElem.childNodes[j].nodeName == "#text") - { - fname = liElem.childNodes[j].nodeValue; - } - } - - if (fname.match(/\.(bmp|gif|png|jpg|jpeg)$/)) - tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]); + var att = rc_client.env.attachments[id]; + if (att.complete && att.mimetype.indexOf('image/') == 0) + tinyMCEImageList.push([att.name, rc_client.env.comm_path+'&_action=display-attachment&_file='+id]); } }; |