' . t('Χωρίστε μεγάλες σελίδες σε μικρότερες με ετικέτες αλλαγής γραμμής (π.χ. %separator):
Πρώτη σελίδα. %separator Δεύτερη σελίδα. %separator Επόμενες σελίδες.', array('%separator' => '')) . '
' . t('Υποστηρίζεται, επίσης, η αυτόματη αλλαγή σελίδας με βάση το πλήθος των χαρακτήρων ή των λέξεων.') . '
'; break; } } /** * Implementation of hook_theme(). */ function paging_theme() { return array( // Secondary Pager Navigation with page names in drop down list. 'paging_drop_down' => array('tags' => NULL, 'limit' => NULL, 'element' => NULL, 'parameters' => NULL, 'quantity' => NULL), // Helper theme function to generates the select list for drop down pager. 'paging_drop_down_option' => array('url_chunk' => NULL, 'page_name' => NULL, 'page_no' => NULL, 'selected' => NULL), ); } /** * Implementation of hook_menu(). */ function paging_menu() { $items = array(); $items['admin/settings/paging'] = array( 'title' => t('Paging'), 'description' => t('Enable or disable paging, configure separator string, toggle automatic paging and more for each content types.'), 'page callback' => 'drupal_get_form', 'page arguments' => array('paging_settings'), 'access arguments' => array('administer site configuration'), ); return $items; } /** * Menu callback; display module settings form. */ function paging_settings() { $form = array(); // Set the id of the top-level form tag $form['#id'] = 'paging'; $paging_filter = FALSE; // Retrieve all input filters. foreach (filter_formats() as $format) { // Further retrieve all input formats. foreach (filter_list_format($format->format) as $filter) { // Check if any of the input formats have paging filter enabled. if ($filter->module == 'paging') { $paging_filter = TRUE; break; } } } if (!$paging_filter) { // Warn if paging filter is not yet enabled for any input format. drupal_set_message(t('Paging filter has not yet been enabled for any input formats. !link!', array('!link' => l(t('Take action'), 'admin/settings/filters'))), 'warning paging-warning'); } // Traverse available node types. foreach (node_get_types('names') as $type => $name) { // Container fieldset. $form[$type]['paging_config'] = array( '#type' => 'fieldset', '#title' => $name, '#collapsible' => TRUE, '#collapsed' => FALSE, '#attributes' => array('class' => 'paging-fieldset', 'id' => 'paging-type-' . $type), ); // Left column fieldset. $form[$type]['paging_config']['paging_left'] = array( '#type' => 'fieldset', '#collapsible' => FALSE, '#collapsed' => FALSE, '#attributes' => array('class' => 'paging-left'), ); // Paging toggle checkbox. $form[$type]['paging_config']['paging_left']['paging_enabled_' . $type] = array( '#type' => 'checkbox', '#title' => '', '#default_value' => variable_get('paging_enabled_' . $type, 0), '#attributes' => array('class' => 'paging-enabled'), ); // Paging separator string. $form[$type]['paging_config']['paging_left']['paging_separator_' . $type] = array( '#type' => 'textfield', '#title' => t('Page separator string'), '#size' => 20, '#maxlength' => 255, '#required' => TRUE, '#default_value' => variable_get('paging_separator_' . $type, ''), '#description' => t('Use an HTML tag that will render reasonably when paging is not enabled, such as %pagebreak or %hr.', array('%pagebreak' => '', '%hr' => '!pager
', array(
'!pager' => l('theme_pager()', 'http://api.drupal.org/api/function/theme_pager/6', array('attributes' => array('target' => '_blank'))),
)),
'paging_drop_down' => t('Drop down list - theme_paging_drop_down()
'),
'custom' => t('Custom'),
),
'#required' => TRUE,
'#description' => t('Choose style of page navigation. See also: !link.', array('!link' => l('Overriding theme output', 'http://drupal.org/node/173880#function-override'))),
'#default_value' => variable_get('paging_pager_widget_' . $type, 'pager'),
'#attributes' => array('class' => 'paging-pager'),
);
// Textfield to accept custom pager theme function name.
$form[$type]['paging_config']['paging_left']['paging_pager_widget_custom_' . $type] = array(
'#type' => 'textfield',
'#title' => t('Custom pager theme function'),
'#size' => 20,
'#maxlength' => 255,
'#required' => TRUE,
'#default_value' => variable_get('paging_pager_widget_custom_' . $type, 'pager'),
'#description' => t('Enter the part after the prefix theme_ of your custom theme function.'),
'#attributes' => array('class' => 'paging-pager-custom-' . $type),
'#field_prefix' => 'theme_',
);
// Right column fieldset.
$form[$type]['paging_config']['paging_right'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#attributes' => array('class' => 'paging-right'),
);
// Positions to place the page navigation links at.
$form[$type]['paging_config']['paging_right']['paging_pager_widget_position_' . $type] = array(
'#type' => 'radios',
'#title' => t('Pager position'),
'#options' => array(
'below' => t('Below content'),
'above' => t('Above content'),
'both' => t('Below and above content'),
'manual' => t('None (No output)'),
),
'#required' => TRUE,
'#description' => t('Choose the position of page navigation. If set to %none, @paging
can be used to place it at a customizable location.', array('%none' => t('None'), '@paging' => '$node->paging'))
. (module_exists('content') ? ' ' . t('Position of enabled pager(s) can further be customized for content types under Manage fields tab.', array('@url' => url('admin/content/types'))) : ''),
'#default_value' => variable_get('paging_pager_widget_position_' . $type, 'below'),
'#attributes' => array('class' => 'paging-pager'),
);
// Toggle dynamic loading of pages using AJAX.
$form[$type]['paging_config']['paging_right']['paging_ajax_enabled_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Dynamically load pages using AJAX'),
'#description' => t('Clicking on a pager links will load the page content dynamically. Supports both Default and Drop down list pager styles.'),
'#default_value' => variable_get('paging_ajax_enabled_' . $type, 0),
'#attributes' => array('class' => 'paging-ajax'),
);
// Toggle UI that helps with assigning names to pages. Disabled with automatic paging.
$form[$type]['paging_config']['paging_right']['paging_names_enabled_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Display Page names interface'),
'#description' => t('Add an interface to manage page names, which otherwise is a text format within content body, like <!--pagenames:First page||Page no. 2||Page 3-->. Disabled when an automatic paging method is selected.'),
'#default_value' => variable_get('paging_names_enabled_' . $type, 0),
'#attributes' => array('class' => 'paging-names'),
);
// Set the browser's title to current page's name.
$form[$type]['paging_config']['paging_right']['paging_name_title_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Change page title to name of current page'),
'#description' => t("Change the node's and browser window's title into name of the current page."),
'#default_value' => variable_get('paging_name_title_' . $type, 0),
);
// Optional automatic paging method. Each option opens the corresponding character/word length select list.
// Accompanied by paging.admin.js.
$form[$type]['paging_config']['paging_right']['paging_automatic_method_' . $type] = array(
'#type' => 'radios',
'#title' => t('Automatic paging method'),
'#options' => array(t('Disabled'), t('Limit by characters (recommended)'), t('Limit by words'),
),
'#required' => TRUE,
'#description' => t('Choose the method for automatic paging. Automatic paging is ignored where paging separator string is used.'),
'#default_value' => variable_get('paging_automatic_method_' . $type, 0),
'#attributes' => array('class' => 'paging-method'),
);
// Automatic paging method. Select list to choose the number of characters per page.
$form[$type]['paging_config']['paging_right']['paging_automatic_chars_' . $type] = array(
'#type' => 'select',
'#title' => t('Length of each page'),
'#options' => array(
500 => t('500 characters'), 750 => t('750 characters'),
1000 => t('1000 characters'), 1500 => t('1500 characters'),
2000 => t('2000 characters'), 2500 => t('2500 characters'),
3000 => t('3000 characters'), 3500 => t('3500 characters'),
4000 => t('4000 characters'), 4500 => t('4500 characters'),
5000 => t('5000 characters'), 5500 => t('5500 characters'),
6000 => t('6000 characters'), 6500 => t('6500 characters'),
7000 => t('7000 characters'), 7500 => t('7500 characters'),
),
'#required' => TRUE,
'#description' => ''; $output .= '' . $li_previous . ''; $options = ''; // Now generate the actual pager piece. for ($i = 1; $i <= $pager_max; $i++) { $page = $_GET['page'] ? $_GET['page'] : '0,' . ($i-1); if (strpos($page, ',') == 1) { $page = $page[0] . ',' . ($i-1); } else if (!empty($_GET['page']) && strpos($page, ',') === FALSE) { $page = $_GET['page'] . ',' . ($i-1); } $url = $i == 1 ? url($_GET['q']) : url($_GET['q'], array('query' => array('page' => $page))); // Decode the comma entity. $url = str_replace('%2C', ',', $url); $options .= theme('paging_drop_down_option', $url, $page_names[$i-1], $i, ($i == ($pager_current))); } $output .= ' | '; $output .= ''; $output .= ' | '; $output .= '' . $li_next . ''; $output .= ' |