| 1 |
<?php
|
| 2 |
// $Id: openwysiwyg.settings.inc,v 1.1 2009/04/11 12:00:44 thenicespider Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Settings page callback file for the openwysiwyg module.
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Menu callback;
|
| 10 |
*/
|
| 11 |
|
| 12 |
function openwysiwyg_admin_settings() {
|
| 13 |
$form = array();
|
| 14 |
// only administrators can access this function
|
| 15 |
|
| 16 |
// Generate the form - settings applying to all patterns first
|
| 17 |
$form['openwysiwyg_general'] = array(
|
| 18 |
'#type' => 'fieldset',
|
| 19 |
'#title' => t('General settings'),
|
| 20 |
'#collapsible' => TRUE,
|
| 21 |
'#collapsed' => FALSE,
|
| 22 |
);
|
| 23 |
$form['openwysiwyg_general']['openwysiwyg_xhtml'] = array(
|
| 24 |
'#type' => 'checkbox',
|
| 25 |
'#title' => t('Use xHTML markup'),
|
| 26 |
'#default_value' => variable_get("openwysiwyg_xhtml", '0'),
|
| 27 |
'#description' => t('Choose whether xhtml markup should be enabled or not.'),
|
| 28 |
);
|
| 29 |
$form['openwysiwyg_general']['openwysiwyg_editor_width'] = array(
|
| 30 |
'#type' => 'textfield',
|
| 31 |
'#title' => t('Editor width'),
|
| 32 |
'#default_value' => variable_get('openwysiwyg_editor_width', '100%'),
|
| 33 |
'#description' => t("Width of the openwysiwyg editor (%,px,em), i.e: 520px"),
|
| 34 |
);
|
| 35 |
$form['openwysiwyg_general']['openwysiwyg_editor_height'] = array(
|
| 36 |
'#type' => 'textfield',
|
| 37 |
'#title' => t('Editor height'),
|
| 38 |
'#default_value' => variable_get('openwysiwyg_editor_height', 0),
|
| 39 |
'#description' => t("Height of the openwysiwyg editor (%,px,em,ex)"),
|
| 40 |
);
|
| 41 |
|
| 42 |
$form['openwysiwyg_general']['openwysiwyg_style'] = array(
|
| 43 |
'#type' => 'textfield',
|
| 44 |
'#title' => t('Stylesheet'),
|
| 45 |
'#default_value' => variable_get('openwysiwyg_style', 'openwysiwyg.css'),
|
| 46 |
'#description' => t("CSS file for openwysiwyg. File should be located at: <b>openwysiwyg/library/styles/</b>")
|
| 47 |
);
|
| 48 |
|
| 49 |
$form['openwysiwyg_toolbar1'] = array(
|
| 50 |
'#type' => 'fieldset',
|
| 51 |
'#title' => t('Toolbar 1 buttons'),
|
| 52 |
'#collapsible' => TRUE,
|
| 53 |
'#collapsed' => FALSE,
|
| 54 |
);
|
| 55 |
$form['openwysiwyg_toolbar1']['openwysiwyg_toolbar_buttons_1'] = array(
|
| 56 |
'#suffix' => _openwysiwyg_settings_toolbar_js(),
|
| 57 |
'#title' => t('Buttons for Toolbar 1'),
|
| 58 |
'#type' => 'textfield',
|
| 59 |
'#default_value' => variable_get('openwysiwyg_toolbar_buttons_1', 'bold italic underline strikethrough seperator unorderedlist orderedlist'),
|
| 60 |
'#description' => t("Specify the names of the buttons to show on the toolbar. They will appear in order. Use the '|' (seperator) to separate button groups."),
|
| 61 |
'#prefix' => _openwysiwyg_settings_toolbar(1),
|
| 62 |
);
|
| 63 |
|
| 64 |
$form['openwysiwyg_toolbar2'] = array(
|
| 65 |
'#type' => 'fieldset',
|
| 66 |
'#title' => t('Toolbar 2 buttons'),
|
| 67 |
'#collapsible' => TRUE,
|
| 68 |
'#collapsed' => FALSE,
|
| 69 |
);
|
| 70 |
$form['openwysiwyg_toolbar2']['openwysiwyg_toolbar_buttons_2'] = array(
|
| 71 |
'#title' => t('Buttons for Toolbar 2'),
|
| 72 |
'#type' => 'textfield',
|
| 73 |
'#default_value' => variable_get('openwysiwyg_toolbar_buttons_2', 'subscript superscript seperator removeformat seperator inserttable insertimage'),
|
| 74 |
'#prefix' => _openwysiwyg_settings_toolbar(2),
|
| 75 |
);
|
| 76 |
return system_settings_form($form);
|
| 77 |
}
|
| 78 |
|
| 79 |
|
| 80 |
function openwysiwyg_settings_custombuttons() {
|
| 81 |
//$form = array();
|
| 82 |
|
| 83 |
$data = variable_get("openwysiwyg_custombuttons", NULL);
|
| 84 |
// initialize empty last row
|
| 85 |
$data[] = array('btnname' => '', 'btnvalue' => '');
|
| 86 |
|
| 87 |
$form['openwysiwyg_custombuttons'] = array('#tree' => TRUE,);
|
| 88 |
foreach ($data as $key => $val) {
|
| 89 |
$form['openwysiwyg_custombuttons'][$key]['btnname'] = array(
|
| 90 |
'#type' => 'textfield',
|
| 91 |
'#default_value' => $val['btnname'],
|
| 92 |
'#size' => 20,
|
| 93 |
'#maxlength' => 20,
|
| 94 |
);
|
| 95 |
$form['openwysiwyg_custombuttons'][$key]['btnvalue'] = array(
|
| 96 |
'#type' => 'textfield',
|
| 97 |
'#default_value' => $val['btnvalue'],
|
| 98 |
'#size' => 50,
|
| 99 |
'#maxlength' => 255,
|
| 100 |
);
|
| 101 |
$form['openwysiwyg_custombuttons'][$key]['delete'] = array(
|
| 102 |
'#type' => 'checkbox',
|
| 103 |
'#return_value' => 1,
|
| 104 |
'#default_value' => 0,
|
| 105 |
);
|
| 106 |
}
|
| 107 |
return system_settings_form($form);
|
| 108 |
}
|
| 109 |
|
| 110 |
function openwysiwyg_settings_visibility() {
|
| 111 |
//$form = array();
|
| 112 |
|
| 113 |
$form['openwysiwyg_visibility'] = array(
|
| 114 |
'#type' => 'fieldset',
|
| 115 |
'#title' => t('Visibility settings'),
|
| 116 |
'#collapsible' => TRUE,
|
| 117 |
'#collapsed' => FALSE,
|
| 118 |
);
|
| 119 |
$form['openwysiwyg_visibility']['openwysiwyg_textarea_id'] = array(
|
| 120 |
'#type' => 'radios',
|
| 121 |
'#title' => t('Textarea ID'),
|
| 122 |
'#default_value' => variable_get('openwysiwyg_textarea_id', 1),
|
| 123 |
'#options' => array(
|
| 124 |
t("Don't show openwysiwyg editor on this textareas ID:"),
|
| 125 |
t("Only show openwysiwyg editor on this textareas ID:")),
|
| 126 |
);
|
| 127 |
$form['openwysiwyg_visibility']['openwysiwyg_textarea_id_val'] = array(
|
| 128 |
'#type' => 'textfield',
|
| 129 |
'#default_value' => variable_get('openwysiwyg_textarea_id_val', 'edit-teaser,edit-body'),
|
| 130 |
'#description' => t("Specify the textarea IDs for this rule. Separate by comma."),
|
| 131 |
);
|
| 132 |
|
| 133 |
$form['openwysiwyg_visibility']['openwysiwyg_content_type'] = array(
|
| 134 |
'#type' => 'radios',
|
| 135 |
'#title' => t('Content type'),
|
| 136 |
'#default_value' => variable_get('openwysiwyg_content_type', 1),
|
| 137 |
'#options' => array(
|
| 138 |
t("Don't show openwysiwyg editor on this content type:"),
|
| 139 |
t("Only show openwysiwyg editor on this content type:")),
|
| 140 |
);
|
| 141 |
$form['openwysiwyg_visibility']['openwysiwyg_content_type_val'] = array(
|
| 142 |
'#type' => 'textfield',
|
| 143 |
'#default_value' => variable_get('openwysiwyg_content_type_val', 'page'),
|
| 144 |
'#description' => t("Specify the content type for this rule. Separate by comma."),
|
| 145 |
);
|
| 146 |
|
| 147 |
$form['openwysiwyg_visibility']['openwysiwyg_comment'] = array(
|
| 148 |
'#type' => 'radios',
|
| 149 |
'#title' => t('Comment box'),
|
| 150 |
'#default_value' => variable_get('openwysiwyg_comment', 0),
|
| 151 |
'#options' => array(
|
| 152 |
t("Disable editor for Comment"), t("Enable editor for Comment")),
|
| 153 |
);
|
| 154 |
|
| 155 |
$form['openwysiwyg_visibility']['openwysiwyg_page'] = array(
|
| 156 |
'#type' => 'radios',
|
| 157 |
'#title' => t('Show editor on specific pages'),
|
| 158 |
'#default_value' => variable_get('openwysiwyg_page', 0),
|
| 159 |
'#options' => array(
|
| 160 |
t("Show on every page except the listed pages."),
|
| 161 |
t("Show on only the listed pages."),
|
| 162 |
t("Show if the following PHP code returns TRUE (PHP-mode, experts only).")),
|
| 163 |
);
|
| 164 |
$form['openwysiwyg_visibility']['openwysiwyg_page_val'] = array(
|
| 165 |
'#type' => 'textarea',
|
| 166 |
'#default_value' => variable_get('openwysiwyg_page_val', ''),
|
| 167 |
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. <front> is the front page. If the PHP-mode is chosen, enter PHP code between <?php ?>. Note that executing incorrect PHP-code can break your Drupal site."),
|
| 168 |
);
|
| 169 |
|
| 170 |
return system_settings_form($form);
|
| 171 |
}
|
| 172 |
|
| 173 |
function openwysiwyg_settings_file_browser() {
|
| 174 |
//$form = array();
|
| 175 |
|
| 176 |
$form['openwysiwyg_file_browser'] = array(
|
| 177 |
'#type' => 'fieldset',
|
| 178 |
'#title' => t('File Browser'),
|
| 179 |
'#collapsible' => TRUE,
|
| 180 |
'#collapsed' => FALSE,
|
| 181 |
);
|
| 182 |
|
| 183 |
$form['openwysiwyg_file_browser']['openwysiwyg_folder_format'] = array(
|
| 184 |
'#type' => 'textfield',
|
| 185 |
'#title' => t('Folder format for each users'),
|
| 186 |
'#default_value' => variable_get('openwysiwyg_folder_format', 'u[uid]'),
|
| 187 |
'#description' => t("<ul><li>Specify the format for user folder, if you enter 'u[uid]' then the user folder become files/u1, files/u2, files/u3, etc.</li>".
|
| 188 |
"<li>Available variables: <b>[uid]</b> = User ID, <b>[username]</b> = Username, <b>[domainname]</b> = Domain Name</li>".
|
| 189 |
"<li>For Drupal multisite please use [domainname]-[username] to avoid conflict for same Username in different site.</li></ul>"),
|
| 190 |
);
|
| 191 |
$form['openwysiwyg_file_browser']['openwysiwyg_predefine_folder'] = array(
|
| 192 |
'#type' => 'textfield',
|
| 193 |
'#title' => t('Predefine folder for each users'),
|
| 194 |
'#default_value' => variable_get('openwysiwyg_predefine_folder', ''),
|
| 195 |
'#description' => t("Specify the predefine folder, i.e: if you enter 'article,story'' then this module will automatically create 'article and story' folder for each users, i.e: files/u1/article and files/u1/story"),
|
| 196 |
);
|
| 197 |
|
| 198 |
$form['openwysiwyg_file_upload'] = array(
|
| 199 |
'#type' => 'fieldset',
|
| 200 |
'#title' => t('File Upload'),
|
| 201 |
'#collapsible' => TRUE,
|
| 202 |
'#collapsed' => FALSE,
|
| 203 |
);
|
| 204 |
$form['openwysiwyg_file_upload']['openwysiwyg_file_extension'] = array(
|
| 205 |
'#type' => 'textfield',
|
| 206 |
'#title' => t('Allowed upload file extensions'),
|
| 207 |
'#default_value' => variable_get('openwysiwyg_file_extension', ''),
|
| 208 |
'#description' => t("Specify the file extension for upload, i.e: .gif,.jpg, .png . Leave blank if you allow all file extensions."),
|
| 209 |
);
|
| 210 |
$form['openwysiwyg_file_upload']['openwysiwyg_file_size'] = array(
|
| 211 |
'#type' => 'textfield',
|
| 212 |
'#title' => t('Maximum file size (KB)'),
|
| 213 |
'#default_value' => variable_get('openwysiwyg_file_size', '0'),
|
| 214 |
'#description' => t("Specify the maximum file size for upload in KB. Set 0 for unlimited size."),
|
| 215 |
);
|
| 216 |
$form['openwysiwyg_file_upload']['openwysiwyg_image_dimension'] = array(
|
| 217 |
'#type' => 'textfield',
|
| 218 |
'#title' => t('Maximum image dimension'),
|
| 219 |
'#default_value' => variable_get('openwysiwyg_image_dimension', '480x480'),
|
| 220 |
'#description' => t("Specify the maximum image dimension, i.e: 200x300. If the image size bigger then this module will automatically resize to this value with proportional size (retain image aspect ratio). Leave blank if you don't need this field."),
|
| 221 |
);
|
| 222 |
|
| 223 |
$form['openwysiwyg_file_resize'] = array(
|
| 224 |
'#type' => 'fieldset',
|
| 225 |
'#title' => t('File Resize'),
|
| 226 |
'#collapsible' => TRUE,
|
| 227 |
'#collapsed' => FALSE,
|
| 228 |
);
|
| 229 |
$form['openwysiwyg_file_resize']['openwysiwyg_file_resize_width'] = array(
|
| 230 |
'#type' => 'textfield',
|
| 231 |
'#title' => t('Default resize width'),
|
| 232 |
'#default_value' => variable_get('openwysiwyg_file_resize_width', '100'),
|
| 233 |
'#description' => t("Specify the default width for image resizing."),
|
| 234 |
);
|
| 235 |
$form['openwysiwyg_file_resize']['openwysiwyg_file_resize_height'] = array(
|
| 236 |
'#type' => 'textfield',
|
| 237 |
'#title' => t('Default resize height'),
|
| 238 |
'#default_value' => variable_get('openwysiwyg_file_resize_height', ''),
|
| 239 |
'#description' => t("Specify the default height for image resizing.<br><b>NOTE</b>: If you set value for <b>width</b> and leave <b>height</b> as blank then image will be resizing proportional to width size, and vice versa."),
|
| 240 |
);
|
| 241 |
return system_settings_form($form);
|
| 242 |
}
|