Index: SiteCatalyst(20.3).example.txt =================================================================== RCS file: SiteCatalyst(20.3).example.txt diff -N SiteCatalyst(20.3).example.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SiteCatalyst(20.3).example.txt 5 Jan 2010 16:33:08 -0000 @@ -0,0 +1,33 @@ + + + + + Index: omniture.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/omniture/omniture.info,v retrieving revision 1.4.4.1 diff -u -p -r1.4.4.1 omniture.info --- omniture.info 7 Oct 2008 21:11:16 -0000 1.4.4.1 +++ omniture.info 8 Jan 2010 00:31:05 -0000 @@ -1,4 +1,6 @@ ; $Id: omniture.info,v 1.4.4.1 2008/10/07 21:11:16 ultimateboy Exp $ name = Omniture -description = Adds Omniture SiteCatalyst javascript tracking code to all your site's pages. -core = 6.x \ No newline at end of file +description = Adds Omniture SiteCatalyst javascript tracking code to your site's pages. +core = 7.x +files[] = omniture.module +files[] = omniture.install Index: omniture.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/omniture/omniture.install,v retrieving revision 1.4 diff -u -p -r1.4 omniture.install --- omniture.install 6 Oct 2008 22:22:52 -0000 1.4 +++ omniture.install 8 Jan 2010 00:49:37 -0000 @@ -1,21 +1,49 @@ fields('r') + ->orderBy('name', 'ASC') + ->execute(); - while ($role = db_fetch_object($result)) { - $role_varname = $string = str_replace(" ", "_", $role->name); + foreach ($result as $role) { + $role_varname = str_replace(" ", "_", $role->name); $omniture_role = "omniture_track_{$role_varname}"; - //check if variable is not already set from a previous install + // Check if variable is not already set from a previous install. if (strpos(variable_get($omniture_role, 'new'), 'new') !== FALSE) { variable_set($omniture_role, TRUE); - drupal_set_message(t('Role %rolename is now being tracked by SiteCatalyst', array('%rolename' => $role->name))); + drupal_set_message(t('Role %rolename is now being tracked by SiteCatalyst.', array('%rolename' => $role->name))); } } } + +/** + * Implements hook_uninstall(). + */ +function omniture_uninstall() { + $result = db_select('variable', 'v') + ->fields('v') + ->condition('v.name', 'omniture_%', 'LIKE') + ->execute(); + + foreach ($result as $variable) { + variable_del($variable->name); + } +} + +/** + * Update to Drupal 7. Set the version number for new installs. + */ +function omniture_update_7000() { + $ret = array(); + return $ret; +} Index: omniture.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/omniture/omniture.module,v retrieving revision 1.6.4.3 diff -u -p -r1.6.4.3 omniture.module --- omniture.module 23 Sep 2009 23:18:18 -0000 1.6.4.3 +++ omniture.module 8 Jan 2010 19:32:04 -0000 @@ -1,6 +1,6 @@ array( + 'title' => t('Administer SiteCatalyst configuration'), + ) + ); } /** - * Implementation of hook_menu + * Implements hook_menu(). */ function omniture_menu() { - $items = array(); - - $items['admin/settings/omniture'] = array( + $items['admin/config/system/omniture'] = array( 'title' => 'SiteCatalyst', - 'description' => 'Configure the settings used to integrate Omniture\'s SiteCatalyst.', + 'description' => "Configure the settings used to integrate Omniture's SiteCatalyst.", 'page callback' => 'drupal_get_form', 'page arguments' => array('omniture_admin_settings'), 'access arguments' => array('administer SiteCatalyst configuration'), @@ -42,205 +50,179 @@ function omniture_menu() { } /** - * Implementation of hook_footer() to insert Javascript at the end of the page + * Implements hook_page_alter(). */ -function omniture_footer($main = 0) { - +function omniture_page_alter(&$page) { global $user; - // Check if we should track the currently active user's role + // Check if we should track the currently active user's role. $track = 0; foreach ($user->roles as $role) { $role = str_replace(' ', '_', $role); $track += variable_get("omniture_track_{$role}", FALSE); } - // Don't track page views in the admin sections, or for certain roles - if (arg(0) != 'admin' && $track > 0) { + // Don't track page views in the admin sections, or for certain roles. + if (arg(0) == 'admin' || $track <= 0) { + return; + } + + // Add any custom code snippets if specified. + $codesnippet = variable_get('omniture_codesnippet', ''); + + // Format and combine variables in the "right" order + // Right order is the code file (least likely to be maintained) + // Then admin settings with codesnippet first and finally taxonomy->vars + $extra_variables_formatted = $codesnippet; + + $header = "\n"; + $header .= "\n"; + $header .= "'."\n"; + $footer .= '