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');
9 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
10 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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">
20 var preview_window
= null;
24 var param
= window
.dialogArguments
;
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();
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
);
49 // pass data back to the calling window
50 var fields
= ["f_url", "f_alt", "f_align", "f_border",
52 var param
= new Object();
53 for (var i in fields
) {
55 var el
= document
.getElementById(id
);
59 preview_window
.close();
67 preview_window
.close();
73 function onPreview() {
74 var f_url
= document
.getElementById("f_url");
75 var url
= f_url
.value
;
77 alert("<?php print_string("enterurlfirst
","editor
");?>");
81 var img
= new Image();
85 win
= window
.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
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");
90 var doc
= win
.document
;
94 body
.style
.padding
= "0px";
95 body
.style
.margin
= "0px";
96 var el
= doc
.createElement("img");
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");
109 td
.style
.textAlign
= "center";
112 win
.resizeTo(el
.offsetWidth +
30, el
.offsetHeight +
30);
120 <style type
="text/css">
122 background
: ButtonFace
;
124 font
: 11px Tahoma
,Verdana
,sans
-serif
;
128 body
{ padding
: 5px
; }
130 font
: 11px Tahoma
,Verdana
,sans
-serif
;
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
; }
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">
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
>
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
>
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
>
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
>
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" />
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
>
223 <div style
="margin-top: 85px; text-align: right;">
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
>