source: trunk/plugins/ExtendedFileManager/manager.php @ 572

Last change on this file since 572 was 572, checked in by gogo, 13 years ago

Undo the spurious whitespace changes introduced in changeset:569

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