? .svn
? 506658_customizable_text_tokens.patch
? 506658_customizable_titles_tokens_5.patch
? tests/.svn
? translations/.svn
Index: talk.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/Attic/talk.install,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 talk.install
--- talk.install	11 Jul 2009 19:15:48 -0000	1.1.2.3
+++ talk.install	14 Jul 2009 17:18:04 -0000
@@ -13,4 +13,17 @@ function talk_uninstall() {
   variable_del('talk_title');
   $result = db_query("DELETE FROM {variable} WHERE name LIKE 'comment_talk_%%'");
   cache_clear_all('variables', 'cache');
+}
+
+/**
+ * Provide 3 different settings instead of the one.  Default to the one.
+ */
+function talk_update_1() {
+  $default = variable_get('talk_title', t('Talk'));
+  variable_set('talk_tab', $default);
+  variable_set('talk_page', $default);
+  variable_set('talk_link', $default);
+  variable_del('talk_title');
+
+  return array(array('success' => TRUE, 'query' => 'Your Talk module settings have been updated automatically to support customizable strings. You may want to configure them further at Administer > Site configuration > Talk page.'));
 }
\ No newline at end of file
Index: talk.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/talk.module,v
retrieving revision 1.6.2.9
diff -u -p -r1.6.2.9 talk.module
--- talk.module	14 Jul 2009 17:09:01 -0000	1.6.2.9
+++ talk.module	14 Jul 2009 17:18:04 -0000
@@ -24,6 +24,7 @@ function talk_menu() {
   $items = array();
   $items['node/%node/talk'] = array(
     'title callback' => 'talk_title',
+    'title arguments' => array(1),
     'page callback' => 'talk_handle',
     'page arguments' => array(1),
     'access callback' => '_talk_access',
@@ -53,23 +54,51 @@ function _talk_access($node) {
  */
 function talk_admin_form() {
   $form = array();
-  $form['talk_title'] = array(
+  $form['talk_page'] = array(
     '#type' => 'textfield',
     '#title' => t('Title of the "talk" page'),
-    '#default_value' => talk_title(),
+    '#default_value' => talk_title(NULL, 'page'),
+    '#description' => t('If token is enabled you can use tokens like [title] or [nid]')
   );
+  $form['talk_link'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Link from the node "links" to the "talk" page'),
+    '#default_value' => talk_title(NULL, 'link'),
+    '#description' => t('If token is enabled you can use tokens like [title] or [nid]. Leave blank to disable.')
+  );
+  $form['talk_tab'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Link from the node "tab" to the "talk" page'),
+    '#default_value' => talk_title(NULL, 'tab'),
+    '#description' => t('If token is enabled you can use tokens like [title] or [nid].')
+  );
+
   return system_settings_form($form);
 }
 
-function talk_title() {
-  return variable_get('talk_title', t('Talk'));
+/**
+ * Provide an appropriate title for the context.
+ *
+ * @param object $node
+ *   Optional node object.
+ * @param string $type
+ *   Optional string for context: tab, page, link.
+ * @return string
+ */
+function talk_title($node = NULL, $type = 'tab') {
+  $title = variable_get('talk_'. $type, t('Talk'));
+  if (module_exists('token') && isset($node->nid)) {
+    global $user;
+    $title = token_replace_multiple($title, array('global' => NULL, 'user' => $user, 'node' => $node));
+  }
+  return check_plain($title);
 }
 
 /**
  * Menu callback for talk page.
  */
 function talk_handle($node) {
-  drupal_set_title(t('@title page for @node', array('@title' => talk_title(), '@node' => $node->title)));
+  drupal_set_title(talk_title($node, 'page'));
   $add_comments = _talk_node_comment_value($node) == COMMENT_NODE_READ_WRITE && user_access('post comments');
   return theme('talkpage', $node, $add_comments);
 }
@@ -98,10 +127,13 @@ function talk_link($type, $node = NULL, 
   if ($type == 'node' && talk_activated($node->type) && user_access('access comments') && _talk_node_comment_value($node)) {
     $result = array();
     if ($node->comment_count) {
-      $result['comment_comments'] = array(
-        'title' => t('@title page (@nr comments)', array('@nr' => $node->comment_count, '@title' => talk_title())),
-        'href' => 'node/'. $node->nid .'/talk',
-      );
+      $title = talk_title($node, 'link');
+      if (!empty($title)) {
+        $result['comment_comments'] = array(
+          'title' => $title,
+          'href' => 'node/'. $node->nid .'/talk',
+        );
+      }
     }
     if (_talk_node_comment_value($node) == COMMENT_NODE_READ_WRITE) {
       if (user_access('post comments')) {
@@ -183,10 +215,10 @@ function talk_theme() {
  *   Boolean which indicates if adding comments is allowed for current user.
  * @ingroup themeable
  */
-function template_preprocess_talkpage(&$variables) {
+function talk_preprocess_talkpage(&$variables) {
   $add_comments = $variables['add_comments'];
   $node = $variables['node'];
-  $variables['title'] = talk_title();
+  $variables['title'] = talk_title($node, 'page');
   $comment_link = '';
   if ($add_comments) {
     if (variable_get('comment_form_location_'. $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
