diff -urp /home/drupal/custom_pagers/custom_pagers.admin.inc /patch/custom_pagers/custom_pagers.admin.inc --- /home/drupal/custom_pagers/custom_pagers.admin.inc 2010-01-17 23:57:39.000000000 +0100 +++ /patch/custom_pagers/custom_pagers.admin.inc 2010-11-15 10:12:17.000000000 +0100 @@ -30,7 +30,6 @@ function custom_pagers_page() { return theme('table', $header, $rows); } - // Displays an edit form for a custom pager record. function custom_pagers_form(&$form_state, $pid = NULL) { if (isset($pid) && $pager = _custom_pagers_load_pager($pid)) { @@ -47,7 +46,6 @@ function custom_pagers_form(&$form_state '#default_value' => $pid ? $pager->title : '', ); - $form['position'] = array( '#type' => 'select', '#title' => t('Pager position'), @@ -187,6 +185,25 @@ function custom_pagers_form(&$form_state '#default_value' => $pid ? $pager->reverse_list : NULL ); + $form['node_titles']['custom_pagers_display_titles'] = array( + '#type' => 'checkbox', + '#title' => t('Use the node titles for the prev/next pager'), + '#return_value' => 1, + '#description' => t("You can use this switch to change the way the prev/next pager is constructed. Normally it displays the prev/next text, but you might want to use the previous and next node's titles for the link title."), + '#default_value' => $pid ? $pager->custom_pagers_display_titles : NULL + ); + + $form['node_titles']['custom_pagers_limit_characters'] = array( + '#type' => 'textfield', + '#title' => t('Limit the node titles length if the Use the node titles for the prev/next pager is enabled.'), + '#size' => 3, + '#maxlength' => 3, + '#min_value' => 1, + '#max_value' => $max_length, + '#description' => t("You can use this box to limit the length of the titles when the use the node titles option is enabled. When enabled, titles are limited and the usual ... is added."), + '#default_value' => $pid ? $pager->custom_pagers_limit_characters : 30 + ); + $form['buttons']['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), diff -urp /home/drupal/custom_pagers/custom_pagers.install /patch/custom_pagers/custom_pagers.install --- /home/drupal/custom_pagers/custom_pagers.install 2010-01-17 23:14:21.000000000 +0100 +++ /patch/custom_pagers/custom_pagers.install 2010-11-15 09:46:32.000000000 +0100 @@ -77,6 +77,20 @@ function custom_pagers_schema() { 'size' => 'tiny', 'description' => 'A boolean flag indicating that this {custom_pager} should be displayed in reverse order.', ), + 'custom_pagers_display_titles' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'A boolean flag used to troggle prev/next text or use the node titles in the url.', + ), + 'custom_pagers_limit_characters' => array( + 'type' => 'varchar', + 'length' => 10, + 'not null' => TRUE, + 'default' => 30, + 'description' => 'A value used to limit the display length of the prev/next node titles when the Display Node Titles setting is enabled.', + ), ), 'primary key' => array('pid'), ); diff -urp /home/drupal/custom_pagers/custom_pagers.module /patch/custom_pagers/custom_pagers.module --- /home/drupal/custom_pagers/custom_pagers.module 2010-01-17 23:08:10.000000000 +0100 +++ /patch/custom_pagers/custom_pagers.module 2010-11-15 10:55:41.000000000 +0100 @@ -285,9 +285,40 @@ function template_preprocess_custom_page $pager = $vars['pager']; $nav = $vars['nav_array']; - $vars['previous'] = !empty($nav['prev']) ? l('‹ ' . t('previous'), 'node/'. $nav['prev']) : ''; - $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list']))); - $vars['next'] = !empty($nav['next']) ? l(t('next') . ' ›', 'node/'. $nav['next']) : ''; + // if people want to use the node titles for the prev/next pager, they now can set an option on the admin page + if ($pager->custom_pagers_display_titles != 1) { + $vars['previous'] = !empty($nav['prev']) ? l('‹ ' . t('previous'), 'node/'. $nav['prev']) : ''; + $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list']))); + $vars['next'] = !empty($nav['next']) ? l(t('next') . ' ›', 'node/'. $nav['next']) : ''; + } + else + { + if (!empty($nav['prev'])) { + // load the previous node's title + $prevnode = !empty($nav['prev']) ? check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nav['prev']))) : ''; + if (strlen($prevnode) < $pager->custom_pagers_limit_characters) { + $prevtitle = ' « ' . substr(t($prevnode),0,$pager->custom_pagers_limit_characters); + } + else + { + $prevtitle = ' « ' . substr(t($prevnode),0,$pager->custom_pagers_limit_characters) . '...'; + } + $vars['previous'] = l($prevtitle, 'node/'. $nav['prev']); + } + $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list']))); + if (!empty($nav['next'])) { + // load the next node's title + $nextnode = !empty($nav['next']) ? check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nav['next']))) : ''; + if (strlen($nextnode) < $pager->custom_pagers_limit_characters) { + $nexttitle = substr(t($nextnode),0,$pager->custom_pagers_limit_characters) . ' » '; + } + else + { + $nexttitle = substr(t($nextnode),0,$pager->custom_pagers_limit_characters) . '... » '; + } + $vars['next'] = l($nexttitle,'node/'. $nav['next']); + } + } $vars['template_files'][] = "custom-pager-{$vars['position']}"; $vars['template_files'][] = "custom-pager-$node->type"; diff -urp /home/drupal/custom_pagers/custom-pager.tpl.php /patch/custom_pagers/custom-pager.tpl.php --- /home/drupal/custom_pagers/custom-pager.tpl.php 2008-12-24 01:58:21.000000000 +0100 +++ /patch/custom_pagers/custom-pager.tpl.php 2010-11-15 05:14:36.000000000 +0100 @@ -24,7 +24,7 @@ */ ?>