Index: modules/quicktags/quicktags.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quicktags/quicktags.module,v
retrieving revision 1.19
diff -u -r1.19 quicktags.module
--- modules/quicktags/quicktags.module	10 Oct 2006 15:48:44 -0000	1.19
+++ modules/quicktags/quicktags.module	11 Oct 2006 14:10:06 -0000
@@ -2,16 +2,6 @@
 // $Id: quicktags.module,v 1.19 2006/10/10 15:48:44 ber Exp $
 
 /**
- * Implementation of hook_help().
- */
-function quicktags_help($section) {
-  switch($section) {
-    case 'admin/modules#description':
-      return t('Allows Drupal to use quicktags around the textarea for easier user input');
-  }
-}
-
-/**
  * Implementation of hook_perm().
  */
 function quicktags_perm() {
@@ -22,7 +12,6 @@
  * Implementation of hook_settings().
  */
 function quicktags_settings() {
-
   $form['quicktags_options'] = array(
     '#type' => 'fieldset',
     '#title' => t('Quicktags options'),
@@ -34,9 +23,8 @@
     '#options' => array(0 => t('Everywhere'), 1 => t('Only nodes'), 2 => t('Nodes and comments')),
     '#description' => t('Where to show the quicktags toolbar.'),
   );
-
-
-  return $form;
+  
+  return system_settings_form($form);
 }
 
 /**
@@ -44,9 +32,19 @@
  */
 function quicktags_menu($may_cache) {
   $items = array();
-
+  
   if ($may_cache) {
     $items[] = array(
+      'path' => 'admin/settings/quicktags',
+      'title' => t('Quicktags'),
+      'description' => t('Configure quicktags options.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'quicktags_settings',
+      'access' => user_access('administer site configuration')
+    );
+  } 
+  else {
+    $items[] = array(
       'path' => 'quicktags',
       'callback' => 'quicktags_javascript',
       'access' => TRUE,
@@ -110,19 +108,11 @@
 function theme_quicktags_textfield($element) {
   static $ta_count = 0;
 
-  $path = drupal_get_path('module','quicktags');
-
   //Add the stylesheet
-  $stylesheet =  $path .'/quicktags.css';
-  drupal_set_html_head(theme_stylesheet_import(base_path() . $stylesheet));
-
-  //Add the static file
-  $javascript = $path .'/quicktags.js';
-  drupal_add_js($javascript);
-
-  //Add the dynamically generated file
-  drupal_add_js('?q=quicktags');
-  //using cache = FALSE might seem a good option, but this breaks on the menu.
+  drupal_add_css(drupal_get_path('module','quicktags') .'/styles/quicktags.css');
+  
+  //Add javascript
+  module_invoke_all('quicktags', 'js', '');
 
   $cols = ($element['#cols'] ? ' cols="'. $element['#cols'] .'"' : '');
   $class[] = ($element['#attributes']['class'] ? $element['#attributes']['class'] : 'form-textarea');
@@ -142,7 +132,25 @@
   return theme('form_element', $element['#title'], $html, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
 }
 
-
+/**
+ * Implementation of hook_quicktags().
+ */
+function quicktags_quicktags($op, $items) {
+  switch ($op) {
+    case 'insert':
+      $items = quicktags_quicktags_insert();
+      break;
+    case 'js':
+      //Add the static file
+      drupal_add_js(drupal_get_path('module','quicktags') .'/javascript/quicktags.js');
+      //Add the dynamically generated file
+      drupal_add_js('?q=quicktags');
+      //using cache = FALSE might seem a good option, but this breaks on the menu.
+      break;
+  }
+  
+  return $items;
+}
 
 /* array(id, display, tagStart, tagEnd, access, open, location)
  * id;         // used to name the toolbar button
@@ -154,7 +162,7 @@
  * location;   // optional: onclick action omit the ().
 */
 function quicktags_quicktags_insert() {
-  $path = base_path() . drupal_get_path('module','quicktags') .'/';
+  $path = base_path() . drupal_get_path('module','quicktags') .'/images/';
 
   $items = array(
     'ed_italic' => array(
@@ -207,8 +215,8 @@
 function quicktags_javascript() {
   $output = '';
   $items = array();
-  $items = module_invoke_all('quicktags_insert');
-  $items = array_merge($items, module_invoke_all('quicktags_alter', $items));
+  $items = module_invoke_all('quicktags', 'insert', '');
+  $items = array_merge($items, module_invoke_all('quicktags', 'alter', $items));
 
   $js = quicktags_javascript_prepare($items);
 
@@ -227,7 +235,7 @@
 }
 
 function quicktags_javascript_prepare() {
-  $path = base_path() . drupal_get_path('module', 'quicktags');
+  $path = base_path() . drupal_get_path('module', 'quicktags') .'/images';
   $output = <<<EOD
 function edToolbar(id) {
   document.write('<div class="ed_toolbar" id="ed_toolbar' + id + '">');
