Index: yui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/yui/yui.module,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 yui.module
--- yui.module	7 Jun 2008 19:31:42 -0000	1.9.2.2
+++ yui.module	4 Nov 2008 13:31:39 -0000
@@ -3,79 +3,65 @@
 
 /**
  * @file
- * YUI Common module.
- * 
- * Bunyamin AKYILDIZ (bakyildiz).
- */ 
+ * Common settings for the Yahoo! UI Library.
+ *
+ * Copyright 2007-2008 Bunyamin Akyildiz (bakyildiz).
+ */
 
 /**
  * Implementation of hook_help().
  */
 function yui_help($section) {
-	switch ($section) {
-		case 'admin/settings/modules#description':
-			return t('YUI Common parameters.');
-	}
-}
-
-/**
- * implementation of hook_perm().
- */
-function yui_perm() {
-    $array = array('Access YUI');
-      return $array;
+  switch ($section) {
+    case 'admin/settings/modules#description':
+      return t('YUI Common parameters.');
+  }
 }
 
 /**
- * implementation of hook_init().
+ * Implementation of hook_init().
  */
 function yui_init() {
-  // No more needed in D6
-  //require_once './includes/common.inc';
   $skin = variable_get('yui_skin', 'yui-skin-sam');
-
-  drupal_add_js("if (Drupal.jsEnabled) { $(document).ready(function() { $('body').addClass('$skin'); } ); };", "inline");
-}
-
-/**
- * Form builder; configure the YUI module.
- *
- * @ingroup forms
- * @see system_settings_form()                                            
- */  
-function yui_admin() {
-	$form['yui_source'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Location of YUI library'),
-    '#description' => t('Default location is Yahoo Server. <BR>If you install YUI library locally please enter the path as follows: files/lib'),
-    '#default_value' => variable_get('yui_source','http://yui.yahooapis.com/2.5.0'),
-   	'#required' => TRUE,
-	);
-	$form['yui_skin'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Skin to use for YUI'),
-    '#description' => t('Skin to use for YUI'),
-    '#default_value' => variable_get('yui_skin','yui-skin-sam'),
-	  '#required' => TRUE,
-	);
-	return system_settings_form($form);
+  drupal_add_js("if (Drupal.jsEnabled) { $(document).ready(function() { $('body').addClass('$skin'); } ); };", 'inline');
 }
 
 /**
  * Implementation of hook_menu().
  */
 function yui_menu() {
-
   $items = array();
+
   $items['admin/settings/yui'] = array(
-    'title' => 'YUI Common Settings',
-    'description' => 'YUI Description',
+    'title' => t('Yahoo! UI library'),
+    'description' => t('Common settings for the Yahoo! UI library.'),
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('yui_admin'),
+    'page arguments' => array('yui_admin_settings'),
     'access arguments' => array('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM,
-	);
-	return $items;
+  );
+
+  return $items;
+}
+
+/**
+ * Yahoo! UI settings form.
+ */
+function yui_admin_settings() {
+  $form['yui_source'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Location of the Yahoo! UI library'),
+    '#description' => t('Default location is Yahoo Server.<br />If you install YUI library locally please enter the path as follows: files/lib'),
+    '#default_value' => variable_get('yui_source', 'http://yui.yahooapis.com/2.6.0'),
+    '#required' => TRUE,
+  );
+  $form['yui_skin'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Skin to use for YUI'),
+    '#description' => t('Skin to use for YUI'),
+    '#default_value' => variable_get('yui_skin', 'yui-skin-sam'),
+    '#required' => TRUE,
+  );
+  return system_settings_form($form);
 }
 
 /**
@@ -88,16 +74,18 @@
  * @param $file_and_path
  *   File to include.
  */
-function yui_add_js($component = NULL, $yui_source = NULL, $file_and_path = NULL) {
+function yui_add_js($file, $component = NULL) {
   static $js_files = array();
 
-  if (! preg_match('/^http:\/\//', $yui_source)) {
+  $yui_source = variable_get('yui_source', 'http://yui.yahooapis.com/2.6.0');
+
+  if (!preg_match('/^http:\/\//', $yui_source)) {
     $yui_source = base_path() . $yui_source;
   }
 
-  if (! in_array($yui_source . $file_and_path, $js_files)) {
-    drupal_set_html_head('<script type="text/javascript" src="'.$yui_source.$file_and_path.'"></script>');
-    $js_files[] = $yui_source . $file_and_path;
+  if (!in_array($yui_source . $file, $js_files)) {
+    drupal_set_html_head('<script type="text/javascript" src="'. $yui_source . $file .'"></script>');
+    $js_files[] = $yui_source . $file;
   }
 }
 
@@ -111,15 +99,17 @@
  * @param $file_and_path
  *   File to include.
  */
-function yui_add_css($component = NULL, $yui_source = NULL, $file_and_path = NULL) {
+function yui_add_css($file, $component = NULL) {
   static $css_files = array();
 
-  if (! preg_match('/^http:\/\//', $yui_source)) {
+  $yui_source = variable_get('yui_source', 'http://yui.yahooapis.com/2.6.0');
+
+  if (!preg_match('/^http:\/\//', $yui_source)) {
     $yui_source = base_path() . $yui_source;
-  }  
+  }
 
-  if (! in_array($yui_source . $file_and_path, $css_files)) {
-    drupal_set_html_head('<link rel="stylesheet" type="text/css" href="'.$yui_source.$file_and_path.'"/>');
-    $css_files[] = $yui_source . $file_and_path;
+  if (!in_array($yui_source . $file, $css_files)) {
+    drupal_set_html_head('<link rel="stylesheet" type="text/css" href="'. $yui_source . $file .'"/>');
+    $css_files[] = $yui_source . $file;
   }
-}
\ No newline at end of file
+}

