[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the file settings. 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)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}. 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 * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license 22 * PROGIDISTRI S.A.S.'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 fplanque: Francois PLANQUE. 30 * @author mbruneau: Marc BRUNEAU / PROGIDISTRI 31 * @author fsaya: Fabrice SAYA-GASNIER / PROGIDISTRI 32 * 33 * @version $Id: _file_settings.form.php,v 1.1 2007/06/25 11:00:05 fplanque Exp $ 34 */ 35 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 36 37 38 /** 39 * @var GeneralSettings 40 */ 41 global $Settings; 42 43 global $upload_maxmaxkb; 44 45 /** 46 * Javascript to init hidden/shown state of something (like a DIV) based on a checkbox 47 * 48 * EXPERIMENTAL 49 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 50 * 51 * PROBLEM: jQuery is not necessarily loaded at the moment we use this :( 52 * 53 * @param string DOM class 54 * @param string DOM id 55 */ 56 function JS_showhide_class_on_checkbox( $class, $checkbox_id ) 57 { 58 return '<script type="text/javascript"> 59 if( document.getElementById("'.$checkbox_id.'").checked ) 60 { 61 $(".'.$class.'").show(); 62 } 63 else 64 { 65 $(".'.$class.'").hide(); 66 } 67 </script>'; 68 } 69 70 /** 71 * Javascript to init hidden/shown state of something (like a DIV) based on a checkbox 72 * 73 * EXPERIMENTAL 74 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 75 * 76 * @param array|string DOM id 77 * @param string DOM id 78 */ 79 function JS_showhide_ids_on_checkbox( $div_ids, $checkbox_id ) 80 { 81 if( !is_array($div_ids) ) 82 { 83 $div_ids = array( $div_ids ); 84 } 85 $r = '<script type="text/javascript"> 86 var display = document.getElementById("'.$checkbox_id.'").checked ? "" : "none";'."\n"; 87 foreach( $div_ids as $div_id ) 88 { 89 $r .= 'document.getElementById("'.$div_id.'").style.display = display;'."\n"; 90 } 91 $r .= '</script>'; 92 return $r; 93 } 94 95 /** 96 * Javascript to init hidden/shown state of a fastform field based on a checkbox 97 * 98 * EXPERIMENTAL 99 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 100 * 101 * @param string form field id as used when creating it with the Form class 102 * @param string DOM id 103 */ 104 function JS_showhide_ffield_on_checkbox( $field_id, $checkbox_id ) 105 { 106 return '<script type="text/javascript"> 107 document.getElementById("ffield_'.$field_id.'").style.display = (document.getElementById("'.$checkbox_id.'").checked ? "" : "none") 108 </script>'; 109 } 110 111 /** 112 * Javascript hide/show all DOM elements with a particular class based on current checkbox 113 * 114 * EXPERIMENTAL 115 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 116 * 117 * @param string DOM class name 118 */ 119 function JS_showhide_class_on_this( $class ) 120 { 121 return 'if( this.checked ) 122 { 123 $(".'.$class.'").show(); 124 } 125 else 126 { 127 $(".'.$class.'").hide(); 128 }'; 129 } 130 131 /** 132 * Javascript hide/show something (like a DIV) based on current checkbox 133 * 134 * EXPERIMENTAL 135 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 136 * 137 * @param array|string DOM ids 138 */ 139 function JS_showhide_ids_on_this( $div_ids ) 140 { 141 if( !is_array($div_ids) ) 142 { 143 $div_ids = array( $div_ids ); 144 } 145 $r = 'var display = this.checked ? "" : "none";'."\n"; 146 foreach( $div_ids as $div_id ) 147 { 148 $r .= 'document.getElementById("'.$div_id.'").style.display = display;'."\n"; 149 } 150 return $r; 151 } 152 153 /** 154 * Javascript hide/show a fastform field based on current checkbox 155 * 156 * EXPERIMENTAL 157 * Will be moved to another file, I'm leaving it here for a short period, in order to provide context 158 * 159 * @param string DOM id 160 */ 161 function JS_showhide_ffield_on_this( $field_id ) 162 { 163 return 'document.getElementById("ffield_'.$field_id.'").style.display = (this.checked ? "" : "none")'; 164 } 165 166 167 $Form = & new Form( NULL, 'files_checkchanges' ); 168 169 $Form->begin_form( 'fform', T_('File Settings') ); 170 171 $Form->hidden( 'ctrl', 'fileset' ); 172 $Form->hidden( 'action', 'update' ); 173 174 $Form->begin_fieldset( T_('File Manager') ); 175 $Form->checkbox_input( 'fm_enabled', $Settings->get('fm_enabled'), T_('Enable Filemanager'), array( 176 'note' => T_('Check to enable the Filemanager.' ), 'onclick' => JS_showhide_ids_on_this(array( 'ffset_fileroots', 'ffset_filecreate', 'ffset_fileadvanced' )) ) ); 177 $Form->end_fieldset(); 178 179 $Form->begin_fieldset( T_('Accessible file roots'), array( 'id' => 'ffset_fileroots', 'class' => 'additional_file_settings' ) ); 180 $Form->checkbox( 'fm_enable_roots_blog', $Settings->get('fm_enable_roots_blog'), T_('Enable blog directories'), T_('Check to enable root directories for blogs.' ) ); 181 // $Form->checkbox( 'fm_enable_roots_group', $Settings->get('fm_enable_roots_group'), T_('Enable group directories'), T_('Check to enable root directories for groups.' ) ); 182 $Form->checkbox( 'fm_enable_roots_user', $Settings->get('fm_enable_roots_user'), T_('Enable user directories'), T_('Check to enable root directories for users.' ) ); 183 $Form->checkbox( 'fm_enable_roots_skins', $Settings->get('fm_enable_roots_skins'), T_('Enable skins directory'), T_('Check to enable root directory for skins.' ) ); // fp> note: meaning may change to 1 dir per (installed) skin 184 $Form->end_fieldset(); 185 186 $Form->begin_fieldset( T_('File creation options'), array( 'id' => 'ffset_filecreate', 'class' => 'additional_file_settings' ) ); 187 $Form->checkbox( 'fm_enable_create_dir', $Settings->get('fm_enable_create_dir'), T_('Enable creation of folders'), T_('Check to enable creation of directories.' ) ); 188 $Form->checkbox( 'fm_enable_create_file', $Settings->get('fm_enable_create_file'), T_('Enable creation of files'), T_('Check to enable creation of files.' ) ); 189 $Form->checkbox_input( 'upload_enabled', $Settings->get('upload_enabled'), T_('Enable upload of files'), array( 190 'note' => T_('Check to allow uploading files in general.' ), 'onclick' => JS_showhide_ffield_on_this('upload_maxkb') ) ); 191 $Form->text_input( 'upload_maxkb', $Settings->get('upload_maxkb'), 6, T_('Maximum upload filesize'), sprintf( /* TRANS: first %s is setting/var name, second is file name, third is limit value */ T_('KB. This cannot be higher than your PHP/Webserver setting and the limit of %s (in %s), which is currently %s!'), '$upload_maxmaxkb', '/conf/_advanced.php', $upload_maxmaxkb.' '.T_('KB') ), array( 'maxlength'=>7, 'required'=>true ) ); 192 // Javascript to init hidden/shown state: 193 echo JS_showhide_ffield_on_checkbox( 'upload_maxkb', 'upload_enabled' ); 194 $Form->end_fieldset(); 195 196 $Form->begin_fieldset( T_('Advanced options'), array( 'id' => 'ffset_fileadvanced', 'class' => 'additional_file_settings' ) ); 197 198 $Form->text_input( 'fm_default_chmod_dir', $Settings->get('fm_default_chmod_dir'), 4, T_('Default folder permissions'), T_('Default CHMOD (UNIX permissions) for new directories created by the file manager.' ) ); 199 200 // fp> Does the following also applu to *uploaded* files? (It should) 201 $Form->text_input( 'fm_default_chmod_file', $Settings->get('fm_default_chmod_file'), 4, T_('Default file permissions'), T_('Default CHMOD (UNIX permissions) for new files created by the file manager.' ) ); 202 203 if( empty( $force_regexp_filename ) || empty( $force_regexp_dirname ) ) 204 { // At least one of these strings can be configured in the UI: 205 206 // Do not display regexp for filename if the force_regexp_filename var is set 207 if( empty($force_regexp_filename) ) 208 { 209 $Form->text( 'regexp_filename', 210 $Settings->get('regexp_filename'), 211 40, 212 T_('Valid filename'), 213 T_('Regular expression'), 214 255 ); 215 } 216 // Do not display regexp for dirname if the force_regexp_dirname var is set 217 if( empty( $force_regexp_dirname ) ) 218 { 219 $Form->text( 'regexp_dirname', 220 $Settings->get('regexp_dirname'), 221 40, 222 T_('Valid dirname'), 223 T_('Regular expression'), 224 255 ); 225 } 226 } 227 228 $Form->end_fieldset(); 229 230 // Javascript to init hidden/shown state: 231 echo JS_showhide_ids_on_checkbox( array( 'ffset_fileroots', 'ffset_filecreate', 'ffset_fileadvanced' ), 'fm_enabled' ); 232 233 if( $current_User->check_perm( 'options', 'edit', false ) ) 234 { // We have permission to modify: 235 $Form->buttons( array( 236 array( 'submit', 'submit', T_('Update'), 'SaveButton' ), 237 array( 'reset', '', T_('Reset'), 'ResetButton' ), 238 array( 'submit', 'submit[restore_defaults]', T_('Restore defaults'), 'ResetButton' ), 239 ) ); 240 } 241 242 243 $Form->end_form(); 244 245 246 /* 247 * $Log: _file_settings.form.php,v $ 248 * Revision 1.1 2007/06/25 11:00:05 fplanque 249 * MODULES (refactored MVC) 250 * 251 * Revision 1.15 2007/04/26 00:11:10 fplanque 252 * (c) 2007 253 * 254 * Revision 1.14 2006/12/10 01:53:39 blueyed 255 * Mention value of $upload_maxmaxkb 256 * 257 * Revision 1.13 2006/12/10 01:47:11 blueyed 258 * Note about $upload_maxmaxkb limit 259 * 260 * Revision 1.12 2006/12/09 01:55:36 fplanque 261 * feel free to fill in some missing notes 262 * hint: "login" does not need a note! :P 263 * 264 * Revision 1.11 2006/12/07 15:23:42 fplanque 265 * filemanager enhanced, refactored, extended to skins directory 266 * 267 * Revision 1.10 2006/12/06 21:22:49 fplanque 268 * the jQuery tentative and more 269 * 270 * Revision 1.9 2006/12/06 18:06:18 fplanque 271 * an experiment with JS hiding/showing form parts 272 * 273 * Revision 1.8 2006/11/28 01:40:13 fplanque 274 * wording 275 * 276 * Revision 1.7 2006/11/26 01:42:09 fplanque 277 * doc 278 */ 279 ?>
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 |
![]() |