? .DS_Store
? advanced_query_conditions_00.patch
? cache_indexes_01.patch
? ctools_contexts_03.patch
? entity_translations_00.patch
? entity_translations_01.patch
? entity_translations_02.patch
? entity_translations_03.patch
? entity_translations_04.patch
? grid_display_00.patch
? layer_filter_api_00.patch
? layer_filter_api_01.patch
? layer_filters_04.patch
Index: index.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/Attic/index.install,v
retrieving revision 1.1.2.14
diff -u -p -r1.1.2.14 index.install
--- index.install	28 Feb 2010 13:06:47 -0000	1.1.2.14
+++ index.install	1 Apr 2010 11:16:12 -0000
@@ -31,6 +31,13 @@ function index_schema() {
         'size' => 'big',
         'default' => '',
       ),
+      'language' => array(
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+        'default' => 'zxx',
+        'description' => "Language code, e.g. 'de' or 'en-US'.",
+      ),
     ),
     'primary key' => array('iid'),
   );
Index: index.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/Attic/index.module,v
retrieving revision 1.1.2.42
diff -u -p -r1.1.2.42 index.module
--- index.module	28 Feb 2010 11:51:57 -0000	1.1.2.42
+++ index.module	1 Apr 2010 11:16:13 -0000
@@ -12,6 +12,16 @@
 define('INDEX_NO_ENTITY_TYPE', 'index_no_entity_type');
 
 /**
+ * Language neutral ISO 639 code.
+ */
+define('INDEX_LANGUAGE_NEUTRAL', 'zxx');
+
+/**
+ * The active interface language.
+ */
+define('INDEX_LANGUAGE_ACTIVE', 'index_active');
+
+/**
  * Implementation of hook_perm().
  */
 function index_perm() {
Index: includes/index.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/includes/Attic/index.admin.inc,v
retrieving revision 1.1.2.48
diff -u -p -r1.1.2.48 index.admin.inc
--- includes/index.admin.inc	28 Feb 2010 13:21:03 -0000	1.1.2.48
+++ includes/index.admin.inc	1 Apr 2010 11:16:13 -0000
@@ -126,6 +126,12 @@ function index_form_add(array $form_stat
     '#default_value' => $index_edited->description,
     '#rows' => 3,
   );
+  $form['identification']['language'] = array(
+    '#type' => 'select',
+    '#title' => t('Language'),
+    '#options' => index_language_options(),
+    '#default_value' => $index_edited->language,
+  );
 
   // Contexts.
   $form['contexts'] = array(
@@ -412,6 +418,7 @@ function index_form_add_populate_index_r
   $index->iid = $values['iid'];
   $index->title = $values['title'];
   $index->description = $values['description'];
+  $index->language = $values['language'];
 
   // Contexts.
   $contexts_info = index_contexts_info();
@@ -837,4 +844,38 @@ function index_clone(index $index) {
   $index->insert();
   drupal_set_message(t('Index %index_original_title has been cloned to %index_clone_title.', array('%index_original_title' => $index_original_title, '%index_clone_title' => $index->title)));
   drupal_goto('admin/build/index');
+}
+
+/**
+ * Return a list of languages.
+ *
+ * @return
+ *   Array where the keys are languages codes and values are language names.
+ */
+function index_languages() {
+  static $languages = NULL;
+  include_once './includes/locale.inc';
+
+  if(!$languages) {
+    $languages = _locale_get_predefined_list();
+    foreach ($languages as $code => $names) {
+      // Include native name in output, if possible
+      $name = t($names[0]);
+      $languages[$code] = $name;
+      if (count($names) > 1 && $name != $names[1]) {
+        $languages[$code] .= ' (' . $names[1] . ')';
+      }
+    }
+    asort($languages);
+  }
+
+  return $languages;
+}
+
+function index_language_options() {
+  return array(
+    INDEX_LANGUAGE_NEUTRAL => t('Language neutral'),
+    INDEX_LANGUAGE_ACTIVE => t('Active interface language'),
+    t('Languages') => index_languages(),
+  );
 }
\ No newline at end of file
Index: includes/index.classes.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/includes/Attic/index.classes.inc,v
retrieving revision 1.1.2.41
diff -u -p -r1.1.2.41 index.classes.inc
--- includes/index.classes.inc	27 Feb 2010 19:41:10 -0000	1.1.2.41
+++ includes/index.classes.inc	1 Apr 2010 11:16:13 -0000
@@ -18,6 +18,9 @@ class index {
   public $iid = 0;
   public $title = '';
   public $description = '';
+  // Developers are encouraged to use index::language() to get the language to
+  // use for an index.
+  public $language = 'zxx';
   public $layers = array();
   public $contexts = array();
 
@@ -46,6 +49,25 @@ class index {
   }
 
   /**
+   * Return the language to use for this index.
+   *
+   * @return mixed
+   *    Return a two-letter language code or FALSE if no language has been
+   *   defined.
+   */
+  function language() {
+    global $language;
+
+    if ($this->language == INDEX_LANGUAGE_NEUTRAL) {
+      return FALSE;
+    }
+    elseif ($this->language == INDEX_LANGUAGE_ACTIVE) {
+      return $language->language;
+    }
+    return $this->language;
+  }
+
+  /**
    * Set layers for this index.
    *
    * @param $layers array
@@ -180,7 +202,7 @@ class indexLayer {
 
     // We need to get the entity count only.
     if ($key && $this->entity_count_only) {
-      $counts = $entity_types_info[$this->entity_type]['#entity_count_callback']->call($key, $values, $depth_max);
+      $counts = $entity_types_info[$this->entity_type]['#entity_count_callback']->call($this->index, $key, $values, $depth_max);
       foreach ($this->parent->entities[$context->name] as $parent_entity) {
         if (is_null($parent_entity->child_count)) {
           $parent_entity->child_count = 0;
@@ -192,7 +214,7 @@ class indexLayer {
     }
     // We need to get entities.
     else {
-      $this->entities[$context->name] = $entity_types_info[$this->entity_type]['#entity_get_callback']->call($key, $values, $depth_max);
+      $this->entities[$context->name] = $entity_types_info[$this->entity_type]['#entity_get_callback']->call($this->index, $key, $values, $depth_max);
       // Assign parents and children.
       if ($this->parent) {
         foreach ($this->parent->entities[$context->name] as $parent_entity) {
Index: includes/index.entity.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/includes/Attic/index.entity.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 index.entity.inc
--- includes/index.entity.inc	1 Apr 2010 10:44:43 -0000	1.1.2.10
+++ includes/index.entity.inc	1 Apr 2010 11:16:13 -0000
@@ -70,7 +70,7 @@ function index_entity_query_conditions(a
  * @return array
  */
 function index_entity_get($entity_type, $table, $key, array $values) {
-  $result = db_query("SELECT * FROM {$table}" . index_entity_query_conditions(array($key => $values)), $values);
+  $result = db_query("SELECT * FROM {$table}" . index_entity_query_conditions(array($key => $values)));
   $entities = array();
   while ($data = db_fetch_object($result)) {
     $entities[] = new indexEntity($entity_type, $data);
@@ -86,7 +86,7 @@ function index_entity_get($entity_type, 
  */
 function index_entity_count($table, $key, array $values) {
   $where = $key ? index_entity_query_conditions(array($key => $values)) . " GROUP BY $key" : NULL;
-  $result = db_query("SELECT COUNT(*) as count, $key as value FROM {$table} $where", $values);
+  $result = db_query("SELECT COUNT(*) as count, $key as value FROM {$table} $where");
   $counts = array();
   while ($count_data = db_fetch_array($result)) {
     $counts[$count_data['value']] = $count_data['count'];
@@ -101,7 +101,7 @@ function index_entity_count($table, $key
  * @return array
  *   Node types from {node_type}.
  */
-function index_entity_get_node_type($key, array $values, $depth_max) {
+function index_entity_get_node_type(index $index, $key, array $values, $depth_max) {
   return index_entity_get('node_type', 'node_type', $key, $values);
 }
 
@@ -110,7 +110,7 @@ function index_entity_get_node_type($key
  *
  * @return integer
  */
-function index_entity_count_node_type($key, array $values) {
+function index_entity_count_node_type(index $index, $key, array $values) {
   return index_entity_count('node_type', $key, $values);
 }
 
@@ -120,22 +120,25 @@ function index_entity_count_node_type($k
  * @return array
  *   Nodes from {node} and {node_revision}.
  */
-function index_entity_get_node($key, array $values, $depth_max) {
+function index_entity_get_node(index $index, $key, array $values, $depth_max) {
   $entities = array();
 
+  $query = 'SELECT * FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid';
+  $table = 'n';
+
   // Get nodes by TID.
   if ($key == 'tid') {
-    $result = db_query("SELECT * FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid LEFT JOIN {term_node} tn ON tn.vid = n.vid" . index_entity_query_conditions(array($key => $values), 'tn'), $values);
-    while ($data = db_fetch_object($result)) {
-      $entities[] = new indexEntity('node', $data);
-    }
+    $query .= ' LEFT JOIN {term_node} tn ON tn.vid = n.vid';
+    $table = 'tn';
   }
-  // Get nodes for all other keys.
-  else {
-    $result = db_query("SELECT * FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid" . index_entity_query_conditions(array($key => $values), 'n'), $values);
-    while ($data = db_fetch_object($result)) {
-      $entities[] = new indexEntity('node', $data);
-    }
+
+  $conditions = array($key => $values);
+  if ($index->language()) {
+    $conditions['language'] = array($index->language());
+  }
+  $result = db_query($query . index_entity_query_conditions($conditions, $table));
+  while ($data = db_fetch_object($result)) {
+    $entities[] = new indexEntity('node', $data);
   }
 
   return $entities;
@@ -146,11 +149,34 @@ function index_entity_get_node($key, arr
  *
  * @return integer
  */
-function index_entity_count_node($key, array $values) {
+function index_entity_count_node(index $index, $key, array $values) {
+  $query = "SELECT COUNT(*) as count, $key as value FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid";
+  $table = 'n';
+  $coutns = array();
+
+  // Get nodes by TID.
+  if ($key == 'tid') {
+    $query .= ' LEFT JOIN {term_node} tn ON tn.vid = n.vid';
+    $table = 'tn';
+  }
+
+  $conditions = array($key => $values);
+  if ($index->language()) {
+    $conditions['language'] = array($index->language());
+  }
+  $result = db_query($query . index_entity_query_conditions($conditions, $table) . " GROUP BY $key");
+  while ($count_data = db_fetch_array($result)) {
+    $counts[$count_data['value']] = $count_data['count'];
+  }
+
+  return $counts;
+
+
+
   // Count nodes by TID.
   if ($key == 'tid') {
     $counts = array();
-    $result = db_query("SELECT COUNT(*) as count, $key as value FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid LEFT JOIN {term_node} tn ON tn.vid = n.vid" . index_entity_query_conditions(array($key => $values), 'tn') . " GROUP BY $key", $values);
+    $result = db_query("SELECT COUNT(*) as count, $key as value FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid LEFT JOIN {term_node} tn ON tn.vid = n.vid" . index_entity_query_conditions(array($key => $values), 'tn') . " GROUP BY $key");
     while ($count_data = db_fetch_array($result)) {
       $counts[$count_data['value']] = $count_data['count'];
     }
@@ -168,7 +194,7 @@ function index_entity_count_node($key, a
  * @return array
  *   Comments from {comments}.
  */
-function index_entity_get_comment($key, array $values, $depth_max) {
+function index_entity_get_comment(index $index, $key, array $values, $depth_max) {
   // TODO: Comments are hierarchical as well.
   return index_entity_get('comment', 'comments', $key, $values);
 }
@@ -178,7 +204,7 @@ function index_entity_get_comment($key, 
  *
  * @return integer
  */
-function index_entity_count_comments($key, array $values) {
+function index_entity_count_comments(index $index, $key, array $values) {
   return index_entity_count('comments', $key, $values);
 }
 
@@ -188,9 +214,9 @@ function index_entity_count_comments($ke
  * @return array
  *   Users from {users}.
  */
-function index_entity_get_user($key, array $values, $depth_max) {
+function index_entity_get_user(index $index, $key, array $values, $depth_max) {
   $where = ($clause = index_entity_query_conditions(array($key => $values))) ? "$clause AND uid <> 0" : ' WHERE uid <> 0';
-  $result = db_query("SELECT * FROM {users}" . $where, $values);
+  $result = db_query("SELECT * FROM {users}" . $where);
   $entities = array();
   while ($data = db_fetch_object($result)) {
     $entities[] = new indexEntity('user', $data);
@@ -204,7 +230,7 @@ function index_entity_get_user($key, arr
  *
  * @return integer
  */
-function index_entity_count_user($key, array $values) {
+function index_entity_count_user(index $index, $key, array $values) {
   return index_entity_count('users', $key, $values);
 }
 
@@ -214,7 +240,7 @@ function index_entity_count_user($key, a
  * @return array
  *   User roles from {users_roles}. 
  */
-function index_entity_get_user_role($key, array $values, $depth_max) {
+function index_entity_get_user_role(index $index, $key, array $values, $depth_max) {
   $result = db_query("SELECT * FROM {role} r LEFT JOIN {users_roles} ur ON ur.rid = r.rid" . index_entity_query_conditions(array($key => $values)));
   $entities = array();
   while ($user_role = db_fetch_object($result)) {
@@ -229,7 +255,7 @@ function index_entity_get_user_role($key
  *
  * @return integer
  */
-function index_entity_count_user_role($key, array $values) {
+function index_entity_count_user_role(index $index, $key, array $values) {
   $result = db_query("SELECT COUNT(*) FROM {role} r LEFT JOIN {users_roles} ur ON ur.rid = r.rid" . index_entity_query_conditions(array($key => $values)));
 
   return db_result($result);
@@ -241,7 +267,7 @@ function index_entity_count_user_role($k
  * @return array
  *   Vocabularies from {vocabulary}.
  */
-function index_entity_get_taxonomy_vocabulary($key, array $values, $depth_max) {
+function index_entity_get_taxonomy_vocabulary(index $index, $key, array $values, $depth_max) {
   return index_entity_get('taxonomy_vocabulary', 'vocabulary', $key, $values);
 }
 
@@ -250,7 +276,7 @@ function index_entity_get_taxonomy_vocab
  *
  * @return integer
  */
-function index_entity_count_taxonomy_vocabulary($key, array $values, $depth_max) {
+function index_entity_count_taxonomy_vocabulary(index $index, $key, array $values, $depth_max) {
   return index_entity_count('vocabulary', $key, $values);
 }
 
@@ -260,7 +286,7 @@ function index_entity_count_taxonomy_voc
  * @return array
  *   Terms from {term_data}.
  */
-function index_entity_get_taxonomy_term($key, array $values, $depth_max) {
+function index_entity_get_taxonomy_term(index $index, $key, array $values, $depth_max) {
   $entities = array();
   $where = index_entity_query_conditions(array($key => $values));
 
@@ -345,6 +371,6 @@ function index_entity_get_taxonomy_term_
  *
  * @return integer
  */
-function index_entity_count_taxonomy_term($key, array $values, $depth_max) {
+function index_entity_count_taxonomy_term(index $index, $key, array $values, $depth_max) {
   return index_entity_count('term_data', $key, $values);
 }
\ No newline at end of file
