93 lines
3.8 KiB
HTML
93 lines
3.8 KiB
HTML
|
<html>
|
||
|
<head><title>Insert Image</title>
|
||
|
<style><%include editor_dialog.css%></style>
|
||
|
<script>
|
||
|
|
||
|
var form = document.frm_image;
|
||
|
var editor = opener.dialogWindow.editor;
|
||
|
var att = editor.inlineAttachments();
|
||
|
var attachments = att[0];
|
||
|
var num_att = att[1];
|
||
|
|
||
|
var is_ie = window.opener.editor_isIE;
|
||
|
var inline_selected;
|
||
|
|
||
|
function showSource () {
|
||
|
var img_src = document.getElementById('img_src');
|
||
|
var inline = document.getElementById('inline');
|
||
|
|
||
|
img_src.style.visibility = 'visible';
|
||
|
inline.style.visibility = 'hidden';
|
||
|
|
||
|
var src_radio = document.getElementById('source_radio');
|
||
|
if (src_radio) src_radio.checked = true;
|
||
|
}
|
||
|
|
||
|
function showInline () {
|
||
|
var img_src = document.getElementById('img_src');
|
||
|
var inline = document.getElementById('inline');
|
||
|
|
||
|
img_src.style.visibility = 'hidden';
|
||
|
inline.style.visibility = 'visible';
|
||
|
|
||
|
document.getElementById('inline_radio').checked = true;
|
||
|
}
|
||
|
|
||
|
function selectInline (radio) {
|
||
|
inline_selected = radio.value;
|
||
|
}
|
||
|
|
||
|
function imageReturn () {
|
||
|
var src_radio = document.getElementById('source_radio');
|
||
|
if (!src_radio || src_radio.checked) {
|
||
|
var img = document.createElement('IMG');
|
||
|
img.src = document.getElementById('img_src').value
|
||
|
editor.returnImage(img);
|
||
|
}
|
||
|
else if (document.getElementById('inline_radio').checked) {
|
||
|
editor.returnImage(inline_selected, true);
|
||
|
}
|
||
|
window.close();
|
||
|
}
|
||
|
|
||
|
function imageCancel () {
|
||
|
window.close();
|
||
|
}
|
||
|
|
||
|
function cancelEvent (evt) {
|
||
|
if (is_ie) evt.cancelBubble = true;
|
||
|
else evt.stopPropagation();
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
<body class="body">
|
||
|
<form onsubmit="imageReturn()">
|
||
|
<script>
|
||
|
if (num_att > 0) {
|
||
|
document.write('<div style="position: absolute; left: 10px; top: 5px; height: 20px; cursor: default" onclick="showSource()"><input type="radio" id="source_radio" name="image_type" value="source" onclick="showSource()" checked style="position: relative; top: 2px"> Image Location</div>\n' +
|
||
|
'<div style="position: absolute; right: 10px; top: 5px; height: 20px; cursor: default" onclick="showInline()"><input type="radio" id="inline_radio" name="image_type" value="inline" style="position: relative; top: 2px"> Inline Image</div>\n' +
|
||
|
'<div id="source" style="position: absolute; left: 10px; top: 30px; height: 40px">\n' +
|
||
|
' <input id="img_src" name="img_source" value="http://" style="width: 300px">\n' +
|
||
|
'</div>\n');
|
||
|
|
||
|
document.write('<div id="inline" style="position: absolute; left: 10px; top: 30px; height: 40px; width: 300px; visibility: hidden; overflow: auto">\n');
|
||
|
for (i in attachments) {
|
||
|
var filename = i.replace(/"/, '"').replace(/&/, '&').replace(/>/, '>').replace(/</, '<');
|
||
|
document.write('<span style="white-space: nowrap; cursor: default" onclick="this.childNodes[0].click();"><input type="radio" name="inline_image" value="' + filename + '" onclick="selectInline(this)" style="position: relative; top: 2px"> ' + filename + '</span>\n');
|
||
|
}
|
||
|
document.write('</div>\n');
|
||
|
}
|
||
|
else {
|
||
|
document.write('<div style="position: absolute; left: 10px; top: 10px; height: 20px">Image Location:</div>\n' +
|
||
|
'<div id="source" style="position: absolute; left: 10px; top: 30px; height: 40px">\n' +
|
||
|
' <input id="img_src" name="img_source" value="http://" style="width: 300px">\n' +
|
||
|
'</div>\n');
|
||
|
}
|
||
|
document.write('<div style="position: absolute; left: 10px; top: 80px; bottom: 5px"><input type="button" class="button" onclick="imageReturn()" value="Submit"></div>\n');
|
||
|
document.write('<div style="position: absolute; right: 10px; top: 80px"><input type="button" class="button" onclick="imageCancel()" value="Cancel"></div>\n');
|
||
|
</script>
|
||
|
</form>
|
||
|
</body>
|
||
|
</html>
|