? skinr-skinsets-empty.patch
Index: skinr_ui.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/skinr/skinr_ui.admin.inc,v
retrieving revision 1.14
diff -u -p -r1.14 skinr_ui.admin.inc
--- skinr_ui.admin.inc	14 Oct 2010 23:09:30 -0000	1.14
+++ skinr_ui.admin.inc	22 Oct 2010 15:32:57 -0000
@@ -468,58 +468,63 @@ function skinr_ui_admin_skinsets($form, 
 
   $skinsets = skinr_rebuild_skinset_data();
 
-  uasort($skinsets, 'skinr_ui_sort_by_info_name');
+  if(empty($skinsets)) {
+    $form['skinsets'] = array(
+      '#markup' => t('You do not currently have any skin sets to manage.'),
+    );
+    return $form;
+  } else {
+    uasort($skinsets, 'skinr_ui_sort_by_info_name');
 
+    $form['skinsets'] = array('#tree' => TRUE);
 
-  $form['skinsets'] = array('#tree' => TRUE);
-  
-  // Iterate through each of the skinsets.
-  foreach ($skinsets as $name => $skinset) {
-    $extra = array();
-    $extra['enabled'] = (bool) $skinset->status;
-
-    // Generate link for skinset's configuration page
-    $configure_link = menu_get_item('admin/appearance/skinr/skins/settings/'. $name);
-    if ($configure_link['access']) {
-      $extra['links']['configure'] = array(
-        '#type' => 'link',
-        '#title' => t('Configure'),
-        '#href' => $configure_link['href'],
-        '#options' => array('attributes' => array('class' => array('skinset-link', 'skinset-link-configure'), 'title' => $configure_link['description'])),
-      );
+    // Iterate through each of the skinsets.
+    foreach ($skinsets as $name => $skinset) {
+      $extra = array();
+      $extra['enabled'] = (bool) $skinset->status;
+
+      // Generate link for skinset's configuration page
+      $configure_link = menu_get_item('admin/appearance/skinr/skins/settings/'. $name);
+      if ($configure_link['access']) {
+        $extra['links']['configure'] = array(
+          '#type' => 'link',
+          '#title' => t('Configure'),
+          '#href' => $configure_link['href'],
+          '#options' => array('attributes' => array('class' => array('skinset-link', 'skinset-link-configure'), 'title' => $configure_link['description'])),
+        );
+      }
+
+      // Create a row entry for this skinset.
+      $form['skinsets'][$skinset->info['package']][$skinset->name] = _skinr_ui_admin_skinsets_build_row($skinset->info, $extra);
     }
 
-    // Create a row entry for this skinset.
-    $form['skinsets'][$skinset->info['package']][$skinset->name] = _skinr_ui_admin_skinsets_build_row($skinset->info, $extra);
-  }
+    // Add basic information to the fieldsets.
+    foreach (element_children($form['skinsets']) as $package) {
+      $form['skinsets'][$package] += array(
+        '#type' => 'fieldset',
+        '#title' => t($package),
+        '#collapsible' => TRUE,
+        '#theme' => 'skinr_ui_admin_skinsets_fieldset',
+        '#header' => array(
+          t('Screenshot'),
+          t('Name'),
+          t('Version'),
+          array('data' => t('Enabled'), 'class' => array('checkbox')),
+          array('data' => t('Operations'), 'colspan' => 3),
+        ),
+      );
+    }
 
-  // Add basic information to the fieldsets.
-  foreach (element_children($form['skinsets']) as $package) {
-    $form['skinsets'][$package] += array(
-      '#type' => 'fieldset',
-      '#title' => t($package),
-      '#collapsible' => TRUE,
-      '#theme' => 'skinr_ui_admin_skinsets_fieldset',
-      '#header' => array(
-        t('Screenshot'),
-        t('Name'),
-        t('Version'),
-        array('data' => t('Enabled'), 'class' => array('checkbox')),
-        array('data' => t('Operations'), 'colspan' => 3),
-      ),
+    $form['actions'] = array('#type' => 'actions');
+    $form['actions']['submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Save configuration'),
     );
-  }
+    $form['#action'] = url('admin/appearance/skinr/skins');
 
-  $form['actions'] = array('#type' => 'actions');
-  $form['actions']['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Save configuration'),
-  );
-  $form['#action'] = url('admin/appearance/skinr/skins');
-
-  return $form;
+    return $form;
+  }
 }
-
 /**
  * Build a table row for the skinsets page.
  */
