? before.sql
Index: translation_overview.admin.inc
===================================================================
RCS file: translation_overview.admin.inc
diff -N translation_overview.admin.inc
--- translation_overview.admin.inc	11 Sep 2008 23:21:07 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-<?php
-// $Id: translation_overview.admin.inc,v 1.1 2008/09/11 23:21:07 drewish Exp $
-
-/**
- * Settings form.
- */
-function translation_overview_admin_settings_form($form_state) {
-  $management = variable_get('translation_overview_management', array());
-
-  $form['translation_overview_management']['#tree'] = TRUE;
-
-  $form['#roles'] = user_roles(TRUE, 'manage translation overview priorities');
-
-  foreach (locale_language_list() as $lang_code => $language) {
-    $form['translation_overview_management'][$lang_code]['name'] = array(
-      '#value' => check_plain($language),
-    );
-    foreach ($form['#roles'] as $rid => $role) {
-      $form['translation_overview_management'][$lang_code][$rid] = array(
-        '#type' => 'checkbox',
-        '#default_value' => isset($management[$lang_code][$rid]) ? $management[$lang_code][$rid] : FALSE,
-      );
-    }
-  }
-
-  $form = system_settings_form($form);
-  $form['#theme'] = 'translation_overview_admin_settings_form';
-  return $form;
-}
-
-function theme_translation_overview_admin_settings_form($form) {
-  $header = array(t('Language'));
-  foreach($form['#roles'] as $rid => $role) {
-    $header[] = $role;
-  }
-  $rows = array();
-  foreach (element_children($form['translation_overview_management']) as $lang_code) {
-    $row = array();
-    foreach (element_children($form['translation_overview_management'][$lang_code]) as $rid) {
-      $row[] = drupal_render($form['translation_overview_management'][$lang_code][$rid]);
-    }
-    $rows[] = $row;
-  }
-
-  return theme('table', $header, $rows, array(), t('Who manages the languages')) . drupal_render($form);
-}
\ No newline at end of file
Index: translation_overview.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/translation_overview/translation_overview.install,v
retrieving revision 1.3
diff -u -p -r1.3 translation_overview.install
--- translation_overview.install	16 Apr 2009 19:47:28 -0000	1.3
+++ translation_overview.install	16 Apr 2009 21:47:36 -0000
@@ -16,8 +16,6 @@ function translation_overview_install() 
  */
 function translation_overview_uninstall() {
   drupal_uninstall_schema('translation_overview');
-
-  variable_del('translation_overview_management');
 }
 
 /**
@@ -120,3 +118,34 @@ function translation_overview_update_600
 
   return $ret;
 }
+
+/**
+ * Store the manager information in permissions rather than our own variable.
+ */
+function translation_overview_update_6002() {
+  $ret = array();
+
+  $changes = array();
+  foreach (variable_get('translation_overview_management', array()) as $lang_code => $rids) {
+    foreach (array_filter($rids) as $rid => $true) {
+      $changes[$rid][] = 'manage '. check_plain($lang_code) .' translation overview priorities';
+    }
+  }
+
+  foreach ($changes as $rid => $perms) {
+    // Retrieve the currently set permissions.
+    $existing_perms = array();
+    $result = db_query("SELECT p.perm FROM {permission} p WHERE p.rid = %d ", $rid);
+    if ($row = db_fetch_object($result)) {
+      $perms = array_unique(array_merge($perms, explode(', ', $row->perm)));
+      $ret[] = update_sql('DELETE FROM {permission} WHERE rid = '. (int) $rid);
+    }
+
+    // Update the permissions.
+    $ret[] = update_sql("INSERT INTO {permission} (rid, perm) VALUES (". (int) $rid .", '". db_escape_string(implode(', ', $perms)) ."')");
+  }
+
+  variable_del('translation_overview_management');
+
+  return $ret;
+}
\ No newline at end of file
Index: translation_overview.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/translation_overview/translation_overview.module,v
retrieving revision 1.10
diff -u -p -r1.10 translation_overview.module
--- translation_overview.module	16 Apr 2009 19:47:28 -0000	1.10
+++ translation_overview.module	16 Apr 2009 21:47:37 -0000
@@ -10,16 +10,14 @@ define('TRANSLATION_OVERVIEW_IGNORE', 0)
  */
 function translation_overview_help($path, $arg) {
   switch ($path) {
-    case 'admin/settings/translation_overview':
-      return '<p>'. t('These settings control which roles are allowed to assign the translation priorities for each language. Only roles with the "manage translation overview priorities" permission are show.') .'</p>';
     case 'admin/content/translation_overview_manage':
       return NULL;
       $args = array();
       $states = array('original', 'current', 'outofdate', 'missing');
       foreach ($states as $state) {
-        $args['!'. $state] = theme('translation_overview_translation_link', $state, 1, 'medium', array());
+        $args['!'. $state] = theme('translation_overview_translation_link', $state);
       }
-      return '<p>'. t('The table uses the following symbols to indicate the translation status: !original Original language, !current Current translation, !outofdate Out-of-date translation, !missing Untranslated.', $args) .'</p>';
+      return '<p>'. t('The table uses the following symbols to indicate the translation status: !original, !current, !outofdate, !missing.', $args) .'</p>';
   }
 }
 
