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("insertlink","editor");?
></title
>
15 <script type
="text/javascript" src
="popup.js"></script
>
16 <script type
="text/javascript">
18 function onTargetChanged() {
19 var f
= document
.getElementById("f_other_target");
20 if (this
.value
== "_other") {
21 f
.style
.visibility
= "visible";
24 } else f
.style
.visibility
= "hidden";
27 //__dlg_translate(I18N);
30 var param
= window
.dialogArguments
;
32 //anchors = param.f_anchors;
33 var anchor
= document
.getElementById('f_anchors');
34 for(var a in param
.f_anchors
) {
35 var opti
= document
.createElement('option');
36 opti
.value
= '#' + param
.f_anchors
[a
];
37 opti
.innerHTML
= opti
.value
;
38 anchor
.appendChild(opti
);
41 var target_select
= document
.getElementById("f_target");
43 document
.getElementById("f_href").value
= param
["f_href"];
44 document
.getElementById("f_title").value
= param
["f_title"];
45 //comboSelectValue(target_select, param["f_target"]);
46 if (target_select
.value
!= param
.f_target
) {
47 var opt
= document
.createElement("option");
48 opt
.value
= param
.f_target
;
49 opt
.innerHTML
= opt
.value
;
50 target_select
.appendChild(opt
);
54 document
.getElementById("f_href").value
= "http://";
56 var opt
= document
.createElement("option");
58 opt
.innerHTML
= "<?php print_string("linktargetother
","editor
");?>";
59 target_select
.appendChild(opt
);
60 target_select
.onchange
= onTargetChanged
;
61 document
.getElementById("f_href").focus();
62 document
.getElementById("f_href").select();
67 "f_href": "You must enter the URL where this link points to"
69 for (var i in required
) {
70 var el
= document
.getElementById(i
);
77 // pass data back to the calling window
78 var fields
= ["f_href", "f_title", "f_target" ];
79 var param
= new Object();
80 for (var i in fields
) {
82 var el
= document
.getElementById(id
);
85 if (param
.f_target
== "_other") {
86 param
.f_target
= document
.getElementById("f_other_target").value
;
98 var lx
= (screen
.width
- 470) / 2;
99 var tx
= (screen
.height
- 400) / 2;
101 var settings
= "toolbar=no,";
102 settings +
= " location=no,";
103 settings +
= " directories=no,";
104 settings +
= " status=no,";
105 settings +
= " menubar=no,";
106 settings +
= " scrollbars=no,";
107 settings +
= " resizable=no,";
108 settings +
= " width=470,";
109 settings +
= " height=400,";
111 var newwin
= window
.open("link.php?id=<?php echo $id; ?>","",""+ settings +
" left="+ lx +
", top="+ tx +
"");
115 var sel
= document
.getElementById('f_anchors');
116 var txt
= sel
.options
[sel
.selectedIndex
].text
;
118 var f_url
= document
.getElementById('f_href');
124 <style type
="text/css">
126 background
: ButtonFace
;
128 font
: 11px Tahoma
,Verdana
,sans
-serif
;
132 body
{ padding
: 5px
; }
133 table
{ font
: 11px Tahoma
,Verdana
,sans
-serif
; }
134 select
, input
, button
{ font
: 11px Tahoma
,Verdana
,sans
-serif
; }
135 button
{ width
: 70px
; }
136 table
.label
{ text
-align
: right
; width
: 8em
; }
138 .title
{ background
: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 3px;
139 border
-bottom
: 1px solid black
; letter
-spacing
: 2px
;
143 margin
-top
: 1em
; border
-top
: 1px solid
#999;
144 padding
: 2px
; text
-align
: right
;
148 <body onload
="Init()">
149 <div
class="title"><?php
print_string("insertlink","editor");?
></div
>
150 <table border
="0" style
="width: 100%;">
152 <td
class="label"><?php
print_string("linkurl","editor");?
>:</td
>
153 <td
><input type
="text" id
="f_href" style
="width: 100%" /></td
>
156 <td
class="label"><?php
print_string("linktitle","editor");?
>:</td
>
157 <td
><input type
="text" id
="f_title" style
="width: 100%" /></td
>
160 <td
class="label"><?php
print_string("linktarget","editor");?
>:</td
>
161 <td
><select id
="f_target">
162 <option value
=""><?php
print_string("linktargetnone","editor");?
></option
>
163 <option value
="_blank"><?php
print_string("linktargetblank","editor");?
></option
>
164 <option value
="_self"><?php
print_string("linktargetself","editor");?
></option
>
165 <option value
="_top"><?php
print_string("linktargettop","editor");?
></option
>
168 <td
class="label"><?php
print_string("anchors","editor");?
>:</td
>
169 <td
><select id
="f_anchors" onchange
="seturl()">
170 <option value
="">----</option
></select
></td
>
172 <input type
="text" name
="f_other_target" id
="f_other_target" size
="10" style
="visibility: hidden" />
178 <?php
if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE
, $id))) {
179 echo "<button type=\"button\" name=\"browse\" onclick=\"return onBrowse();\">".get_string("browse","editor")."...</button>";
182 <button type
="button" name
="ok" onclick
="return onOK();"><?php
print_string("ok","editor");?
></button
>
183 <button type
="button" name
="cancel" onclick
="return onCancel();"><?php
print_string("cancel","editor");?
></button
>