function fckeditor_admin_global_profile_form in FCKeditor - WYSIWYG HTML editor 6.2
1 string reference to 'fckeditor_admin_global_profile_form'
- fckeditor_menu in ./
fckeditor.module - Implementation of hook_menu().
File
- ./
fckeditor.admin.inc, line 1007 - FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben
Code
function fckeditor_admin_global_profile_form($form_state, $mode = 'add') {
module_load_include('lib.inc', 'fckeditor');
if ($mode == 'edit') {
$profile = fckeditor_profile_load('FCKeditor Global Profile');
$form['_profile'] = array(
'#type' => 'value',
'#value' => $profile,
);
}
else {
$profile = new stdClass();
}
if ($mode == 'add') {
$data = fckeditor_profile_load('FCKeditor Global Profile');
if (!empty($data)) {
drupal_set_message(t('Global profile already exist. Only one global profile is allowed.'), 'error');
drupal_not_found();
}
$btn = t('Create global profile');
}
else {
$btn = t('Update global profile');
}
$form['common'] = array(
'#type' => 'fieldset',
'#title' => t('Main setup'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$roles = fckeditor_sorted_roles();
$rids = $rtext = array();
foreach ($roles as $rid => $name) {
$rids[] = $rid;
$rtext[] = '<strong>' . $rid . ' - </strong>' . $name;
}
$form['common']['rank'] = array(
'#type' => 'textfield',
'#title' => t('Role precedence'),
'#default_value' => implode('>', $rids),
'#description' => t('A user having multiple roles gets the permissions of the highest one. Sort role IDs according to their precedence from higher to lower by putting > in between.'),
);
if ($rids) {
$form['common']['rank']['#description'] .= '<br />' . t('Here are the id-name pairs of roles having access to FCKeditor:') . '<div>' . implode('<br />', $rtext) . '</div>';
}
else {
$form['common']['rank']['#description'] .= '<br />' . t('You haven\'t assigned the %accesspermission !permissionslink yet.', array(
'%accesspermission' => t('access fckeditor'),
'!permissionslink' => l(t('permission'), 'admin/user/permissions'),
));
}
$form['fckeditor_exclude_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Visibility settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('The following settings are combined with the visibility settings of the specific profile.'),
);
$form['fckeditor_exclude_settings']['excl_mode'] = array(
'#type' => 'radios',
'#title' => t('Use inclusion or exclusion mode'),
'#default_value' => empty($profile->settings['excl_mode']) || in_array($profile->settings['excl_mode'], array(
0,
2,
)) ? 0 : 1,
'#options' => array(
'0' => t('Exclude'),
'1' => t('Include'),
),
'#description' => t('Choose the way of disabling/enabling FCKeditor on selected fields/paths (see below). Use exclude to disable FCKeditor on selected fields/paths. Use include if you want to load FCKeditor only on selected paths/fields.'),
);
/**
* get excluded fields - so we can have normal textareas too
* split the phrase by any number of commas or space characters,
* which include " ", \r, \t, \n and \f
*/
$form['fckeditor_exclude_settings']['excl'] = array(
'#type' => 'textarea',
'#title' => t('Fields to exclude/include'),
'#cols' => 60,
'#rows' => 5,
'#prefix' => '<div style="margin-left:20px">',
'#suffix' => '</div>',
'#default_value' => !empty($profile->settings['excl']) ? $profile->settings['excl'] : '',
'#description' => t('Enter the paths to the textarea fields on which you want to enable or disable FCKeditor.') . ' ' . t('Please see the !helppagelink for more information about defining field names. Short instruction is available below.', array(
'!helppagelink' => l(t('help page'), 'admin/help/fckeditor', array(
'fragment' => 'fieldinclexcl',
)),
)) . ' <ul>' . '<li>' . t('Path structure') . ': <strong>content_type@path.element_id</strong></li>' . '<li>' . t('The following wildcards are available: *, ?') . '</li>' . '<li>' . t('Content type is optional. You may even specify only path or field id') . '</li>' . '<li>' . t('Examples') . ':<ul>' . '<li><em>blog@*.edit-body</em> - ' . t('matches all fields of type %type called %field, on any page', array(
'%type' => 'blog',
'%field' => 'edit-body',
)) . '<li><em>node/add/*.edit-user-*</em> - ' . t('matches fields starting with %field on pages starting with %path', array(
'%field' => 'edit-user-',
'%path' => 'node/add/',
)) . '</li></ul>' . '</li></ul>',
'#wysiwyg' => FALSE,
);
$form['fckeditor_exclude_settings']['simple_incl'] = array(
'#type' => 'textarea',
'#title' => t('Force simplified toolbar on the following fields'),
'#cols' => 60,
'#rows' => 5,
'#default_value' => !empty($profile->settings['simple_incl']) ? $profile->settings['simple_incl'] : '',
'#description' => t('Enter the paths to the textarea fields on which you want to force the simplified toolbar (%toolbarname).', array(
'%toolbarname' => FCKEDITOR_FORCE_SIMPLE_TOOLBAR_NAME,
)) . ' ' . t('Please see the !helppagelink for more information about defining field names. Take a look at the exclusion settings (above) for short instruction.', array(
'!helppagelink' => l(t('help page'), 'admin/help/fckeditor', array(
'fragment' => 'fieldinclexcl',
)),
)),
'#wysiwyg' => FALSE,
);
$form['fckeditor_advanced_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$module_drupal_path = drupal_get_path('module', 'fckeditor');
$form['fckeditor_advanced_settings']['fckeditor_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to FCKeditor'),
'#default_value' => !empty($profile->settings['fckeditor_path']) ? $profile->settings['fckeditor_path'] : '%m/fckeditor',
'#size' => 40,
'#maxlength' => 128,
'#description' => t('Path to FCKeditor (the HTML editor, downloaded from !fckeditorlink) relative to the document root.', array(
'!fckeditorlink' => l('http://ckeditor.com', 'http://ckeditor.com/download'),
)) . '<br />' . t('Available placeholders') . ':<br />' . '<strong>%b</strong> - ' . t('base URL path of the Drupal installation (%base)', array(
'%base' => base_path(),
)) . '<br />' . '<strong>%m</strong> - ' . t('base URL path where FCKeditor module is stored (%files)', array(
'%files' => base_path() . $module_drupal_path,
)) . '<br />' . t('Current path: %path', array(
'%path' => fckeditor_path(FALSE),
)),
'#required' => TRUE,
);
$form['fckeditor_advanced_settings']['fckeditor_local_path'] = array(
'#type' => 'textfield',
'#title' => t('Local path to FCKeditor'),
'#default_value' => isset($profile->settings['fckeditor_local_path']) ? $profile->settings['fckeditor_local_path'] : '',
'#size' => 40,
'#maxlength' => 128,
'#description' => t('The path to the local directory (on the server) which points to the path defined above. Enter either an absolute server path or path relative to %index. If empty, FCKeditor module will try to find the right path.', array(
'%index' => 'index.php',
)) . '<br />' . t('Current path: %path', array(
'%path' => fckeditor_path(TRUE),
)),
);
$form['fckeditor_advanced_settings']['show_fieldnamehint'] = array(
'#type' => 'radios',
'#title' => t('Show field name hint below each rich text editor'),
'#default_value' => !empty($profile->settings['show_fieldnamehint']) ? $profile->settings['show_fieldnamehint'] : 't',
'#options' => array(
't' => t('Yes'),
'f' => t('No'),
),
'#description' => t('This only applies for users with %adminpermission permissions.', array(
'%adminpermission' => t('administer fckeditor'),
)),
);
if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) {
global $user;
$current_private_dir = isset($profile->settings['private_dir']) ? trim($profile->settings['private_dir'], '\\/') : '';
$current_private_dir = strtr($current_private_dir, array(
'%u' => $user->uid,
'%n' => $user->name,
));
$form['fckeditor_advanced_settings']['private_dir'] = array(
'#type' => 'textfield',
'#title' => t('Location of files uploaded with FCKeditor in the private folder'),
'#default_value' => !empty($profile->settings['private_dir']) ? $profile->settings['private_dir'] : '',
'#size' => 40,
'#maxlength' => 255,
'#description' => t('The path relative to the location of the private directory where FCKeditor should store uploaded files.') . '<br />' . '<strong>' . t('Warning') . ':</strong> ' . t('FCKeditor does not implement any kind of access protection on files available in this location. All files stored in the directory defined above might be accessible by unauthenticated users if there is no information about the file in the Drupal\'s database.') . '<br />' . t('System path to the private folder is: @system_path.', array(
'@system_path' => realpath(file_directory_path()) . DIRECTORY_SEPARATOR,
)) . '<br />' . t('Available placeholders') . ':<br/>' . '<strong>%u</strong> - ' . t('User ID') . '<br />' . '<strong>%n</strong> - ' . t('Username') . '<br />' . t('Current path: @path', array(
'@path' => $current_private_dir . ' (' . file_create_path($current_private_dir) . ')',
)),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => $btn,
);
return $form;
}