Index: img_assist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/Attic/img_assist.module,v retrieving revision 1.68.2.45 diff -u -p -r1.68.2.45 img_assist.module --- img_assist.module 8 Jan 2008 17:35:45 -0000 1.68.2.45 +++ img_assist.module 8 Jan 2008 17:49:45 -0000 @@ -15,6 +15,9 @@ */ function img_assist_help($section) { switch ($section) { + case 'admin/settings/img_assist': + return t('If this site was moved or is planned to move to another domain or sub-directory, it might be needed to empty the filter cache to correct image paths that are pointing to the old address. Note that this will only work for images that have been inserted using filter tags.', array('!empty-cache' => url('img_assist/cache/clear'))); + case 'img_assist/template': return '
%image
%caption
'; } @@ -29,6 +32,12 @@ function img_assist_menu($may_cache) { $access = user_access('access content'); if ($may_cache) { + $items[] = array('path' => 'img_assist/cache/clear', + 'title' => t('Empty cache'), + 'callback' => 'img_assist_cache_clear', + 'access' => $access, + 'type' => MENU_CALLBACK, + ); $items[] = array( 'path' => 'img_assist/load', 'title' => t('Image Assist'), @@ -310,7 +319,7 @@ function img_assist_admin_settings() { '#title' => t('Default link behavior'), '#default_value' => variable_get('img_assist_default_link_behavior', 'none'), '#options' => array('none' => t('Not a link'), 'node' => t('Link to image page'), 'popup' => t('Open in popup window'), 'url' => t('Go to URL')), - '#description' => t('The link behavior can be overriden when inserting images by users with the proper permissions, but these defaults will still be used for everyone else.'), + '#description' => t('The link behavior can be overridden when inserting images by users with the proper permissions, but these defaults will still be used for everyone else.'), ); $form['properties']['img_assist_default_link_url'] = array( '#type' => 'textfield', @@ -325,7 +334,7 @@ function img_assist_admin_settings() { '#title' => t('Default insert mode'), '#default_value' => variable_get('img_assist_default_insert_mode', 'none'), '#options' => array('filtertag' => t('Filter Tag'), 'html' => t('HTML Code')), - '#description' => t('The link behavior can be overriden when inserting images by users with the proper permissions, but these defaults will still be used for everyone else.'), + '#description' => t('The insert behavior can be overridden by users with the %permission permission when inserting images. Warning: If images are inserted as HTML, Image Assist is not able to correct a link or image URL afterwards. Please also note that users will not be able to edit already inserted images when using the TinyMCE plugin.', array('%permission' => t('access advanced options'))), ); $form['properties']['img_assist_load_title'] = array( '#type' => 'radios', @@ -437,6 +446,21 @@ function img_assist_nodeapi(&$node, $op, } /** + * Menu callback; clears relevant caches, then redirects to the previous page. + * + * @see devel_cache_clear() + */ +function img_assist_cache_clear() { + // clear core tables + $core = array('cache_filter', 'cache_page'); + foreach ($core as $table) { + cache_clear_all('*', $table, TRUE); + } + drupal_set_message('Cache cleared.'); + drupal_goto('admin/settings/img_assist'); +} + +/** * @defgroup img_assist_pages Image Assist Pages * @{ * All but img_assist_loader() are in frames. @@ -1151,7 +1175,7 @@ function img_assist_display(&$node, $siz $attributes['class'] = 'image image-'. $label . (isset($attributes['class']) ? ' '. $attributes['class'] : ''); $attributes['width'] = $info['width']; $attributes['height'] = $info['height']; - return theme('image_display', $node, $label, $node->images[$label], $attributes); + return theme('image_display', $node, $label, file_create_url($node->images[$label]), $attributes); } /** @@ -1625,7 +1649,7 @@ function theme_img_assist_inline($node, $info = image_get_info(file_create_path($node->images[$popup_size])); $width = $info['width']; $height = $info['height']; - $popup_url = $node->images[variable_get('img_assist_popup_label', IMAGE_PREVIEW)]; + $popup_url = file_create_url($node->images[variable_get('img_assist_popup_label', IMAGE_PREVIEW)]); $output .= l($img_tag, $popup_url, array('onclick' => "launch_popup({$node->nid}, {$width}, {$height}); return false;", 'target' => '_blank'), NULL, NULL, FALSE, TRUE); } elseif ($link == 'url') {