/[drupal]/contributions/modules/tracker2/tracker2.admin.inc
ViewVC logotype

Contents of /contributions/modules/tracker2/tracker2.admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Jan 12 22:09:35 2009 UTC (10 months, 1 week ago) by toddnienkerk
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-ALPHA1, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
applied trackerport4.patch [294091]
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Admin page callbacks for the tracker2 module.
7 */
8
9 /**
10 * Menu callback argument. Creates the tracker2 administration form.
11 */
12 function tracker2_admin() {
13 $max_nid = variable_get('tracker2_index_nid', 0);
14 $form['max_nid'] = array(
15 '#value' => $max_nid ? t('Max node ID for indexing on the next cron run: @max', array('@max' => $max_nid)) : t('Existing nodes have finished tracker indexing.'),
16 );
17
18 $form['tracker2_batch_size'] = array(
19 '#title' => t('Batch size'),
20 '#description' => t('Number of nodes to index during each cron run.'),
21 '#type' => 'textfield',
22 '#size' => 6,
23 '#maxlength' => 7,
24 '#default_value' => variable_get('tracker2_batch_size', 1000),
25 '#required' => TRUE,
26 );
27
28 $form['tracker2_pager'] = array(
29 '#title' => t('Nodes per page'),
30 '#description' => t('Number of nodes to show per page of the tracker listing.'),
31 '#type' => 'textfield',
32 '#size' => 6,
33 '#maxlength' => 7,
34 '#default_value' => variable_get('tracker2_pager', 25),
35 '#required' => TRUE,
36 );
37
38 return system_settings_form($form);
39 }
40
41 /**
42 * Validate callback.
43 */
44 function tracker2_admin_validate($form, &$form_state) {
45 // Max_nid is just a markup field and should not cause a variable to be set.
46 unset($form_state['values']['max_nid']);
47
48 // The variables must be non-negative and numeric.
49 if (!is_numeric($form_state['values']['tracker2_batch_size']) || $form_state['values']['tracker2_batch_size'] <= 0) {
50 form_set_error('tracker2_batch_size', t('The batch size must be a number and greater than zero.'));
51 }
52 if (!is_numeric($form_state['values']['tracker2_pager']) || $form_state['values']['tracker2_pager'] <= 0) {
53 form_set_error('tracker2_pager', t('The nodes per page must be a number and greater than zero.'));
54 }
55 }

  ViewVC Help
Powered by ViewVC 1.1.2