Index: skinr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/skinr/skinr.module,v
retrieving revision 1.13.2.6.2.38
diff -u -p -r1.13.2.6.2.38 skinr.module
--- skinr.module	8 Oct 2010 00:41:55 -0000	1.13.2.6.2.38
+++ skinr.module	15 Oct 2010 16:40:58 -0000
@@ -24,7 +24,7 @@ function skinr_init() {
   static $run = FALSE;
   if (!$run) {
     module_load_include('inc', 'skinr', 'skinr.handlers');
-    skinr_module_include('skinr.inc');
+    skinr_module_include('skinr.plugin.inc');
     $run = TRUE;
   }
 }
@@ -405,6 +405,115 @@ function skinr_get_module_apis() {
   return $cache;
 }
 
+/**
+ * Get a list of filenames and location for skins.
+ */
+function skinr_get_skinr_files() {
+  // Find skins in skins folders.
+  $mask = '\.skinr.inc$';
+  $directory = 'skins';
+  $files = drupal_system_listing($mask, $directory);
+
+  // Find skins in theme folders.
+  $mask = '\.skinr.inc$';
+  $directory = 'themes';
+  $files = $files = array_merge($files, drupal_system_listing($mask, $directory));
+
+  // Find skins in module folders.
+  $mask = '\.skinr.inc$';
+  $directory = 'modules';
+  $files = $files = array_merge($files, drupal_system_listing($mask, $directory));
+
+  // If our filename contains multiple dots in the extension, for example
+  // filename.skinr.inc, we need to fix the name and key.
+  $info = array();
+  foreach ($files as $skinset) {
+    $key = substr($skinset->name, 0, -6);
+    $skinset->name = $key;
+    $info[$key] = $skinset;
+  }
+
+  return $info;
+}
+
+/**
+ * Load all skins.
+ */
+function skinr_load_all_info() {
+  $info = skinr_get_skinr_files();
+
+  $return = array();
+  foreach ($info as $skinset) {
+    if (!empty($skinset)) {
+      $result = skinr_load_info($skinset->name, $skinset);
+      if (isset($result) && is_array($result)) {
+        $return = array_merge_recursive($return, $result);
+      }
+      elseif (isset($result)) {
+        $return[$skinset->name] = $result;
+      }
+    }
+  }
+
+  return $return;
+}
+
+/**
+ * Load a skin.
+ */
+function skinr_load_info($skin, $skinset = NULL) {
+  if (is_null($skinset)) {
+    $info = skinr_get_skinr_files();
+    if (!empty($info[$skin])) {
+      $skinset = $info[$skin];
+    }
+    else {
+      return FALSE;
+    }
+  }
+
+  if (is_file($skinset->filename)) {
+    require_once $skinset->filename;
+
+    $function = $skinset->name .'_skinr_info';
+    $skinset->info = call_user_func_array($function, array());
+    if (!isset($skinset->info)) {
+      return FALSE;
+    }
+    if (!is_array($skinset->info)) {
+      $skinset->info = array($skinset->info);
+    }
+
+    foreach ($skinset->info as $key => $info) {
+      $skinset->info[$key] += skinr_skins_default();
+
+      // Give the screenshot proper path information.
+      if (!empty($skinset->info[$key]['screenshot'])) {
+        $skinset->info[$key]['screenshot'] = dirname($skinset->filename) .'/'. $skinset->info[$key]['screenshot'];
+      }
+
+      // Give all css and js files proper path information.
+      _skinr_add_paths_to_files($skinset->info[$key]['skinr'], dirname($skinset->filename));
+
+      // Invoke hook_skinr_info_alter() to give installed modules a chance to
+      // modify the data in the .skinr.inc files if necessary.
+      drupal_alter('skinr_info', $skinset->info[$key], $skinset);
+
+      // @todo In the future we might want to disable the below code to allow
+      //       multiple skinsets in a single file. This would require
+      //       substantial re-writing of certain pieces of code.
+      $skinset->info = $skinset->info[$key];
+      break;
+      //       End code to remove.
+    }
+
+    return $skinset;
+  }
+  else {
+    return FALSE;
+  }
+}
+
 // -----------------------------------------------------------------------
 // Skinr data handling functions.
 
@@ -627,83 +736,7 @@ function skinr_skin_default() {
 }
 
 /**
- * Retrieves all the Skinr skins from theme parents. Theme skins
- * will override any skins of the same name from its parents.
- */
-function skinr_inherited_skins($theme) {
-  $themes = _system_theme_data();
-
-  $all_skins = $skins = array();
-  $base_theme = (!empty($themes[$theme]->info['base theme'])) ? $themes[$theme]->info['base theme'] : '';
-  while ($base_theme) {
-    // Add in path info here.
-    $base_skins = (!empty($themes[$base_theme]->info['skinr'])) ? (array)$themes[$base_theme]->info['skinr'] : array();
-    $base_path  = $path_root = dirname($themes[$base_theme]->filename);
-    _skinr_add_paths_to_files($base_skins, $base_path);
-
-    $all_skins[] = $base_skins;
-    $base_theme = (!empty($themes[$base_theme]->info['base theme'])) ? $themes[$base_theme]->info['base theme'] : '';
-  }
-  array_reverse($all_skins);
-  foreach ($all_skins as $new_skin) {
-    $skins = array_merge($skins, $new_skin);
-  }
-  return $skins;
-}
-
-/**
- * Helper function to scan and collect skin .info data.
- *
- * @return
- *   An associative array of skins information.
- */
-function _skinr_skins_data() {
-  static $skins_info = array();
-
-  if (empty($skins_info)) {
-    // Find skins.
-    $mask = '\.info$';
-    $directory = 'skins';
-    $skinsets = drupal_system_listing($mask, $directory);
-
-    // Find skins in theme folders.
-    $themes = _system_theme_data();
-    foreach ($themes as $theme) {
-      $dir = dirname($theme->filename) .'/'. $directory;
-      $skinsets = array_merge($skinsets, file_scan_directory($dir, $mask, array('.', '..', 'CVS'), 0, TRUE, 'name', 1));
-    }
-
-    // Find skins in module folders.
-    foreach (skinr_get_module_apis() as $module => $info) {
-      if (isset($info['skins']) && $info['skins'] == TRUE) {
-        $dir = dirname($info['path'] .'/'. $directory);
-        $skinsets = array_merge($skinsets, file_scan_directory($dir, $mask, array('.', '..', 'CVS'), 0, TRUE, 'name', 1));
-      }
-    }
-
-    $defaults = skinr_skins_default();
-
-    foreach ($skinsets as $key => $skinset) {
-      $skinsets[$key]->info = drupal_parse_info_file($skinset->filename) + $defaults;
-
-      // Give the screenshot proper path information.
-      if (!empty($skinsets[$key]->info['screenshot'])) {
-        $skinsets[$key]->info['screenshot'] = dirname($skinsets[$key]->filename) .'/'. $skinsets[$key]->info['screenshot'];
-      }
-
-      // Invoke hook_skinr_info_alter() to give installed modules a chance to
-      // modify the data in the .info files if necessary.
-      drupal_alter('skinr_info', $skinsets[$key]->info, $skinsets[$key]);
-    }
-
-    $skins_info = $skinsets;
-  }
-
-  return $skins_info;
-}
-
-/**
- * Helper function to process a skin or theme .info file.
+ * Helper function to process a .skinr.inc file.
  *
  * @return
  *    A skinset.
@@ -714,6 +747,7 @@ function _skinr_skinset($info) {
     'skins' => array(),
   );
 
+  // @todo Account for $info->info being an array.
   if (!empty($info->info['skinr'])) {
     $path_root = dirname($info->filename);
 
@@ -737,17 +771,6 @@ function _skinr_skinset($info) {
       }
     }
 
-    // Add paths to $skinr_info.
-    _skinr_add_paths_to_files($skinr_info, $path_root);
-
-    // Inherit skins from parent theme, if inherit_skins is set to true.
-    if (!empty($skinset['options']['inherit_skins'])) {
-      // Paths get automatically added to base theme info.
-      $base_info  = skinr_inherited_skins($info->name);
-      // Merge base theme and current.
-      $skinr_info = array_merge($base_info, $skinr_info);
-    }
-
     $defaults = skinr_skin_default();
 
     foreach ($skinr_info as $id => $skin) {
@@ -802,7 +825,7 @@ function _skinr_add_paths_to_files(&$ski
 }
 
 /**
- * Helper function to prepend a path to an array of stylesheets or scripts in a .info file.
+ * Helper function to prepend a path to an array of stylesheets or scripts in a .skinr.inc file.
  *
  * @param $files
  *   A an array of filenames that need the path prepended.
@@ -837,45 +860,30 @@ function _skinr_add_path_to_files($files
 }
 
 /**
- * Helper function to process an array of skins or themes .info files.
+ * Helper function to process an array of skins or themes .skinr.inc files.
  *
- * @param $type
- *   Either 'theme' or 'skinset'.
  * @param $refresh
  *   Whether to reload the list of skinsets from the database or not.
  *
  * @return
  *    An array of skinsets.
  */
