| 1 |
<?php |
<?php |
| 2 |
// $Id: webfm.admin.inc,v 1.2 2009/02/08 06:34:34 robmilne Exp $ |
// $Id: webfm.admin.inc,v 1.3 2009/07/21 17:45:09 robmilne Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 61 |
<br />If metadata title is used, renaming is available inside the metadata editor.') |
<br />If metadata title is used, renaming is available inside the metadata editor.') |
| 62 |
); |
); |
| 63 |
|
|
| 64 |
|
$form['webfm_display_owner'] = |
| 65 |
|
array('#type' => 'checkbox', |
| 66 |
|
'#title' => t('Display file owner column in browser'), |
| 67 |
|
'#default_value' => variable_get('webfm_display_owner', ''), |
| 68 |
|
'#description' => t('Check this box to display the file owner column in the browser.') |
| 69 |
|
); |
| 70 |
|
|
| 71 |
$form['file_perm'] = |
$form['file_perm'] = |
| 72 |
array('#type' => 'fieldset', |
array('#type' => 'fieldset', |
| 73 |
'#title' => t('Default File Permissions'), |
'#title' => t('Default File Permissions'), |
| 116 |
|
|
| 117 |
foreach ($roles as $rid => $role) { |
foreach ($roles as $rid => $role) { |
| 118 |
if(variable_get("root_dir_".$rid, '') == '') { |
if(variable_get("root_dir_".$rid, '') == '') { |
| 119 |
drupal_set_message(t('Role root directory not set for @role role', array('@role' => $role)), error); |
drupal_set_message(t('Role root directory not set for @role role', array('@role' => $role)), 'error'); |
| 120 |
} |
} |
| 121 |
|
|
| 122 |
$form["settings_role_".$rid] = |
$form["settings_role_".$rid] = |
| 166 |
); |
); |
| 167 |
} |
} |
| 168 |
|
|
| 169 |
|
if (module_exists('og')) { |
| 170 |
|
// Per group settings |
| 171 |
|
$groups = og_all_groups_options(); |
| 172 |
|
$form['groups'] = array('#type' => 'value', '#value' => $groups); |
| 173 |
|
$form['webfm_og_auto'] = array( |
| 174 |
|
'#type' => 'checkbox', |
| 175 |
|
'#default_value' => variable_get('webfm_og_auto', 0), |
| 176 |
|
'#title' => t('Create new group folders'), |
| 177 |
|
'#description' => t('Automatically create a new group folder when a group is created.'), |
| 178 |
|
); |
| 179 |
|
foreach ($groups as $gid => $group) { |
| 180 |
|
if (variable_get("root_dir_group_".$gid, '') == '') { |
| 181 |
|
drupal_set_message(t('Group root directory not set for @group group', array('@group' => $group)), 'error'); |
| 182 |
|
} |
| 183 |
|
$form["settings_group_". $gid] = |
| 184 |
|
array('#type' => 'fieldset', |
| 185 |
|
'#title' => t('Settings for @group group', array('@group' => $group)), |
| 186 |
|
'#collapsible' => TRUE, |
| 187 |
|
'#collapsed' => TRUE |
| 188 |
|
); |
| 189 |
|
$form["settings_group_". $gid]["root_dir_group_". $gid] = |
| 190 |
|
array('#type' => 'textfield', |
| 191 |
|
'#title' => t('Group Root directory'), |
| 192 |
|
'#default_value' => variable_get("root_dir_group_". $gid, ''), |
| 193 |
|
'#maxlength' => '100', |
| 194 |
|
'#size' => '70', |
| 195 |
|
'#description' => t('Root directory for this group. |
| 196 |
|
<br />This path is relative to "WebFM Root directory" set above. |
| 197 |
|
<br />If this directory path is compound then the path must already exist for this |
| 198 |
|
<br />setting to validate.'), |
| 199 |
|
); |
| 200 |
|
} |
| 201 |
|
} |
| 202 |
|
|
| 203 |
|
|
| 204 |
$form['attach'] = |
$form['attach'] = |
| 205 |
array('#type' => 'fieldset', |
array('#type' => 'fieldset', |
| 206 |
'#title' => t('WebFM attachments'), |
'#title' => t('WebFM attachments'), |
| 353 |
form_set_error('webfm_uploadsize_'. $rid, t('The %role maximum file size per upload is greater than the total file size allowed per user', array('%role' => $role))); |
form_set_error('webfm_uploadsize_'. $rid, t('The %role maximum file size per upload is greater than the total file size allowed per user', array('%role' => $role))); |
| 354 |
} |
} |
| 355 |
} |
} |
| 356 |
|
|
| 357 |
|
if (module_exists('og')) { |
| 358 |
|
foreach ($form_state['values']['groups'] as $gid => $group) { |
| 359 |
|
$group_root_dir_name = $form_state['values']['root_dir_group_'. $gid]; |
| 360 |
|
if (!empty($group_root_dir_name)) { |
| 361 |
|
if ($valid_webfm_root) { |
| 362 |
|
if (!preg_match('/^[0-9a-zA-Z]/', $group_root_dir_name)) { |
| 363 |
|
form_set_error('root_dir_group_'. $gid, t('The leading character of the %group root directory must be alphanumeric.', array('%group' => $group))); |
| 364 |
|
} else if(preg_match('[\.]', $group_root_dir_name)) { |
| 365 |
|
form_set_error('root_dir_group_'. $gid, t('The %group root directory name is not valid.', array('%group' => $group))); |
| 366 |
|
} else { |
| 367 |
|
$group_root_dir = $webfm_root_dir ."/". $group_root_dir_name; |
| 368 |
|
file_check_directory($group_root_dir, FILE_CREATE_DIRECTORY, 'root_dir_group_'.$gid); |
| 369 |
|
} |
| 370 |
|
} else { |
| 371 |
|
form_set_error('root_dir_group_'. $gid, t('The WebFM root directory must be valid for the %group root directory name to be valid.', array('%group' => $group))); |
| 372 |
|
} |
| 373 |
|
} |
| 374 |
|
} |
| 375 |
|
} |
| 376 |
} |
} |