3 require("../../../../config.php");
5 $id = optional_param('id', SITEID
, PARAM_INT
);
8 require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE
, $id));
10 @header
('Content-Type: text/html; charset=utf-8');
12 $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes
);
15 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
16 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
19 <meta http
-equiv
="content-type" content
="text/html; charset=utf-8" />
20 <title
><?php
print_string("insertimage","editor");?
></title
>
21 <script type
="text/javascript" src
="popup.js"></script
>
22 <script type
="text/javascript">
24 var preview_window
= null;
28 var param
= window
.dialogArguments
;
30 var alt
= param
["f_url"].substring(param
["f_url"].lastIndexOf('/') +
1);
31 document
.getElementById("f_url").value
= param
["f_url"];
32 document
.getElementById("f_alt").value
= param
["f_alt"] ? param
["f_alt"] : alt
;
33 document
.getElementById("f_border").value
= parseInt(param
["f_border"] ||
0);
34 document
.getElementById("f_align").value
= param
["f_align"];
35 document
.getElementById("f_vert").value
= param
["f_vert"] != -1 ? param
["f_vert"] : 0;
36 document
.getElementById("f_horiz").value
= param
["f_horiz"] != -1 ? param
["f_horiz"] : 0;
37 document
.getElementById("f_width").value
= param
["f_width"];
38 document
.getElementById("f_height").value
= param
["f_height"];
39 window
.ipreview
.location
.replace('preview.php?id='+
<?php
print($id);?
> +
'&imageurl='+ param
.f_url
);
41 document
.getElementById("f_url").focus();
46 "f_url": "<?php print_string("mustenterurl
", "editor
");?>",
47 "f_alt": "<?php print_string("pleaseenteralt
", "editor
");?>"
49 for (var i in required
) {
50 var el
= document
.getElementById(i
);
57 // pass data back to the calling window
58 var fields
= ["f_url", "f_alt", "f_align", "f_border",
59 "f_horiz", "f_vert","f_width","f_height"];
60 var param
= new Object();
61 for (var i in fields
) {
63 var el
= document
.getElementById(id
);
67 preview_window
.close();
75 preview_window
.close();
81 function onPreview() {
82 var f_url
= document
.getElementById("f_url");
83 var url
= f_url
.value
;
85 alert("<?php print_string("enterurlfirst
","editor
");?>");
89 var img
= new Image();
93 win
= window
.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
95 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");
98 var doc
= win
.document
;
102 body
.style
.padding
= "0px";
103 body
.style
.margin
= "0px";
104 var el
= doc
.createElement("img");
107 var table
= doc
.createElement("table");
108 body
.appendChild(table
);
109 table
.style
.width
= "100%";
110 table
.style
.height
= "100%";
111 var tbody
= doc
.createElement("tbody");
112 table
.appendChild(tbody
);
113 var tr
= doc
.createElement("tr");
114 tbody
.appendChild(tr
);
115 var td
= doc
.createElement("td");
117 td
.style
.textAlign
= "center";
120 win
.resizeTo(el
.offsetWidth +
30, el
.offsetHeight +
30);
126 function checkvalue(elm
,formname
) {
127 var el
= document
.getElementById(elm
);
129 alert("Nothing to do!");
135 function submit_form(dothis
) {
136 if(dothis
== "delete") {
137 window
.ibrowser
.document
.dirform
.action
.value
= "delete";
139 if(dothis
== "move") {
140 window
.ibrowser
.document
.dirform
.action
.value
= "move";
142 if(dothis
== "zip") {
143 window
.ibrowser
.document
.dirform
.action
.value
= "zip";
146 window
.ibrowser
.document
.dirform
.submit();
152 <style type
="text/css">
155 background
-color
: rgb(212,208,200);
156 font
-family
: Tahoma
, Verdana
, sans
-serif
;
160 background
-color
: #ddddff;
162 border
-bottom
: 1px solid black
;
163 font
-family
: Tahoma
, sans
-serif
;
168 td
, input
, select
, button
{
169 font
-family
: Tahoma
, Verdana
, sans
-serif
;
172 button
{ width
: 70px
; }
173 .space
{ padding
: 2px
; }
174 form
{ margin
-bottom
: 0px
; margin
-top
: 0px
; }
177 <body onload
="Init()">
178 <div
class="title"><?php
print_string("insertimage","editor");?
></div
>
179 <div
class="space"></div
>
180 <div
class="space"></div
>
181 <div
class="space"></div
>
182 <form action
="" method
="get" id
="first">
183 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
185 <td width
="15%" align
="right"><?php
print_string("imageurl","editor");?
>:</td
>
186 <td width
="60%"><input name
="f_url" type
="text" id
="f_url" style
="width: 100%;" /></td
>
187 <td width
="23%" align
="center">
188 <button name
="btnOK" type
="button" id
="btnOK" onclick
="return onOK();"><?php
print_string("ok","editor") ?
></button
></td
>
191 <td align
="right"><?php
print_string("alternatetext","editor");?
>:</td
>
192 <td
><input name
="f_alt" type
="text" id
="f_alt" style
="width: 100%;" /></td
>
194 <button name
="btnCancel" type
="button" id
="btnCancel" onclick
="return onCancel();"><?php
print_string("cancel","editor") ?
></button
></td
>
197 <div
class="space"></div
>
198 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
200 <td width
="32%" valign
="top">
201 <fieldset
><legend
><?php
print_string("layout","editor");?
></legend
>
202 <div
class="space"></div
>
203 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
205 <td width
="40%" align
="right"><?php
print_string("alignment","editor");?
>:</td
>
207 <select size
="1" name
="f_align" id
="f_align"
208 title
="Positioning of this image">
209 <option value
="" ><?php
print_string("notset","editor") ?
></option
>
210 <option value
="left" ><?php
print_string("left","editor") ?
></option
>
211 <option value
="right" ><?php
print_string("right","editor") ?
></option
>
212 <option value
="texttop" ><?php
print_string("texttop","editor") ?
></option
>
213 <option value
="middle" ><?php
print_string("middle","editor") ?
></option
>
214 <option value
="baseline" selected
="1" ><?php
print_string("baseline","editor") ?
></option
>
215 <option value
="absbottom" ><?php
print_string("absbottom","editor") ?
></option
>
216 <option value
="bottom" ><?php
print_string("bottom","editor") ?
></option
>
217 <option value
="middle" ><?php
print_string("middle","editor") ?
></option
>
218 <option value
="top" ><?php
print_string("top","editor") ?
></option
>
222 <td width
="40%" align
="right"><?php
print_string("borderthickness","editor") ?
>:</td
>
224 <input type
="text" id
="f_border" name
="f_border" size
="5" /></td
>
226 </table
><div
class="space"></div
>
227 </fieldset
> 
;</td
>
228 <td width
="34%" valign
="top">
229 <fieldset
><legend
><?php
print_string("spacing","editor");?
></legend
>
230 <div
class="space"></div
>
231 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
233 <td width
="40%" align
="right"><?php
print_string("horizontal","editor");?
>: </td
>
235 <input name
="f_horiz" type
="text" id
="f_horiz" size
="5" />
239 <td width
="40%" align
="right"><?php
print_string("vertical","editor");?
>:</td
>
241 <input name
="f_vert" type
="text" id
="f_vert" size
="5" /></td
>
243 </table
><div
class="space"></div
></fieldset
></td
>
244 <td width
="34%" valign
="top">
245 <fieldset
><legend
><?php
print_string("size","editor");?
></legend
>
246 <div
class="space"></div
>
247 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
249 <td width
="40%" align
="right"><?php
print_string("width","editor");?
>:</td
>
251 <input name
="f_width" type
="text" id
="f_width" size
="5" />
255 <td width
="40%" align
="right"><?php
print_string("height","editor");?
>:</td
>
257 <input name
="f_height" type
="text" id
="f_height" size
="5" /></td
>
259 </table
><div
class="space"></div
>
263 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
265 <td width
="55%" valign
="top"><?php
266 print_string("filebrowser","editor");
268 echo "<iframe id=\"ibrowser\" name=\"ibrowser\" src=\"{$CFG->wwwroot}/lib/editor/htmlarea/coursefiles.php?usecheckboxes=1&id=$id\" style=\"width: 100%; height: 200px;\"></iframe>";
271 <td width
="45%" valign
="top"><?php
print_string("preview","editor");?
>:<br
/>
272 <iframe id
="ipreview" name
="ipreview" src
="about:blank" style
="width: 100%; height: 200px;"></iframe
>
276 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
278 <td width
="55%"><div
class="space"></div
>
279 <?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE
, $id))) { ?
>
280 <table border
="0" cellpadding
="2" cellspacing
="0">
281 <tr
><td
><?php
print_string("selection","editor");?
>: </td
>
282 <td
><form id
="idelete">
283 <input name
="btnDelete" type
="submit" id
="btnDelete" value
="<?php print_string("delete
","editor
");?>" onclick
="return submit_form('delete');" /></form
></td
>
284 <td
><form id
="imove">
285 <input name
="btnMove" type
="submit" id
="btnMove" value
="<?php print_string("move
","editor
");?>" onclick
="return submit_form('move');" /></td
>
287 <input name
="btnZip" type
="submit" id
="btnZip" value
="<?php print_string("zip
","editor
");?>" onclick
="return submit_form('zip');" /></form
></td
>
288 <td
><form method
="post" action
="../coursefiles.php" target
="ibrowser">
289 <input type
="hidden" name
="id" value
="<?php print($id);?>" />
290 <input type
="hidden" name
="wdir" value
="" />
291 <input type
="hidden" id
="irename" name
="file" value
="" />
292 <input type
="hidden" name
="action" value
="rename" />
293 <input type
="hidden" name
="sesskey" value
="<?php p($USER->sesskey) ?>" />
294 <input name
="btnRename" type
="submit" id
="btnRename" value
="<?php print_string("rename
","editor
");?>" /></form
></td
>
302 <td width
="45%" rowspan
="2" valign
="top"><fieldset
>
303 <legend
><?php
print_string("properties","editor");?
></legend
>
304 <div
class="space"></div
>
305 <div
class="space"></div
>
306  
; 
;<?php
print_string("size","editor");?
>:
307 <input type
="text" id
="isize" name
="isize" size
="10" style
="background: transparent; border: none;" />
308 <?php
print_string("type","editor");?
>: <input type
="text" id
="itype" name
="itype" size
="10" style
="background: transparent; border: none;" />
309 <div
class="space"></div
>
310 <div
class="space"></div
>
315 <form id
="cfolder" action
="../coursefiles.php" method
="post" target
="ibrowser">
316 <input type
="hidden" name
="id" value
="<?php print($id);?>" />
317 <input type
="hidden" name
="wdir" value
="" />
318 <input type
="hidden" name
="action" value
="mkdir" />
319 <input type
="hidden" name
="sesskey" value
="<?php p($USER->sesskey) ?>" />
320 <input name
="name" type
="text" id
="foldername" size
="35" />
321 <input name
="btnCfolder" type
="submit" id
="btnCfolder" value
="<?php print_string("createfolder
","editor
");?>" onclick
="return checkvalue('foldername','cfolder');" />
323 <div
class="space"></div
>
324 <form action
="../coursefiles.php?id=<?php print($id);?>" method
="post" enctype
="multipart/form-data" target
="ibrowser" id
="uploader">
325 <input type
="hidden" name
="MAX_FILE_SIZE" value
="<?php print($upload_max_filesize);?>" />
326 <input type
="hidden" name
="id" VALUE
="<?php print($id);?>" />
327 <input type
="hidden" name
="wdir" value
="" />
328 <input type
="hidden" name
="action" value
="upload" />
329 <input type
="hidden" name
="sesskey" value
="<?php p($USER->sesskey) ?>" />
330 <input type
="file" name
="userfile" id
="userfile" size
="35" />
331 <input name
="save" type
="submit" id
="save" onclick
="return checkvalue('userfile','uploader');" value
="<?php print_string("upload
","editor
");?>" />