? drupal6_to_drupal7.patch
Index: switchtheme.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/switchtheme/switchtheme.info,v
retrieving revision 1.5
diff -u -p -r1.5 switchtheme.info
--- switchtheme.info	18 Sep 2008 23:20:59 -0000	1.5
+++ switchtheme.info	2 Aug 2010 15:46:57 -0000
@@ -1,4 +1,8 @@
 ; $Id: switchtheme.info,v 1.5 2008/09/18 23:20:59 sun Exp $
 name = Switchtheme
 description = Allows switching the theme in various means.
-core = 6.x
+core = 7.x
+
+files[] = switchtheme.module
+files[] = switchtheme.admin.inc
+files[] = switchtheme.css
Index: switchtheme.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/switchtheme/switchtheme.module,v
retrieving revision 1.17
diff -u -p -r1.17 switchtheme.module
--- switchtheme.module	10 Aug 2009 23:47:00 -0000	1.17
+++ switchtheme.module	2 Aug 2010 15:46:57 -0000
@@ -26,8 +26,17 @@ function switchtheme_help($path, $arg) {
 /**
  * Implementation of hook_perm().
  */
-function switchtheme_perm() {
-  return array('administer switch', 'switch theme');
+function switchtheme_permission() {
+  return array(
+    'administer switch' =>  array(
+      'title' => t('Administer SwitchTheme'),
+      'description' => t('Allow user/role to access switchtheme administrative options.'),
+    ),
+    'switch theme' =>  array(
+      'title' => t('Use SwitchTheme'),
+      'description' => t('Allow user/role to access switchtheme to change theme.'),
+    ),
+  );
 }
 
 /**
@@ -67,7 +76,7 @@ function switchtheme_menu() {
  */
 function switchtheme_init() {
   global $custom_theme, $user;
-  drupal_add_css(drupal_get_path('module', 'switchtheme') .'/switchtheme.css');
+  drupal_add_css(drupal_get_path('module', 'switchtheme') . '/switchtheme.css');
 
   // If query parameter 'theme' is set, we always assign a new theme.
   if (isset($_REQUEST['theme'])) {
@@ -107,26 +116,35 @@ function switchtheme_theme() {
 }
 
 /**
- * Implementation of hook_block().
+ * Implementation of hook_block_info()
  */
-function switchtheme_block($op = 'list', $delta = 0, $edit = array()) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Switch theme form');
-    $blocks[1]['info'] = t('Random theme');
-    return $blocks;
-  }
-  elseif ($delta == 0 && $op == 'view' && user_access('switch theme')) {
-    $block['subject'] = t('Theme');
-    $block['content'] = drupal_get_form('switchtheme_switch_form');
-    return $block;
-  }
-  elseif ($delta == 1 && $op == 'view' && user_access('switch theme')) {
-    $block['subject'] = t('Random theme');
-    $block['content'] = switchtheme_display_random_block();
-    return $block;
+function switchtheme_block_info() {
+  $blocks['switch_form']['info'] = t('Switch theme form');
+  $blocks['switch_random']['info'] = t('Random theme');
+  return $blocks;
+}
+
+/**
+ * Implementation of hook_block_view()
+ */
+function switchtheme_block_view($delta = '') {
+  if (user_access('switch theme')) {
+  	switch ($delta) {
+  		case 'switch_form':
+      $block['subject'] = t('Switch Theme');
+      $block['content'] = drupal_get_form('switchtheme_switch_form');
+      return $block;
+      case 'switch_random':
+      $block['subject'] = t('Random Theme');
+      $block['content'] = switchtheme_display_random_block();
+      return $block;
+  	break;
+  	}
   }
 }
 
+
+
 /**
  * Render a random theme with screenshot to switch to.
  */
@@ -137,7 +155,7 @@ function switchtheme_display_random_bloc
     $theme->screenshot = dirname($theme->filename) .'/screenshot.png';
     if ($theme->status && file_exists($theme->screenshot)) {
       // Return the first theme with a screenshot.
-      $output = l("<img src=\"". base_path() ."$theme->screenshot\" alt=\"preview of $theme->name\"/>", $_GET['q'], array('query' => 'theme='. $theme->name, 'html' => TRUE));
+      $output = l("<img src=\"" . base_path() . "$theme->screenshot\" alt=\"preview of $theme->name\"/>", $_GET['q'], array('query' => 'theme='. $theme->name, 'html' => TRUE));
       return $output;
     }
   }
