1 | <html style="width: 398; height: 243">
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
|
---|
5 | <title>Insert Image</title>
|
---|
6 |
|
---|
7 | <script type="text/javascript" src="popup.js"></script>
|
---|
8 |
|
---|
9 | <script type="text/javascript">
|
---|
10 | var preview_window = null;
|
---|
11 |
|
---|
12 | function Init() {
|
---|
13 | __dlg_init();
|
---|
14 | document.getElementById("f_url").focus();
|
---|
15 | };
|
---|
16 |
|
---|
17 | function onOK() {
|
---|
18 | var required = {
|
---|
19 | "f_url": "You must enter the URL",
|
---|
20 | "f_alt": "Please enter the alternate text"
|
---|
21 | };
|
---|
22 | for (var i in required) {
|
---|
23 | var el = document.getElementById(i);
|
---|
24 | if (!el.value) {
|
---|
25 | alert(required[i]);
|
---|
26 | el.focus();
|
---|
27 | return false;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | // pass data back to the calling window
|
---|
31 | var fields = ["f_url", "f_alt", "f_align", "f_border",
|
---|
32 | "f_horiz", "f_vert"];
|
---|
33 | var param = new Object();
|
---|
34 | for (var i in fields) {
|
---|
35 | var id = fields[i];
|
---|
36 | var el = document.getElementById(id);
|
---|
37 | param[id] = el.value;
|
---|
38 | }
|
---|
39 | if (preview_window) {
|
---|
40 | preview_window.close();
|
---|
41 | }
|
---|
42 | __dlg_close(param);
|
---|
43 | return false;
|
---|
44 | };
|
---|
45 |
|
---|
46 | function onCancel() {
|
---|
47 | if (preview_window) {
|
---|
48 | preview_window.close();
|
---|
49 | }
|
---|
50 | __dlg_close(null);
|
---|
51 | return false;
|
---|
52 | };
|
---|
53 |
|
---|
54 | function onPreview() {
|
---|
55 | var f_url = document.getElementById("f_url");
|
---|
56 | var url = f_url.value;
|
---|
57 | if (!url) {
|
---|
58 | alert("You have to enter an URL first");
|
---|
59 | f_url.focus();
|
---|
60 | return false;
|
---|
61 | }
|
---|
62 | // var img = new Image();
|
---|
63 | // img.src = url;
|
---|
64 | var win = null;
|
---|
65 | if (!document.all) {
|
---|
66 | win = window.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,scrollbars=yes,resizable=yes");
|
---|
67 | } else {
|
---|
68 | win = window.open("about:blank", "ha_imgpreview", "channelmode=no,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
|
---|
69 | }
|
---|
70 | win.document.write("<html><head></head><body>\n");
|
---|
71 | win.document.write("<table border=0><tr><td>\n");
|
---|
72 | win.document.write("<img noborder src='"+url+"'>\n");
|
---|
73 | win.document.write("</td></tr></table>\n");
|
---|
74 | win.document.write("</body></html>\n");
|
---|
75 | win.focus();
|
---|
76 | return false;
|
---|
77 | };
|
---|
78 |
|
---|
79 | function onChange() {
|
---|
80 | var f_attlist = document.getElementById('f_attlist');
|
---|
81 | var f_url = document.getElementById('f_url');
|
---|
82 | var f_alt = document.getElementById('f_alt');
|
---|
83 |
|
---|
84 | var i=f_attlist.options.selectedIndex;
|
---|
85 |
|
---|
86 | f_url.value=f_attlist.options[i].value;
|
---|
87 | if (f_url.value == "") {
|
---|
88 | f_alt.value = "";
|
---|
89 | } else {
|
---|
90 | f_alt.value=f_attlist.options[i].text;
|
---|
91 | }
|
---|
92 | return true;
|
---|
93 | };
|
---|
94 | </script>
|
---|
95 |
|
---|
96 | <style type="text/css">
|
---|
97 | html, body {
|
---|
98 | background: ButtonFace;
|
---|
99 | color: ButtonText;
|
---|
100 | font: 11px Tahoma,Verdana,sans-serif;
|
---|
101 | margin: 0px;
|
---|
102 | padding: 0px;
|
---|
103 | }
|
---|
104 | body { padding: 5px; }
|
---|
105 | table {
|
---|
106 | font: 11px Tahoma,Verdana,sans-serif;
|
---|
107 | }
|
---|
108 | form p {
|
---|
109 | margin-top: 5px;
|
---|
110 | margin-bottom: 5px;
|
---|
111 | }
|
---|
112 | .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
|
---|
113 | .fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
|
---|
114 | fieldset { padding: 0px 10px 5px 5px; }
|
---|
115 | select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
---|
116 | button { width: 70px; }
|
---|
117 | .space { padding: 2px; }
|
---|
118 |
|
---|
119 | .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
---|
120 | border-bottom: 1px solid black; letter-spacing: 2px;
|
---|
121 | }
|
---|
122 | form { padding: 0px; margin: 0px; }
|
---|
123 | </style>
|
---|
124 |
|
---|
125 | </head>
|
---|
126 |
|
---|
127 | <body onload="Init()">
|
---|
128 |
|
---|
129 | <div class="title">Insert Image</div>
|
---|
130 |
|
---|
131 | <form action="" method="get">
|
---|
132 | <table border="0" width="100%" style="padding: 0px; margin: 0px">
|
---|
133 | <tbody>
|
---|
134 |
|
---|
135 | <tr>
|
---|
136 | <td style="width: 7em; text-align: right">Attachments:</td>
|
---|
137 | <td><select name="attlist" id="f_attlist"
|
---|
138 | onchange="return onChange();" style="witdth:100%">
|
---|
139 | <option selected value="">-- Not selected --
|
---|
140 | </select>
|
---|
141 | </td>
|
---|
142 | </tr>
|
---|
143 | <tr>
|
---|
144 | <td style="width: 7em; text-align: right">Image URL:</td>
|
---|
145 | <td><input type="text" name="url" id="f_url" style="width:75%"
|
---|
146 | title="Enter the image URL here" />
|
---|
147 | <button name="preview" onclick="return onPreview();"
|
---|
148 | title="Preview the image in a new window">Preview</button>
|
---|
149 | </td>
|
---|
150 | </tr>
|
---|
151 | <tr>
|
---|
152 | <td style="width: 7em; text-align: right">Alternate text:</td>
|
---|
153 | <td><input type="text" name="alt" id="f_alt" style="width:100%"
|
---|
154 | title="For browsers that don't support images" /></td>
|
---|
155 | </tr>
|
---|
156 |
|
---|
157 | </tbody>
|
---|
158 | </table>
|
---|
159 |
|
---|
160 | <p />
|
---|
161 |
|
---|
162 | <fieldset style="float: left; margin-left: 5px;">
|
---|
163 | <legend>Layout</legend>
|
---|
164 |
|
---|
165 | <div class="space"></div>
|
---|
166 |
|
---|
167 | <div class="fl">Alignment:</div>
|
---|
168 | <select size="1" name="align" id="f_align"
|
---|
169 | title="Positioning of this image">
|
---|
170 | <option value="" >Not set</option>
|
---|
171 | <option value="left" >Left</option>
|
---|
172 | <option value="right" >Right</option>
|
---|
173 | <option value="texttop" >Texttop</option>
|
---|
174 | <option value="absmiddle" >Absmiddle</option>
|
---|
175 | <option value="baseline" selected="1" >Baseline</option>
|
---|
176 | <option value="absbottom" >Absbottom</option>
|
---|
177 | <option value="bottom" >Bottom</option>
|
---|
178 | <option value="middle" >Middle</option>
|
---|
179 | <option value="top" >Top</option>
|
---|
180 | </select>
|
---|
181 |
|
---|
182 | <p />
|
---|
183 |
|
---|
184 | <div class="fl">Border thickness:</div>
|
---|
185 | <input type="text" name="border" id="f_border" size="5"
|
---|
186 | title="Leave empty for no border" />
|
---|
187 |
|
---|
188 | <div class="space"></div>
|
---|
189 |
|
---|
190 | </fieldset>
|
---|
191 |
|
---|
192 | <fieldset style="float:right; margin-right: 5px;">
|
---|
193 | <legend>Spacing</legend>
|
---|
194 |
|
---|
195 | <div class="space"></div>
|
---|
196 |
|
---|
197 | <div class="fr">Horizontal:</div>
|
---|
198 | <input type="text" name="horiz" id="f_horiz" size="5"
|
---|
199 | title="Horizontal padding" />
|
---|
200 |
|
---|
201 | <p />
|
---|
202 |
|
---|
203 | <div class="fr">Vertical:</div>
|
---|
204 | <input type="text" name="vert" id="f_vert" size="5"
|
---|
205 | title="Vertical padding" />
|
---|
206 |
|
---|
207 | <div class="space"></div>
|
---|
208 |
|
---|
209 | </fieldset>
|
---|
210 |
|
---|
211 | <div style="margin-top: 85px; text-align: right;">
|
---|
212 | <hr />
|
---|
213 | <button type="button" name="ok" onclick="return onOK();">OK</button>
|
---|
214 | <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
---|
215 | </div>
|
---|
216 |
|
---|
217 | </form>
|
---|
218 |
|
---|
219 | <script type="text/javascript">
|
---|
220 | var tid;
|
---|
221 | function init_attlist () {
|
---|
222 | var options=window.dialogArguments;
|
---|
223 | var sel=document.getElementById("f_attlist");
|
---|
224 | if (options) {
|
---|
225 | for (var i in options) {
|
---|
226 | if ( i.match(/\.(jpg|jpeg|gif|png|bmp)$/i) ) {
|
---|
227 | var op = document.createElement("option");
|
---|
228 | op.appendChild(document.createTextNode(i));
|
---|
229 | op.value = options[i];
|
---|
230 | sel.appendChild(op);
|
---|
231 | }
|
---|
232 | }
|
---|
233 | }
|
---|
234 | clearTimeout(tid);
|
---|
235 | }
|
---|
236 | // delay 0.1 sec to ensure attlist has been loaded by Init at body onload
|
---|
237 | tid=setTimeout("init_attlist()", 100);
|
---|
238 | </script>
|
---|
239 | </body>
|
---|
240 | </html>
|
---|