editor_insert_image_button.naml

<override_macro name="editor_insert_image_button">
    <n.put_in_head.>
        <script type="text/javascript">
            <![CDATA[
            Nabble.uploadImage = function() {
                Nabble.closeWindows();
                var $imgDiv = $('#image-upload');
                var isOpen = $imgDiv.css("display") != 'none';
                var alreadyLoaded = window.imageuploader && $('#image-upload-form', window.imageuploader.document).size() == 1;
                if (isOpen)
                    return;
                else if (alreadyLoaded)
                    $imgDiv.show();
                else {
                    var f = '';
                    if ($.browser.msie)
                        f += '<br style="line-height:1px"/>';
                    f += "<iframe id='imageuploader' name='imageuploader' src='/forum/UploadImage.jtp?node=" + nodeId + "' width='20em' height='20em' frameBorder='0' scrolling='no' allowtransparency='true'>";
                    $imgDiv.html(f).show();
                }
            };
            Nabble.uploadedImage = function(name,float,desc) {
                var textarea = Nabble.get(textareaID);
                var tag = '<nabble_img src="' + name + '" border="0"';
                if (float == 'left')
                    tag += ' style="float:left; margin:.4em;"';
                else if (float == 'right')
                    tag += ' style="float:right; margin:.4em;"';
                else if (float == 'center')
                    tag += ' class="center"';
                if (desc)
                    tag += ' alt="' + desc + '"';
                tag += '/>';
                this.setSelection(textarea, tag);
                textarea.focus();
                Nabble.closeWindows();
            };
            ]]>
        </script>
    </n.put_in_head.>
    <td class="nowrap has-dropdown">
        <div id="image-upload" class="editor-dropdown image-upload medium-border-color light-bg-color drop-shadow"></div>
        <button type="button" onclick="Nabble.uploadImage()" class="toolbar image-upload" title="[t]Add an image to your post[/t]">
            <img src="/images/image.png" border="0" height="12" alt="Picture" style="vertical-align:middle"/>
            <t>Insert Image</t>
        </button>
        <n.tooltip use_title="true"/>
    </td>
</override_macro>