26 require_once dirname(__FILE__).
'/../../../../core/include/init.inc';
27 if (empty($GLOBALS[
'SQ_SYSTEM']->user) || !($GLOBALS[
'SQ_SYSTEM']->user->canAccessBackend() || $GLOBALS[
'SQ_SYSTEM']->user->type() ==
'simple_edit_user')){
33 <title>Insert
Image</title>
35 <script type=
"text/javascript" src=
"../../core/popup.js"></script>
37 <script type=
"text/javascript">
38 var preview_window = null;
41 __dlg_init(
"insertImage");
42 document.getElementById(
"f_url").focus();
47 "f_url":
"You must enter the URL",
48 "f_alt":
"Please enter the alternate text"
50 for (var i in required) {
51 var el = document.getElementById(i);
59 var fields = [
"f_url",
"f_alt",
"f_align",
"f_border",
61 var param =
new Object();
62 for (var i in fields) {
64 var el = document.getElementById(
id);
68 preview_window.close();
70 __dlg_close(
"insertImage", param);
76 preview_window.close();
78 __dlg_close(
"insertImage", null);
82 function onPreview() {
83 alert(js_translate(
'preview_needs_rewritten'));
84 var f_url = document.getElementById(
"f_url");
85 var url = f_url.value;
87 alert(
"You have to enter an URL first");
91 var img =
new Image();
95 win = window.open(
"about:blank",
"ha_imgpreview",
"toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
97 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");
100 var doc = win.document;
104 body.style.padding =
"0px";
105 body.style.margin =
"0px";
106 var el = doc.createElement(
"img");
109 var table = doc.createElement(
"table");
110 body.appendChild(table);
111 table.style.width =
"100%";
112 table.style.height =
"100%";
113 var tbody = doc.createElement(
"tbody");
114 table.appendChild(tbody);
115 var tr = doc.createElement(
"tr");
116 tbody.appendChild(tr);
117 var td = doc.createElement(
"td");
119 td.style.textAlign =
"center";
122 win.resizeTo(el.offsetWidth + 30, el.offsetHeight + 30);
129 <style type=
"text/css">
131 background: ButtonFace;
133 font: 11px Tahoma,Verdana,sans-serif;
137 body { padding: 5px; }
139 font: 11px Tahoma,Verdana,sans-serif;
145 .fl { width: 9em;
float: left; padding: 2px 5px; text-align: right; }
146 .fr { width: 6em;
float: left; padding: 2px 5px; text-align: right; }
147 fieldset { padding: 0px 10px 5px 5px; }
148 select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
149 button { width: 70px; }
150 .space { padding: 2px; }
152 .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
153 border-bottom: 1px solid black; letter-spacing: 2px;
155 form { padding: 0px; margin: 0px; }
159 <body onload=
"Init()">
160 <div
class=
"title"><?php echo translate(
'insert_image'); ?></div>
161 <form action=
"" method=
"get">
162 <table border=
"0" width=
"100%" style=
"padding: 0px; margin: 0px">
165 <td style=
"width: 7em; text-align: right"><?php echo translate(
'image_url'); ?>:</td>
167 <input type=
"text" name=
"url" id=
"f_url" style=
"width:75%" title=
"Enter the image URL here" value=
"<?php echo htmlspecialchars($_REQUEST['f_url']) ?>" />
168 <button name=
"preview" onclick=
"return onPreview();" title=
"Preview the image in a new window"><?php echo translate(
'preview'); ?></button>
172 <td style=
"width: 7em; text-align: right">Alternate text:</td>
173 <td><input type=
"text" name=
"alt" id=
"f_alt" style=
"width:100%" title=
"For browsers that don't support images" value=
"<?php echo htmlspecialchars($_REQUEST['f_alt']) ?>" /></td>
180 <fieldset style=
"float: left; margin-left: 5px;">
181 <legend><?php echo translate(
'layout'); ?></legend>
183 <div
class=
"space"></div>
185 <div
class=
"fl"><?php echo translate(
'alignment'); ?>:</div>
186 <select size=
"1" name=
"align" id=
"f_align" title=
"Positioning of this image">
188 if (!isset($_REQUEST[
'f_align'])) $_REQUEST[
'f_align'] =
'baseline';
189 $options_array = Array(
'' =>
'Not set',
192 'texttop' =>
'Texttop',
193 'absmiddle' =>
'Absmiddle',
194 'baseline' =>
'Baseline',
195 'absbottom' =>
'Absbottom',
196 'bottom' =>
'Bottom',
197 'middle' =>
'Middle',
200 foreach ($options_array as $value => $text) {
201 ?><option value=
"<?php echo $value?>" <?php echo ($_REQUEST[
'f_align'] == $value) ?
'selected="1"' :
''?>><?php echo $text?></option><?php
208 <div
class=
"fl"><?php echo translate(
'border_thickness'); ?>:</div>
209 <input type=
"text" name=
"border" id=
"f_border" size=
"5"
210 title=
"Leave empty for no border" value=
"<?php echo htmlspecialchars($_REQUEST['f_border']) ?>" />
212 <div
class=
"space"></div>
215 <fieldset style=
"float:right; margin-right: 5px;">
216 <legend><?php echo translate(
'spacing'); ?></legend>
218 <div
class=
"space"></div>
220 <div
class=
"fr"><?php echo translate(
'horizontal'); ?>:</div>
221 <input type=
"text" name=
"horiz" id=
"f_horiz" size=
"5" title=
"Horizontal padding" value=
"<?php echo htmlspecialchars($_REQUEST['f_horiz']) ?>" />
225 <div
class=
"fr"><?php echo translate(
'vertical'); ?>:</div>
226 <input type=
"text" name=
"vert" id=
"f_vert" size=
"5" title=
"Vertical padding" value=
"<?php echo htmlspecialchars($_REQUEST['f_vert']) ?>" />
228 <div
class=
"space"></div>
231 <div style=
"margin-top: 85px; text-align: right;">
233 <button type=
"button" name=
"ok" onclick=
"return onOK();"><?php echo translate(
'ok'); ?></button>
234 <button type=
"button" name=
"cancel" onclick=
"return onCancel();"><?php echo translate(
'cancel'); ?></button>