? .git
Index: views.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/views.module,v
retrieving revision 1.332.2.18
diff -u -p -r1.332.2.18 views.module
--- views.module	24 Dec 2009 00:02:57 -0000	1.332.2.18
+++ views.module	24 Dec 2009 17:48:05 -0000
@@ -1006,8 +1006,10 @@ function views_exposed_form(&$form_state
 
   $form['submit'] = array(
     '#name' => '', // prevent from showing up in $_GET.
+    '#prefix' => '<div class="views-exposed-widget">',
+    '#suffix' => '</div>',
     '#type' => 'submit',
-    '#value' => t('Submit'),
+    '#value' => t('Apply'),
     '#id' => form_clean_id('edit-submit-' . $view->name),
   );
 
Index: plugins/views_plugin_display.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/views_plugin_display.inc,v
retrieving revision 1.20.2.26
diff -u -p -r1.20.2.26 views_plugin_display.inc
--- plugins/views_plugin_display.inc	24 Dec 2009 00:41:17 -0000	1.20.2.26
+++ plugins/views_plugin_display.inc	24 Dec 2009 17:48:16 -0000
@@ -118,6 +118,11 @@ class views_plugin_display extends views
           }
         }
       }
+      $pager = $this->get_plugin('pager');
+      if ($pager->offset_exposed() || $pager->items_per_page_exposed()) {
+        $this->has_exposed = TRUE;
+        return TRUE;
+      }
       $this->has_exposed = FALSE;
     }
 
Index: plugins/views_plugin_exposed_form.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/Attic/views_plugin_exposed_form.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 views_plugin_exposed_form.inc
--- plugins/views_plugin_exposed_form.inc	23 Dec 2009 20:29:00 -0000	1.1.2.6
+++ plugins/views_plugin_exposed_form.inc	24 Dec 2009 17:48:17 -0000
@@ -149,6 +149,8 @@ class views_plugin_exposed_form extends 
     if (!empty($this->options['reset_button'])) {
       $form['reset'] = array(
         '#value' => t('Reset'),
+        '#prefix' => '<div class="views-exposed-widget">',
+        '#suffix' => '</div>',
         '#type' => 'submit',
       );
     }
@@ -164,6 +166,8 @@ class views_plugin_exposed_form extends 
  
     if (count($exposed_sorts)) {
       $form['sort_by'] = array(
+        '#prefix' => '<div class="views-exposed-widget">',
+        '#suffix' => '</div>',
         '#type' => 'select',
         '#options' => $exposed_sorts,
         '#title' => t($this->options['exposed_sorts_label']),
@@ -173,6 +177,8 @@ class views_plugin_exposed_form extends 
         'desc' => t($this->options['sort_desc_label']),
       );
       $form['sort_order'] = array(
+        '#prefix' => '<div class="views-exposed-widget">',
+        '#suffix' => '</div>',
         '#type' => 'select',
         '#options' => $sort_order,
         '#title' => t('Order'),
@@ -182,6 +188,40 @@ class views_plugin_exposed_form extends 
         $form['reset']['#weight'] = 10;
       }
     }
+
+    $pager = $this->view->display_handler->get_plugin('pager');
+    if ($pager->items_per_page_exposed()) {
+      $options = explode(',', $pager->options['expose']['items_per_page_options']);
+      $sanitized_options = array();
+      if (is_array($options)) {
+        foreach ($options as $option) {
+          $sanitized_options[intval($option)] = intval($option);
+        }
+
+        $form['items_per_page'] = array(
+          '#type' => 'select',
+          '#prefix' => '<div class="views-exposed-widget">',
+          '#suffix' => '</div>',
+          '#title' => $pager->options['expose']['items_per_page_label'],
+          '#options' => $sanitized_options,
+          '#default_value' => $pager->get_items_per_page(),
+        );
+      }
+      $form['submit']['#weight'] = 10;
+    }
+
+    if ($pager->offset_exposed()) {
+      $form['offset'] = array(
+        '#type' => 'textfield',
+        '#prefix' => '<div class="views-exposed-widget">',
+        '#suffix' => '</div>',
+        '#size' => 10,
+        '#maxlength' => 10,
+        '#title' => $pager->options['expose']['offset_label'],
+        '#default_value' => $pager->get_offset(),
+      );
+      $form['submit']['#weight'] = 10;
+    }
   }
 
   function exposed_form_validate(&$form, &$form_state) { }
Index: plugins/views_plugin_pager.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/Attic/views_plugin_pager.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 views_plugin_pager.inc
--- plugins/views_plugin_pager.inc	3 Dec 2009 23:28:53 -0000	1.1.2.2
+++ plugins/views_plugin_pager.inc	24 Dec 2009 17:48:17 -0000
@@ -177,4 +177,12 @@ class views_plugin_pager extends views_p
     return $this->get_items_per_page()
       && $this->total_items > (intval($this->current_page) + 1) * $this->get_items_per_page();
   }
+
+  function items_per_page_exposed() {
+    return !empty($this->options['expose']['items_per_page']);
+  }
+
+  function offset_exposed() {
+    return !empty($this->options['expose']['offset']);
+  }
 }
