Index: auto_nodetitle.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/auto_nodetitle/auto_nodetitle.module,v
retrieving revision 1.4.2.14
diff -u -r1.4.2.14 auto_nodetitle.module
--- auto_nodetitle.module	7 Apr 2007 15:25:20 -0000	1.4.2.14
+++ auto_nodetitle.module	3 Oct 2007 20:03:59 -0000
@@ -22,13 +22,18 @@
     auto_nodetitle_node_settings_form($form);
   }
   else if (isset($form['#node']) && isset($form['#post']) && $form['#node']->type .'_node_form' == $form_id) {
+    $nodetitlestatus = variable_get('ant_'. $form['#node']->type, 0);
     //this is a node form    
-    if (variable_get('ant_'. $form['#node']->type, 0)) {
+    if ($nodetitlestatus == 1) {
       // we will autogenerate the title later, just hide the title field in the meanwhile
       $form['title']['#value'] = 'ant';
       $form['title']['#type'] = 'value';
       $form['title']['#required'] = FALSE;
     }
+    else if ($nodetitlestatus == 2) {
+      // we will make the title optional
+      $form['title']['#required'] = FALSE;
+    }
   }
 }
 
@@ -36,17 +41,20 @@
  * Implementation of hook_nodeapi().
  */
 function auto_nodetitle_nodeapi(&$node, $op, $form = NULL, $a4 = NULL) {
-  if ($op == 'validate' && variable_get('ant_'. $node->type, 0)) {
-    /*
-     * Sets the node title.
-     * We need to do this on validation because of two points: 
-     *     It's early engouh to have node previews working and 
-     *     it's late enough as CCK has already gone through the 'process form values' step 
-     * 
-     * As changes to $node are not persistent during validation, we use form_set_value()!
-     */
-    auto_nodetitle_set_title($node);
-    form_set_value($form['title'], $node->title);
+  if ($op == 'validate') {
+    $nodetitlestatus = variable_get('ant_'. $node->type, 0);
+    if (($nodetitlestatus == 1) || ($nodetitlestatus == 2 && empty($node->title))) {
+      /*
+       * Sets the node title.
+       * We need to do this on validation because of two points: 
+       *     It's early engouh to have node previews working and 
+       *     it's late enough as CCK has already gone through the 'process form values' step 
+       * 
+       * As changes to $node are not persistent during validation, we use form_set_value()!
+       */
+      auto_nodetitle_set_title($node);
+      form_set_value($form['title'], $node->title);
+    }
   }
 }
 
@@ -108,9 +116,13 @@
     '#collapsed' => TRUE,
   );
   $form['auto_nodetitle']['ant'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Automatically generate the node title and hide the node title field.'),
+    '#type' => 'radios',
     '#default_value' => variable_get('ant_'. $form['#node_type']->type, 0),
+    '#options' => array(
+      t('Disabled'),
+      t('Automatically generate the node title and hide the node title field'),
+      t('Automatically generate the node title if the title field is left empty'),
+    )
   );
 
   if (module_exists('token') || user_access('use PHP for title patterns')) {
