/[drupal]/contributions/modules/apachesolr/apachesolr.module
ViewVC logotype

Diff of /contributions/modules/apachesolr/apachesolr.module

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

revision 1.1.2.12.2.155.2.38 by robertDouglass, Fri Nov 20 14:27:08 2009 UTC revision 1.1.2.12.2.155.2.39 by robertDouglass, Fri Nov 20 17:13:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: apachesolr.module,v 1.1.2.12.2.155.2.37 2009/11/20 11:37:36 robertDouglass Exp $  // $Id: apachesolr.module,v 1.1.2.12.2.155.2.38 2009/11/20 14:27:08 robertDouglass Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 818  function apachesolr_block_admin_configur Line 818  function apachesolr_block_admin_configur
818   */   */
819  function apachesolr_facet_block($response, $query, $module, $delta, $facet_field, $filter_by, $facet_callback = FALSE) {  function apachesolr_facet_block($response, $query, $module, $delta, $facet_field, $filter_by, $facet_callback = FALSE) {
820    if (!empty($response->facet_counts->facet_fields->$facet_field)) {    if (!empty($response->facet_counts->facet_fields->$facet_field)) {
821        $facet_query_sorts = variable_get('apachesolr_facet_query_sorts', array());
822      $contains_active = FALSE;      $contains_active = FALSE;
823      $items = array();      $items = array();
824      foreach ($response->facet_counts->facet_fields->$facet_field as $facet => $count) {      foreach ($response->facet_counts->facet_fields->$facet_field as $facet => $count) {
# Line 841  function apachesolr_facet_block($respons Line 842  function apachesolr_facet_block($respons
842        if ($facet_callback && function_exists($facet_callback)) {        if ($facet_callback && function_exists($facet_callback)) {
843          $facet_text = $facet_callback($facet, $options);          $facet_text = $facet_callback($facet, $options);
844        }        }
845          // If this block is to be alphabetically sorted, change $sortpre.
846          if (isset($facet_query_sorts[$module][$delta]) && ($facet_query_sorts[$module][$delta] == 'index')) {
847            $sortpre = $facet_text;
848          }
849        $unclick_link = '';        $unclick_link = '';
850        $active = FALSE;        $active = FALSE;
851        $new_query = clone $query;        $new_query = clone $query;
# Line 1101  function apachesolr_date_gap_drilldown($ Line 1106  function apachesolr_date_gap_drilldown($
1106  function apachesolr_facetcount_form($module, $delta) {  function apachesolr_facetcount_form($module, $delta) {
1107    $initial = variable_get('apachesolr_facet_query_initial_limits', array());    $initial = variable_get('apachesolr_facet_query_initial_limits', array());
1108    $limits = variable_get('apachesolr_facet_query_limits', array());    $limits = variable_get('apachesolr_facet_query_limits', array());
1109      $sorts = variable_get('apachesolr_facet_query_sorts', array());
1110    $facet_missing = variable_get('apachesolr_facet_missing', array());    $facet_missing = variable_get('apachesolr_facet_missing', array());
1111    
1112    $limit = drupal_map_assoc(array(50, 40, 30, 20, 15, 10, 5, 3));    $limit = drupal_map_assoc(array(50, 40, 30, 20, 15, 10, 5, 3));
# Line 1120  function apachesolr_facetcount_form($mod Line 1126  function apachesolr_facetcount_form($mod
1126      '#description' => t('The maximum number of filter links to show in this block.'),      '#description' => t('The maximum number of filter links to show in this block.'),
1127      '#default_value' => isset($limits[$module][$delta]) ? $limits[$module][$delta] : variable_get('apachesolr_facet_query_limit_default', 20),      '#default_value' => isset($limits[$module][$delta]) ? $limits[$module][$delta] : variable_get('apachesolr_facet_query_limit_default', 20),
1128    );    );
1129    
1130      // TODO: Generalize how we know what type a facet block is by putting field
1131      // type into the facet definition. 'created' and 'changed' are date blocks.
1132      if ($delta != 'created' && $delta != 'changed') {
1133        $form['apachesolr_facet_query_sort'] = array(
1134          '#type' => 'radios',
1135          '#title' => t('Sort order of facet links'),
1136          '#options' => array('count' => t('Count'), 'index' => t('Alphanumeric')),
1137          '#description' => t('The sort order of facet links in this block. %Count, which is the default, will show facets with the most results first. %Alphanumeric will sort alphabetically, ascending.', array('%Count' => t('Count'), '%Alphanumeric' => t('Alphanumeric'))),
1138          '#default_value' => isset($sorts[$module][$delta]) ? $sorts[$module][$delta] : 'count',
1139        );
1140      }
1141    $form['apachesolr_facet_missing'] = array(    $form['apachesolr_facet_missing'] = array(
1142      '#type' => 'radios',      '#type' => 'radios',
1143      '#title' => t('Include a facet for missing'),      '#title' => t('Include a facet for missing'),
# Line 1141  function apachesolr_facetcount_save($edi Line 1159  function apachesolr_facetcount_save($edi
1159    $limits = variable_get('apachesolr_facet_query_limits', array());    $limits = variable_get('apachesolr_facet_query_limits', array());
1160    $limits[$module][$delta] = (int)$edit['apachesolr_facet_query_limit'];    $limits[$module][$delta] = (int)$edit['apachesolr_facet_query_limit'];
1161    variable_set('apachesolr_facet_query_limits', $limits);    variable_set('apachesolr_facet_query_limits', $limits);
1162      $sorts = variable_get('apachesolr_facet_query_sorts', array());
1163      $sorts[$module][$delta] = $edit['apachesolr_facet_query_sort'];
1164      variable_set('apachesolr_facet_query_sorts', $sorts);
1165    $initial = variable_get('apachesolr_facet_query_initial_limits', array());    $initial = variable_get('apachesolr_facet_query_initial_limits', array());
1166    $initial[$module][$delta] = (int)$edit['apachesolr_facet_query_initial_limit'];    $initial[$module][$delta] = (int)$edit['apachesolr_facet_query_initial_limit'];
1167    variable_set('apachesolr_facet_query_initial_limits', $initial);    variable_set('apachesolr_facet_query_initial_limits', $initial);

Legend:
Removed from v.1.1.2.12.2.155.2.38  
changed lines
  Added in v.1.1.2.12.2.155.2.39

  ViewVC Help
Powered by ViewVC 1.1.3