Index: modules/img_assist/img_assist.module =================================================================== RCS file: /cvs/drupal/contributions/modules/img_assist/img_assist.module,v retrieving revision 1.54 diff -u -r1.54 img_assist.module --- modules/img_assist/img_assist.module 30 Nov 2005 02:48:56 -0000 1.54 +++ modules/img_assist/img_assist.module 13 Dec 2005 17:33:11 -0000 @@ -89,6 +89,7 @@ return t('Add images to your posts using img_assist.'); case 'process': + echo "YEP"; foreach(img_assist_get_macros($text) as $unexpanded_macro => $macro) { $expanded_macro = img_assist_render_image($macro); $text = str_replace($unexpanded_macro, $expanded_macro, $text); @@ -135,30 +136,81 @@ if (!$upload_enabled && !$image_enabled) { drupal_set_message(t('Neither Upload module or Image module are enabled. Img_assist needs one of these modules enabled in order to work. Please do that now.'), 'error'); } - - $group = form_radios(t('Display img_assist on'), 'img_assist_all', variable_get('img_assist_all', 1), array(t('on specific pages'), t('on all textareas'))); + $form['img_assist_access'] = array( + '#title' => t('Access settings'), + '#type' => 'fieldset', + '#collapsible' => true, + '#collapsed' => true, + ); + $form['img_assist_access']['img_assist_all'] = array( + '#type' => 'radios', + '#title' => t('Display img_assist on'), + '#default_value' => variable_get('img_assist_all', 1), + '#options' => array(t('on specific pages'), t('on all textareas')), + ); if (!variable_get('img_assist_all', 1)) { - $group .= form_textarea(t('Pages'), 'img_assist_pages', variable_get('img_assist_pages', img_assist_help('admin/settings/img_assist#pages')), 40, 5, 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.")); - } - $output = form_group_collapsible(t('Access settings'), $group, TRUE); - - $group = form_checkboxes(t('Hide \'inline image link\' for the following node types'), 'img_assist_no_nodes', variable_get('img_assist_no_nodes', array()), $nodetypes, t('Check the node types you do not want the ability to add images to.'), NULL, TRUE); - $group .= form_textarea(t('Image HTML template'), 'img_assist_img_html', variable_get('img_assist_img_html', img_assist_help('img_assist/template')), 50, 10, t('Enter the HTML wrap around your image tag. You can use the following variables: %image-class - CSS class name of the image. The default is "image", %img-link - a link to the original image, %node-link - a link to the original node containing the image, %nid - a nid of the original node containing the image, and %caption - a user-defined caption.')); - $group .= form_radios(t('Preload image captions'), 'img_assist_load_caption', variable_get('img_assist_load_caption', 1), array(t('Disabled'), t('Enabled')), t('If enabled, The body text from the image will be loaded as the caption by default.')); - $output .= form_group_collapsible(t('Image output settings'), $group, TRUE); + $form['img_assist_access']['img_assist_pages'] = array( + '#type' => 'textarea', + '#title' => t('Pages'), + '#default_value' => variable_get('img_assist_pages', img_assist_help('admin/settings/img_assist#pages')), + '#cols' => 40, + '#rows' => 5, + '#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."), + ); + } + $form['img_assist_output'] = array( + '#title' => t('Image output settings'), + '#type' => 'fieldset', + '#collapsible' => true, + '#collapsed' => true, + ); + $form['img_assist_output']['img_assist_no_nodes'] = array( + '#type' => 'checkboxes', + '#title' => t('Hide \'inline image link\' for the following node types'), + '#default_value' => variable_get('img_assist_no_nodes', array()), + '#options' => array_keys(node_get_types()), + '#description' => t('Check the node types you do not want the ability to add images to.'), + '#required' => TRUE, + ); + $form['img_assist_output']['img_assist_img_html'] = array( + '#type' => 'textarea', + '#title' => t('Image HTML template'), + '#default_value' => variable_get('img_assist_img_html', img_assist_help('img_assist/template')), + '#cols' => 50, + '#rows' => 10, + '#description' => t('Enter the HTML wrap around your image tag. You can use the following variables: %image-class - CSS class name of the image. The default is "image", %img-link - a link to the original image, %node-link - a link to the original node containing the image, %nid - a nid of the original node containing the image, and %caption - a user-defined caption.'), + ); + $form['img_assist_output']['img_assist_load_caption'] = array( + '#type' => 'radios', + '#title' => t('Preload image captions'), + '#default_value' => variable_get('img_assist_load_caption', 1), + '#options' => array(t('Disabled'), t('Enabled')), + '#description' => t('If enabled, The body text from the image will be loaded as the caption by default.'), + ); if (module_exist('taxonomy')) { $vocs[0] = '<'. t('none') .'>'; foreach (taxonomy_get_vocabularies() as $vid => $voc) { $vocs[$vid] = $voc->name; } - - if ($voc) { - $preview = form_select(t('Image preview filter'), 'img_assist_preview_filter', variable_get('img_assist_preview_filter', array()), $vocs, t('Select the vocabularies you want to be able to filter thumbnails by. This setting changes the behavior of img_assist at startup from loading all image thumbnails to displaying a list of image names until a filter is chosen.'), '', 1); - } + } + $form['img_assist_preview_settings'] = array( + '#title' => t('Preview settings'), + '#type' => 'fieldset', + '#collapsible' => true, + '#collapsed' => true, + ); + if ($voc) { + $form['img_assist_preview_settings']['img_assist_preview_filter'] = array( + '#type' => 'select', + '#title' => t('Image preview filter'), + '#default_value' => variable_get('img_assist_preview_filter', array()), + '#options' => $vocs, + '#description' => t('Select the vocabularies you want to be able to filter thumbnails by. This setting changes the behavior of img_assist at startup from loading all image thumbnails to displaying a list of image names until a filter is chosen.'), + '#multiple' => 1, + ); } - - $group = $preview; if (function_exists('_image_get_sizes')) { foreach (_image_get_sizes() as $size) { if ($size['label']) { @@ -167,13 +219,39 @@ } } if ($derivatives) { - $group .= form_select(t('Default derivative selection'), 'default_label', variable_get('default_label', '_original'), $derivatives, t('Select a derivative to be highlighted by default when an image is selected in the img_assist preview pane.')); - } - $group .= form_textfield(t('Default width of image thumbnail previews'), 'img_assist_default_preview_width', variable_get('img_assist_default_preview_width', 75), 6, 6, t('Enter, in pixels, the default width of an image to display in the preview pane. The smaller this number, the more images you will be able to see without scrolling.')); - $group .= form_textfield(t('Max number of images to preview'), 'img_assist_preview_count', variable_get('img_assist_preview_count', 25), 6, 6, t('Enter the threshold of the number of images to display in the directory preview pane. If there are more images for a given view, they will be displayed as hyperlinks.')); - $output .= form_group_collapsible(t('Preview settings'), $group, TRUE); + $form['img_assist_preview_settings']['default_label'] = array( + '#type' => 'select', + '#title' => t('Default derivative selection'), + '#default_value' => variable_get('default_label', '_original'), + '#options' => $derivatives, + '#description' => t('Select a derivative to be highlighted by default when an image is selected in the img_assist preview pane.'), + ); + } + $form['img_assist_preview_settings']['img_assist_default_preview_width'] = array( + '#type' => 'textfield', + '#title' => t('Default width of image thumbnail previews'), + '#default_value' => variable_get('img_assist_default_preview_width', 75), + '#size' => 6, + '#maxlength' => 6, + '#description' => t('Enter, in pixels, the default width of an image to display in the preview pane. The smaller this number, the more images you will be able to see without scrolling.'), + ); + $form['img_assist_preview_settings']['img_assist_preview_count'] = array( + '#type' => 'textfield', + '#title' => t('Max number of images to preview'), + '#default_value' => variable_get('img_assist_preview_count', 25), + '#size' => 6, + '#maxlength' => 6, + '#description' => t('Enter the threshold of the number of images to display in the directory preview pane. If there are more images for a given view, they will be displayed as hyperlinks.'), + ); + return $form; +} - return $output; +/** + * Implementation of hook_elements(). + */ +function img_assist_elements() { + $type['textarea'] = array('#process' => array('img_assist_textarea' => array())); + return $type; } /** @@ -181,12 +259,14 @@ * * Add image links underneath textareas. */ -function img_assist_textarea($op, $name) { - if ($op == 'post' && _img_assist_page_match() && !strstr($_GET['q'], 'img_assist/add/image')) { - $anchor = '
'; } + return $element; + } /******************************************************************** @@ -201,7 +281,6 @@ $textarea = $_GET['textarea'] ? $_GET['textarea'] : variable_get('img_assist_textarea', $textarea); variable_set('img_assist_textarea', $textarea); - $head = ''; $editor = ''; if ($_GET['editor']) { @@ -257,7 +336,7 @@ var f = myDoc.getElementsByTagName('form'); for (var i=0; i| ', + '#suffix' => ' | ' + ); + $form['imgtouse']['alt'] = array( + '#type' => 'textfield', + '#title' => t('Image description for the visually impaired'), + '#default_value' => $img->title, + '#size' => 55, + '#maxlength' => 255, + ); + $form['imgtouse']['caption'] = array( + '#type' => 'textarea', + '#title' => t('Image caption (optional)'), + '#default_value' => $img->caption, + '#cols' => 70, + '#rows' => 2, + ); + $form['imgsize'] = array( + '#type' => 'fieldset', + '#title' => t('Image size in pixels'), + '#prefix' => '', + '#suffix' => ' |
$format_type $id_field $submit
Once you\'ve clicked on an above image, you can modify its properties in this pane.
')); + return ($id > 0 ? $output : t('Once you\'ve clicked on an above image, you can modify its properties in this pane.
')); } /********************************************************************