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

Last change on this file since 525 was 525, checked in by koto, 13 years ago
File size: 10.7 KB
Line 
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<!-- temp -->
97<!-- /temp -->
98<!-- image properties -->
99        <table class="inputTable">
100                <tr>
101                        <td align="right" nowrap><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td>
102                        <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td>
103            <td rowspan="5" colspan="2" valign="top"><?php if($insertMode=='image') { ?>
104            <div style="padding:4px;background-color:#CCC;border:1px inset;width: 100px; height: 100px;">
105            <img src="" id="f_preview" />
106            </div>
107            <?php } else if($insertMode=="link") {?><label for="f_align">Target Window</label>
108                        <select id="f_target" style="width:125px;">
109                          <option value="">None (use implicit)</option>
110                          <option value="_blank">New window (_blank)</option>
111                          <option value="_self">Same frame (_self)</option>
112                      <option value="_top">Top frame (_top)</option>
113                    </select><br /><br />
114<input type="text" name="f_other_target" id="f_other_target" style="visibility:hidden; width:120px;" />
115            <?php } ?></td>
116                </tr>
117                <tr>
118                        <td align="right"><label for="f_alt"><?php if($insertMode=='image') echo 'Alt'; else echo 'Title (tooltip)';?></label></td>
119                        <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_alt'; else echo 'f_title';?>" class="largelWidth" value="" /></td>
120                </tr>
121                <tr>
122<?php
123if (!empty($IMConfig['max_foldersize_mb']) && Files::dirSize($manager->getImagesDir()) > ($IMConfig['max_foldersize_mb']*1048576))
124{ ?>
125        <td colspan="6" align="right">Maximum folder size limit reached. Upload disabled.</td>
126<?php }
127else if($IMConfig['allow_upload']) { ?>
128                        <td align="right"><label for="upload">Upload</label></td>
129                        <td colspan="5">
130                                <table cellpadding="0" cellspacing="0" border="0">
131                  <tr>
132                    <td><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo (($insertMode == 'image' ? $IMConfig['max_filesize_kb_image'] : $IMConfig['max_filesize_kb_link'] )*1024); ?>" />
133<input type="file" name="upload" id="upload" /></td>
134                    <td><button type="submit" name="submit" onclick="doUpload();">Upload</button></td>
135                  </tr>
136                </table>
137                        </td>
138<?php } else { ?>
139                        <td colspan="6"></td>
140<?php } ?>
141                </tr>
142                <tr>
143                 <td></td>
144                 <td colspan="5"> <span id="diskmesg"></span></td>
145      </tr>
146<tr>
147                        <td align="right"><?php if($insertMode=='image') { ?> <label for="f_width">Width</label><?php }?></td>
148
149                        <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>
150
151                        <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" />
152                                <input type="hidden" id="orginal_width" />
153                                <input type="hidden" id="orginal_height" />
154            <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" /><br />
155            <label for="constrain_prop">Constrain Proportions</label><?php }?>
156            </td>
157
158                        <td rowspan="3" align="right"></td>
159
160                        <td align="right"><?php if($insertMode=='image') { ?><label for="f_margin">Margin</label><?php }?></td>
161
162                        <td><?php if($insertMode=='image') { ?><input type="text" id="f_margin" class="smallWidth" value="" /><?php } ?></td>
163</tr>
164<tr>
165                        <td align="right"><?php if($insertMode=='image') { ?><label for="f_height">Height</label><?php }?></td>
166
167                        <td><?php if($insertMode=='image') { ?><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/><?php }?></td>
168
169                        <td align="right"><?php if($insertMode=='image') { ?><label for="f_padding">Padding</label><?php }?></td>
170
171                        <td><?php if($insertMode=='image') { ?><input type="text" id="f_padding" class="smallWidth" value="" />
172                        <?php }?></td>
173
174            <?php if($insertMode=='image' && !empty($IMConfig['use_color_pickers'])) { ?>
175                    <th align="left">Color:</th>
176                    <td>
177                  <input name="f_backgroundColor" type="text" id="f_backgroundColor" size="7" /><input type="button" id="bgCol_pick" value="..." />
178                </td>
179                <?php } else { // empty space in place of colorpickers ?>
180            <td colspan="2" rowspan="2"><input id="f_borderColor" name="f_borderColor" type="hidden" /><input id="f_backgroundColor" name="f_backgroundColor" type="hidden" /></td>
181                <?php } ?>
182</tr>
183<tr>
184                        <td align="right"><?php if($insertMode=='image') { ?><label for="f_align">Align</label><?php }?></td>
185
186                        <td colspan="2"><?php if($insertMode=='image') { ?>
187                                <select size="1" id="f_align"  title="Positioning of this image">
188                                  <option value=""                             >Not set</option>
189                                  <option value="left"                         >Left</option>
190                                  <option value="right"                        >Right</option>
191                                  <option value="texttop"                      >Texttop</option>
192                                  <option value="absmiddle"                    >Absmiddle</option>
193                                  <option value="baseline" selected="selected" >Baseline</option>
194                                  <option value="absbottom"                    >Absbottom</option>
195                                  <option value="bottom"                       >Bottom</option>
196                                  <option value="middle"                       >Middle</option>
197                                  <option value="top"                          >Top</option>
198                                </select><?php } ?>
199                        </td>
200
201                        <td align="right"><?php if($insertMode=='image') { ?><label for="f_border">Border</label><?php }?></td>
202                        <td><?php if($insertMode=='image') { ?><input type="text" id="f_border" class="smallWidth" value="" /><?php }?></td>
203                        <?php if($insertMode=='image' && !empty($IMConfig['use_color_pickers'])) { ?>
204                <th align="left">Border Color:</th>
205            <td><input name="f_borderColor" type="text" id="f_borderColor" size="7" /><input type="button" id="bdCol_pick" value="..." /></td>
206            <?php } ?>
207</tr>
208</table>
209
210<!--// image properties -->     
211        <div style="text-align: right;">
212          <hr />
213                  <button type="button" class="buttons" onclick="return refresh();">Refresh</button>
214          <button type="button" class="buttons" onclick="return onOK();">OK</button>
215          <button type="button" class="buttons" onclick="return onCancel();">Cancel</button>
216    </div>
217</form>
218</body>
219</html>
Note: See TracBrowser for help on using the repository browser.