Index: l10n_community/l10n_community.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v
retrieving revision 1.1.2.23.2.59
diff -u -p -r1.1.2.23.2.59 l10n_community.module
--- l10n_community/l10n_community.module	6 Nov 2009 15:38:16 -0000	1.1.2.23.2.59
+++ l10n_community/l10n_community.module	6 Nov 2009 18:18:37 -0000
@@ -50,6 +50,11 @@ define('L10N_STATUS_NO_SUGGESTION', 4);
  */
 define('L10N_STATUS_HAS_SUGGESTION', 8);
 
+/**
+ * Define one day expiring time.
+ */
+define('L10N_1_DAY_EXPIRING_TIME', time() + 60 * 60 * 24);
+
 // = Core hooks ================================================================
 
 /**
@@ -435,6 +440,12 @@ function l10n_community_block($op = 'lis
           'enabled' => 1,
           'region' => 'left'
         ),
+        'latest_translations' => array(
+          'info' => t('Latest translations'),
+        ),
+        'top_translators' => array(
+          'info' => t('Top translators'),
+        ),
       );
       return $blocks;
 
@@ -450,6 +461,16 @@ function l10n_community_block($op = 'lis
             return l10n_community_block_stats();
           }
           return;
+        case 'latest_translations':
+          if (user_access('access localization community')) {
+            return l10n_community_block_latest_translations();
+          }
+          return;
+        case 'top_translators':
+          if (user_access('access localization community')) {
+            return l10n_community_block_top_translators();
+          }
+          return;
       }
   }
 }
@@ -575,6 +596,52 @@ function l10n_community_block_stats() {
 }
 
 /**
+ * Latest translations block.
+ */
+function l10n_community_block_latest_translations() {
+  $cid = 'l10n:latest_translations';
+  if ($cache = cache_get($cid)) {
+    $translations = $cache->data;
+  }
+  else {
+    $translations = array();
+    $query = db_query_range("SELECT translation, uid_entered FROM {l10n_community_translation} ORDER BY time_entered DESC", 0, 10);
+    while ($translation = db_fetch_object($query)) {
+      $translation->translation = strip_tags($translation->translation);
+      $translation->account = user_load($translation->uid_entered);
+      $translations[] = t('@translation by !account', array('@translation' => truncate_utf8($translation->translation, 60, TRUE, TRUE), '!account' => theme('username', $translation->account)));
+    }
+    cache_set($cid, $translations, 'cache', L10N_1_DAY_EXPIRING_TIME);
+  }
+  return array(
+    'subject' => t('Latest translations'),
+    'content' => theme('item_list', $translations),
+  );
+}
+
+/**
+ * Top translators block.
+ */
+function l10n_community_block_top_translators() {
+  $cid = 'l10n:top_translators';
+  if ($cache = cache_get($cid)) {
+    $translators = $cache->data;
+  }
+  else {
+    $translators = array();
+    $query = db_query_range("SELECT uid_entered, COUNT(tid) AS tid_count FROM {l10n_community_translation} GROUP BY uid_entered ORDER BY tid_count DESC", 0, 10);
+    while ($translator = db_fetch_object($query)) {
+      $translators[] = t('!account (@count)', array('!account' => theme('username', user_load($translator->uid_entered)), '@count' => $translator->tid_count));
+    }
+    cache_set($cid, $translators, 'cache', L10N_1_DAY_EXPIRING_TIME);
+  }
+  return array(
+    'subject' => t('Top translators'),
+    'content' => theme('item_list', $translators),
+  );
+}
+
+/**
  * Implementation of hook_user().
  */
 function l10n_community_user($op, &$edit, &$account, $category = NULL) {
