? l10n_server-220119.patch Index: l10n_community/ajax.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/ajax.inc,v retrieving revision 1.1.2.18.2.4 diff -u -p -r1.1.2.18.2.4 ajax.inc --- l10n_community/ajax.inc 16 Aug 2009 15:00:51 -0000 1.1.2.18.2.4 +++ l10n_community/ajax.inc 6 Sep 2009 17:14:04 -0000 @@ -56,6 +56,7 @@ function l10n_community_string_details($ } function l10n_community_string_suggestions($langcode = NULL, $sid = 0) { + global $user; // Existing, "unresolved" suggestions. $suggestions = array(); $result = db_query("SELECT t.tid, t.sid, t.translation, t.uid_entered, t.time_entered, u.name FROM {l10n_community_translation} t LEFT JOIN {users} u ON u.uid = t.uid_entered WHERE t.language = '%s' AND t.sid = %d AND t.is_active = 1 AND t.is_suggestion = 1 ORDER BY t.time_entered", $langcode, $sid); @@ -64,7 +65,9 @@ function l10n_community_string_suggestio while ($suggestion = db_fetch_object($result)) { // This detail pane is only retrieved from JS, so we are free to output obtrusive JS here. $token = "'". drupal_get_token('l10n_server_'. $suggestion->tid .'_'. $suggestion->sid) ."'"; - $approve_button = $perm == L10N_PERM_ALL ? theme('l10n_community_button', 'approve', 'l10n-approve', 'onclick="l10nCommunity.approveSuggestion('. $suggestion->tid .','. $suggestion->sid .', this, '. $token .');" title="'. t('Approve suggestion.') .'"') : ''; + if ($user->uid != $suggestion->uid_entered || user_access('Approve own suggestions')) { + $approve_button = $perm == L10N_PERM_ALL ? theme('l10n_community_button', 'approve', 'l10n-approve', 'onclick="l10nCommunity.approveSuggestion('. $suggestion->tid .','. $suggestion->sid .', this, '. $token .');" title="'. t('Approve suggestion.') .'"') : ''; + } $decline_button = $perm == L10N_PERM_ALL ? theme('l10n_community_button', 'decline', 'l10n-decline', 'onclick="l10nCommunity.declineSuggestion('. $suggestion->tid .','. $suggestion->sid .', this, '. $token .');" title="'. t('Decline suggestion.') .'"') : ''; // Plural versions are shown in a short form. @@ -95,10 +98,12 @@ function l10n_community_string_suggestio * The suggestion object if validated $tid, user permissions and token. */ function l10n_community_string_ajax_suggestion($tid = 0) { + global $user; if (($suggestion = db_fetch_object(db_query("SELECT * FROM {l10n_community_translation} WHERE tid = %d AND is_suggestion = 1 AND is_active = 1", $tid))) && (l10n_community_get_permission($suggestion->language) == L10N_PERM_ALL) && !empty($_GET['form_token']) && - drupal_valid_token($_GET['form_token'], 'l10n_server_'. $suggestion->tid .'_'. $suggestion->sid)) { + drupal_valid_token($_GET['form_token'], 'l10n_server_'. $suggestion->tid .'_'. $suggestion->sid) && + ($user->uid != $suggestion->uid_entered || user_access('Approve own suggestions'))) { return $suggestion; } return FALSE; 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.45 diff -u -p -r1.1.2.23.2.45 l10n_community.module --- l10n_community/l10n_community.module 5 Sep 2009 12:18:39 -0000 1.1.2.23.2.45 +++ l10n_community/l10n_community.module 6 Sep 2009 17:14:05 -0000 @@ -371,7 +371,7 @@ function l10n_community_init() { * Implementation of hook_perm(). */ function l10n_community_perm() { - return array('access localization community', 'submit suggestions', 'submit translations and approve suggestions', 'administer localization community', 'export gettext templates and translations', 'import gettext files'); + return array('access localization community', 'submit suggestions', 'submit translations and approve suggestions', 'administer localization community', 'export gettext templates and translations', 'import gettext files', 'Approve own suggestions'); } /**