--- page_title.module	2006-09-28 17:23:38.000000000 +0800
+++ /opt/www/drupal-4.7.int.thatsbj.com/modules/page_title/page_title.module	2007-03-22 16:54:30.000000000 +0800
@@ -55,11 +55,27 @@
     '#maxlength' => 128,
     '#description' => t('Available placeholders: <code>%site_name</code>, <code>%site_slogan</code>.'),
   );
+
+  $select = array();
+  $nodetypes = node_get_types();
+  foreach($nodetypes as $type => $name) {
+    $select[$type] = $name;
+  }
+  $form['page_title']['page_title_content_types'] = array(
+    '#type' => 'select',
+    '#title' => t('Included content types'),
+    '#default_value' => variable_get('page_title_content_types', array()),
+    '#options' => $select,
+    '#description' => t('Select content types to enable page title editing.'),
+    '#multiple' => TRUE,
+  );
+
   return $form;
 }
 
 function page_title_form_alter($form_id, &$form) {
-  if ($form['#id'] == 'node-form' && user_access('set page title')) {
+  $allowed_node_types = array_keys(variable_get('page_title_content_types',array()));
+  if ($form['#id'] == 'node-form' && user_access('set page title') && in_array($form['type']['#value'],$allowed_node_types)) {
     $form['page_title'] = array(
       '#type' => 'textfield',
       '#title' => t('Page title'),
@@ -126,6 +142,21 @@
 }
 
 /**
+ * Sets the page title for a node id
+ *
+ * @param the node's id
+ * @param the page title to set.
+ */
+function page_title_node_set_title($nid, $page_title) {
+  if (page_title_node_get_title($nid)) {
+    db_query("UPDATE {page_title} SET page_title = '%s' WHERE nid = %d", $page_title, $nid);
+  }
+  else {
+    db_query("INSERT INTO {page_title} (nid, page_title) VALUES (%d, '%s')", $nid, $page_title);
+  }
+}
+
+/**
  * Does the logic to see what title should be send to the page template. Call this function from
  * the page hook of function _phptemplate_variables in template.php.
  */
