From 01ffe039089e08fd6faaf03f4170853defd41fc8 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 6 Oct 2009 06:55:08 +0000 Subject: Hold attachment info in a js list in order to simplify things + codestyle --- program/js/editor_images.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'program/js/editor_images.js') 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]); } }; -- cgit v1.2.3