--- views_theme_wizard.module	Tue Oct 31 20:23:24 2006
+++ views_theme_wizard.module.new	Wed Nov 22 17:00:47 2006
@@ -55,6 +55,12 @@ function views_theme_wizard_form($views)
     '#type' => 'markup',
     '#value' => '',
   );
+  
+  $form['code3'] = array(
+    '#type' => 'markup',
+    '#value' => '',
+  );
+
 
   $form['submit'] = array(
     '#type' => 'button',
@@ -90,6 +96,11 @@ function views_theme_wizard_generate($fo
     $form['code2']['#value'] = views_theme_wizard_generate_list_template_code($view);
     $form['code2']['#title'] = t('This code goes in a file named views-list-%s.tpl.php', array('%s' => $view->name));
     $form['code2']['#rows'] = 20;
+    
+    $form['code3']['#type'] = 'textarea';
+    $form['code3']['#value'] = views_theme_wizard_generate_list_stylesheet_code($view);
+    $form['code3']['#title'] = t('This code goes in a file named views-list-%s.css', array('%s' => $view->name));
+    $form['code3']['#rows'] = 20;
   }
 
   if ($op == t('List Theme Fields')) {
@@ -102,6 +113,7 @@ function views_theme_wizard_generate($fo
     $form['code2']['#value'] = views_theme_wizard_example_field($view);
     $form['code2']['#title'] = t('This is a basic theme function', array('%s' => $view->name));
     $form['code2']['#rows'] = 20;
+    
   }
   return $form;
 }
@@ -202,7 +214,9 @@ EOT;
  * generate a template file for a list theme
  */
 function views_theme_wizard_generate_list_template_code($view) {
-  $header = <<<EOT
+  
+	
+	$header = <<<EOT
 <?php 
 /**
  * views template to output one 'row' of a view.
@@ -220,7 +234,6 @@ function views_theme_wizard_generate_lis
  * \$count -- the current row in the view (not TOTAL but for this page) starting
  *   from 0.
  * \$stripe -- 'odd' or 'even', alternating.
-
 EOT;
 
   $fields = _views_get_fields();
@@ -251,7 +264,12 @@ EOT;
  *
  * This function goes in your views-list-{$view->name}.tpl.php file
  */
-?>
+ 
+ 
+ //now we add the stylesheet...
+  drupal_add_css(path_to_theme() .'/views-list-{$view->name}.css');
+  
+  ?>
 
 EOT;
 
@@ -259,3 +277,55 @@ EOT;
   return $header .$output;
 }
 
+/**
+ * generate a stylesheet file for a list theme
+ */
+function views_theme_wizard_generate_list_stylesheet_code($view) {
+  $header = <<<EOT
+/* *
+ * views template to output the stylesheet to customize a view.
+ * This code was generated by the views theming wizard
+ * Date: $now
+ * View: $view->name
+ *
+ * The class selectors are filled with a single comment line.
+ * You should complete each selector according to your liking.
+*/
+\n
+EOT;
+
+  $fields = _views_get_fields();
+  $taken = array();
+  
+   $output .= <<<EOT
+.view-label {
+/* insert your css code for this element here */
+}
+
+.view-field {
+/* insert your css code for this element here */
+}
+
+EOT;
+
+  // Set up the selectors in nicely named chunks.
+  foreach ($view->field as $id => $field) {
+    $field_name = $field['field'];
+    if (isset($taken[$field_name])) {
+      $field_name = $field['queryname'];
+    }
+    $taken[$field_name] = true;
+    $output .= <<<EOT
+.view-field-{$field_name} {
+/* insert your css code for this element here */
+}
+.view-data-{$field_name} {
+/* insert your css code for this element here */
+}
+
+EOT;
+ }
+
+
+  return $header .$output;
+}
