Index: img_assist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/Attic/img_assist.module,v
retrieving revision 1.68.2.10
diff -u -p -r1.68.2.10 img_assist.module
--- img_assist.module	22 Mar 2007 19:20:09 -0000	1.68.2.10
+++ img_assist.module	29 Mar 2007 00:31:06 -0000
@@ -112,7 +112,7 @@ function img_assist_elements() {
 function img_assist_textarea($element) {
   $link = variable_get('img_assist_link', 'icon');
   if (($link == 'icon') || ($link == 'text')) {
-    if (_img_assist_page_match() && !strstr($_GET['q'], 'img_assist')) { // removed ($op == 'post')
+    if (_img_assist_textarea_match($element['#id']) && _img_assist_page_match() && !strstr($_GET['q'], 'img_assist')) { // removed ($op == 'post')
       if (user_access('access img_assist')) {
         $output = theme('img_assist_textarea_link', $element, $link);
         $element['#suffix'] .= $output;
@@ -163,8 +163,7 @@ function img_assist_block($op = 'list', 
  */
 function img_assist_admin_settings() {
   // check for image.module
-  $image_enabled  = function_exists('image_help');
-  if (!$image_enabled) {
+  if (!module_exists('image')) {
     drupal_set_message(t('Image module is not enabled. Image assist needs this module enabled in order to work. Please do that now.'), 'error');
   }
 
@@ -177,19 +176,36 @@ function img_assist_admin_settings() {
   );
   $form['access']['img_assist_all'] = array(
     '#type' => 'radios',
-    '#title' => t('Display Image assist'),
+    '#title' => t('Display Image assist on paths'),
     '#default_value' => variable_get('img_assist_all', 0),
-    '#options' => array(t('on specific pages'), t('on all textareas')),
+    '#options' => array(t('on all paths'), t('on specific paths')),
   );
 
-  if (!variable_get('img_assist_all', 0)) {
+  if (variable_get('img_assist_all', 0)) {
     $form['access']['img_assist_pages'] = array(
       '#type' => 'textarea',
-      '#title' => t('Pages'),
+      '#title' => t('Paths'),
       '#default_value' => variable_get('img_assist_pages', "node/*\ncomment/*"),
       '#cols' => 40,
       '#rows' => 5,
-      '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '<em>blog</em>' for the blog page and '<em>blog/*</em>' for every personal blog. '<em>&lt;front&gt;</em>' is the front page."),
+      '#description' => t("Enter one path per line as Drupal paths. The '*' character is a wildcard. Example paths are '<em>blog</em>' for the blog page and '<em>blog/*</em>' for every personal blog. '<em>&lt;front&gt;</em>' is the front page."),
+    );
+  }
+  
+  $form['access']['img_assist_textareas_type'] = array(
+    '#type' => 'radios',
+    '#title' => t('Display Image assist on textareas'),
+    '#default_value' => variable_get('img_assist_textareas_type', 2),
+    '#options' => array(t('on specific textareas'), t('not on specific textareas'), t('on all textareas')),
+  );
+  if (variable_get('img_assist_textareas_type', 2) != 2) {
+    $form['access']['img_assist_textareas'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Textareas'),
+      '#default_value' => variable_get('img_assist_textareas', "edit-body\nedit-comment"),
+      '#cols' => 40,
+      '#rows' => 5,
+      '#description' => t('Enter one textarea form-id per line.'),
     );
   }
   $form['access']['img_assist_link'] = array(
@@ -1469,7 +1485,7 @@ function img_assist_get_macros($text) {
  *   TRUE if can render, FALSE if not allowed.
  */
 function _img_assist_page_match() {
-  if (variable_get('img_assist_all', 1)) {
+  if (variable_get('img_assist_all', 0)) {
     return TRUE;
   }
   else {
@@ -1484,6 +1500,25 @@ function _img_assist_page_match() {
   }
 }
 
+/**
+ * Determine if img_assist can render the current textarea.
+ *
+ * @return
+ *   TRUE if can render, FALSE if not allowed.
+ */
+function _img_assist_textarea_match($formid) {
+  $must_match = variable_get('img_assist_textareas_type', 2);
+  if ($must_match == 2) {
+    return TRUE;
+  }
+  else {
+    $formids = variable_get('img_assist_textareas', 'edit-body\nedit-comment');
+    $formids = preg_split("/\r\n?|\n/", $formids);
+    $match = in_array($formid, $formids);
+    return $match != $must_match;
+  }
+}
+
 // --------------------------------------------------------------------------------
 // Theme Functions
 // --------------------------------------------------------------------------------
@@ -1698,4 +1733,3 @@ function _img_assist_get_thumbnail(&$ima
 function theme_img_assist_legacy() {
   return "<div class=\"%image-class\">\n  <a href=\"%node-link\"><img src=\"%src\" width=\"%width\" height=\"%height\" alt=\"%alt\" /></a>\n  <div class=\"caption\">%caption</div>\n</div>";
 }
-
