From 34db20ab7d69d9091361089df1ed8db81c092622 Mon Sep 17 00:00:00 2001
From: barrett <barrett@52745.no-reply.drupal.org>
Date: Wed, 11 Apr 2012 19:21:04 -0600
Subject: [PATCH] rerolling patch to use drupal_add_js and ..._css instead of
 writing html into the head

---
 usasearch.info   |    7 ++++---
 usasearch.module |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/usasearch.info b/usasearch.info
index 2f6a639..d6d72d8 100644
--- a/usasearch.info
+++ b/usasearch.info
@@ -1,7 +1,8 @@
 name = USASearch
 description = "Provides customized search using the General Services Administration's USASearch program"
-core = 6.x
-dependencies[] = search
-dependencies[] = jquery_update
+core = 7.x
 configure = admin/settings/usasearch
 package = USASearch
+
+dependencies[] = search
+dependencies[] = jquery_update
diff --git a/usasearch.module b/usasearch.module
index a577ec0..439914a 100644
--- a/usasearch.module
+++ b/usasearch.module
@@ -73,10 +73,11 @@ function usasearch_preprocess_page(&$variables) {
     // Add external scripts into $variables['head'], instead of $variables['scripts'], due to jquery_update module, any 6-2x version as of 12/29/2011, clobbering $variables['scripts'].
     // This also means we need to defer the script loading so that they see the jquery javascript since these lines will print before the jquery script include.
     // See jquery_update module issue http://drupal.org/node/965680 for more information and to check the status of this problem.
-    $variables['head'] .= '<script type="text/javascript" defer="defer" src="http://search.usa.gov/javascripts/jquery/jquery.autocomplete.min.js"></script>' . "\n";
-    $variables['head'] .= '<script type="text/javascript" defer="defer" src="http://search.usa.gov/javascripts/sayt.js"></script>' . "\n";
+    drupal_add_js('http://search.usa.gov/javascripts/jquery/jquery.autocomplete.min.js', array('type' => 'external', 'defer' => TRUE));
+    drupal_add_js('http://search.usa.gov/javascripts/sayt.js', array('type' => 'external', 'defer' => TRUE));
+
     // Add external css.
-    $variables['styles'] .= '<link type="text/css" rel="stylesheet" media="all" href="http://search.usa.gov/stylesheets/compiled/sayt.css" />' . "\n";
+    drupal_add_css('http://search.usa.gov/stylesheets/compiled/sayt.css', array('type' => 'external', 'media' => 'all'));
 
     // Check for usasearch_affiliate_id variable, if set output javascript inline WITH affilite id to limit suggestions.
     if ($affiliate_id = check_plain(variable_get('usasearch_affiliate_id', ''))) {
-- 
1.7.6