Index: plugins/views_plugin_pager_full.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/Attic/views_plugin_pager_full.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 views_plugin_pager_full.inc
--- plugins/views_plugin_pager_full.inc	23 Dec 2009 23:47:35 -0000	1.1.2.2
+++ plugins/views_plugin_pager_full.inc	24 Dec 2009 17:48:18 -0000
@@ -20,7 +20,16 @@ class views_plugin_pager_full extends vi
     $options['offset'] = array('default' => 0);
     $options['id'] = array('default' => 0);
     $options['total_pages'] = array('default' => '');
-
+    $options['expose'] = array(
+      'contains' => array(
+        'items_per_page' => array('default' => FALSE, 'bool' => TRUE),
+        'items_per_page_label' => array('default' => 'Items per page', 'translatable' => TRUE),
+        'items_per_page_options' => array('default' => '5, 10, 20, 40, 60'),
+
+        'offset' => array('default' => FALSE, 'bool' => TRUE),
+        'offset_label' => array('default' => 'Offset', 'translatable' => TRUE),
+      ),
+    );
     return $options;
   }
 
@@ -55,9 +64,103 @@ class views_plugin_pager_full extends vi
       '#description' => t('The total number of pages. Leave empty to show all pages.'),
       '#default_value' => $this->options['total_pages'],
     );
+
+    $form['expose'] = array (
+      '#type' => 'fieldset',
+      '#collapsible' => FALSE,
+      '#collapsed' => FALSE,
+      '#tree' => TRUE,
+      '#title' => t('Exposed options'),
+      '#input' => TRUE,
+      '#description' => t('Exposing this options allows users to define their values in a exposed form when view is displayed'), 
+    );
+
+    $form['expose']['items_per_page'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Expose items per page'),
+      '#description' => t('When checked, users can determine how many items per page show in a view'),
+      '#default_value' => $this->options['expose']['items_per_page'],
+    );
+
+    $form['expose']['items_per_page_label'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Items per page label'),
+      '#required' => TRUE,
+      '#description' => t('Label to use in the exposed items per page form element.'),
+      '#default_value' => $this->options['expose']['items_per_page_label'],
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array(
+        'edit-pager-options-expose-items-per-page' => array(1)
+      ),
+    );
+
+    $form['expose']['items_per_page_options'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Exposed items per page options'),
+      '#required' => TRUE,
+      '#description' => t('Set between which values the user can choose when determining the items per page. Separated by colon.'),
+      '#default_value' => $this->options['expose']['items_per_page_options'],
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array(
+        'edit-pager-options-expose-items-per-page' => array(1)
+      ),
+    );
+
+    $form['expose']['offset'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Expose Offset'),
+      '#description' => t('When checked, users can determine how many items per page show in a view'),
+      '#default_value' => $this->options['expose']['items_per_page'],
+    );
+
+    $form['expose']['offset_label'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Offset label'),
+      '#required' => TRUE,
+      '#description' => t('Label to use in the exposed offset form element.'),
+      '#default_value' => $this->options['expose']['offset_label'],
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array(
+        'edit-pager-options-expose-offset' => array(1)
+      ),
+    );
+  }
+
+  function options_validate(&$form, &$form_state) {
+    // Only accept integer values.
+    $error = FALSE;
+    $exposed_options = $form_state['values']['pager_options']['expose']['items_per_page_options'];
+    if (strpos($exposed_options, '.') !== FALSE) {
+      $error = TRUE;
+    }
+    $options = explode(',',$exposed_options);
+    if (!$error && is_array($options)) {
+      foreach ($options as $option) {
+        if (!is_numeric($option) || intval($option) == 0) {
+          $error = TRUE;
+        }
+      }
+    }
+    else {
+      $error = TRUE;
+    }
+    if ($error) {
+      form_set_error('pager_options][expose][items_per_page_options', t('Please insert a list of integer numeric values separated by colons: e.g: 10, 20, 50, 100'));
+    }
   }
 
   function query() {
+    if ($this->items_per_page_exposed()) {
+      if (!empty($_GET['items_per_page']) && $_GET['items_per_page'] > 0){
+        $this->options['items_per_page'] = $_GET['items_per_page'];
+      }
+    }
+    if ($this->offset_exposed()) {
+      if (isset($_GET['offset']) && $_GET['offset'] >= 0){
+        $this->options['offset'] = $_GET['offset'];
+      }
+    }
+
     $limit = $this->options['items_per_page'];
     $offset = $this->current_page * $this->options['items_per_page'] + $this->options['offset'];
     if (!empty($this->options['total_pages'])) {
Index: theme/views-exposed-form.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/theme/views-exposed-form.tpl.php,v
retrieving revision 1.4.2.1
diff -u -p -r1.4.2.1 views-exposed-form.tpl.php
--- theme/views-exposed-form.tpl.php	18 Nov 2009 20:37:53 -0000	1.4.2.1
+++ theme/views-exposed-form.tpl.php	24 Dec 2009 17:48:19 -0000
@@ -41,8 +41,6 @@
         </div>
       </div>
     <?php endforeach; ?>
-    <div class="views-exposed-widget">
-      <?php print $button ?>
-    </div>
+    <?php print $button ?>
   </div>
-</div>
\ No newline at end of file
+</div>
