--- openwysiwyg_orig/openwysiwyg.module	2008-09-08 00:51:01.000000000 +0700
+++ openwysiwyg_new/openwysiwyg.module	2008-09-08 20:43:35.281250000 +0700
@@ -225,7 +225,14 @@ function openwysiwyg_settings_visibility
   '#type' => 'textfield',
   '#default_value' => variable_get('openwysiwyg_content_type_val', 'page'),
   '#description' => t("Specify the content type for this rule. Separate by comma."),
-  );   
+  );
+
+  $form['openwysiwyg_visibility']['openwysiwyg_pages'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Choose pages'),
+    '#description' => t('If you enter pages in here, and a textarea id above, these pages will be checked for the textarea, and the WYSIWYG editor will be initialized.  Enter your pages in the form <em>admin/build/block/add</em>, each on its own line.'),
+    '#default_value' => variable_get('openwysiwyg_pages', ''),
+  );
   
 	return $form;
 }
@@ -257,7 +264,7 @@ function openwysiwyg_change_textarea($el
   if (arg(0) == 'node' && arg(1)=='add') {
     $form_type =arg(2);
   } 
-  if(_openwysiwyg_validate_element_id($element["#id"]) && _openwysiwyg_validate_content_type($form_type)) {
+  if(_openwysiwyg_validate_element_id($element["#id"]) && (_openwysiwyg_validate_content_type($form_type) || _openwysiwyg_allowed_pages())) {
     if (!$openwysiwyg_ready) {
       // get the path for the buttom images
 		  $buttonpath = base_path().drupal_get_path('module', 'openwysiwyg').'/library/images/'; 
@@ -357,6 +364,12 @@ function _openwysiwyg_validate_element_i
   // when returned valid, the openwysiwyg editor will be shown
   $values = variable_get('openwysiwyg_textarea_id_val','edit-teaser,edit-body');
   $values_arr = split(',',$values);
+  
+  // someone might put a space between the comma and the next content type
+  foreach ($values_arr as $key => $value) {
+    $values_arr[$key] = trim($value);
+  }
+  
   // exclude some textfields that we need on the settings page from showing the editor
   array_push($values_arr,'edit-openwysiwyg-textarea-id-val');
   array_push($values_arr,'edit-openwysiwyg-visibility-path-val');  
@@ -384,6 +397,12 @@ function _openwysiwyg_validate_content_t
   // when returned valid, the openwysiwyg editor will be shown
   $values = variable_get('openwysiwyg_content_type_val','page');
   $values_arr = split(',',$values);
+  
+  // someone might put a space between the comma and the next textarea id
+  foreach ($values_arr as $key => $value) {
+    $values_arr[$key] = trim($value);
+  }
+
   // exclude some textfields that we need on the settings page from showing the editor
   array_push($values_arr,'edit-openwysiwyg-textarea-id-val');
   array_push($values_arr,'edit-openwysiwyg-visibility-path-val');  
@@ -404,6 +423,24 @@ function _openwysiwyg_validate_content_t
 }
 
 /**
+ * Check to see if the current path is contained within the list of acceptable paths
+ */
+function _openwysiwyg_allowed_pages() {
+  $values = variable_get('openwysiwyg_pages', '');
+  
+  $path = drupal_get_path_alias($_GET['q']);
+  $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($values, '/')) .')$/';
+  
+  // Compare with the internal and path alias (if any).
+  $page_match = preg_match($regexp, $path);
+  if ($path != $_GET['q']) {
+    $page_match = $page_match || preg_match($regexp, $_GET['q']);
+  }
+
+  return $page_match;
+}
+
+/**
  * Check whether the xhtml.js file is available
  * @return bool
  */