-function skinr_skinsets($type, $refresh = FALSE) {
-  static $skinsets = array('theme' => array(), 'skinset' => array());
+function skinr_skinsets($refresh = FALSE) {
+  static $skinsets = array();
 
   if ($refresh) {
-    $skinsets[$type] = array();
+    $skinsets = array();
   }
 
-  if (empty($skinsets[$type])) {
+  if (empty($skinsets)) {
     $themes = _system_theme_data();
 
-    if ($type == 'theme') {
-      foreach ($themes as $theme) {
-        $skinset = new StdClass();
-        $skinset->filename = $theme->filename;
-        $skinset->name = $theme->name;
-        $skinset->status = isset($theme->status) ? 1 : 0;
-        $skinset->info = $theme->info;
-
-        $skinsets[$type][$skinset->name] = $skinset;
-      }
-    }
-    elseif ($type == 'skinset') {
-      $result = db_query("SELECT * FROM {skinr_skinsets}");
-      while ($skinset = db_fetch_object($result)) {
-        if (file_exists($skinset->filename)) {
-          $skinset->info = unserialize($skinset->info);
+    $result = db_query("SELECT * FROM {skinr_skinsets}");
+    while ($skinset = db_fetch_object($result)) {
+      if (file_exists($skinset->filename)) {
+        $skinset->info = unserialize($skinset->info);
 
-          $skinsets[$type][$skinset->name] = $skinset;
-        }
+        $skinsets[$skinset->name] = $skinset;
       }
     }
 
@@ -884,8 +892,34 @@ function skinr_skinsets($type, $refresh 
       $default_status[$theme->name] = $theme->name;
     }
 
-    foreach ($skinsets[$type] as $key => $skinset) {
-      $skinset->type = $type;
+    foreach ($skinsets as $key => $skinset) {
+      if (isset($themes[$key])) {
+        $skinset->type = 'theme';
+        $skinset->status = !empty($theme->status) ? 1 : 0;
+      }
+      else {
+        $skinset->type = 'skinset';
+      }
+
+      // Inherit skins from base theme, if inherit_skins is set to true.
+      // @todo Account for $skinset->info being an array.
+      if (!empty($skinset->info['skinr']['options']['inherit_skins'])) {
+        // Merge base theme and current.
+        $inheriting = TRUE;
+        $merged_skins = array();
+        $current_skinset = $skinset;
+        while ($inheriting) {
+          $inheriting = FALSE;
+          if (!empty($current_skinset->info['base theme'])) {
+            if (!empty($skinsets[$current_skinset->info['base theme']])) {
+              $current_skinset = $skinsets[$current_skinset->info['base theme']];
+              $merged_skins = array_merge($current_skinset->info['skinr'], $merged_skins);
+              $inheriting = TRUE;
+            }
+          }
+        }
+        $skinset->info['skinr'] = array_merge($merged_skins, $skinset->info['skinr']);
+      }
 
       $additional = _skinr_skinset($skinset);
       $skinset->options = $additional['options'];
@@ -898,7 +932,7 @@ function skinr_skinsets($type, $refresh 
     }
   }
 
-  return $skinsets[$type];
+  return $skinsets;
 }
 
 /**
@@ -915,7 +949,7 @@ function skinr_skinsets($type, $refresh 
 function skinr_skinset_statuses($skinset_name, $refresh = FALSE) {
   static $statuses = array();
 
-  if (isset($refresh)) {
+  if ($refresh) {
     $statuses[$skinset_name] = array();
   }
 
@@ -936,9 +970,20 @@ function skinr_skinset_statuses($skinset
  *   Array of all available skinsets and their data.
  */
 function skinr_rebuild_skinset_data() {
-  $skinsets = _skinr_skins_data();
+  $skinsets = skinr_load_all_info();
   skinr_get_files_database($skinsets);
 
+  $themes = list_themes();
+  foreach ($skinsets as $key => $skinset) {
+    if (isset($themes[$key])) {
+      $skinset->status = !empty($themes[$key]->status) ? 1 : 0;
+      $skinset->type = 'theme';
+    }
+    else {
+      $skinset->type = 'skinset';
+    }
+  }
+
   db_query("DELETE FROM {skinr_skinsets}");
 
   foreach ($skinsets as $skinset) {
@@ -989,19 +1034,20 @@ function skinr_skin_data() {
   static $cache = NULL;
 
   if (is_null($cache)) {
-    $skins_skinsets  = skinr_skinsets('skinset');
-    $themes_skinsets = skinr_skinsets('theme');
+    $skinsets = skinr_skinsets();
 
     // Need to merge all skins skinsets into a single list of skins.
     // Also merge in the groups information.
     $additional_skins = array();
     $groups = array();
-    foreach ($skins_skinsets as $key => $skinset) {
-      if (!empty($skinset->skins) && $skinset->status == 1) {
-        $additional_skins += $skinset->skins;
-      }
-      if (!empty($skinset->options['groups'])) {
-        $groups += $skinset->options['groups'];
+    foreach ($skinsets as $key => $skinset) {
+      if ($skinset->type == 'skinset') {
+        if (!empty($skinset->skins) && $skinset->status == 1) {
+          $additional_skins += $skinset->skins;
+        }
+        if (!empty($skinset->options['groups'])) {
+          $groups += $skinset->options['groups'];
+        }
       }
     }
 
@@ -1013,16 +1059,18 @@ function skinr_skin_data() {
         continue;
       }
 
-      if (isset($themes_skinsets[$theme->name])) {
-        $cache[$theme->name] = $themes_skinsets[$theme->name];
+      if (!empty($skinsets[$theme->name])) {
+        $cache[$theme->name] = $skinsets[$theme->name];
         $cache[$theme->name]->skins += $additional_skins;
         $cache[$theme->name]->options['groups'] += $groups;
       }
       else {
-        $cache[$theme->name] = array(
-          'options' => array('groups' => $groups),
-          'skins' => $additional_skins,
-        );
+        $cache[$theme->name] = new StdClass();
+        $cache[$theme->name]->name = $theme->name;
+        $cache[$theme->name]->status = 1;
+        $cache[$theme->name]->type = 'theme';
+        $cache[$theme->name]->skins = $additional_skins;
+        $cache[$theme->name]->options = array('groups' => $groups);
       }
     }
   }
Index: skinr_ui.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/skinr/skinr_ui.admin.inc,v
retrieving revision 1.1.2.18
diff -u -p -r1.1.2.18 skinr_ui.admin.inc
--- skinr_ui.admin.inc	8 Oct 2010 00:41:55 -0000	1.1.2.18
+++ skinr_ui.admin.inc	15 Oct 2010 16:40:59 -0000
@@ -286,7 +286,7 @@ function theme_skinr_ui_filters($form) {
   }
 
   $output .= '<li><dl class="multiselect">';
-  
+
   $element_children = element_children($form['filter']);
   if (!empty($element_children)) {
     $output .= (!empty($form['current']) ? '<dt><em>'. t('and') .'</em> '. t('where') .'</dt>' : '') .'<dd class="a">';
@@ -294,10 +294,10 @@ function theme_skinr_ui_filters($form) {
       $output .= drupal_render($form['filter'][$key]);
     }
     $output .= '</dd>';
-  
+
     $output .= '<dt>'. t('is') .'</dt>';
   }
-  
+
   $output .= '<dd class="b">';
 
   foreach (element_children($form['status']) as $key) {
@@ -400,8 +400,12 @@ function skinr_ui_skinsets_form() {
   // Store module list for use in the theme function.
   $form['skinsets'] = array('#type' => 'value', '#value' => $skinsets);
 
+  // Create storage for disabled skinsets as browser will disable checkboxes.
+  $form['disabled_skinsets'] = array('#type' => 'value', '#value' => array());
+
   $options = array();
   $status = array();
+  $disabled_skinsets = array();
   $incompatible_core = array();
   $incompatible_php = array();
 
@@ -434,6 +438,11 @@ function skinr_ui_skinsets_form() {
       }
     }
 
+    if ($skinset->type == 'theme') {
+      $disabled_skinsets[] = $skinset->name;
+      $form['disabled_skinsets']['#value'][$skinset->name] = TRUE;
+    }
+
     $form[$skinset->name]['operations'] = array(
       '#value' => l('configure', 'admin/build/skinr/skins/settings/'. $skinset->name),
     );
@@ -443,6 +452,7 @@ function skinr_ui_skinsets_form() {
     '#type' => 'checkboxes',
     '#options' => $options,
     '#default_value' => $status,
+    '#disabled_skinsets' => drupal_map_assoc($disabled_skinsets),
     '#incompatible_skinsets_core' => drupal_map_assoc($incompatible_core),
     '#incompatible_skinsets_php' => $incompatible_php,
   );
@@ -458,6 +468,24 @@ function skinr_ui_skinsets_form() {
 }
 
 /**
+ * Form process callback function to disable check boxes.
+ *
+ * @param $form
+ *   The form structure.
+ * @param $edit
+ *   Not used.
+ * @ingroup forms
+ * @return
+ *   The form structure.
+ */
+function skinr_ui_skinsets_disable($form, $edit) {
+  foreach ($form['#disabled_skinsets'] as $key) {
+    $form[$key]['#attributes']['disabled'] = 'disabled';
+  }
+  return $form;
+}
+
+/**
  * Menu callback; displays a listing of all skins in a skinsets, allowing you
  * to enable or disable them individually for each theme.
  *
@@ -469,12 +497,13 @@ function skinr_ui_skinsets_settings_form
     '#tree' => TRUE,
   );
 
-  $skinsets = skinr_skinsets('skinset');
+  $skinsets = skinr_skinsets();
   if (!empty($skinsets[$skinset_name])) {
     $skinset = $skinsets[$skinset_name];
   }
 
   $themes = list_themes();
+  $use_themes = array();
   ksort($themes);
 
   foreach ($skinset->skins as $skin_name => $skin) {
@@ -486,10 +515,11 @@ function skinr_ui_skinsets_settings_form
     $status = array();
     $options = array();
     foreach ($themes as $theme) {
-      if (!$theme->status) {
+      if (!$theme->status || ($skinset->type == 'theme' && $skinset->name != $theme->name)) {
         continue;
       }
 
+      $use_themes[$theme->name] = $theme->info['name'];
       $options[$theme->name] = '';
 
       if (!empty($skin['status'][$theme->name])) {
@@ -504,6 +534,7 @@ function skinr_ui_skinsets_settings_form
     );
   }
 
+  $form['#themes'] = $use_themes;
   $form['skinset'] = array(
     '#type' => 'value',
     '#value' => $skinset_name,
@@ -526,7 +557,7 @@ function skinr_ui_skinsets_settings_form
 function skinr_ui_skinsets_form_submit($form, &$form_state) {
   // Store list of previously enabled themes and disable all themes
   $old_skinset_list = $new_skinset_list = array();
-  foreach (skinr_skinsets('skinset') as $skinset) {
+  foreach (skinr_skinsets() as $skinset) {
     if ($skinset->status) {
       $old_skinset_list[] = $skinset->name;
     }
@@ -548,7 +579,7 @@ function skinr_ui_skinsets_form_submit($
   }
 
   // Refresh skinsets from DB.
-  skinr_skinsets('skinset', TRUE);
+  skinr_skinsets(TRUE);
 
   // @todo Disable any skins from skinsets that are now disabled.
 
@@ -914,7 +945,10 @@ function theme_skinr_ui_skinsets_form($f
   $skinsets = $form['skinsets']['#value'];
   $packages = array();
   foreach ($skinsets as $skinset) {
-    if (!isset($skinset->info['package']) || !$skinset->info['package']) {
+    if ($skinset->type == 'theme') {
+      $skinset->info['package'] = t('Themes');
+    }
+    elseif (!isset($skinset->info['package']) || !$skinset->info['package']) {
       $skinset->info['package'] = t('Other');
     }
     $packages[$skinset->info['package']][$skinset->name] = $skinset->info;
@@ -951,6 +985,10 @@ function theme_skinr_ui_skinsets_form($f
         }
         $description .= '<div class="incompatible">'. t('This skinset requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion())) .'</div>';
       }
+      elseif (isset($form['status']['#disabled_skinsets'][$key])) {
+        $form['status'][$key]['#attributes']['disabled'] = 'disabled';
+        $status = drupal_render($form['status'][$key]);
+      }
       else {
         $status = drupal_render($form['status'][$key]);
       }
@@ -1001,11 +1039,7 @@ function theme_skinr_ui_skinsets_setting
   $themes = list_themes();
   ksort($themes);
 
-  foreach ($themes as $theme) {
-    if (!$theme->status) {
-      continue;
-    }
-
+  foreach ($form['#themes'] as $theme_name => $theme_title) {
     $rows = array();
     foreach ($form as $key => $skin) {
       // Only look for skins.
@@ -1026,7 +1060,7 @@ function theme_skinr_ui_skinsets_setting
       }
       $features = t('Used by: !features', array('!features' => implode(', ', $features)));
 
-      $status = drupal_render($form[$key]['status'][$theme->name]);
+      $status = drupal_render($form[$key]['status'][$theme_name]);
 
       // Style theme info
       $content = '<div class="skin-info"><h2>'. $title .'</h2><div class="description">'. $description .'</div><div class="features">'. $features .'</div></div>';
@@ -1040,14 +1074,17 @@ function theme_skinr_ui_skinsets_setting
     }
 
     $fieldset = array(
-      '#title' => t($theme->info['name']),
+      '#title' => t($theme_title),
       '#collapsible' => TRUE,
-      '#collapsed' => $theme->name == $current_theme ? FALSE : TRUE,
+      '#collapsed' => $theme_name == $current_theme ? FALSE : TRUE,
       '#value' => theme('table', $header, $rows, array('class' => 'theme')),
     );
     $output .= theme('fieldset', $fieldset);
   }
 
+  if (empty($output)) {
+    $output .= t('This theme is disabled.');
+  }
   $output .= drupal_render($form);
   return $output;
 }
Index: modules/block.skinr.inc
===================================================================
RCS file: modules/block.skinr.inc
diff -N modules/block.skinr.inc
--- modules/block.skinr.inc	5 Apr 2010 22:41:45 -0000	1.3.2.1.2.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,120 +0,0 @@
-<?php
-// $Id: block.skinr.inc,v 1.3.2.1.2.6 2010/04/05 22:41:45 moonray Exp $
-/**
- * @file
- * Provide skinr handling for block.module
- */
-
-/**
- * @defgroup skinr_block_module block.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function block_skinr_config() {
-  $data['block']['form']['block_admin_configure'] = array(
-    'index_handler' => 'block_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
-    'title' => t('block settings'),
-  );
-  $data['block']['form']['block_add_block_form'] = array(
-    'index_handler' => 'block_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
-    'title' => t('block settings'),
-  );
-  $data['block']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
-    'title' => t('block settings'),
-    'collapsed' => FALSE,
-  );
-  $data['block']['preprocess']['block'] = array(
-    'index_handler' => 'block_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function block_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      $form['submit']['#weight'] = 50;
-      return $form['module']['#value'] .'-'. $form['delta']['#value'];
-
-    case 'submit':
-      $form_id = $form['form_id']['#value'];
-      if ($form_id == 'block_add_block_form') {
-        // This is a new block, so we need to fetch the delta from DB
-        if ($delta = db_result(db_query("SELECT delta FROM {blocks} WHERE bid = '%s'", db_last_insert_id('boxes', 'bid')))) {
-          return $form_state['values']['module'] .'-'. $delta;
-        }
-      }
-      else {
-        return $form_state['values']['module'] .'-'. $form_state['values']['delta'];
-      }
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function block_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array();
-
-  if (!isset($form['module']['#value']) && isset($form['skinr']['sid']['#value'])) {
-    $result = db_query_range(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b WHERE CONCAT(b.module, '-', b.delta) = '%s'", 'b', 'bid'), $form['skinr']['sid']['#value'], 0, 1);
-    while ($block = db_fetch_object($result)) {
-      $preprocess_hooks[] = 'block_'. $block->module;
-    }
-  }
-  else {
-    $preprocess_hooks[] = 'block_'. $form['module']['#value'];
-  }
-  $preprocess_hooks[] = 'block';
-
-  return $preprocess_hooks;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function block_skinr_preprocess_index_handler(&$vars) {
-  return $vars['block']->module .'-'. $vars['block']->delta;
-}
-
-/**
- * @}
- */
Index: modules/block.skinr.plugin.inc
===================================================================
RCS file: modules/block.skinr.plugin.inc
diff -N modules/block.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/block.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,120 @@
+<?php
+// $Id: block.skinr.inc,v 1.3.2.1.2.6 2010/04/05 22:41:45 moonray Exp $
+/**
+ * @file
+ * Provide skinr handling for block.module
+ */
+
+/**
+ * @defgroup skinr_block_module block.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function block_skinr_config() {
+  $data['block']['form']['block_admin_configure'] = array(
+    'index_handler' => 'block_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
+    'title' => t('block settings'),
+  );
+  $data['block']['form']['block_add_block_form'] = array(
+    'index_handler' => 'block_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
+    'title' => t('block settings'),
+  );
+  $data['block']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'block_skinr_preprocess_hook_callback',
+    'title' => t('block settings'),
+    'collapsed' => FALSE,
+  );
+  $data['block']['preprocess']['block'] = array(
+    'index_handler' => 'block_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function block_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      $form['submit']['#weight'] = 50;
+      return $form['module']['#value'] .'-'. $form['delta']['#value'];
+
+    case 'submit':
+      $form_id = $form['form_id']['#value'];
+      if ($form_id == 'block_add_block_form') {
+        // This is a new block, so we need to fetch the delta from DB
+        if ($delta = db_result(db_query("SELECT delta FROM {blocks} WHERE bid = '%s'", db_last_insert_id('boxes', 'bid')))) {
+          return $form_state['values']['module'] .'-'. $delta;
+        }
+      }
+      else {
+        return $form_state['values']['module'] .'-'. $form_state['values']['delta'];
+      }
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function block_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array();
+
+  if (!isset($form['module']['#value']) && isset($form['skinr']['sid']['#value'])) {
+    $result = db_query_range(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b WHERE CONCAT(b.module, '-', b.delta) = '%s'", 'b', 'bid'), $form['skinr']['sid']['#value'], 0, 1);
+    while ($block = db_fetch_object($result)) {
+      $preprocess_hooks[] = 'block_'. $block->module;
+    }
+  }
+  else {
+    $preprocess_hooks[] = 'block_'. $form['module']['#value'];
+  }
+  $preprocess_hooks[] = 'block';
+
+  return $preprocess_hooks;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function block_skinr_preprocess_index_handler(&$vars) {
+  return $vars['block']->module .'-'. $vars['block']->delta;
+}
+
+/**
+ * @}
+ */
Index: modules/comment.skinr.inc
===================================================================
RCS file: modules/comment.skinr.inc
diff -N modules/comment.skinr.inc
--- modules/comment.skinr.inc	3 Mar 2010 19:18:13 -0000	1.3.2.1.2.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-<?php
-// $Id: comment.skinr.inc,v 1.3.2.1.2.5 2010/03/03 19:18:13 moonray Exp $
-/**
- * @file
- * Provide skinr handling for comment.module
- */
-
-/**
- * @defgroup skinr_comment_module comment.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function comment_skinr_config() {
-  $data['comment']['form']['node_type_form'] = array(
-    'index_handler' => 'comment_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'comment_skinr_preprocess_hook_callback',
-    'title' => t('comment settings'),
-    'weight' => 1,
-  );
-  $data['comment']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'comment_skinr_preprocess_hook_callback',
-    'title' => t('comment settings'),
-    'skinr_weight' => 2,
-    'collapsed' => FALSE,
-  );
-  $data['comment']['preprocess']['comment_wrapper'] = array(
-    'index_handler' => 'comment_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function comment_skinr_form_index_handler($op, &$form, &$form_state) {
-  switch ($op) {
-    case 'form':
-      return $form['#node_type']->type;
-
-    case 'submit':
-      // Clear old variable before we set a new one if the node type has changed
-      if ($form_state['values']['old_type'] != $form_state['values']['type']) {
-        foreach ($form_state['values']['skinr_settings']['comment_group'] as $theme_name => $theme_data) {
-          $skinr = new stdClass();
-          $skinr->theme = $theme_name;
-          $skinr->module = 'comment';
-          $skinr->sid = $form_state['values']['old_type'];
-          $skinr->skins = array();
-
-          skinr_set($skinr);
-        }
-      }
-    return $form_state['values']['type'];
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function comment_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array();
-
-  if (!isset($form['#node_type']->type) && !empty($form['skinr']['sid']['#value'])) {
-    $preprocess_hooks[] = 'comment_wrapper_'. $form['skinr']['sid']['#value'];
-  }
-  else {
-    $preprocess_hooks[] = 'comment_wrapper_'. $form['#node_type']->type;
-  }
-  $preprocess_hooks[] = 'comment_wrapper';
-
-  return $preprocess_hooks;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function comment_skinr_preprocess_index_handler(&$vars) {
-  return $vars['node']->type;
-}
-
-/**
- * @}
- */
Index: modules/comment.skinr.plugin.inc
===================================================================
RCS file: modules/comment.skinr.plugin.inc
diff -N modules/comment.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/comment.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,116 @@
+<?php
+// $Id: comment.skinr.inc,v 1.3.2.1.2.5 2010/03/03 19:18:13 moonray Exp $
+/**
+ * @file
+ * Provide skinr handling for comment.module
+ */
+
+/**
+ * @defgroup skinr_comment_module comment.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function comment_skinr_config() {
+  $data['comment']['form']['node_type_form'] = array(
+    'index_handler' => 'comment_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'comment_skinr_preprocess_hook_callback',
+    'title' => t('comment settings'),
+    'weight' => 1,
+  );
+  $data['comment']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'comment_skinr_preprocess_hook_callback',
+    'title' => t('comment settings'),
+    'skinr_weight' => 2,
+    'collapsed' => FALSE,
+  );
+  $data['comment']['preprocess']['comment_wrapper'] = array(
+    'index_handler' => 'comment_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function comment_skinr_form_index_handler($op, &$form, &$form_state) {
+  switch ($op) {
+    case 'form':
+      return $form['#node_type']->type;
+
+    case 'submit':
+      // Clear old variable before we set a new one if the node type has changed
+      if ($form_state['values']['old_type'] != $form_state['values']['type']) {
+        foreach ($form_state['values']['skinr_settings']['comment_group'] as $theme_name => $theme_data) {
+          $skinr = new stdClass();
+          $skinr->theme = $theme_name;
+          $skinr->module = 'comment';
+          $skinr->sid = $form_state['values']['old_type'];
+          $skinr->skins = array();
+
+          skinr_set($skinr);
+        }
+      }
+    return $form_state['values']['type'];
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function comment_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array();
+
+  if (!isset($form['#node_type']->type) && !empty($form['skinr']['sid']['#value'])) {
+    $preprocess_hooks[] = 'comment_wrapper_'. $form['skinr']['sid']['#value'];
+  }
+  else {
+    $preprocess_hooks[] = 'comment_wrapper_'. $form['#node_type']->type;
+  }
+  $preprocess_hooks[] = 'comment_wrapper';
+
+  return $preprocess_hooks;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function comment_skinr_preprocess_index_handler(&$vars) {
+  return $vars['node']->type;
+}
+
+/**
+ * @}
+ */
Index: modules/content.skinr.inc
===================================================================
RCS file: modules/content.skinr.inc
diff -N modules/content.skinr.inc
--- modules/content.skinr.inc	9 Jun 2010 13:52:25 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,101 +0,0 @@
-<?php
-// $Id: content.skinr.inc,v 1.1.2.1 2010/06/09 13:52:25 moonray Exp $
-
-/**
- * @file
- * Provide skinr handling for content.module
- */
-
-/**
- * @defgroup skinr_content_module content.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function content_skinr_config() {
-  $data['content']['form']['content_field_edit_form'] = array(
-    'index_handler' => 'content_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'content_skinr_preprocess_hook_callback',
-    'title' => t('content settings'),
-  );
-  $data['content']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'content_skinr_preprocess_hook_callback',
-    'title' => t('content settings'),
-    'collapsed' => FALSE,
-  );
-  $data['content']['preprocess']['content_field'] = array(
-    'index_handler' => 'content_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function content_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      // Fix weights for this form to have the proper order of elements.
-      $form['field']['#weight'] = 2;
-      $form['submit']['#weight'] = 50;
-      
-      return $form['#field']['field_name'] .'_'. $form['#field']['type_name'];
-
-    case 'submit':
-      return $form_state['values']['field_name'] .'_'. $form_state['values']['type_name'];
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function content_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array();
-
-  $preprocess_hooks[] = 'content_field';
-
-  return $preprocess_hooks;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function content_skinr_preprocess_index_handler(&$vars) {
-  return $vars['field_name'] .'_'. $vars['node']->type;
-}
-
-/**
- * @}
- */
Index: modules/content.skinr.plugin.inc
===================================================================
RCS file: modules/content.skinr.plugin.inc
diff -N modules/content.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/content.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,101 @@
+<?php
+// $Id: content.skinr.inc,v 1.1.2.1 2010/06/09 13:52:25 moonray Exp $
+
+/**
+ * @file
+ * Provide skinr handling for content.module
+ */
+
+/**
+ * @defgroup skinr_content_module content.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function content_skinr_config() {
+  $data['content']['form']['content_field_edit_form'] = array(
+    'index_handler' => 'content_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'content_skinr_preprocess_hook_callback',
+    'title' => t('content settings'),
+  );
+  $data['content']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'content_skinr_preprocess_hook_callback',
+    'title' => t('content settings'),
+    'collapsed' => FALSE,
+  );
+  $data['content']['preprocess']['content_field'] = array(
+    'index_handler' => 'content_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function content_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      // Fix weights for this form to have the proper order of elements.
+      $form['field']['#weight'] = 2;
+      $form['submit']['#weight'] = 50;
+      
+      return $form['#field']['field_name'] .'_'. $form['#field']['type_name'];
+
+    case 'submit':
+      return $form_state['values']['field_name'] .'_'. $form_state['values']['type_name'];
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function content_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array();
+
+  $preprocess_hooks[] = 'content_field';
+
+  return $preprocess_hooks;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function content_skinr_preprocess_index_handler(&$vars) {
+  return $vars['field_name'] .'_'. $vars['node']->type;
+}
+
+/**
+ * @}
+ */
Index: modules/fieldgroup.skinr.inc
===================================================================
RCS file: modules/fieldgroup.skinr.inc
diff -N modules/fieldgroup.skinr.inc
--- modules/fieldgroup.skinr.inc	9 Jun 2010 13:52:25 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,126 +0,0 @@
-<?php
-// $Id: fieldgroup.skinr.inc,v 1.1.2.1 2010/06/09 13:52:25 moonray Exp $
-
-/**
- * @file
- * Provide skinr handling for fieldgroup.module
- */
-
-/**
- * @defgroup skinr_fieldgroup_module fieldgroup.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function fieldgroup_skinr_config() {
-  $data['fieldgroup']['form']['fieldgroup_group_edit_form'] = array(
-    'index_handler' => 'fieldgroup_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'fieldgroup_skinr_preprocess_hook_callback',
-    'title' => t('fieldgroup settings'),
-  );
-  $data['fieldgroup']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'fieldgroup_skinr_preprocess_hook_callback',
-    'title' => t('fieldgroup settings'),
-    'collapsed' => FALSE,
-  );
-  $data['fieldgroup']['preprocess']['fieldgroup_simple'] = array(
-    'index_handler' => 'fieldgroup_skinr_preprocess_index_handler',
-  );
-  $data['fieldgroup']['preprocess']['fieldgroup_fieldset'] = array(
-    'index_handler' => 'fieldgroup_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function fieldgroup_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      // Fix weights for this form to have the proper order of elements.
-      $form['submit']['#weight'] = 50;
-      
-      return $form['group_name']['#default_value'] .'_'. $form['#content_type']['type'];
-
-    case 'submit':
-      return $form_state['values']['group_name'] .'_'. $form['#content_type']['type'];
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function fieldgroup_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array();
-
-  $preprocess_hooks[] = 'fieldgroup_simple';
-  $preprocess_hooks[] = 'fieldgroup_fieldset';
-
-  return $preprocess_hooks;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function fieldgroup_skinr_preprocess_index_handler(&$vars) {
-  return $vars['element']['#group_name'] .'_'. $vars['element']['#node']->type;
-}
-
-/**
- * Implementation of hook_fieldgroup_view().
- */
-function skinr_fieldgroup_view($node, &$element, &$group, $context) {
-  // We need to fake a preprocess to get our skinr data, since these
-  // renderings of the fieldgroup don't have a preprocess hook.
-  $exclude = array('no_style', 'simple', 'hidden');
-  if (!in_array($group['settings']['display'][$context]['format'], $exclude)) {
-    $vars = array(
-      'element' => $element,
-    );
-    $vars['element']['#group_name'] = $group['group_name'];
-    $vars['element']['#node'] = $node;
-
-    skinr_preprocess($vars, 'fieldgroup_fieldset');
-    
-    if ($vars['skinr']) {
-      $element['#attributes']['class'] .= ' '. $vars['skinr'];
-    }
-  }
-}
-
-/**
- * @}
- */
Index: modules/fieldgroup.skinr.plugin.inc
===================================================================
RCS file: modules/fieldgroup.skinr.plugin.inc
diff -N modules/fieldgroup.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/fieldgroup.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,126 @@
+<?php
+// $Id: fieldgroup.skinr.inc,v 1.1.2.1 2010/06/09 13:52:25 moonray Exp $
+
+/**
+ * @file
+ * Provide skinr handling for fieldgroup.module
+ */
+
+/**
+ * @defgroup skinr_fieldgroup_module fieldgroup.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function fieldgroup_skinr_config() {
+  $data['fieldgroup']['form']['fieldgroup_group_edit_form'] = array(
+    'index_handler' => 'fieldgroup_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'fieldgroup_skinr_preprocess_hook_callback',
+    'title' => t('fieldgroup settings'),
+  );
+  $data['fieldgroup']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'fieldgroup_skinr_preprocess_hook_callback',
+    'title' => t('fieldgroup settings'),
+    'collapsed' => FALSE,
+  );
+  $data['fieldgroup']['preprocess']['fieldgroup_simple'] = array(
+    'index_handler' => 'fieldgroup_skinr_preprocess_index_handler',
+  );
+  $data['fieldgroup']['preprocess']['fieldgroup_fieldset'] = array(
+    'index_handler' => 'fieldgroup_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function fieldgroup_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      // Fix weights for this form to have the proper order of elements.
+      $form['submit']['#weight'] = 50;
+      
+      return $form['group_name']['#default_value'] .'_'. $form['#content_type']['type'];
+
+    case 'submit':
+      return $form_state['values']['group_name'] .'_'. $form['#content_type']['type'];
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function fieldgroup_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array();
+
+  $preprocess_hooks[] = 'fieldgroup_simple';
+  $preprocess_hooks[] = 'fieldgroup_fieldset';
+
+  return $preprocess_hooks;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function fieldgroup_skinr_preprocess_index_handler(&$vars) {
+  return $vars['element']['#group_name'] .'_'. $vars['element']['#node']->type;
+}
+
+/**
+ * Implementation of hook_fieldgroup_view().
+ */
+function skinr_fieldgroup_view($node, &$element, &$group, $context) {
+  // We need to fake a preprocess to get our skinr data, since these
+  // renderings of the fieldgroup don't have a preprocess hook.
+  $exclude = array('no_style', 'simple', 'hidden');
+  if (!in_array($group['settings']['display'][$context]['format'], $exclude)) {
+    $vars = array(
+      'element' => $element,
+    );
+    $vars['element']['#group_name'] = $group['group_name'];
+    $vars['element']['#node'] = $node;
+
+    skinr_preprocess($vars, 'fieldgroup_fieldset');
+    
+    if ($vars['skinr']) {
+      $element['#attributes']['class'] .= ' '. $vars['skinr'];
+    }
+  }
+}
+
+/**
+ * @}
+ */
Index: modules/node.skinr.inc
===================================================================
RCS file: modules/node.skinr.inc
diff -N modules/node.skinr.inc
--- modules/node.skinr.inc	4 Mar 2010 14:06:59 -0000	1.3.2.1.2.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,114 +0,0 @@
-<?php
-// $Id: node.skinr.inc,v 1.3.2.1.2.5 2010/03/04 14:06:59 moonray Exp $
-/**
- * @file
- * Provide skinr handling for node.module
- */
-
-/**
- * @defgroup skinr_node_module node.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function node_skinr_config() {
-  $data['node']['form']['node_type_form'] = array(
-    'index_handler' => 'node_skinr_form_index_handler',
-    'preprocess_hook_callback' => 'node_skinr_preprocess_hook_callback',
-    'title' => t('node settings'),
-  );
-  $data['node']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'node_skinr_preprocess_hook_callback',
-    'title' => t('node settings'),
-    'collapsed' => FALSE,
-  );
-  $data['node']['preprocess']['node'] = array(
-    'index_handler' => 'node_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function node_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      return $form['#node_type']->type;
-
-    case 'submit':
-      // Clear old variable before we set a new one if the node type has changed
-      if ($form_state['values']['old_type'] != $form_state['values']['type']) {
-        foreach ($form_state['values']['skinr_settings']['node_group'] as $theme_name => $theme_data) {
-          $skinr = new stdClass();
-          $skinr->theme = $theme_name;
-          $skinr->module = 'node';
-          $skinr->sid = $form_state['values']['old_type'];
-          $skinr->skins = array();
-
-          skinr_set($skinr);
-        }
-      }
-    return $form_state['values']['type'];
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function node_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array();
-
-  if (!isset($form['#node_type']->type) && !empty($form['skinr']['sid']['#value'])) {
-    $preprocess_hooks[] = 'node_'. $form['skinr']['sid']['#value'];
-  }
-  else {
-    $preprocess_hooks[] = 'node_'. $form['#node_type']->type;
-  }
-  $preprocess_hooks[] = 'node';
-
-  return $preprocess_hooks;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function node_skinr_preprocess_index_handler(&$vars) {
-  return $vars['node']->type;
-}
-
-/**
- * @}
- */
Index: modules/node.skinr.plugin.inc
===================================================================
RCS file: modules/node.skinr.plugin.inc
diff -N modules/node.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/node.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,114 @@
+<?php
+// $Id: node.skinr.inc,v 1.3.2.1.2.5 2010/03/04 14:06:59 moonray Exp $
+/**
+ * @file
+ * Provide skinr handling for node.module
+ */
+
+/**
+ * @defgroup skinr_node_module node.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function node_skinr_config() {
+  $data['node']['form']['node_type_form'] = array(
+    'index_handler' => 'node_skinr_form_index_handler',
+    'preprocess_hook_callback' => 'node_skinr_preprocess_hook_callback',
+    'title' => t('node settings'),
+  );
+  $data['node']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'node_skinr_preprocess_hook_callback',
+    'title' => t('node settings'),
+    'collapsed' => FALSE,
+  );
+  $data['node']['preprocess']['node'] = array(
+    'index_handler' => 'node_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function node_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      return $form['#node_type']->type;
+
+    case 'submit':
+      // Clear old variable before we set a new one if the node type has changed
+      if ($form_state['values']['old_type'] != $form_state['values']['type']) {
+        foreach ($form_state['values']['skinr_settings']['node_group'] as $theme_name => $theme_data) {
+          $skinr = new stdClass();
+          $skinr->theme = $theme_name;
+          $skinr->module = 'node';
+          $skinr->sid = $form_state['values']['old_type'];
+          $skinr->skins = array();
+
+          skinr_set($skinr);
+        }
+      }
+    return $form_state['values']['type'];
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function node_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array();
+
+  if (!isset($form['#node_type']->type) && !empty($form['skinr']['sid']['#value'])) {
+    $preprocess_hooks[] = 'node_'. $form['skinr']['sid']['#value'];
+  }
+  else {
+    $preprocess_hooks[] = 'node_'. $form['#node_type']->type;
+  }
+  $preprocess_hooks[] = 'node';
+
+  return $preprocess_hooks;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function node_skinr_preprocess_index_handler(&$vars) {
+  return $vars['node']->type;
+}
+
+/**
+ * @}
+ */
Index: modules/panels.skinr.inc
===================================================================
RCS file: modules/panels.skinr.inc
diff -N modules/panels.skinr.inc
--- modules/panels.skinr.inc	4 Sep 2010 05:29:19 -0000	1.8.2.2.2.13
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,426 +0,0 @@
-<?php
-// $Id: panels.skinr.inc,v 1.8.2.2.2.13 2010/09/04 05:29:19 jgirlygirl Exp $
-/**
- * @file
- * Provide skinr handling for panels.module.
- */
-
-/**
- * @defgroup skinr_panels_module panels.module handlers.
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function panels_skinr_config() {
-  $data['panels']['form']['panels_edit_style_settings_form'] = array(
-    'index_handler' => 'panels_skinr_form_index_handler',
-    'data_handler' => 'panels_skinr_data_handler',
-    'submit_handler' => 'panels_skinr_submit_handler_settings',
-    'preprocess_hook_callback' => 'panels_skinr_preprocess_hook_callback',
-    'title' => t('panel pane settings'),
-    'skinr_weight' => 0,
-    'collapsed' => FALSE,
-  );
-  // AJAX form.
-  $data['panels']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'panels_skinr_ajax_preprocess_hook_callback',
-    'title' => t('panel pane settings'),
-    'collapsed' => FALSE,
-  );
-  // Panel pages.
-  $data['panels']['form']['page_manager_save_page_form'] = array(
-    'access_handler' => 'panels_skinr_access_handler_display',
-    'submit_handler' => 'panels_skinr_submit_handler_display',
-  );
-  // Content form for panel pages.
-  $data['panels']['form']['panels_panel_context_edit_content'] = array(
-    'access_handler' => 'panels_skinr_access_handler_display',
-    'submit_handler' => 'panels_skinr_submit_handler_display',
-  );
-  // Mini panels.
-  $data['panels']['form']['panels_edit_display_form'] = array(
-    'access_handler' => 'panels_skinr_access_handler_display',
-    'submit_handler' => 'panels_skinr_submit_handler_display',
-  );
-  $data['panels']['preprocess']['panels_pane'] = array(
-    'index_handler' => 'panels_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function panels_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-    case 'submit':
-      switch ($form['#parameters'][1]['type']) {
-        case 'display':
-          return 'display-'. $form['#parameters'][1]['display']->did;
-        case 'panel': // Deprecated in Panels 3.7
-        case 'region':
-          return 'display-'. $form['#parameters'][1]['display']->did .'-panel-'. $form['#parameters'][1]['pid'];
-        case 'pane':
-          return 'display-'. $form['#parameters'][1]['display']->did .'-pane-'. $form['#parameters'][1]['pid'];
-      }
-  }
-}
-
-/**
- * Skinr access handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "access skinr": access to edit skinr's selector
- *   - "access skinr classes": access to edit skinr's additional classes
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   TRUE if we get access, FALSE if we don't.
- */
-function panels_skinr_access_handler_display($op, &$form, $form_state) {
-  // We don't want the skinr settings form to appear on this form. We only want
-  // to intercept it so we can save our cached data.
-
-  // Since we're not using the form, we won't get our form submitter, so let's
-  // add it manually.
-
-  $form_id = $form['form_id']['#value'];
-
-  switch ($form_id) {
-    case 'panels_panel_context_edit_content':
-      // Update and save button
-
-      // Only add submit handler once.
-      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
-        $form['#submit'][] = 'skinr_ui_form_submit';
-      }
-      break;
-
-    case 'page_manager_save_page_form':
-      // Submitting a panel page.
-
-      // Only add submit handler once.
-      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
-        $form['#submit'][] = 'skinr_ui_form_submit';
-      }
-      if (isset($form['save']['#submit']) && !in_array('skinr_ui_form_submit', $form['save']['#submit'])) {
-        $form['save']['#submit'][] = 'skinr_ui_form_submit';
-      }
-      if (isset($form['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['cancel']['#submit'])) {
-        $form['cancel']['#submit'][] = 'skinr_ui_form_submit';
-      }
-      break;
-
-    case 'panels_edit_display_form':
-      // Only add submit handler once.
-      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
-        $form['#submit'][] = 'skinr_ui_form_submit';
-      }
-      if (isset($form['buttons']['submit']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['submit']['#submit'])) {
-        $form['buttons']['submit']['#submit'][] = 'skinr_ui_form_submit';
-      }
-      break;
-
-    default:
-      // We only want to save or cancel on these other forms if we're dealing with a panel_page.
-      if ($form_state['task']['name'] == 'panel_page') {
-        // Only add submit handler once
-        if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
-          $form['#submit'][] = 'skinr_ui_form_submit';
-        }
-        if (isset($form['buttons']['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['cancel']['#submit'])) {
-          $form['buttons']['cancel']['#submit'][] = 'skinr_ui_form_submit';
-        }
-      }
-      break;
-  }
-
-  return FALSE;
-}
-
-/**
- * Skinr data handler.
- * This is the data that populates the skinr form.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_submit().
- * @param $module
- *   The module that is currently being processed.
- * @param $form_settings
- *   The settings from hook_skinr_config() for the form that's currently being
- *   processed.
- * @return
- *   TRUE if we get access, FALSE if we don't.
- */
-function panels_skinr_data_handler(&$form, $form_state, $theme, $module, $form_settings) {
-  // Ensure we have the required index_handler.
-  if (empty($form_settings['index_handler'])) {
-    trigger_error(sprintf("No index_handler was found for form_id '%s' in module '%s'.", $form_id, $module), E_USER_ERROR);
-  }
-  $index = skinr_handler('form_index_handler', 'form', $form_settings['index_handler'], $form, $form_state);
-
-  // Fetch skinr data for this view from cache.
-  ctools_include('object-cache');
-
-  if ($skinr_data = ctools_object_cache_get('skinr', $form_state['display']->did, TRUE)) {
-    if (isset($skinr_data[$theme][$index])) {
-      return $skinr_data[$theme][$index];
-    }
-    else {
-      return array();
-    }
-  }
-
-  // No data exists in cache, so let's grab it from the regular source.
-  return skinr_get($theme, $module, $index);
-}
-
-/**
- * Skinr submit handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "access skinr": access to edit skinr's selector
- *   - "access skinr classes": access to edit skinr's additional classes
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   TRUE if we get access, FALSE if we don't.
- */
-function panels_skinr_submit_handler_settings(&$form, $form_state, $module, $form_settings) {
-  foreach ($form_state['values']['skinr_settings'][$module .'_group'] as $theme_name => $theme) {
-    if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['_additional'])) {
-      $hook  = $module;
-      $sid   = skinr_handler('form_index_handler', 'submit', $form_settings['index_handler'], $form, $form_state);
-
-      // Key doesn't exist properly for new displays. Perhaps we should inject a timestamp based key into the display object
-      // and use that for reference on the final submit? If it works...
-
-      $value = array();
-
-      if (is_array($theme['widgets'])) {
-        foreach ($theme['widgets'] as $skin_id => $skin_value) {
-          $value[$skin_id] = $skin_value;
-        }
-      }
-
-      if (isset($theme['_additional'])) {
-        $theme['_additional'] = trim($theme['_additional']);
-        if (!empty($theme['_additional'])) {
-          $value['_additional'] = $theme['_additional'];
-        }
-      }
-
-      if (isset($theme['_template'])) {
-        $theme['_template'] = trim($theme['_template']);
-        if (!empty($theme['_template'])) {
-          $value['_template'] = $theme['_template'];
-        }
-      }
-
-      if (empty($sid)) {
-        // We didn't receive a valid sid, so raise an error.
-        drupal_set_message(t("Skinr settings weren't saved due to an error."), 'error');
-      }
-
-      // Save skinr_settings for this panel display in cache.
-      ctools_include('object-cache');
-      if (!$skinr_data = ctools_object_cache_get('skinr', $form_state['display']->did, TRUE)) {
-        $skinr_data = array();
-        // Fetch skinr data.
-        $skinr = skinr_get($theme_name);
-        if (isset($skinr[$module])) {
-          foreach ($skinr[$module] as $skinr_key => $skinr_value) {
-            if (drupal_substr($skinr_key, 0, drupal_strlen('display-'. $form_state['display']->did)) == 'display-'. $form_state['display']->did) {
-              $skinr_data[$theme_name][$skinr_key] = $skinr_value;
-            }
-          }
-        }
-      }
-      $skinr_data[$theme_name][$sid] = $value;
-      ctools_object_cache_set('skinr', $form_state['display']->did, $skinr_data);
-    }
-  }
-}
-
-/**
- * @todo remove values from skinr if a display is deleted
- */
-function panels_skinr_submit_handler_display(&$form, $form_state, $module, $form_settings) {
-  $form_id = $form_state['values']['form_id'];
-
-  // Include ctools' object cache files.
-  ctools_include('object-cache');
-
-  if ($form_state['values']['op'] == t('Save') || $form_state['values']['op'] == t('Update and save')) {
-    switch ($form_id) {
-      case 'panels_panel_context_edit_content':
-      case 'page_manager_save_page_form':
-        // Panel page.
-        foreach ($form_state['page']->handler_info as $id => $info) {
-          if ($info['changed']) {
-            _panels_skinr_save_and_clear_cache($form_state['page']->handlers[$id]->conf['did']);
-          }
-        }
-        break;
-
-      case 'panels_edit_display_form':
-        // Mini panels.
-        _panels_skinr_save_and_clear_cache($form_state['display']->did);
-        break;
-    }
-  }
-  elseif ($form_state['values']['op'] == t('Cancel')) {
-    switch ($form_id) {
-      case 'page_manager_save_page_form':
-        // Panel page.
-        foreach ($form_state['page']->handler_info as $id => $info) {
-          if ($info['changed']) {
-            ctools_object_cache_clear('skinr', $form_state['page']->handlers[$id]->conf['did']);
-          }
-        }
-        break;
-
-      case 'panels_edit_display_form':
-        // Mini panels.
-        ctools_object_cache_clear('skinr', $form_state['display']->did);
-        break;
-    }
-  }
-}
-
-function _panels_skinr_save_and_clear_cache($did) {
-  if ($skinr_data = ctools_object_cache_get('skinr', $did, TRUE)) {
-    foreach ($skinr_data as $theme_name => $theme) {
-      foreach ($theme as $sid => $skins) {
-        $skinr = new stdClass();
-        $skinr->theme = $theme_name;
-        $skinr->module = 'panels';
-        $skinr->sid = $sid;
-        $skinr->skins = $skins;
-
-        skinr_set($skinr);
-      }
-    }
-    ctools_object_cache_clear('skinr', $did);
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function panels_skinr_preprocess_hook_callback(&$form, $form_state) {
-  switch ($form['#parameters'][1]['type']) {
-    case 'display':
-      return 'panels_display';
-    case 'panel': // Deprecated as of Panels 3.7
-    case 'region':
-    /* @todo  This needs to use panels_region */
-      return 'panels_panel';
-    case 'pane':
-      return 'panels_pane';
-  }
-}
-
-/**
- * Skinr preprocess_hook_callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function panels_skinr_ajax_preprocess_hook_callback(&$form, $form_state) {
-  if (strpos($form['skinr']['sid']['#value'], '-panel-') !== FALSE) {
-    return 'panels_panel';
-  }
-  elseif (strpos($form['skinr']['sid']['#value'], '-pane-') !== FALSE) {
-    return 'panels_pane';
-  }
-  else {
-    return 'panels_display';
-  }
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function panels_skinr_preprocess_index_handler(&$vars) {
-  $index = '';
-  if (isset($vars['pane']->style['style']) && $vars['pane']->style['style'] == 'skinr') {
-    $index = 'display-'. $vars['pane']->did .'-pane-'. $vars['pane']->pid;
-  }
-  return $index;
-}
-
-//----------------------------------------------------------------------------
-// Panels hooks.
-
-/**
- * Implementation of hook_ctools_plugin_directory() to let the system know
- * we implement panels plugins.
- */
-function skinr_ctools_plugin_directory($module, $plugin) {
-  // Safety: go away if CTools is not at an appropriate version.
-  if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
-    return;
-  }
-  if ($module == 'panels') {
-    return 'modules/panels';
-  }
-}
-
-/**
- * Implementation of hook_ctools_plugin_api().
- */
-function skinr_ctools_plugin_api($module, $api) {
-  if ($module == 'panels' && $api == 'styles') {
-    return array('version' => 2);
-  }
-}
-
-/**
- * @}
- */
\ No newline at end of file
Index: modules/panels.skinr.plugin.inc
===================================================================
RCS file: modules/panels.skinr.plugin.inc
diff -N modules/panels.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/panels.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,426 @@
+<?php
+// $Id: panels.skinr.inc,v 1.8.2.2.2.13 2010/09/04 05:29:19 jgirlygirl Exp $
+/**
+ * @file
+ * Provide skinr handling for panels.module.
+ */
+
+/**
+ * @defgroup skinr_panels_module panels.module handlers.
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function panels_skinr_config() {
+  $data['panels']['form']['panels_edit_style_settings_form'] = array(
+    'index_handler' => 'panels_skinr_form_index_handler',
+    'data_handler' => 'panels_skinr_data_handler',
+    'submit_handler' => 'panels_skinr_submit_handler_settings',
+    'preprocess_hook_callback' => 'panels_skinr_preprocess_hook_callback',
+    'title' => t('panel pane settings'),
+    'skinr_weight' => 0,
+    'collapsed' => FALSE,
+  );
+  // AJAX form.
+  $data['panels']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'panels_skinr_ajax_preprocess_hook_callback',
+    'title' => t('panel pane settings'),
+    'collapsed' => FALSE,
+  );
+  // Panel pages.
+  $data['panels']['form']['page_manager_save_page_form'] = array(
+    'access_handler' => 'panels_skinr_access_handler_display',
+    'submit_handler' => 'panels_skinr_submit_handler_display',
+  );
+  // Content form for panel pages.
+  $data['panels']['form']['panels_panel_context_edit_content'] = array(
+    'access_handler' => 'panels_skinr_access_handler_display',
+    'submit_handler' => 'panels_skinr_submit_handler_display',
+  );
+  // Mini panels.
+  $data['panels']['form']['panels_edit_display_form'] = array(
+    'access_handler' => 'panels_skinr_access_handler_display',
+    'submit_handler' => 'panels_skinr_submit_handler_display',
+  );
+  $data['panels']['preprocess']['panels_pane'] = array(
+    'index_handler' => 'panels_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function panels_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+    case 'submit':
+      switch ($form['#parameters'][1]['type']) {
+        case 'display':
+          return 'display-'. $form['#parameters'][1]['display']->did;
+        case 'panel': // Deprecated in Panels 3.7
+        case 'region':
+          return 'display-'. $form['#parameters'][1]['display']->did .'-panel-'. $form['#parameters'][1]['pid'];
+        case 'pane':
+          return 'display-'. $form['#parameters'][1]['display']->did .'-pane-'. $form['#parameters'][1]['pid'];
+      }
+  }
+}
+
+/**
+ * Skinr access handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "access skinr": access to edit skinr's selector
+ *   - "access skinr classes": access to edit skinr's additional classes
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   TRUE if we get access, FALSE if we don't.
+ */
+function panels_skinr_access_handler_display($op, &$form, $form_state) {
+  // We don't want the skinr settings form to appear on this form. We only want
+  // to intercept it so we can save our cached data.
+
+  // Since we're not using the form, we won't get our form submitter, so let's
+  // add it manually.
+
+  $form_id = $form['form_id']['#value'];
+
+  switch ($form_id) {
+    case 'panels_panel_context_edit_content':
+      // Update and save button
+
+      // Only add submit handler once.
+      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
+        $form['#submit'][] = 'skinr_ui_form_submit';
+      }
+      break;
+
+    case 'page_manager_save_page_form':
+      // Submitting a panel page.
+
+      // Only add submit handler once.
+      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
+        $form['#submit'][] = 'skinr_ui_form_submit';
+      }
+      if (isset($form['save']['#submit']) && !in_array('skinr_ui_form_submit', $form['save']['#submit'])) {
+        $form['save']['#submit'][] = 'skinr_ui_form_submit';
+      }
+      if (isset($form['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['cancel']['#submit'])) {
+        $form['cancel']['#submit'][] = 'skinr_ui_form_submit';
+      }
+      break;
+
+    case 'panels_edit_display_form':
+      // Only add submit handler once.
+      if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
+        $form['#submit'][] = 'skinr_ui_form_submit';
+      }
+      if (isset($form['buttons']['submit']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['submit']['#submit'])) {
+        $form['buttons']['submit']['#submit'][] = 'skinr_ui_form_submit';
+      }
+      break;
+
+    default:
+      // We only want to save or cancel on these other forms if we're dealing with a panel_page.
+      if ($form_state['task']['name'] == 'panel_page') {
+        // Only add submit handler once
+        if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
+          $form['#submit'][] = 'skinr_ui_form_submit';
+        }
+        if (isset($form['buttons']['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['cancel']['#submit'])) {
+          $form['buttons']['cancel']['#submit'][] = 'skinr_ui_form_submit';
+        }
+      }
+      break;
+  }
+
+  return FALSE;
+}
+
+/**
+ * Skinr data handler.
+ * This is the data that populates the skinr form.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_submit().
+ * @param $module
+ *   The module that is currently being processed.
+ * @param $form_settings
+ *   The settings from hook_skinr_config() for the form that's currently being
+ *   processed.
+ * @return
+ *   TRUE if we get access, FALSE if we don't.
+ */
+function panels_skinr_data_handler(&$form, $form_state, $theme, $module, $form_settings) {
+  // Ensure we have the required index_handler.
+  if (empty($form_settings['index_handler'])) {
+    trigger_error(sprintf("No index_handler was found for form_id '%s' in module '%s'.", $form_id, $module), E_USER_ERROR);
+  }
+  $index = skinr_handler('form_index_handler', 'form', $form_settings['index_handler'], $form, $form_state);
+
+  // Fetch skinr data for this view from cache.
+  ctools_include('object-cache');
+
+  if ($skinr_data = ctools_object_cache_get('skinr', $form_state['display']->did, TRUE)) {
+    if (isset($skinr_data[$theme][$index])) {
+      return $skinr_data[$theme][$index];
+    }
+    else {
+      return array();
+    }
+  }
+
+  // No data exists in cache, so let's grab it from the regular source.
+  return skinr_get($theme, $module, $index);
+}
+
+/**
+ * Skinr submit handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "access skinr": access to edit skinr's selector
+ *   - "access skinr classes": access to edit skinr's additional classes
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   TRUE if we get access, FALSE if we don't.
+ */
+function panels_skinr_submit_handler_settings(&$form, $form_state, $module, $form_settings) {
+  foreach ($form_state['values']['skinr_settings'][$module .'_group'] as $theme_name => $theme) {
+    if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['_additional'])) {
+      $hook  = $module;
+      $sid   = skinr_handler('form_index_handler', 'submit', $form_settings['index_handler'], $form, $form_state);
+
+      // Key doesn't exist properly for new displays. Perhaps we should inject a timestamp based key into the display object
+      // and use that for reference on the final submit? If it works...
+
+      $value = array();
+
+      if (is_array($theme['widgets'])) {
+        foreach ($theme['widgets'] as $skin_id => $skin_value) {
+          $value[$skin_id] = $skin_value;
+        }
+      }
+
+      if (isset($theme['_additional'])) {
+        $theme['_additional'] = trim($theme['_additional']);
+        if (!empty($theme['_additional'])) {
+          $value['_additional'] = $theme['_additional'];
+        }
+      }
+
+      if (isset($theme['_template'])) {
+        $theme['_template'] = trim($theme['_template']);
+        if (!empty($theme['_template'])) {
+          $value['_template'] = $theme['_template'];
+        }
+      }
+
+      if (empty($sid)) {
+        // We didn't receive a valid sid, so raise an error.
+        drupal_set_message(t("Skinr settings weren't saved due to an error."), 'error');
+      }
+
+      // Save skinr_settings for this panel display in cache.
+      ctools_include('object-cache');
+      if (!$skinr_data = ctools_object_cache_get('skinr', $form_state['display']->did, TRUE)) {
+        $skinr_data = array();
+        // Fetch skinr data.
+        $skinr = skinr_get($theme_name);
+        if (isset($skinr[$module])) {
+          foreach ($skinr[$module] as $skinr_key => $skinr_value) {
+            if (drupal_substr($skinr_key, 0, drupal_strlen('display-'. $form_state['display']->did)) == 'display-'. $form_state['display']->did) {
+              $skinr_data[$theme_name][$skinr_key] = $skinr_value;
+            }
+          }
+        }
+      }
+      $skinr_data[$theme_name][$sid] = $value;
+      ctools_object_cache_set('skinr', $form_state['display']->did, $skinr_data);
+    }
+  }
+}
+
+/**
+ * @todo remove values from skinr if a display is deleted
+ */
+function panels_skinr_submit_handler_display(&$form, $form_state, $module, $form_settings) {
+  $form_id = $form_state['values']['form_id'];
+
+  // Include ctools' object cache files.
+  ctools_include('object-cache');
+
+  if ($form_state['values']['op'] == t('Save') || $form_state['values']['op'] == t('Update and save')) {
+    switch ($form_id) {
+      case 'panels_panel_context_edit_content':
+      case 'page_manager_save_page_form':
+        // Panel page.
+        foreach ($form_state['page']->handler_info as $id => $info) {
+          if ($info['changed']) {
+            _panels_skinr_save_and_clear_cache($form_state['page']->handlers[$id]->conf['did']);
+          }
+        }
+        break;
+
+      case 'panels_edit_display_form':
+        // Mini panels.
+        _panels_skinr_save_and_clear_cache($form_state['display']->did);
+        break;
+    }
+  }
+  elseif ($form_state['values']['op'] == t('Cancel')) {
+    switch ($form_id) {
+      case 'page_manager_save_page_form':
+        // Panel page.
+        foreach ($form_state['page']->handler_info as $id => $info) {
+          if ($info['changed']) {
+            ctools_object_cache_clear('skinr', $form_state['page']->handlers[$id]->conf['did']);
+          }
+        }
+        break;
+
+      case 'panels_edit_display_form':
+        // Mini panels.
+        ctools_object_cache_clear('skinr', $form_state['display']->did);
+        break;
+    }
+  }
+}
+
+function _panels_skinr_save_and_clear_cache($did) {
+  if ($skinr_data = ctools_object_cache_get('skinr', $did, TRUE)) {
+    foreach ($skinr_data as $theme_name => $theme) {
+      foreach ($theme as $sid => $skins) {
+        $skinr = new stdClass();
+        $skinr->theme = $theme_name;
+        $skinr->module = 'panels';
+        $skinr->sid = $sid;
+        $skinr->skins = $skins;
+
+        skinr_set($skinr);
+      }
+    }
+    ctools_object_cache_clear('skinr', $did);
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function panels_skinr_preprocess_hook_callback(&$form, $form_state) {
+  switch ($form['#parameters'][1]['type']) {
+    case 'display':
+      return 'panels_display';
+    case 'panel': // Deprecated as of Panels 3.7
+    case 'region':
+    /* @todo  This needs to use panels_region */
+      return 'panels_panel';
+    case 'pane':
+      return 'panels_pane';
+  }
+}
+
+/**
+ * Skinr preprocess_hook_callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function panels_skinr_ajax_preprocess_hook_callback(&$form, $form_state) {
+  if (strpos($form['skinr']['sid']['#value'], '-panel-') !== FALSE) {
+    return 'panels_panel';
+  }
+  elseif (strpos($form['skinr']['sid']['#value'], '-pane-') !== FALSE) {
+    return 'panels_pane';
+  }
+  else {
+    return 'panels_display';
+  }
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function panels_skinr_preprocess_index_handler(&$vars) {
+  $index = '';
+  if (isset($vars['pane']->style['style']) && $vars['pane']->style['style'] == 'skinr') {
+    $index = 'display-'. $vars['pane']->did .'-pane-'. $vars['pane']->pid;
+  }
+  return $index;
+}
+
+//----------------------------------------------------------------------------
+// Panels hooks.
+
+/**
+ * Implementation of hook_ctools_plugin_directory() to let the system know
+ * we implement panels plugins.
+ */
+function skinr_ctools_plugin_directory($module, $plugin) {
+  // Safety: go away if CTools is not at an appropriate version.
+  if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+    return;
+  }
+  if ($module == 'panels') {
+    return 'modules/panels';
+  }
+}
+
+/**
+ * Implementation of hook_ctools_plugin_api().
+ */
+function skinr_ctools_plugin_api($module, $api) {
+  if ($module == 'panels' && $api == 'styles') {
+    return array('version' => 2);
+  }
+}
+
+/**
+ * @}
+ */
\ No newline at end of file
Index: modules/skinr.skinr.inc
===================================================================
RCS file: modules/skinr.skinr.inc
diff -N modules/skinr.skinr.inc
--- modules/skinr.skinr.inc	1 May 2010 20:11:11 -0000	1.1.2.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,100 +0,0 @@
-<?php
-// $Id: skinr.skinr.inc,v 1.1.2.3 2010/05/01 20:11:11 jgirlygirl Exp $
-/**
- * @file
- * Provide skinr handling for page level rules.
- */
-
-/**
- * @defgroup skinr page rule handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function skinr_skinr_config() {
-  $data['page']['form']['skinr_rule_edit'] = array(
-    'index_handler' => 'page_skinr_form_index_handler',
-    'preprocess_hook' => 'page',
-    'title' => t('page rule settings'),
-    'skinr_weight' => 0,
-    'collapsed' => FALSE,
-  );
-  $data['page']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook' => 'page',
-    'title' => t('page rule settings'),
-    'collapsed' => FALSE,
-  );
-  $data['page']['preprocess']['page'] = array(
-    'index_handler' => 'page_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinr's data structure.
- */
-function page_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      if (!empty($form['rule']['rid']['#value'])) {
-        return $form['rule']['rid']['#value'];
-      }
-      else {
-        return 0;
-      }
-
-    case 'submit':
-      if (!empty($form_state['values']['rid'])) {
-        return $form_state['values']['rid'];
-      }
-      else {
-        // This is a rule, so we need to fetch the rid from DB.
-        return(db_last_insert_id('skinr_rules', 'rid'));
-      }
-  }
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from module_preprocess().
- * @return
- *   The index where we can find our values in Skinr's data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function page_skinr_preprocess_index_handler(&$vars) {
-  $rules = skinr_rule_load();
-
-  // Find any page level skinr options and return an array of them.
-  $indices = array();
-  foreach ($rules as $rule) {
-    if (skinr_rule_visible($rule->rid)) {
-      $indices[] = $rule->rid;
-    }
-  }
-  return $indices;
-}
-
-/**
- * @}
- */
Index: modules/skinr.skinr.plugin.inc
===================================================================
RCS file: modules/skinr.skinr.plugin.inc
diff -N modules/skinr.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/skinr.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,100 @@
+<?php
+// $Id: skinr.skinr.inc,v 1.1.2.3 2010/05/01 20:11:11 jgirlygirl Exp $
+/**
+ * @file
+ * Provide skinr handling for page level rules.
+ */
+
+/**
+ * @defgroup skinr page rule handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function skinr_skinr_config() {
+  $data['page']['form']['skinr_rule_edit'] = array(
+    'index_handler' => 'page_skinr_form_index_handler',
+    'preprocess_hook' => 'page',
+    'title' => t('page rule settings'),
+    'skinr_weight' => 0,
+    'collapsed' => FALSE,
+  );
+  $data['page']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook' => 'page',
+    'title' => t('page rule settings'),
+    'collapsed' => FALSE,
+  );
+  $data['page']['preprocess']['page'] = array(
+    'index_handler' => 'page_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinr's data structure.
+ */
+function page_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      if (!empty($form['rule']['rid']['#value'])) {
+        return $form['rule']['rid']['#value'];
+      }
+      else {
+        return 0;
+      }
+
+    case 'submit':
+      if (!empty($form_state['values']['rid'])) {
+        return $form_state['values']['rid'];
+      }
+      else {
+        // This is a rule, so we need to fetch the rid from DB.
+        return(db_last_insert_id('skinr_rules', 'rid'));
+      }
+  }
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from module_preprocess().
+ * @return
+ *   The index where we can find our values in Skinr's data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function page_skinr_preprocess_index_handler(&$vars) {
+  $rules = skinr_rule_load();
+
+  // Find any page level skinr options and return an array of them.
+  $indices = array();
+  foreach ($rules as $rule) {
+    if (skinr_rule_visible($rule->rid)) {
+      $indices[] = $rule->rid;
+    }
+  }
+  return $indices;
+}
+
+/**
+ * @}
+ */
Index: modules/views.skinr.inc
===================================================================
RCS file: modules/views.skinr.inc
diff -N modules/views.skinr.inc
--- modules/views.skinr.inc	1 May 2010 20:11:11 -0000	1.5.2.1.2.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,351 +0,0 @@
-<?php
-// $Id: views.skinr.inc,v 1.5.2.1.2.6 2010/05/01 20:11:11 jgirlygirl Exp $
-
-/**
- * @file
- * Provide skinr handling for node.module
- */
-
-/**
- * @defgroup skinr_node_module node.module handlers
- *
- * @{
- */
-
-/**
- * Implementation of hook_skinr_config().
- */
-function views_skinr_config() {
-  $data['views']['form']['views_ui_edit_display_form'] = array(
-    'index_handler' => 'views_skinr_form_index_handler',
-    'access_handler' => 'views_skinr_access_handler_display',
-    'data_handler' => 'views_skinr_data_handler',
-    'submit_handler' => 'views_skinr_submit_handler_display',
-    'submit_handler_attach_to' => array('buttons', 'submit', '#submit'),
-    'preprocess_hook_callback' => 'views_skinr_preprocess_hook_callback',
-    'title' => t('views style settings'),
-    'skinr_weight' => 0,
-    'collapsed' => FALSE,
-  );
-  $data['views']['form']['views_ui_edit_view_form'] = array(
-    'access_handler' => 'views_skinr_access_handler_view',
-    'submit_handler' => 'views_skinr_submit_handler_view',
-  );
-  $data['views']['form']['skinr_ui_form'] = array(
-    'index_handler' => 'skinr_ajax_index_handler',
-    'preprocess_hook_callback' => 'views_skinr_preprocess_hook_callback',
-    'title' => t('views style settings'),
-    'collapsed' => FALSE,
-  );
-  $data['views']['preprocess']['views_view'] = array(
-    'index_handler' => 'views_skinr_preprocess_index_handler',
-  );
-
-  return $data;
-}
-
-/**
- * Skinr form index handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "form": the form elements for Skinr are being inserted in a form
- *   - "submit": the form has been submitted.
- * @param &$form
- *   - For "form", passes in the $form parameter from hook_form_alter().
- *   - For "submit", passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   - For "form", passes in the $form_state parameter from hook_form_alter().
- *   - For "submit", passes in the $form_state parameter from hook_form_submit().
- * @return
- *   The index where we can find our values in Skinrs data structure.
- */
-function views_skinr_form_index_handler($op, &$form, $form_state) {
-  switch ($op) {
-    case 'form':
-      $default = $form_state['view']->display_handler->is_defaulted('style_options');
-      if ($default) {
-        return 'view-'. $form_state['view']->name .'-display-default';
-      }
-      else {
-        return 'view-'. $form_state['view']->name .'-display-'. $form_state['view']->current_display;
-      }
-
-    case 'submit':
-      // Can't use display_handler->is_defaulted('style_options') on submit
-      $default = ($form_state['#section'] == 'default-style_options');
-      if ($default) {
-        return 'view-'. $form_state['view']->name .'-display-default';
-      }
-      else {
-        return 'view-'. $form_state['view']->name .'-display-'. $form_state['display_id'];
-      }
-  }
-}
-
-/**
- * Skinr access handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "access skinr": access to edit skinr's selector
- *   - "access skinr classes": access to edit skinr's additional classes
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   TRUE if we get access, FALSE if we don't.
- */
-function views_skinr_access_handler_display($op, &$form, $form_state) {
-  if ($access = skinr_access_handler($op, $form, $form_state)) {
-    // Views uses the same form_id for all forms, but it sets a $section
-    // variable to distinguish between them. So only show the skinr settings
-    // form on the style options form.
-    if ($form_state['section'] != 'style_options') {
-      $access = FALSE;
-    }
-  }
-
-  return $access;
-}
-
-function views_skinr_access_handler_view($op, &$form, $form_state) {
-  // We don't want the skinr settings form to appear on this form. We only want
-  // to intercept it so we can save our cached data.
-
-  // Since we're not using the form, we won't get our form submitter, so let's
-  // add it manually.
-
-  // Only add submit handler once
-  if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
-    $form['#submit'][] = 'skinr_ui_form_submit';
-  }
-  // Special for views
-  if (isset($form['buttons']['save']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['save']['#submit'])) {
-    $form['buttons']['save']['#submit'][] = 'skinr_ui_form_submit';
-  }
-  if (isset($form['buttons']['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['cancel']['#submit'])) {
-    // Need to make this happen before views' submit handler because it hijacks
-    // things and does a drupal_goto(). That effectively prevents any other
-    // submit handlers from being processed.
-    array_unshift($form['buttons']['cancel']['#submit'], 'skinr_ui_form_submit');
-  }
-
-  return FALSE;
-}
-
-/**
- * Skinr data handler.
- * This is the data that populates the skinr form.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_submit().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_submit().
- * @param $module
- *   The module that is currently being processed.
- * @param $form_settings
- *   The settings from hook_skinr_config() for the form that's currently being
- *   processed.
- * @return
- *   A skinr object.
- */
-function views_skinr_data_handler(&$form, $form_state, $theme, $module, $form_settings) {
-  // Ensure we have the required index_handler
-  if (empty($form_settings['index_handler'])) {
-    trigger_error(sprintf("No index_handler was found for form_id '%s' in module '%s'.", $form_id, $module), E_USER_ERROR);
-  }
-  $index = skinr_handler('form_index_handler', 'form', $form_settings['index_handler'], $form, $form_state);
-
-  // Fetch skinr data for this view from cache
-  views_include('cache');
-
-  if ($skinrs = views_object_cache_get('skinr', $form_state['view']->name)) {
-    if (isset($skinrs[$theme][$index])) {
-      $skinr = new stdClass();
-      $skinr->theme = $theme;
-      $skinr->module = $module;
-      $skinr->sid = $index;
-      $skinr->skins = $skinrs[$theme][$index];
-
-      return $skinr;
-    }
-    else {
-      return array();
-    }
-  }
-
-  // No data exists in cache, so let's grab it from the regular source
-  return skinr_get($theme, $module, $index);
-}
-
-/**
- * Skinr submit handler.
- *
- * @param $op
- *   What kind of action is being performed. Possible values:
- *   - "access skinr": access to edit skinr's selector
- *   - "access skinr classes": access to edit skinr's additional classes
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   TRUE if we get access, FALSE if we don't.
- */
-function views_skinr_submit_handler_display(&$form, $form_state, $module, $form_settings) {
-  foreach ($form_state['values']['skinr_settings'][$module .'_group'] as $theme_name => $theme) {
-    if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['_additional'])) {
-      $sid   = skinr_handler('form_index_handler', 'submit', $form_settings['index_handler'], $form, $form_state);
-      $value = array();
-
-      if (is_array($theme['widgets'])) {
-        foreach ($theme['widgets'] as $skin_id => $skin_value) {
-          $value[$skin_id] = $skin_value;
-        }
-      }
-
-      if (isset($theme['_additional'])) {
-        $theme['_additional'] = trim($theme['_additional']);
-        if (!empty($theme['_additional'])) {
-          $value['_additional'] = $theme['_additional'];
-        }
-      }
-
-      if (isset($theme['_template'])) {
-        $theme['_template'] = trim($theme['_template']);
-        if (!empty($theme['_template'])) {
-          $value['_template'] = $theme['_template'];
-        }
-      }
-
-      if (empty($sid)) {
-        // We didn't receive a valid sid, so raise an error
-        drupal_set_message(t("Skinr settings weren't saved due to an error."), 'error');
-      }
-
-      // Save skinr_settings for this view in cache
-      views_include('cache');
-      if (!$skinrs = views_object_cache_get('skinr', $form_state['view']->name, TRUE)) {
-        $skinrs = array();
-        // Fetch skinr data
-        $skinr = skinr_get($theme_name);
-        if (isset($skinr[$module])) {
-          foreach ($skinr[$module] as $skinr_key => $skinr_value) {
-            if (drupal_substr($skinr_key, 0, drupal_strlen('view-'. $form_state['view']->name)) == 'view-'. $form_state['view']->name) {
-              $skinrs[$theme_name][$skinr_key] = $skinr_value;
-            }
-          }
-        }
-      }
-      $skinrs[$theme_name][$sid] = $value;
-      views_object_cache_set('skinr', $form_state['view']->name, $skinrs);
-    }
-  }
-}
-
-function views_skinr_submit_handler_view(&$form, $form_state, $module, $form_settings) {
-  switch ($form_state['values']['op']) {
-    case t('Save'):
-      // Fetch skinr data for this view from cache
-      views_include('cache');
-
-      if ($skinrs = views_object_cache_get('skinr', $form_state['view']->name, TRUE)) {
-        foreach ($skinrs as $theme_name => $theme) {
-          foreach ($theme as $sid => $skins) {
-            $skinr = new stdClass();
-            $skinr->theme = $theme_name;
-            $skinr->module = $module;
-            $skinr->sid = $sid;
-            $skinr->skins = $skins;
-
-            skinr_set($skinr);
-          }
-        }
-        views_object_cache_clear('skinr', $form_state['view']->name);
-      }
-      break;
-    case t('Cancel'):
-      // Remove our data from views cache
-      views_include('cache');
-
-      views_object_cache_clear('skinr', $form_state['view']->name);
-      break;
-  }
-}
-
-/**
- * Skinr form preprocess_hook callback.
- *
- * @param &$form
- *   Passes in the $form parameter from hook_form_alter().
- * @param $form_state
- *   Passes in the $form_state parameter from hook_form_alter().
- * @return
- *   The preprocess_hook we wish to use.
- */
-function views_skinr_preprocess_hook_callback(&$form, $form_state) {
-  $preprocess_hooks = array('views_view');
-
-  if (!empty($form_state['view']) && !empty($form_state['view']->name)) {
-    $view = $form_state['view'];
-  }
-  elseif(isset($form['skinr']['sid']['#value'])) {
-    $sidinfo = _views_skinr_sidinfo($form['skinr']['sid']['#value']);
-    if ($view = views_get_view($sidinfo['view'])) {
-      $view->execute_display($sidinfo['display']);
-    }
-  }
-
-  if (!empty($view)) {
-    $display = $view->display[$view->current_display];
-
-    // Create list of suggested templates.
-    $preprocess_hooks = views_theme_functions('views_view', $view, $display);
-    // Fetch additional style based suggested templates.
-    $additional_hooks = views_theme_functions($view->style_plugin->definition['theme'], $view, $display);
-    
-    $preprocess_hooks = array_merge($additional_hooks, $preprocess_hooks);
-  }
-
-  return $preprocess_hooks;
-}
-
-function _views_skinr_sidinfo($sid) {
-  // view-[view_name]-display-[display_name]
-  $pos = strpos($sid, '-display-');
-  if ($pos !== FALSE) {
-    $sidinfo = array();
-    $sidinfo['view'] = substr($sid, strlen('view-'), $pos - strlen('view-'));
-    $sidinfo['display'] = substr($sid, $pos + strlen('-display-'));
-
-    return $sidinfo;
-  }
-
-  return FALSE;
-}
-
-/**
- * Skinr preprocess index handler.
- *
- * @param &$vars
- *   Passes in the $vars parameter from skinr_preprocess().
- * @return
- *   The index where we can find our values in Skinrs data structure. If an
- *   array is returned, it will loop through each index in Skinr's data
- *   structure and merge the returned classes.
- */
-function views_skinr_preprocess_index_handler(&$vars) {
-  $default = $vars['view']->display_handler->is_defaulted('style_options');
-  if ($default) {
-    return 'view-'. $vars['view']->name .'-display-default';
-  }
-  else {
-    return 'view-'. $vars['view']->name .'-display-'. $vars['view']->current_display;
-  }
-}
-
-/**
- * @}
- */
Index: modules/views.skinr.plugin.inc
===================================================================
RCS file: modules/views.skinr.plugin.inc
diff -N modules/views.skinr.plugin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/views.skinr.plugin.inc	15 Oct 2010 16:40:59 -0000
@@ -0,0 +1,351 @@
+<?php
+// $Id: views.skinr.inc,v 1.5.2.1.2.6 2010/05/01 20:11:11 jgirlygirl Exp $
+
+/**
+ * @file
+ * Provide skinr handling for node.module
+ */
+
+/**
+ * @defgroup skinr_node_module node.module handlers
+ *
+ * @{
+ */
+
+/**
+ * Implementation of hook_skinr_config().
+ */
+function views_skinr_config() {
+  $data['views']['form']['views_ui_edit_display_form'] = array(
+    'index_handler' => 'views_skinr_form_index_handler',
+    'access_handler' => 'views_skinr_access_handler_display',
+    'data_handler' => 'views_skinr_data_handler',
+    'submit_handler' => 'views_skinr_submit_handler_display',
+    'submit_handler_attach_to' => array('buttons', 'submit', '#submit'),
+    'preprocess_hook_callback' => 'views_skinr_preprocess_hook_callback',
+    'title' => t('views style settings'),
+    'skinr_weight' => 0,
+    'collapsed' => FALSE,
+  );
+  $data['views']['form']['views_ui_edit_view_form'] = array(
+    'access_handler' => 'views_skinr_access_handler_view',
+    'submit_handler' => 'views_skinr_submit_handler_view',
+  );
+  $data['views']['form']['skinr_ui_form'] = array(
+    'index_handler' => 'skinr_ajax_index_handler',
+    'preprocess_hook_callback' => 'views_skinr_preprocess_hook_callback',
+    'title' => t('views style settings'),
+    'collapsed' => FALSE,
+  );
+  $data['views']['preprocess']['views_view'] = array(
+    'index_handler' => 'views_skinr_preprocess_index_handler',
+  );
+
+  return $data;
+}
+
+/**
+ * Skinr form index handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "form": the form elements for Skinr are being inserted in a form
+ *   - "submit": the form has been submitted.
+ * @param &$form
+ *   - For "form", passes in the $form parameter from hook_form_alter().
+ *   - For "submit", passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   - For "form", passes in the $form_state parameter from hook_form_alter().
+ *   - For "submit", passes in the $form_state parameter from hook_form_submit().
+ * @return
+ *   The index where we can find our values in Skinrs data structure.
+ */
+function views_skinr_form_index_handler($op, &$form, $form_state) {
+  switch ($op) {
+    case 'form':
+      $default = $form_state['view']->display_handler->is_defaulted('style_options');
+      if ($default) {
+        return 'view-'. $form_state['view']->name .'-display-default';
+      }
+      else {
+        return 'view-'. $form_state['view']->name .'-display-'. $form_state['view']->current_display;
+      }
+
+    case 'submit':
+      // Can't use display_handler->is_defaulted('style_options') on submit
+      $default = ($form_state['#section'] == 'default-style_options');
+      if ($default) {
+        return 'view-'. $form_state['view']->name .'-display-default';
+      }
+      else {
+        return 'view-'. $form_state['view']->name .'-display-'. $form_state['display_id'];
+      }
+  }
+}
+
+/**
+ * Skinr access handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "access skinr": access to edit skinr's selector
+ *   - "access skinr classes": access to edit skinr's additional classes
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   TRUE if we get access, FALSE if we don't.
+ */
+function views_skinr_access_handler_display($op, &$form, $form_state) {
+  if ($access = skinr_access_handler($op, $form, $form_state)) {
+    // Views uses the same form_id for all forms, but it sets a $section
+    // variable to distinguish between them. So only show the skinr settings
+    // form on the style options form.
+    if ($form_state['section'] != 'style_options') {
+      $access = FALSE;
+    }
+  }
+
+  return $access;
+}
+
+function views_skinr_access_handler_view($op, &$form, $form_state) {
+  // We don't want the skinr settings form to appear on this form. We only want
+  // to intercept it so we can save our cached data.
+
+  // Since we're not using the form, we won't get our form submitter, so let's
+  // add it manually.
+
+  // Only add submit handler once
+  if (!in_array('skinr_ui_form_submit', $form['#submit'])) {
+    $form['#submit'][] = 'skinr_ui_form_submit';
+  }
+  // Special for views
+  if (isset($form['buttons']['save']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['save']['#submit'])) {
+    $form['buttons']['save']['#submit'][] = 'skinr_ui_form_submit';
+  }
+  if (isset($form['buttons']['cancel']['#submit']) && !in_array('skinr_ui_form_submit', $form['buttons']['cancel']['#submit'])) {
+    // Need to make this happen before views' submit handler because it hijacks
+    // things and does a drupal_goto(). That effectively prevents any other
+    // submit handlers from being processed.
+    array_unshift($form['buttons']['cancel']['#submit'], 'skinr_ui_form_submit');
+  }
+
+  return FALSE;
+}
+
+/**
+ * Skinr data handler.
+ * This is the data that populates the skinr form.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_submit().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_submit().
+ * @param $module
+ *   The module that is currently being processed.
+ * @param $form_settings
+ *   The settings from hook_skinr_config() for the form that's currently being
+ *   processed.
+ * @return
+ *   A skinr object.
+ */
+function views_skinr_data_handler(&$form, $form_state, $theme, $module, $form_settings) {
+  // Ensure we have the required index_handler
+  if (empty($form_settings['index_handler'])) {
+    trigger_error(sprintf("No index_handler was found for form_id '%s' in module '%s'.", $form_id, $module), E_USER_ERROR);
+  }
+  $index = skinr_handler('form_index_handler', 'form', $form_settings['index_handler'], $form, $form_state);
+
+  // Fetch skinr data for this view from cache
+  views_include('cache');
+
+  if ($skinrs = views_object_cache_get('skinr', $form_state['view']->name)) {
+    if (isset($skinrs[$theme][$index])) {
+      $skinr = new stdClass();
+      $skinr->theme = $theme;
+      $skinr->module = $module;
+      $skinr->sid = $index;
+      $skinr->skins = $skinrs[$theme][$index];
+
+      return $skinr;
+    }
+    else {
+      return array();
+    }
+  }
+
+  // No data exists in cache, so let's grab it from the regular source
+  return skinr_get($theme, $module, $index);
+}
+
+/**
+ * Skinr submit handler.
+ *
+ * @param $op
+ *   What kind of action is being performed. Possible values:
+ *   - "access skinr": access to edit skinr's selector
+ *   - "access skinr classes": access to edit skinr's additional classes
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   TRUE if we get access, FALSE if we don't.
+ */
+function views_skinr_submit_handler_display(&$form, $form_state, $module, $form_settings) {
+  foreach ($form_state['values']['skinr_settings'][$module .'_group'] as $theme_name => $theme) {
+    if ((isset($theme['widgets']) && count($theme['widgets'])) || isset($theme['_additional'])) {
+      $sid   = skinr_handler('form_index_handler', 'submit', $form_settings['index_handler'], $form, $form_state);
+      $value = array();
+
+      if (is_array($theme['widgets'])) {
+        foreach ($theme['widgets'] as $skin_id => $skin_value) {
+          $value[$skin_id] = $skin_value;
+        }
+      }
+
+      if (isset($theme['_additional'])) {
+        $theme['_additional'] = trim($theme['_additional']);
+        if (!empty($theme['_additional'])) {
+          $value['_additional'] = $theme['_additional'];
+        }
+      }
+
+      if (isset($theme['_template'])) {
+        $theme['_template'] = trim($theme['_template']);
+        if (!empty($theme['_template'])) {
+          $value['_template'] = $theme['_template'];
+        }
+      }
+
+      if (empty($sid)) {
+        // We didn't receive a valid sid, so raise an error
+        drupal_set_message(t("Skinr settings weren't saved due to an error."), 'error');
+      }
+
+      // Save skinr_settings for this view in cache
+      views_include('cache');
+      if (!$skinrs = views_object_cache_get('skinr', $form_state['view']->name, TRUE)) {
+        $skinrs = array();
+        // Fetch skinr data
+        $skinr = skinr_get($theme_name);
+        if (isset($skinr[$module])) {
+          foreach ($skinr[$module] as $skinr_key => $skinr_value) {
+            if (drupal_substr($skinr_key, 0, drupal_strlen('view-'. $form_state['view']->name)) == 'view-'. $form_state['view']->name) {
+              $skinrs[$theme_name][$skinr_key] = $skinr_value;
+            }
+          }
+        }
+      }
+      $skinrs[$theme_name][$sid] = $value;
+      views_object_cache_set('skinr', $form_state['view']->name, $skinrs);
+    }
+  }
+}
+
+function views_skinr_submit_handler_view(&$form, $form_state, $module, $form_settings) {
+  switch ($form_state['values']['op']) {
+    case t('Save'):
+      // Fetch skinr data for this view from cache
+      views_include('cache');
+
+      if ($skinrs = views_object_cache_get('skinr', $form_state['view']->name, TRUE)) {
+        foreach ($skinrs as $theme_name => $theme) {
+          foreach ($theme as $sid => $skins) {
+            $skinr = new stdClass();
+            $skinr->theme = $theme_name;
+            $skinr->module = $module;
+            $skinr->sid = $sid;
+            $skinr->skins = $skins;
+
+            skinr_set($skinr);
+          }
+        }
+        views_object_cache_clear('skinr', $form_state['view']->name);
+      }
+      break;
+    case t('Cancel'):
+      // Remove our data from views cache
+      views_include('cache');
+
+      views_object_cache_clear('skinr', $form_state['view']->name);
+      break;
+  }
+}
+
+/**
+ * Skinr form preprocess_hook callback.
+ *
+ * @param &$form
+ *   Passes in the $form parameter from hook_form_alter().
+ * @param $form_state
+ *   Passes in the $form_state parameter from hook_form_alter().
+ * @return
+ *   The preprocess_hook we wish to use.
+ */
+function views_skinr_preprocess_hook_callback(&$form, $form_state) {
+  $preprocess_hooks = array('views_view');
+
+  if (!empty($form_state['view']) && !empty($form_state['view']->name)) {
+    $view = $form_state['view'];
+  }
+  elseif(isset($form['skinr']['sid']['#value'])) {
+    $sidinfo = _views_skinr_sidinfo($form['skinr']['sid']['#value']);
+    if ($view = views_get_view($sidinfo['view'])) {
+      $view->execute_display($sidinfo['display']);
+    }
+  }
+
+  if (!empty($view)) {
+    $display = $view->display[$view->current_display];
+
+    // Create list of suggested templates.
+    $preprocess_hooks = views_theme_functions('views_view', $view, $display);
+    // Fetch additional style based suggested templates.
+    $additional_hooks = views_theme_functions($view->style_plugin->definition['theme'], $view, $display);
+    
+    $preprocess_hooks = array_merge($additional_hooks, $preprocess_hooks);
+  }
+
+  return $preprocess_hooks;
+}
+
+function _views_skinr_sidinfo($sid) {
+  // view-[view_name]-display-[display_name]
+  $pos = strpos($sid, '-display-');
+  if ($pos !== FALSE) {
+    $sidinfo = array();
+    $sidinfo['view'] = substr($sid, strlen('view-'), $pos - strlen('view-'));
+    $sidinfo['display'] = substr($sid, $pos + strlen('-display-'));
+
+    return $sidinfo;
+  }
+
+  return FALSE;
+}
+
+/**
+ * Skinr preprocess index handler.
+ *
+ * @param &$vars
+ *   Passes in the $vars parameter from skinr_preprocess().
+ * @return
+ *   The index where we can find our values in Skinrs data structure. If an
+ *   array is returned, it will loop through each index in Skinr's data
+ *   structure and merge the returned classes.
+ */
+function views_skinr_preprocess_index_handler(&$vars) {
+  $default = $vars['view']->display_handler->is_defaulted('style_options');
+  if ($default) {
+    return 'view-'. $vars['view']->name .'-display-default';
+  }
+  else {
+    return 'view-'. $vars['view']->name .'-display-'. $vars['view']->current_display;
+  }
+}
+
+/**
+ * @}
+ */
