--- C:/Documents and Settings/Administrator/Desktop/archive/archive.module	Sun Jan 21 08:37:19 2007
+++ C:/Apache2/myblog/modules/archive/archive.module	Wed May 02 02:53:07 2007
@@ -7,7 +7,7 @@
 function archive_help($section) {
   switch ($section) {
     case 'admin/help#archive':
-      $output = '<p>'. t('The archive module provides a suggested menu item, which shows a page allowing content to be filtered by date. The date selectors allow visitors to view content published in any given year, month or day.') .'</p>';
+      $output = '<p>'. t('The archive module provides a suggested menu item, which shows a page allowing content to be filtered by date and node type. The date selectors allow visitors to view content published in any given year, month or day. The node type selecteors allow visitors to view content of all node types or only specific ones.') .'</p>';
       $output .= t('<p>You can</p>
 <ul>
 <li>view your <a href="%archive">archive page</a>.</li>
@@ -25,11 +25,17 @@
 function archive_menu($may_cache) {
   $items = array();
   if ($may_cache) {
-    $items[] = array('path' => 'archive',
-      'title' => t('Archives'),
-      'access' => user_access('access content'),
-      'callback' => 'archive_page',
-      'type' => MENU_SUGGESTED_ITEM);
+    $items[] = array('path'     => 'archive',
+                     'title'    => t('Archives'),
+                     'access'   => user_access('access content'),
+                     'callback' => 'archive_page',
+                     'type'     => MENU_SUGGESTED_ITEM);
+    $items[] = array(
+                     'path'               => 'admin/settings/archive',
+                     'title'              => t('Archives'),
+                     'callback'           => 'drupal_get_form',
+                     'callback arguments' => array('archive_admin_settings'),
+                     'type'               => MENU_NORMAL_ITEM);
   }
   else {
     drupal_add_css(drupal_get_path('module', 'archive') .'/archive.css');
@@ -37,7 +43,38 @@
   return $items;
 }
 
-function archive_page($year = NULL, $month = NULL, $day = NULL) {
+/**
+ * Fetch nodes of $type for the selected date, or current date if none selected.
+ *
+ * @param $type
+ *   Node type name
+ * @param $year
+ *   Number of year
+ * @param $month
+ *   Number of month
+ * @param $day
+ *   Number of day
+ * @return
+ *   A string with the themed page
+ */
+function archive_page($type = 'all', $year = NULL, $month = NULL, $day = NULL) {
   include_once 'archive.inc';
-  return _archive_page($year, $month, $day);
+  return _archive_page($type, $year, $month, $day);
+}
+
+function archive_admin_settings(){
+  
+  $types = node_get_types();
+  $final_types = array();
+  foreach ($types as $key => $value) {
+    $final_types[$key] = $value->name;
+  }
+    
+  $form['archive_type_filters'] = array('#type'          => 'checkboxes',
+                                        '#title'         => t('What nodes are available as filters'),
+                                        '#default_value' => variable_get('archive_type_filters', array_keys($final_types)),
+                                        '#options'       => $final_types,
+                                        '#description'   => t('Whichever node type you choose here will be available as a filter to the user.'));
+          
+  return system_settings_form($form);
 }
