[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI for file browsing. 4 * 5 * This file is part of the evoCore framework - {@link http://evocore.net/} 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}. 10 * 11 * {@internal License choice 12 * - If you have received this file as part of a package, please find the license.txt file in 13 * the same folder or the closest folder above for complete license terms. 14 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 15 * then you must choose one of the following licenses before using the file: 16 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 17 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 18 * }} 19 * 20 * {@internal Open Source relicensing agreement: 21 * Daniel HAHLER grants Francois PLANQUE the right to license 22 * Daniel HAHLER's contributions to this file and the b2evolution project 23 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 24 * }} 25 * 26 * @package admin 27 * 28 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 29 * @author blueyed: Daniel HAHLER. 30 * @author fplanque: Francois PLANQUE. 31 * 32 * @version $Id: _file_browse.view.php,v 1.6 2007/11/01 04:31:25 fplanque Exp $ 33 */ 34 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 35 36 /** 37 * @var Filelist 38 */ 39 global $fm_Filelist; 40 /** 41 * @var FileRootCache 42 */ 43 global $FileRootCache; 44 /** 45 * @var string 46 */ 47 global $fm_flatmode; 48 /** 49 * @var User 50 */ 51 global $current_User; 52 /** 53 * @var GeneralSettings 54 */ 55 global $Settings; 56 57 global $UserSettings; 58 59 global $fm_hide_dirtree, $create_name, $ads_list_path, $rsc_url; 60 61 global $fm_FileRoot, $path; 62 63 /** 64 * @var Item 65 */ 66 global $edited_Item; 67 ?> 68 69 <!-- FILE BROWSER --> 70 71 <?php 72 $Widget = & new Widget( 'file_browser' ); 73 $Widget->global_icon( T_('Upload...'), '', regenerate_url( 'ctrl', 'ctrl=upload' ), T_('Upload').' »', 1, 5 ); 74 75 if( !empty($edited_Item) ) 76 { // Return to post editing: 77 $Widget->global_icon( T_('Close file manager'), 'close', '?ctrl=items&p='.$edited_Item->ID ); 78 } 79 80 $Widget->title = T_('File browser'); 81 $Widget->disp_template_replaced( 'block_start' ); 82 ?> 83 84 <table id="fm_browser" cellspacing="0" cellpadding="0"> 85 <thead> 86 <tr> 87 <td colspan="2" id="fm_bar"> 88 <?php 89 if( $UserSettings->get( 'fm_allowfiltering' ) != 'no' ) 90 { 91 // Title for checkbox and its label 92 $titleRegExp = format_to_output( T_('Filter is a regular expression'), 'formvalue' ); 93 94 $Form = & new Form( NULL, 'fmbar_filter_checkchanges', 'get', 'none' ); 95 $Form->begin_form( 'toolbaritem' ); 96 $Form->hidden_ctrl(); 97 $Form->hiddens_by_key( get_memorized(), array('fm_filter', 'fm_filter_regex') ); 98 ?> 99 <label for="fm_filter" class="tooltitle"><?php echo T_('Filter') ?>:</label> 100 <input type="text" name="fm_filter" id="fm_filter" 101 value="<?php echo format_to_output( $fm_Filelist->get_filter( false ), 'formvalue' ) ?>" 102 size="7" accesskey="f" /> 103 104 <?php 105 if( $UserSettings->get( 'fm_allowfiltering' ) == 'regexp' ) 106 { 107 ?> 108 <input type="checkbox" class="checkbox" name="fm_filter_regex" id="fm_filter_regex" title="<?php echo $titleRegExp; ?>" 109 value="1"<?php if( $fm_Filelist->is_filter_regexp() ) echo ' checked="checked"' ?> /> 110 <label for="fm_filter_regex" title="<?php echo $titleRegExp; ?>"><?php 111 echo /* TRANS: short for "is regular expression" */ T_('RegExp').'</label>'; 112 } 113 ?> 114 115 <input type="submit" name="actionArray[filter]" class="SmallButton" 116 value="<?php echo format_to_output( T_('Apply'), 'formvalue' ) ?>" /> 117 118 <?php 119 if( $fm_Filelist->is_filtering() ) 120 { // "reset filter" form 121 ?> 122 <input type="image" name="actionArray[filter_unset]" value="<?php echo T_('Unset filter'); ?>" 123 title="<?php echo T_('Unset filter'); ?>" src="<?php echo get_icon( 'delete', 'url' ) ?>" class="ActionButton" /> 124 <?php 125 } 126 $Form->end_form(); 127 } 128 ?> 129 130 <!-- ROOTS SELECT --> 131 132 <?php 133 $Form = & new Form( NULL, 'fmbar_roots', 'post', 'none' ); 134 $Form->begin_form(); 135 // $Form->hidden_ctrl(); 136 $Form->hiddens_by_key( get_memorized() ); 137 138 $rootlist = $FileRootCache->get_available_FileRoots(); 139 if( count($rootlist) > 1 ) 140 { // provide list of roots to choose from 141 ?> 142 <select name="new_root" onchange="this.form.submit();"> 143 <?php 144 $optgroup = ''; 145 foreach( $rootlist as $l_FileRoot ) 146 { 147 if( ($typegroupname = $l_FileRoot->get_typegroupname()) != $optgroup ) 148 { // We're entering a new group: 149 if( ! empty($optgroup) ) 150 { 151 echo '</optgroup>'; 152 } 153 echo '<optgroup label="'.T_($typegroupname).'">'; 154 $optgroup = $typegroupname; 155 } 156 echo '<option value="'.$l_FileRoot->ID.'"'; 157 158 if( $fm_Filelist->_FileRoot && $fm_Filelist->_FileRoot->ID == $l_FileRoot->ID ) 159 { 160 echo ' selected="selected"'; 161 } 162 163 echo '>'.format_to_output( $l_FileRoot->name )."</option>\n"; 164 } 165 if( ! empty($optgroup) ) 166 { 167 echo '</optgroup>'; 168 } 169 ?> 170 </select> 171 <script type="text/javascript"> 172 <!-- 173 // Just to have noscript tag below (which has to know what type it is not for). 174 // --> 175 </script> 176 <noscript> 177 <input class="ActionButton" type="submit" value="<?php echo T_('Change root'); ?>" /> 178 </noscript> 179 180 <?php 181 } 182 183 /* 184 * Display link to display directory tree: 185 */ 186 if( $fm_hide_dirtree ) 187 { 188 echo ' <a href="'.regenerate_url('fm_hide_dirtree', 'fm_hide_dirtree=0').'">'.T_('Display directory tree').'</a>'; 189 } 190 else 191 { 192 echo ' <a href="'.regenerate_url('fm_hide_dirtree', 'fm_hide_dirtree=1').'">'.T_('Hide directory tree').'</a>'; 193 } 194 195 /* 196 * Flat mode 197 */ 198 echo ' - '; 199 if( $fm_flatmode ) 200 { 201 echo ' <a href="'.regenerate_url('fm_flatmode', 'fm_flatmode=0').'" title="' 202 .T_('View one folder per page').'">'.T_('Folder mode').'</a>'; 203 } 204 else 205 { 206 echo ' <a href="'.regenerate_url('fm_flatmode', 'fm_flatmode=1').'" title="' 207 .T_('View all files and subfolders on a single page').'">'.T_('Flat mode').'</a>'; 208 } 209 210 /* 211 * Settings: 212 */ 213 echo ' - <a href="'.regenerate_url('', 'action=edit_settings').'" title="' 214 .T_('Edit display settings').'">'.T_('Display settings').'</a>'; 215 216 $Form->end_form(); 217 218 219 // ----------------------------------------------- 220 // Display table header: directory location info: 221 // ----------------------------------------------- 222 echo '<div id="fmbar_cwd">'; 223 // Display current dir: 224 echo T_('Current dir').': <strong class="currentdir">'.$fm_Filelist->get_cwd_clickable().'</strong>'; 225 echo '</div> '; 226 227 // Display current filter: 228 if( $fm_Filelist->is_filtering() ) 229 { 230 echo '<div id="fmbar_filter">'; 231 echo '[<em class="filter">'.$fm_Filelist->get_filter().'</em>]'; 232 // TODO: maybe clicking on the filter should open a JS popup saying "Remove filter [...]? Yes|No" 233 echo '</div> '; 234 } 235 236 237 // The hidden reload button, which gets displayed if a popup detects that the displayed files have changed 238 ?> 239 <span style="display:none;" id="fm_reloadhint"> 240 <a href="<?php echo regenerate_url() ?>" 241 title="<?php echo T_('A popup has discovered that the displayed content of this window is not up to date. Click to reload.'); ?>"> 242 <?php echo get_icon( 'refresh' ) ?> 243 </a> 244 </span> 245 246 <?php 247 // Display filecounts: 248 ?> 249 250 <div id="fmbar_filecounts" title="<?php printf( T_('%s bytes'), number_format($fm_Filelist->count_bytes()) ); ?>"> (<?php 251 disp_cond( $fm_Filelist->count_dirs(), T_('One directory'), T_('%d directories'), T_('No directories') ); 252 echo ', '; 253 disp_cond( $fm_Filelist->count_files(), T_('One file'), T_('%d files'), T_('No files' ) ); 254 echo ', '.bytesreadable( $fm_Filelist->count_bytes() ); 255 ?> 256 ) 257 </div> 258 259 </td> 260 </tr> 261 </thead> 262 263 <tbody> 264 <tr> 265 <?php 266 // ______________________________ Directory tree ______________________________ 267 if( ! $fm_hide_dirtree ) 268 { 269 echo '<td id="fm_dirtree">'; 270 271 // Version with all roots displayed 272 //echo get_directory_tree( NULL, NULL, $ads_list_path ); 273 274 // Version with only the current root displayed: 275 echo get_directory_tree( $fm_Filelist->_FileRoot, $fm_Filelist->_FileRoot->ads_path, $ads_list_path ); 276 277 echo '</td>'; 278 } 279 280 echo '<td id="fm_files">'; 281 // ______________________________ Files ______________________________ 282 283 require dirname(__FILE__).'/_file_list.inc.php'; 284 285 // ______________________________ Toolbars ______________________________ 286 echo '<div id="fileman_toolbars_bottom">'; 287 288 /* 289 * CREATE FILE/FOLDER TOOLBAR: 290 */ 291 if( ($Settings->get( 'fm_enable_create_dir' ) || $Settings->get( 'fm_enable_create_file' )) 292 && $current_User->check_perm( 'files', 'add' ) ) 293 { // dir or file creation is enabled and we're allowed to add files: 294 global $create_type; 295 296 $Form = & new Form( NULL, 'fmbar_create_checkchanges', 'post', 'none' ); 297 $Form->begin_form( 'toolbaritem' ); 298 $Form->hidden( 'action', 'createnew' ); 299 $Form->hidden_ctrl(); 300 $Form->hiddens_by_key( get_memorized() ); 301 if( ! $Settings->get( 'fm_enable_create_dir' ) ) 302 { // We can create files only: 303 echo '<label for="fm_createname" class="tooltitle">'.T_('New file:').'</label>'; 304 echo '<input type="hidden" name="create_type" value="file" />'; 305 } 306 elseif( ! $Settings->get( 'fm_enable_create_file' ) ) 307 { // We can create directories only: 308 echo '<label for="fm_createname" class="tooltitle">'.T_('New folder:').'</label>'; 309 echo '<input type="hidden" name="create_type" value="dir" />'; 310 } 311 else 312 { // We can create both files and directories: 313 echo T_('New').': '; 314 echo '<select name="create_type">'; 315 echo '<option value="dir"'; 316 if( isset($create_type) && $create_type == 'dir' ) 317 { 318 echo ' selected="selected"'; 319 } 320 echo '>'.T_('folder').'</option>'; 321 322 echo '<option value="file"'; 323 if( isset($create_type) && $create_type == 'file' ) 324 { 325 echo ' selected="selected"'; 326 } 327 echo '>'.T_('file').'</option>'; 328 echo '</select>:'; 329 } 330 ?> 331 <input type="text" name="create_name" id="fm_createname" value="<?php 332 if( isset( $create_name ) ) 333 { 334 echo $create_name; 335 } ?>" size="15" /> 336 <input class="ActionButton" type="submit" value="<?php echo format_to_output( T_('Create!'), 'formvalue' ) ?>" /> 337 <?php 338 $Form->end_form(); 339 } 340 341 342 /* 343 * UPLOAD: 344 */ 345 if( $Settings->get('upload_enabled') && $current_User->check_perm( 'files', 'add' ) ) 346 { // Upload is enabled and we have permission to use it... 347 echo "<!-- QUICK UPLOAD: -->\n"; 348 $Form = & new Form( NULL, 'fmbar_quick_upload', 'post', 'none', 'multipart/form-data' ); 349 $Form->begin_form( 'toolbaritem' ); 350 $Form->hidden( 'ctrl', 'upload' ); 351 $Form->hidden( 'upload_quickmode', 1 ); 352 // The following is mainly a hint to the browser. 353 $Form->hidden( 'MAX_FILE_SIZE', $Settings->get( 'upload_maxkb' )*1024 ); 354 $Form->hiddens_by_key( get_memorized('ctrl') ); 355 echo '<div>'; 356 echo '<input name="uploadfile[]" type="file" size="10" />'; 357 echo '<input class="ActionButton" type="submit" value="'.T_('Upload!').'" />'; 358 echo '</div>'; 359 $Form->end_form(); 360 } 361 362 echo '</div>'; 363 echo '<div class="clear"></div>'; 364 365 echo '</td>' 366 ?> 367 </tr> 368 </tbody> 369 </table> 370 371 <?php 372 $Widget->disp_template_raw( 'block_end' ); 373 374 /* 375 * $Log: _file_browse.view.php,v $ 376 * Revision 1.6 2007/11/01 04:31:25 fplanque 377 * Better root browsing (roots are groupes by type + only one root is shown at a time) 378 * 379 * Revision 1.5 2007/11/01 01:40:59 fplanque 380 * fixed : dir creation was losing item_ID 381 * 382 * Revision 1.4 2007/09/26 23:32:39 fplanque 383 * upload context saving 384 * 385 * Revision 1.3 2007/09/26 21:53:23 fplanque 386 * file manager / file linking enhancements 387 * 388 * Revision 1.2 2007/09/03 19:36:06 fplanque 389 * chicago admin skin 390 * 391 * Revision 1.1 2007/06/25 10:59:58 fplanque 392 * MODULES (refactored MVC) 393 * 394 * Revision 1.47 2007/04/26 00:11:10 fplanque 395 * (c) 2007 396 * 397 * Revision 1.46 2007/01/25 03:17:00 fplanque 398 * visual cleanup for average users 399 * geeky stuff preserved as options 400 * 401 * Revision 1.45 2007/01/25 02:41:50 fplanque 402 * made settings non sticky 403 * 404 * Revision 1.44 2007/01/24 07:58:59 fplanque 405 * integrated toolbars 406 * 407 * Revision 1.43 2007/01/24 07:18:22 fplanque 408 * file split 409 * 410 * Revision 1.42 2007/01/24 05:57:55 fplanque 411 * cleanup / settings 412 * 413 * Revision 1.41 2007/01/24 03:45:29 fplanque 414 * decrap / removed a lot of bloat... 415 * 416 * Revision 1.40 2007/01/24 02:35:42 fplanque 417 * refactoring 418 * 419 * Revision 1.39 2007/01/24 01:40:14 fplanque 420 * Upload tab now stays in context 421 * 422 * Revision 1.38 2007/01/23 22:30:14 fplanque 423 * empty icons cleanup 424 * 425 * Revision 1.37 2007/01/09 00:55:16 blueyed 426 * fixed typo(s) 427 * 428 * Revision 1.36 2007/01/07 18:42:35 fplanque 429 * cleaned up reload/refresh icons & links 430 * 431 * Revision 1.35 2006/12/24 00:52:57 fplanque 432 * Make posts with images - Proof of concept 433 * 434 * Revision 1.34 2006/12/23 22:53:10 fplanque 435 * extra security 436 * 437 * Revision 1.33 2006/12/22 00:17:05 fplanque 438 * got rid of dirty globals 439 * some refactoring 440 * 441 * Revision 1.32 2006/12/14 02:18:23 fplanque 442 * fixed navigation 443 * 444 * Revision 1.31 2006/12/14 01:46:29 fplanque 445 * refactoring / factorized image preview display 446 * 447 * Revision 1.30 2006/12/14 00:33:53 fplanque 448 * thumbnails & previews everywhere. 449 * this is getting good :D 450 * 451 * Revision 1.29 2006/12/13 18:10:22 fplanque 452 * thumbnail resampling proof of concept 453 * 454 * Revision 1.28 2006/12/13 03:08:28 fplanque 455 * thumbnail implementation design demo 456 * 457 * Revision 1.27 2006/12/12 19:39:07 fplanque 458 * enhanced file links / permissions 459 * 460 * Revision 1.26 2006/12/12 18:04:53 fplanque 461 * fixed item links 462 * 463 * Revision 1.25 2006/12/07 20:03:32 fplanque 464 * Woohoo! File editing... means all skin editing. 465 * 466 * Revision 1.24 2006/12/07 15:23:42 fplanque 467 * filemanager enhanced, refactored, extended to skins directory 468 * 469 * Revision 1.23 2006/11/24 18:27:25 blueyed 470 * Fixed link to b2evo CVS browsing interface in file docblocks 471 */ 472 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |