Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / editor / htmlarea / popups / insert_image_std.php
blob6f12d9cc63d1e52572e1c2fd4641a684f0d5ad3c
1 <?php // $Id$
2 require("../../../../config.php");
4 $id = optional_param('id', SITEID, PARAM_INT);
6 require_course_login($id);
7 @header('Content-Type: text/html; charset=utf-8');
8 ?>
9 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
10 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
11 <html>
12 <head>
13 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
14 <title><?php print_string("insertimage","editor");?></title>
16 <script type="text/javascript" src="popup.js"></script>
18 <script type="text/javascript">
19 //<![CDATA[
20 var preview_window = null;
22 function Init() {
23 __dlg_init();
24 var param = window.dialogArguments;
25 if (param) {
26 var alt = param["f_url"].substring(param["f_url"].lastIndexOf('/') + 1);
27 document.getElementById("f_url").value = param["f_url"];
28 document.getElementById("f_alt").value = param["f_alt"] ? param["f_alt"] : alt;
29 document.getElementById("f_border").value = parseInt(param["f_border"] || 0);
30 document.getElementById("f_vert").value = param["f_vert"] != -1 ? param["f_vert"] : 0;
31 document.getElementById("f_horiz").value = param["f_horiz"] != -1 ? param["f_horiz"] : 0;
33 document.getElementById("f_url").focus();
36 function onOK() {
37 var required = {
38 "f_url": "<?php print_string("mustenterurl", "editor");?>",
39 "f_url": "<?php print_string("pleaseenteralt", "editor");?>"
41 for (var i in required) {
42 var el = document.getElementById(i);
43 if (!el.value) {
44 alert(required[i]);
45 el.focus();
46 return false;
49 // pass data back to the calling window
50 var fields = ["f_url", "f_alt", "f_align", "f_border",
51 "f_horiz", "f_vert"];
52 var param = new Object();
53 for (var i in fields) {
54 var id = fields[i];
55 var el = document.getElementById(id);
56 param[id] = el.value;
58 if (preview_window) {
59 preview_window.close();
61 __dlg_close(param);
62 return false;
65 function onCancel() {
66 if (preview_window) {
67 preview_window.close();
69 __dlg_close(null);
70 return false;
73 function onPreview() {
74 var f_url = document.getElementById("f_url");
75 var url = f_url.value;
76 if (!url) {
77 alert("<?php print_string("enterurlfirst","editor");?>");
78 f_url.focus();
79 return false;
81 var img = new Image();
82 img.src = url;
83 var win = null;
84 if (!document.all) {
85 win = window.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
86 } else {
87 win = window.open("about:blank", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no");
89 preview_window = win;
90 var doc = win.document;
91 var body = doc.body;
92 if (body) {
93 body.innerHTML = "";
94 body.style.padding = "0px";
95 body.style.margin = "0px";
96 var el = doc.createElement("img");
97 el.src = url;
99 var table = doc.createElement("table");
100 body.appendChild(table);
101 table.style.width = "100%";
102 table.style.height = "100%";
103 var tbody = doc.createElement("tbody");
104 table.appendChild(tbody);
105 var tr = doc.createElement("tr");
106 tbody.appendChild(tr);
107 var td = doc.createElement("td");
108 tr.appendChild(td);
109 td.style.textAlign = "center";
111 td.appendChild(el);
112 win.resizeTo(el.offsetWidth + 30, el.offsetHeight + 30);
114 win.focus();
115 return false;
117 //]]>
118 </script>
120 <style type="text/css">
121 html, body {
122 background: ButtonFace;
123 color: ButtonText;
124 font: 11px Tahoma,Verdana,sans-serif;
125 margin: 0px;
126 padding: 0px;
128 body { padding: 5px; }
129 table {
130 font: 11px Tahoma,Verdana,sans-serif;
132 form p {
133 margin-top: 5px;
134 margin-bottom: 5px;
136 .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
137 .fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
138 fieldset { padding: 0px 10px 5px 5px; }
139 select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
140 button { width: 70px; }
141 .space { padding: 2px; }
143 .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
144 border-bottom: 1px solid black; letter-spacing: 2px;
146 form { padding: 0px; margin: 0px; }
147 </style>
148 </head>
149 <body onload="Init()">
151 <div class="title"><?php print_string("insertimage","editor");?></div>
153 <form action="" method="get">
154 <table border="0" width="100%" style="padding: 0px; margin: 0px">
155 <tbody>
157 <tr>
158 <td style="width: 7em; text-align: right"><?php print_string("imageurl","editor");?>:</td>
159 <td><input type="text" name="url" id="f_url" style="width:75%"
160 title="Enter the image URL here" />
161 <button name="preview" onclick="return onPreview()"
162 title="Preview the image in a new window"><?php print_string("preview","editor");?></button>
163 </td>
164 </tr>
165 <tr>
166 <td style="width: 7em; text-align: right"><?php print_string("alternatetext","editor");?>:</td>
167 <td><input type="text" name="alt" id="f_alt" style="width:100%"
168 title="For browsers that don't support images" /></td>
169 </tr>
170 </tbody>
171 </table>
173 <p />
174 <fieldset style="float: left; margin-left: 5px;">
175 <legend><?php print_string("layout","editor");?></legend>
177 <div class="space"></div>
179 <div class="fl"><?php print_string("alignment","editor");?>:</div>
180 <select size="1" name="align" id="f_align"
181 title="Positioning of this image">
182 <option value="" ><?php print_string("notset","editor") ?></option>
183 <option value="left" ><?php print_string("left","editor") ?></option>
184 <option value="right" ><?php print_string("right","editor") ?></option>
185 <option value="texttop" ><?php print_string("texttop","editor") ?></option>
186 <option value="middle" ><?php print_string("middle","editor") ?></option>
187 <option value="baseline" selected="1" ><?php print_string("baseline","editor") ?></option>
188 <option value="absbottom" ><?php print_string("absbottom","editor") ?></option>
189 <option value="bottom" ><?php print_string("bottom","editor") ?></option>
190 <option value="middle" ><?php print_string("middle","editor") ?></option>
191 <option value="top" ><?php print_string("top","editor") ?></option>
192 </select>
194 <p />
196 <div class="fl"><?php print_string("borderthickness","editor");?>:</div>
197 <input type="text" name="border" id="f_border" size="5"
198 title="Leave empty for no border" />
200 <div class="space"></div>
202 </fieldset>
204 <fieldset style="float:right; margin-right: 5px;">
205 <legend><?php print_string("spacing","editor");?></legend>
207 <div class="space"></div>
209 <div class="fr"><?php print_string("horizontal","editor");?>:</div>
210 <input type="text" name="horiz" id="f_horiz" size="5"
211 title="Horizontal padding" />
213 <p />
215 <div class="fr"><?php print_string("vertical","editor");?>:</div>
216 <input type="text" name="vert" id="f_vert" size="5"
217 title="Vertical padding" />
219 <div class="space"></div>
221 </fieldset>
223 <div style="margin-top: 85px; text-align: right;">
224 <hr />
225 <button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor");?></button>
226 <button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button>
227 </div>
228 </form>
229 </body>
230 </html>