Index: modules/quicktags/quicktags.info =================================================================== --- modules/quicktags/quicktags.info (revision 0) +++ modules/quicktags/quicktags.info (revision 0) @@ -0,0 +1,4 @@ +; $Id$ + +name = "Quicktags" +description = "Allows Drupal to use quicktags around the textarea for easier user input." Index: modules/quicktags/quicktags.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/quicktags/quicktags.module,v retrieving revision 1.20 diff -u -r1.20 quicktags.module --- modules/quicktags/quicktags.module 12 Oct 2006 11:19:11 -0000 1.20 +++ modules/quicktags/quicktags.module 22 Dec 2006 01:18:08 -0000 @@ -2,16 +2,6 @@ // $Id: quicktags.module,v 1.20 2006/10/12 11:19:11 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); } /** @@ -47,10 +35,12 @@ if ($may_cache) { $items[] = array( - 'path' => 'quicktags', - 'callback' => 'quicktags_javascript', - 'access' => TRUE, - 'type' => MENU_CALLBACK + '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') ); } @@ -109,31 +99,32 @@ */ function theme_quicktags_textfield($element) { static $ta_count = 0; + + $html = ''; - $path = drupal_get_path('module','quicktags'); + $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. - - $cols = ($element['#cols'] ? ' cols="'. $element['#cols'] .'"' : ''); - $class[] = ($element['#attributes']['class'] ? $element['#attributes']['class'] : 'form-textarea'); - if ($element['#resizable'] !== false) { + if ($ta_count == 0) { + //Add the stylesheet + drupal_add_css($path .'/quicktags.css'); + + //Add the static file + drupal_add_js($path .'/quicktags.js'); + + //Add dynamic code + $html .= quicktags_javascript(); + } + + $cols = $element['#cols'] ? ' cols="'. $element['#cols'] .'"' : ''; + $class = ($element['#attributes']['class'] ? array($element['#attributes']['class']) : array('form-textarea')); + if ($element['#resizable'] !== FALSE) { drupal_add_js('misc/textarea.js'); $class[] = 'resizable'; } _form_set_class($element, $class); - $html = ''; + $html .= ''; $html .= ''; $html .= check_plain($element['#value']); $html .= ''; @@ -144,11 +135,9 @@ '; $ta_count++; - return theme('form_element', $element['#title'], $html, $element['#description'], $element['#id'], $element['#required'], form_get_error($element)); + return theme('form_element', $element, $html); } - - /* array(id, display, tagStart, tagEnd, access, open, location) * id; // used to name the toolbar button * display; // label on button @@ -226,13 +215,12 @@ } if($output) { - drupal_set_header('Content-Type: text/javascript; charset=utf-8'); - print $js ."\n". $output; + return ""; } } function quicktags_javascript_prepare() { - $path = base_path() . drupal_get_path('module', 'quicktags'); + $path = base_path() . drupal_get_path('module', 'quicktags') .'/'; $output = <<');