Index: template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/ninesixty/template.php,v
retrieving revision 1.3
diff -u -r1.3 template.php
--- template.php	18 Jul 2009 17:50:27 -0000	1.3
+++ template.php	26 Dec 2010 15:00:19 -0000
@@ -1,25 +1,89 @@
 <?php
-// $Id: template.php,v 1.3 2009/07/18 17:50:27 dvessel Exp $
+// $Id:$
 
+/**
+ * Implements hook_preprocess_html
+ */
+function ninesixty_preprocess_html(&$vars) {
+  $vars['classes_array'][] = 'show-grid';
+}
 
 /**
  * Preprocessor for page.tpl.php template file.
  */
 function ninesixty_preprocess_page(&$vars, $hook) {
   // For easy printing of variables.
-  $vars['logo_img']         = $vars['logo'] ? theme('image', substr($vars['logo'], strlen(base_path())), t('Home'), t('Home')) : '';
-  $vars['linked_logo_img']  = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home'), 'html' => TRUE)) : '';
-  $vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home'))) : '';
-  
-  $vars['main_menu_links']      = theme('links', $vars['main_menu'], array('class' => 'links main-menu'));
-  $vars['secondary_menu_links'] = theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu'));
-
-  // Make sure framework styles are placed above all others.
-  $vars['css_alt'] = ninesixty_css_reorder($vars['css']);
-  $vars['styles'] = drupal_get_css($vars['css_alt']);
+  $vars['logo_img'] = '';
+  if (!empty($vars['logo'])) {
+    $args = array(
+      'path'  => $vars['logo'],
+      'alt'   => t('Home'),
+      'title' => t('Home'),
+    );
+    $vars['logo_img'] = theme('image', $args);
+  }
+
+  $vars['linked_logo_img']  = '';
+  if (!empty($vars['logo_img'])) {
+    $vars['linked_logo_img'] = l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home'), 'html' => TRUE));
+  }
+
+  $vars['linked_site_name'] = '';
+  if (!empty($vars['site_name'])) {
+    $vars['linked_site_name'] = l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home')));
+  }
+	
+  if (isset($vars['main_menu'])) {
+    $vars['primary_nav'] = theme('links__system_main_menu', array(
+      'links' => $vars['main_menu'],
+      'attributes' => array(
+				'id' => 'main-menu',
+        'class' => array('inline', 'clearfix'),
+      ),
+      'heading' => array(
+        'text' => t('Main menu'),
+        'level' => 'h2',
+        'class' => array('element-invisible'),
+      )
+    ));
+  }
+  else {
+    $vars['primary_nav'] = FALSE;
+  }
+  if (isset($vars['secondary_menu'])) {
+    $vars['secondary_nav'] = theme('links__system_secondary_menu', array(
+      'links' => $vars['secondary_menu'],
+      'attributes' => array(
+				'id' => 'secondary-menu',
+        'class' => array('inline', 'clearfix'),
+      ),
+      'heading' => array(
+        'text' => t('Secondary menu'),
+        'level' => 'h2',
+        'class' => array('element-invisible'),
+      )
+    ));
+  }
+  else {
+    $vars['secondary_nav'] = FALSE;
+  }
 }
 
 /**
+ * Implements hook_css_alter.
+ */
+function ninesixty_css_alter(&$css) {
+  global $theme;
+  $on_top = CSS_SYSTEM - 1; // ensure CSS is always first
+  foreach ( $css as $key => $file ) {
+    if (preg_match("/($theme|ninesixty)\/styles\/framework/", $key)) {
+      $css[$key]['group'] = $on_top;
+    }
+  }
+}
+
+
+/**
  * Contextually adds 960 Grid System classes.
  *
  * The first parameter passed is the *default class*. All other parameters must
@@ -59,52 +123,3 @@
   }
   return $output;
 }
-
-/**
- * This rearranges how the style sheets are included so the framework styles
- * are included first.
- *
- * Sub-themes can override the framework styles when it contains css files with
- * the same name as a framework style. This can be removed once Drupal supports
- * weighted styles.
- */
-function ninesixty_css_reorder($css) {
-  global $theme_info, $base_theme_info;
-
-  // Dig into the framework .info data.
-  $framework = !empty($base_theme_info) ? $base_theme_info[0]->info : $theme_info->info;
-
-  // Pull framework styles from the themes .info file and place them above all stylesheets.
-  if (isset($framework['stylesheets'])) {
-    foreach ($framework['stylesheets'] as $media => $styles_from_960) {
-      // Setup framework group.
-      if (isset($css[$media])) {
-        $css[$media] = array_merge(array('framework' => array()), $css[$media]);
-      }
-      else {
-        $css[$media]['framework'] = array();
-      }
-      foreach ($styles_from_960 as $style_from_960) {
-        // Force framework styles to come first.
-        if (strpos($style_from_960, 'framework') !== FALSE) {
-          $framework_shift = $style_from_960;
-          $remove_styles = array($style_from_960);
-          // Handle styles that may be overridden from sub-themes.
-          foreach ($css[$media]['theme'] as $style_from_var => $preprocess) {
-            if ($style_from_960 != $style_from_var && basename($style_from_960) == basename($style_from_var)) {
-              $framework_shift = $style_from_var;
-              $remove_styles[] = $style_from_var;
-              break;
-            }
-          }
-          $css[$media]['framework'][$framework_shift] = TRUE;
-          foreach ($remove_styles as $remove_style) {
-            unset($css[$media]['theme'][$remove_style]);
-          }
-        }
-      }
-    }
-  }
-
-  return $css;
-}

