### Eclipse Workspace Patch 1.0
#P drupal-contrib-5
Index: modules/google_analytics/googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.14.2.16
diff -u -r1.14.2.16 googleanalytics.module
--- modules/google_analytics/googleanalytics.module	20 Sep 2007 21:09:06 -0000	1.14.2.16
+++ modules/google_analytics/googleanalytics.module	20 Sep 2007 21:37:52 -0000
@@ -10,26 +10,25 @@
 
 define(GA_TRACKFILES, 'pdf|zip|mp3');
 
-function googleanalytics_help($section) {
-  switch ($section) {
+function googleanalytics_help($path, $arg) {
+  switch ($path) {
     case 'admin/settings/googleanalytics':
       return t('Google Analytics is a free statistics package based on the excellent Urchin system.');
   }
 }
 
-function googleanalytics_menu($maycache) {
-  $items = array();
-  if ($maycache) {
-    $items[] = array(
-      'path' => 'admin/settings/googleanalytics',
-      'title' => t('Google Analytics'),
-      'description' => t('Configure the settings used to generate your Google Analytics site map.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => 'googleanalytics_admin_settings',
-      'access' => user_access('administer site configuration'),
-      'type' => MENU_NORMAL_ITEM,
-    );
-  }
+function googleanalytics_menu() {
+
+  $items['admin/settings/googleanalytics'] = array(
+    'title' => 'Google Analytics',
+    'description' => 'Configure the settings used to generate your Google Analytics site map.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('googleanalytics_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+    'file' => 'googleanalytics.admin.inc',
+    'type' => MENU_NORMAL_ITEM,
+  );
+
   return $items;
 }
 
@@ -80,6 +79,7 @@
       }
 
       // Only show segmentation variable if there are specified fields
+      $segmentation = '';
       if (count($fields) > 0) {
         $segmentation = "__utmSetVar('". implode(':', $fields) ."');";
       }
@@ -114,127 +114,6 @@
 }
 
 /**
- * Implementation of hook_admin_settings() for configuring the module
- */
-function googleanalytics_admin_settings() {
-  $form['account'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Analytics Account Settings'),
-    '#collapsible' => FALSE,
-  );
-
-  $form['account']['googleanalytics_account'] = array(
-    '#type' => 'textfield',
-    '#title' => t('User ID'),
-    '#default_value' => variable_get('googleanalytics_account', 'UA-'),
-    '#size' => 15,
-    '#maxlength' => 20,
-    '#required' => TRUE,
-    '#description' => t('The user account is unique to the websites domain. You can obtain a user account from the <a href="@url">Google Analytics</a> website.', array('@url' => 'http://www.google.com/analytics/'))
-  );
-
-  // Render the role overview.
-  $result = db_query('SELECT * FROM {role} ORDER BY name');
-
-  $form['roles'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('User Role Tracking'),
-    '#collapsible' => TRUE,
-    '#description' => t('Define what user roles should not be tracked by Google Analytics.'),
-  );
-
-  $form['roles']['googleanalytics_track__user1'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Admin (user 1)'),
-    '#default_value' => variable_get('googleanalytics_track__user1', TRUE),
-	);
-
-  while ($role = db_fetch_object($result)) {
-    // can't use empty spaces in varname
-    $role_varname = $string = str_replace(' ', '_', $role->name);
-    $form['roles']['googleanalytics_track_'. $role->rid] = array(
-      '#type' => 'checkbox',
-      '#title' => t($role->name),
-      '#default_value' => variable_get('googleanalytics_track_'. $role->rid, FALSE),
-    );
-  }
-
-  $form['segmentation'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('User Segmentation'),
-    '#collapsible' => TRUE,
-    '#description' => t('If your users have profile fields completed, you can track your logged in users based on a defined profile field.')
-  );
-
-  if (!module_exists('profile')) {
-    $form['segmentation']['profile'] = array(
-      '#type' => 'markup',
-      '#value' => t('You need to activate the !profile to use this feature.', array('!profile' => l(t('Profile module'), 'admin/build/modules'))),
-      '#prefix' => '<p>',
-      '#suffix' => '</p>'
-      );
-  }
-  else {
-    // Compile a list of fields to show.
-    $fields = array(
-      'uid' => t('User ID'),
-      'name' => t('Username'),
-      'roles' => t('User Roles')
-    );
-    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} ORDER BY weight');
-    while ($record = db_fetch_object($result)) {
-      $fields[$record->name] = $record->title;
-    }
-
-    $form['segmentation']['googleanalytics_segmentation'] = array(
-      '#type' => 'select',
-      '#title' => t('Track'),
-      '#description' => t('Selecting one or more values allows you to track users by profile values rather than simply an IP address. To select multiple items, hold down CTRL whilst selecting fields.'),
-      '#default_value' => variable_get('googleanalytics_segmentation', ''),
-      '#options' => $fields,
-      '#size' => 10,
-      '#multiple' => TRUE
-    );
-  }
-
-  $form['googleanalytics_trackfiles'] = array(
-    '#type' => 'textfield',
-    '#title' => t('File Extensions To Track'),
-    '#default_value' => variable_get('googleanalytics_trackfiles', GA_TRACKFILES),
-    '#description' => t('A pipe seperated list of file extensions that should be tracked when clicked. Example !extensions', array('!extensions' => GA_TRACKFILES))
-  );
-
-  $form['advanced'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Advanced'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#description' => t('You can add custom Google Analytic code here.')
-  );
-
-  $form['advanced']['googleanalytics_cache'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Cache urchin.js locally'),
-    '#description' => t("If checked, the urchin.js file is received from Google Analytic and cached locally. It is updated daily from Google's servers to ensure updates to urchin.js are reflected in the local copy."),
-    '#default_value' => variable_get('googleanalytics_cache', 0),
-  );
-  if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
-    $form['advanced']['googleanalytics_cache']['#disabled'] = TRUE;
-    $form['advanced']['googleanalytics_cache']['#description'] .= ' '. t('<a href="!url">Public file transfers</a> must be enabled to allow local caching.', array('!url' => url('admin/settings/file-system', drupal_get_destination())));
-  }
-
-  $form['advanced']['googleanalytics_codesnippet'] = array(
-    '#type' => 'textarea',
-    '#title' => t('JavaScript Code'),
-    '#default_value' => variable_get('googleanalytics_codesnippet', ''),
-    '#rows' => 15,
-    '#description' => t('Paste <a href="@snippets">custom code snippets here</a>. These will be added to every page that Google Analytics appears on. For help with this feature see the <a href="@blog">cutroni.com blog</a>. <strong>Do not include the &lt;script&gt; tags</strong>, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/'))
-  );
-
-  return system_settings_form($form);
-}
-
-/**
  * Implementation of hook_requirements().
  */
 function googleanalytics_requirements($phase) {
Index: modules/google_analytics/googleanalytics.admin.inc
===================================================================
RCS file: modules/google_analytics/googleanalytics.admin.inc
diff -N modules/google_analytics/googleanalytics.admin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/google_analytics/googleanalytics.admin.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,127 @@
+<?php
+// $Id: googleanalytics.module,v 1.14.2.13 2007/08/27 21:21:25 budda Exp $
+/**
+ * @file
+ * Administrative page callbacks for the googleanalytics module.
+ */
+
+/**
+ * Implementation of hook_admin_settings() for configuring the module
+ */
+function googleanalytics_admin_settings() {
+  $form['account'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Analytics Account Settings'),
+    '#collapsible' => FALSE,
+  );
+
+  $form['account']['googleanalytics_account'] = array(
+    '#type' => 'textfield',
+    '#title' => t('User ID'),
+    '#default_value' => variable_get('googleanalytics_account', 'UA-'),
+    '#size' => 15,
+    '#maxlength' => 20,
+    '#required' => TRUE,
+    '#description' => t('The user account is unique to the websites domain. You can obtain a user account from the <a href="@url">Google Analytics</a> website.', array('@url' => 'http://www.google.com/analytics/'))
+  );
+
+  // Render the role overview.
+  $result = db_query('SELECT * FROM {role} ORDER BY name');
+
+  $form['roles'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('User Role Tracking'),
+    '#collapsible' => TRUE,
+    '#description' => t('Define what user roles should not be tracked by Google Analytics.'),
+  );
+
+  $form['roles']['googleanalytics_track__user1'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Admin (user 1)'),
+    '#default_value' => variable_get('googleanalytics_track__user1', TRUE),
+	);
+
+  while ($role = db_fetch_object($result)) {
+    // can't use empty spaces in varname
+    $role_varname = $string = str_replace(' ', '_', $role->name);
+    $form['roles']['googleanalytics_track_'. $role->rid] = array(
+      '#type' => 'checkbox',
+      '#title' => t($role->name),
+      '#default_value' => variable_get('googleanalytics_track_'. $role->rid, FALSE),
+    );
+  }
+
+  $form['segmentation'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('User Segmentation'),
+    '#collapsible' => TRUE,
+    '#description' => t('If your users have profile fields completed, you can track your logged in users based on a defined profile field.')
+  );
+
+  if (!module_exists('profile')) {
+    $form['segmentation']['profile'] = array(
+      '#type' => 'markup',
+      '#value' => t('You need to activate the !profile to use this feature.', array('!profile' => l(t('Profile module'), 'admin/build/modules'))),
+      '#prefix' => '<p>',
+      '#suffix' => '</p>'
+      );
+  }
+  else {
+    // Compile a list of fields to show.
+    $fields = array(
+      'uid' => t('User ID'),
+      'name' => t('Username'),
+      'roles' => t('User Roles')
+    );
+    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} ORDER BY weight');
+    while ($record = db_fetch_object($result)) {
+      $fields[$record->name] = $record->title;
+    }
+
+    $form['segmentation']['googleanalytics_segmentation'] = array(
+      '#type' => 'select',
+      '#title' => t('Track'),
+      '#description' => t('Selecting one or more values allows you to track users by profile values rather than simply an IP address. To select multiple items, hold down CTRL whilst selecting fields.'),
+      '#default_value' => variable_get('googleanalytics_segmentation', ''),
+      '#options' => $fields,
+      '#size' => 10,
+      '#multiple' => TRUE
+    );
+  }
+
+  $form['googleanalytics_trackfiles'] = array(
+    '#type' => 'textfield',
+    '#title' => t('File Extensions To Track'),
+    '#default_value' => variable_get('googleanalytics_trackfiles', GA_TRACKFILES),
+    '#description' => t('A pipe seperated list of file extensions that should be tracked when clicked. Example !extensions', array('!extensions' => GA_TRACKFILES))
+  );
+
+  $form['advanced'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Advanced'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#description' => t('You can add custom Google Analytic code here.')
+  );
+
+  $form['advanced']['googleanalytics_cache'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Cache urchin.js locally'),
+    '#description' => t("If checked, the urchin.js file is received from Google Analytic and cached locally. It is updated daily from Google's servers to ensure updates to urchin.js are reflected in the local copy."),
+    '#default_value' => variable_get('googleanalytics_cache', 0),
+  );
+  if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+    $form['advanced']['googleanalytics_cache']['#disabled'] = TRUE;
+    $form['advanced']['googleanalytics_cache']['#description'] .= ' '. t('<a href="!url">Public file transfers</a> must be enabled to allow local caching.', array('!url' => url('admin/settings/file-system', drupal_get_destination())));
+  }
+
+  $form['advanced']['googleanalytics_codesnippet'] = array(
+    '#type' => 'textarea',
+    '#title' => t('JavaScript Code'),
+    '#default_value' => variable_get('googleanalytics_codesnippet', ''),
+    '#rows' => 15,
+    '#description' => t('Paste <a href="@snippets">custom code snippets here</a>. These will be added to every page that Google Analytics appears on. For help with this feature see the <a href="@blog">cutroni.com blog</a>. <strong>Do not include the &lt;script&gt; tags</strong>, and always end your code with a semicolon (;).', array('@snippets' => 'http://drupal.org/node/39282', '@blog' => 'http://cutroni.com/blog/'))
+  );
+
+  return system_settings_form($form);
+}