@@ -31,14 +29,10 @@ function translation_overview_theme() {
     'translation_overview_translation_link' => array(
       'arguments' => array('state' => NULL, 'link' => array(), 'properties' => array()),
     ),
-    'translation_overview_node_form' => array(
+    'translation_overview_node3_form' => array(
       'arguments' => array('form' => array()),
       'file' => 'translation_overview.pages.inc',
     ),
-    'translation_overview_admin_settings_form' => array(
-      'arguments' => array('form' => array()),
-      'file' => 'translation_overview.admin.inc',
-    )
   );
 }
 
@@ -47,10 +41,12 @@ function translation_overview_theme() {
  * Implementation of hook_perm().
  */
 function translation_overview_perm() {
-  return array(
-    'manage translation overview priorities',
-    'view translation overview assigments',
-  );
+  $perms = array('view translation overview assigments');
+  foreach (locale_language_list() as $lang_code => $language) {
+    $perms[] = 'manage '. check_plain($lang_code) .' translation overview priorities';
+  }
+
+  return $perms;
 }
 
 
@@ -68,7 +64,7 @@ function translation_overview_menu() {
     'description' => "View the translation status of the site's content.",
     'page callback' => 'translation_overview_manager_page',
     'file' => 'translation_overview.pages.inc',
-    'access arguments' => array('manage translation overview priorities'),
+    'access callback' => 'translation_overview_is_manager',
   );
   $items['admin/content/translation_overview_assignments'] = array(
     'title' => 'Translator assigments',
@@ -93,15 +89,6 @@ function translation_overview_menu() {
       );
     }
   }
-  $items['admin/settings/translation_overview'] = array(
-    'title' => 'Translation overview',
-    'description' => 'Settings for the translation overview.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('translation_overview_admin_settings_form'),
-    'access arguments' => array('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM,
-    'file' => 'translation_overview.admin.inc',
-  );
   return $items;
 }
 
@@ -226,20 +213,16 @@ function translation_overview_get_node_p
  * @return Boolean
  */
 function translation_overview_is_manager($lang_code = NULL, $account = NULL) {
-  $management = variable_get('translation_overview_management', array());
-
-  if (is_null($account)) {
-    $account = $GLOBALS['user'];
-  }
-
   if (empty($lang_code)) {
-    $allowed = array();
-    foreach ($management as $lang => $rids) {
-      $allowed += array_filter($rids);
+    foreach (locale_language_list() as $lang_code => $language) {
+      if (user_access('manage '. check_plain($lang_code) .' translation overview priorities', $account)) {
+        return TRUE;
+      }
     }
-    return (boolean) count(array_intersect_key((array) $account->roles, $allowed));
+    return FALSE;
   }
-  return (isset($management[$lang_code]) && count(array_intersect_key((array) $account->roles, array_filter((array) $management[$lang_code]))));
+
+  return user_access('manage '. check_plain($lang_code) .' translation overview priorities', $account);
 }
 
 /**
@@ -322,6 +305,14 @@ function translation_overview_translatio
 }
 
 function theme_translation_overview_translation_link($state, $link = array(), $properties = array()) {
+  // Merge in defaults.
+  $properties += array(
+    'priority' => TRANSLATION_OVERVIEW_NORMAL,
+    'has_note' => FALSE,
+    'published' => TRUE,
+    'show_long' => TRUE,
+  );
+
   $long = '&nbsp;';
   $link['options']['html'] = TRUE;
 
@@ -359,16 +350,19 @@ function theme_translation_overview_tran
   if (!empty($properties['has_note'])) {
     $link_title[] = t('with a note');
   }
-  if (preg_match('/node\/\d*\/edit/', $link['path'])) {
-    $action = t('Click to edit it.');
-  }
-  else if (preg_match('/node\/add/', $link['path'])) {
-    $action = t('Click to add it.');
-  }
-  else if (preg_match('/node\/\d*/', $link['path'])) {
-    $action = t('Click to view it.');
+
+  if (isset($link['path'])) {
+    if (preg_match('/node\/\d*\/edit/', $link['path'])) {
+      $action = t('Click to edit it.');
+    }
+    else if (preg_match('/node\/add/', $link['path'])) {
+      $action = t('Click to add it.');
+    }
+    else if (preg_match('/node\/\d*/', $link['path'])) {
+      $action = t('Click to view it.');
+    }
+    $link['options']['attributes'] = array('title' => drupal_ucfirst(trim(implode(', ', $link_title))) .'. '. $action);
   }
-  $link['options']['attributes'] = array('title' => drupal_ucfirst(trim(implode(', ', $link_title))) .'. '. $action);
 
   $class_note = $properties['has_note'] ? 'trov-has-note' : '';
   $class_state = $properties['published'] ? "trov-$state" : "trov-$state-unpublished";
