1 | <?php |
---|
2 | /** |
---|
3 | * The main GUI for the ExtendedFileManager. |
---|
4 | * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer |
---|
5 | * Version: Updated on 08-01-2005 by Afru |
---|
6 | * Version: Updated on 04-07-2006 by Krzysztof Kotowicz |
---|
7 | * Version: Updated on 29-10-2006 by Raimund Meyer |
---|
8 | * Version: Updated on 20-01-2008 by Raimund Meyer |
---|
9 | * Package: ExtendedFileManager (EFM 1.4) |
---|
10 | * http://www.afrusoft.com/htmlarea |
---|
11 | */ |
---|
12 | |
---|
13 | if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode']; |
---|
14 | if(!isset($insertMode)) $insertMode="image"; |
---|
15 | |
---|
16 | require_once('config.inc.php'); |
---|
17 | require_once('Classes/ExtendedFileManager.php'); |
---|
18 | |
---|
19 | $manager = new ExtendedFileManager($IMConfig); |
---|
20 | $dirs = $manager->getDirs(); |
---|
21 | |
---|
22 | // calculate number of table rows to span for the preview cell |
---|
23 | $num_rows = 4; // filename & upload & disk info message & width+margin |
---|
24 | |
---|
25 | if ($insertMode=='image') |
---|
26 | { |
---|
27 | if ($IMConfig['images_enable_styling'] === false) |
---|
28 | { |
---|
29 | $hidden_fields[] = 'f_margin'; |
---|
30 | $hidden_fields[] = 'f_padding'; |
---|
31 | $hidden_fields[] = 'f_border'; |
---|
32 | $hidden_fields[] = 'f_backgroundColor'; |
---|
33 | $hidden_fields[] = 'f_borderColor'; |
---|
34 | $num_rows +=2; |
---|
35 | } |
---|
36 | else if ($IMConfig['use_color_pickers'] === false) |
---|
37 | { |
---|
38 | $hidden_fields[] = 'f_backgroundColor'; |
---|
39 | $hidden_fields[] = 'f_borderColor'; |
---|
40 | $num_rows +=2; |
---|
41 | } |
---|
42 | |
---|
43 | if ($IMConfig['images_enable_align'] === false) |
---|
44 | { |
---|
45 | $hidden_fields[] = 'f_align'; |
---|
46 | } |
---|
47 | if ($IMConfig['images_enable_alt']) |
---|
48 | { |
---|
49 | $num_rows++; |
---|
50 | } |
---|
51 | else |
---|
52 | { |
---|
53 | $hidden_fields[] = 'f_alt'; |
---|
54 | } |
---|
55 | if ($IMConfig['images_enable_title']) |
---|
56 | { |
---|
57 | $num_rows++; |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | $hidden_fields[] = 'f_title'; |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | if ($insertMode == 'link') |
---|
66 | { |
---|
67 | if ($IMConfig['link_enable_target'] === false) |
---|
68 | { |
---|
69 | $hidden_fields[] = 'f_target'; |
---|
70 | } |
---|
71 | $num_rows +=2; |
---|
72 | } |
---|
73 | ?> |
---|
74 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
75 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
76 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
77 | <head> |
---|
78 | <title>Insert <?php echo ($insertMode == 'image' ? 'Image' : 'File Link') ?></title> |
---|
79 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
80 | <link href="<?php print $IMConfig['base_url'];?>assets/manager.css" rel="stylesheet" type="text/css" /> |
---|
81 | <link href="../../popups/popup.css" rel="stylesheet" type="text/css" /> |
---|
82 | <script type="text/javascript" src="../../popups/popup.js"></script> |
---|
83 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> |
---|
84 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script> |
---|
85 | <?php if (!empty($IMConfig['use_color_pickers'])) { ?><script type="text/javascript" src="../../modules/ColorPicker/ColorPicker.js"></script><?php } ?> |
---|
86 | <script type="text/javascript"> |
---|
87 | /* <![CDATA[ */ |
---|
88 | |
---|
89 | if(window.opener) |
---|
90 | Xinha = window.opener.Xinha; |
---|
91 | |
---|
92 | var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>"; |
---|
93 | var base_url = "<?php echo $manager->getImagesURL(); ?>"; |
---|
94 | var _backend_url = "<?php print $IMConfig['backend_url']; ?>"; |
---|
95 | var _resized_prefix = "<?php echo $IMConfig['resized_prefix']; ?>"; |
---|
96 | var _resized_dir = "<?php echo $IMConfig['resized_dir']; ?>"; |
---|
97 | var manager_show_target = <?php echo ($insertMode == 'link' && $IMConfig['link_enable_target'] ? 'true' : 'false') ?>; |
---|
98 | |
---|
99 | <?php |
---|
100 | if(isset($_REQUEST['mode'])) |
---|
101 | { |
---|
102 | echo 'var manager_mode="'.$_REQUEST['mode'].'";'; |
---|
103 | } |
---|
104 | else |
---|
105 | { |
---|
106 | echo 'var manager_mode="image";'; |
---|
107 | } |
---|
108 | //IE doesn't like a relative URL when changing a window's location |
---|
109 | $iframe_url = str_replace( array("backend.php","manager.php"), "", $_SERVER["PHP_SELF"] ) . $IMConfig['backend_url']; |
---|
110 | ?> |
---|
111 | |
---|
112 | var iframeUrl = '<?php print $iframe_url ?>__function=images&mode=<?php echo $insertMode;?>&viewtype=<?php echo $IMConfig['view_type'] ?>'; |
---|
113 | |
---|
114 | /* ]]> */ |
---|
115 | </script> |
---|
116 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/manager.js"></script> |
---|
117 | </head> |
---|
118 | <body class="dialog" > |
---|
119 | <div class="title">Insert <?php echo ($insertMode == 'image' ? 'Image' : 'File Link') ?></div> |
---|
120 | <form action="<?php print htmlspecialchars($IMConfig['backend_url']); ?>" id="uploadForm" method="post" enctype="multipart/form-data"> |
---|
121 | <input type="hidden" name="__plugin" value="ExtendedFileManager" /> |
---|
122 | <input type="hidden" name="__function" value="images" /> |
---|
123 | <input type="hidden" name="mode" value="<?php echo $insertMode; ?>" /> |
---|
124 | <input type="hidden" id="manager_mode" value="<?php echo $insertMode;?>" /> |
---|
125 | <fieldset><legend>File Manager</legend> |
---|
126 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
---|
127 | <tr> |
---|
128 | <td nowrap="nowrap" style="padding:10px;"> |
---|
129 | |
---|
130 | <label for="dirPath">Directory</label> |
---|
131 | <select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)"> |
---|
132 | <option value="/">/</option> |
---|
133 | <?php foreach($dirs as $relative=>$fullpath) { ?> |
---|
134 | <option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option> |
---|
135 | <?php } ?> |
---|
136 | </select> |
---|
137 | |
---|
138 | <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="<?php print $IMConfig['base_url'];?>img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a> |
---|
139 | |
---|
140 | |
---|
141 | <?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?> |
---|
142 | <a href="#" onclick="newFolder();" title="New Folder"><img src="<?php print $IMConfig['base_url'];?>img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a> |
---|
143 | <?php } ?> |
---|
144 | <span id="pasteBtn"></span> |
---|
145 | |
---|
146 | <select name="viewtype" id="viewtype" onchange="updateView()"> |
---|
147 | <option value="thumbview" <?php if($IMConfig['view_type']=="thumbview") echo 'selected="selected"';?> >Thumbnail View</option> |
---|
148 | <option value="listview" <?php if($IMConfig['view_type']=="listview") echo 'selected="selected"';?> >List View</option> |
---|
149 | </select> |
---|
150 | </td> |
---|
151 | </tr> |
---|
152 | <tr><td style="padding:10px; padding-top:0px;"> |
---|
153 | <div id="messages"><span id="message">Loading</span><img src="<?php print $IMConfig['base_url'];?>img/dots.gif" width="22" height="12" alt="..." /></div> |
---|
154 | <iframe src="about:blank" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> |
---|
155 | </td></tr> |
---|
156 | </table> |
---|
157 | </fieldset> |
---|
158 | <!-- image properties --> |
---|
159 | <div id="controls"> |
---|
160 | <table class="inputTable"> |
---|
161 | <tr> |
---|
162 | <td style="text-align: right;" nowrap="nowrap"><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td> |
---|
163 | <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td> |
---|
164 | <td rowspan="<?php echo $num_rows ?>" colspan="2" style="vertical-align: top; text-align: center;"><?php if($insertMode=='image') { ?> |
---|
165 | <div style="padding:4px;background-color:#CCC;border:1px inset;width: 100px; height: 100px;"> |
---|
166 | <img src="<?php print $IMConfig['base_url'];?>img/1x1_transparent.gif" alt="" id="f_preview" /> |
---|
167 | </div> |
---|
168 | <?php } else if($insertMode=="link" && $IMConfig['link_enable_target'] !== false) {?><label for="f_align" id="f_target_label">Target Window</label> |
---|
169 | <select id="f_target" style="width:125px;"> |
---|
170 | <option value="">None (use implicit)</option> |
---|
171 | <option value="_blank">New window (_blank)</option> |
---|
172 | <option value="_self">Same frame (_self)</option> |
---|
173 | <option value="_top">Top frame (_top)</option> |
---|
174 | </select><br /><br /> |
---|
175 | <input type="text" name="f_other_target" id="f_other_target" style="visibility:hidden; width:120px;" /> |
---|
176 | <?php } ?></td> |
---|
177 | </tr> |
---|
178 | <?php if($insertMode == 'image' && $IMConfig['images_enable_alt']) { ?> |
---|
179 | <tr> |
---|
180 | <td style="text-align: right;"><label for="f_alt">Alt</label></td> |
---|
181 | <td colspan="5"><input type="text" id="f_alt" class="largelWidth" value="" /></td> |
---|
182 | </tr> |
---|
183 | <?php } |
---|
184 | if ($insertMode == 'link' || $IMConfig['images_enable_title']) { ?> |
---|
185 | <tr> |
---|
186 | <td style="text-align: right;"><label for="f_title">Title (tooltip)</label></td> |
---|
187 | <td colspan="5"><input type="text" id="f_title" class="largelWidth" value="" /></td> |
---|
188 | </tr> |
---|
189 | <?php } ?> |
---|
190 | <tr> |
---|
191 | <?php |
---|
192 | if (!empty($IMConfig['max_foldersize_mb']) && Files::dirSize($manager->getImagesDir()) > ($IMConfig['max_foldersize_mb']*1048576)) |
---|
193 | { ?> |
---|
194 | <td colspan="6" style="text-align: right;">Maximum folder size limit reached. Upload disabled.</td> |
---|
195 | <?php } |
---|
196 | else if($IMConfig['allow_upload']) { ?> |
---|
197 | <td style="text-align: right;"><label for="upload">Upload</label></td> |
---|
198 | <td colspan="5"> |
---|
199 | <table cellpadding="0" cellspacing="0" border="0"> |
---|
200 | <tr> |
---|
201 | <td><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max = (($insertMode == 'image' ? $IMConfig['max_filesize_kb_image'] : $IMConfig['max_filesize_kb_link'] )*1024); ?>" /> |
---|
202 | <input type="file" name="upload" id="upload" /></td> |
---|
203 | <td><button type="submit" name="submit" onclick="doUpload();">Upload</button>(<?php echo $max/1024 . 'KB'?> max.)</td> |
---|
204 | </tr> |
---|
205 | </table> |
---|
206 | </td> |
---|
207 | <?php } else { ?> |
---|
208 | <td colspan="6"></td> |
---|
209 | <?php } ?> |
---|
210 | </tr> |
---|
211 | <tr> |
---|
212 | <td><?php if (!empty($hidden_fields)) foreach ($hidden_fields as $hf) echo "<input type=\"hidden\" id=\"{$hf}\" name=\"{$hf}\" value=\"\" />"; ?></td> |
---|
213 | <td colspan="5"><span id="diskmesg"></span></td> |
---|
214 | </tr> |
---|
215 | <tr> |
---|
216 | <td style="text-align: right;"><?php if($insertMode=='image') { ?> <label for="f_width">Width</label><?php }?></td> |
---|
217 | |
---|
218 | <td><?php if($insertMode=='image') { ?> <input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/><?php } else echo " ";?></td> |
---|
219 | |
---|
220 | <td rowspan="2"><?php if($insertMode=='image') { ?><img src="<?php print $IMConfig['base_url'];?>img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /> |
---|
221 | <input type="hidden" id="orginal_width" /> |
---|
222 | <input type="hidden" id="orginal_height" /> |
---|
223 | <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" value="on" /><br /> |
---|
224 | <label for="constrain_prop">Constrain Proportions</label><?php }?> |
---|
225 | </td> |
---|
226 | |
---|
227 | <td rowspan="3" style="text-align: right;"></td> |
---|
228 | |
---|
229 | <td style="text-align: right;"><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><label for="f_margin">Margin</label><?php }?></td> |
---|
230 | |
---|
231 | <td><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><input type="text" id="f_margin" class="smallWidth" value="" /><?php } ?></td> |
---|
232 | </tr> |
---|
233 | <tr> |
---|
234 | <td style="text-align: right;"><?php if($insertMode=='image') { ?><label for="f_height">Height</label><?php }?></td> |
---|
235 | |
---|
236 | <td class="smallWidth"><?php if($insertMode=='image') { ?><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/><?php }?></td> |
---|
237 | |
---|
238 | <td style="text-align: right;"><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><label for="f_padding">Padding</label><?php }?></td> |
---|
239 | |
---|
240 | <td><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><input type="text" id="f_padding" class="smallWidth" value="" /> |
---|
241 | <?php }?></td> |
---|
242 | |
---|
243 | <?php if($insertMode=='image' && !empty($IMConfig['use_color_pickers']) && $IMConfig['images_enable_styling'] !== false) { ?> |
---|
244 | <td style="text-align: left;">Color</td> |
---|
245 | <td> |
---|
246 | <input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" /> |
---|
247 | </td> |
---|
248 | <?php } ?> |
---|
249 | </tr> |
---|
250 | <tr> |
---|
251 | <td style="text-align: right;"><?php if($insertMode=='image' && $IMConfig['images_enable_align'] !== false) { ?><label for="f_align">Align</label><?php }?></td> |
---|
252 | |
---|
253 | <td colspan="2"><?php if($insertMode=='image' && $IMConfig['images_enable_align'] !== false) { ?> |
---|
254 | <select size="1" id="f_align" title="Positioning of this image"> |
---|
255 | <option value="" selected="selected" >Not set</option> |
---|
256 | <option value="left" >Left</option> |
---|
257 | <option value="right" >Right</option> |
---|
258 | <option value="texttop" >Texttop</option> |
---|
259 | <option value="absmiddle" >Absmiddle</option> |
---|
260 | <option value="baseline" >Baseline</option> |
---|
261 | <option value="absbottom" >Absbottom</option> |
---|
262 | <option value="bottom" >Bottom</option> |
---|
263 | <option value="middle" >Middle</option> |
---|
264 | <option value="top" >Top</option> |
---|
265 | </select><?php } ?> |
---|
266 | </td> |
---|
267 | |
---|
268 | <td style="text-align: right;"><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><label for="f_border">Border</label><?php }?></td> |
---|
269 | <td><?php if($insertMode=='image' && $IMConfig['images_enable_styling'] !== false) { ?><input type="text" id="f_border" class="smallWidth" value="" /><?php }?></td> |
---|
270 | <?php if($insertMode=='image' && !empty($IMConfig['use_color_pickers']) && $IMConfig['images_enable_styling'] !== false) { ?> |
---|
271 | <td style="text-align: left;">Border Color</td> |
---|
272 | <td><input name="f_borderColor" type="text" id="f_borderColor" size="7" /></td> |
---|
273 | <?php } ?> |
---|
274 | </tr> |
---|
275 | </table> |
---|
276 | |
---|
277 | <!--// image properties --> |
---|
278 | <div style="text-align: right;"> |
---|
279 | <hr /> |
---|
280 | <button type="button" class="buttons" onclick="return refresh();">Refresh</button> |
---|
281 | <button type="button" class="buttons" onclick="return onOK();">OK</button> |
---|
282 | <button type="button" class="buttons" onclick="return onCancel();">Cancel</button> |
---|
283 | </div> |
---|
284 | </div> |
---|
285 | </form> |
---|
286 | </body> |
---|
287 | </html> |
---|