Index: l10n_community/l10n_community.module =================================================================== RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v retrieving revision 1.1.2.23.2.66.2.8 diff -u -r1.1.2.23.2.66.2.8 l10n_community.module --- l10n_community/l10n_community.module 24 Feb 2010 10:04:10 -0000 1.1.2.23.2.66.2.8 +++ l10n_community/l10n_community.module 9 Mar 2010 00:24:31 -0000 @@ -219,7 +219,7 @@ 'access arguments' => array('access localization community'), 'type' => MENU_CALLBACK ); - + // AJAX callbacks for easy translation management. These are expected to be // used only onsite (not as remote API endpoints), so they have no versioning. @@ -1381,6 +1381,7 @@ // Dropdown, validated by form API. 'context' => isset($params['context']) ? (string) $params['context'] : 'all', 'limit' => (isset($params['limit']) && in_array($params['limit'], array(5, 10, 20, 30))) ? (int) $params['limit'] : 10, + 'coreversion' => isset($params['coreversion']) ? $params['coreversion'] : 'all', ); // The project can be a dropdown or text field depending on number of @@ -1469,13 +1470,13 @@ // Pick and render our changed element for output. $changed_element = ($form_id == 'l10n_community_export_form') ? $form['data']['release'] : $form['release']; // Prevent duplicate wrappers. - unset($changed_element['#prefix'], $changed_element['#suffix']); + unset($changed_element['#prefix'], $changed_element['#suffix']); if ($form_id == 'l10n_community_filter_form') { // Prevent duplicate titles (due to how we render the elements). unset($changed_element['#title']); } - + drupal_json( array( 'status' => TRUE, Index: l10n_community/translate.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/translate.inc,v retrieving revision 1.1.2.7.2.31.2.15 diff -u -r1.1.2.7.2.31.2.15 translate.inc --- l10n_community/translate.inc 1 Mar 2010 14:17:03 -0000 1.1.2.7.2.31.2.15 +++ l10n_community/translate.inc 9 Mar 2010 00:24:32 -0000 @@ -32,6 +32,13 @@ L10N_STATUS_IS_SUGGESTION => t('Is suggestion'), ); + $coreversion = array( + 'all' => '<'. t('Any') .'>', + '5.x' => '5.x', + '6.x' => '6.x', + '7.x' => '7.x', + ); + // This form can be submitted multiple times to support AHAH flows. // So we set an initial default value set for the form values, if there // was none submitted already. Otherwise, the submitted values will take @@ -45,9 +52,10 @@ 'author' => isset($filters['author']) ? $filters['author']->name : '', 'search' => isset($filters['search']) ? $filters['search'] : '', 'limit' => isset($filters['limit']) ? $filters['limit'] : 10, + 'coreversion' => isset($filters['coreversion']) ? $filters['coreversion'] : 'all', ); } - + $form = array(); $form['project'] = array( '#title' => t('Project'), @@ -148,6 +156,12 @@ '#options' => drupal_map_assoc(array(5, 10, 20, 30)), '#default_value' => $form_state['values']['limit'], ); + $form['coreversion'] = array( + '#type' => 'select', + '#title' => t('Core version'), + '#options' => $coreversion, + '#default_value' => $form_state['values']['coreversion'], + ); $form['submit'] = array( '#value' => t('Filter'), @@ -169,7 +183,7 @@ $output = '
'; // Only display these elements individually. - $elements = array('project', 'release', 'context', 'status', 'author', 'search', 'limit'); + $elements = array('project', 'release', 'context', 'status', 'author', 'search', 'limit', 'coreversion'); foreach ($form as $id => &$element) { if (in_array($id, $elements)) { $title = $element['#title']; @@ -577,7 +591,7 @@ $element['#attributes']['class'] = ''; } $element['#attributes']['class'] .= ' clearfix translation'; - + // Add is-selectable and is-declinable helpers for JS. if (!$element['active']['#disabled']) { $element['#attributes']['class'] .= ' is-selectable'; @@ -666,11 +680,11 @@ // Iterate outer structure built in l10n_community_translate_form(). foreach ($form_state['values']['strings'] as $sid => $string) { - + // Iterate inner structure built in _l10n_community_translate_form_item(). // Form items have numeric $tid values and other keys here. foreach ($string as $tid => $options) { - + // Store new suggestion. $empty_values = 0; // $options['value'] is the result of (a series of) textareas. @@ -785,6 +799,15 @@ $where_args[] = $project->pid; } } + if(!$release && !$project) { + $coreversion = empty($filters['coreversion']) || $filters['coreversion'] === 'all' ? NULL : $filters['coreversion']; + if ($coreversion) { + $join[] = "INNER JOIN {l10n_community_line} l ON s.sid = l.sid"; + $join[] = "INNER JOIN {l10n_community_release} r ON r.rid = l.rid"; + $where_args[] = $coreversion; + $where[] = "r.title LIKE '%s%%'"; + } + } // Context based filtering. if (isset($filters['context']) && $filters['context'] != 'all') { @@ -811,7 +834,7 @@ elseif ($filters['status'] & L10N_STATUS_IS_TRANSLATION) { $where[] = "t.is_suggestion = 0"; } - + if ($filters['status'] & L10N_STATUS_HAS_SUGGESTION) { $where[] = "ts.has_suggestion = 1"; } @@ -921,7 +944,7 @@ $output .= '

'. t('Source string') .'

'. theme('item_list', $unpacked); $output .= '

'. (empty($string->context) ? t('Used at the following places') : t('Used at the following places in context %context', array('%context' => $string->context))) .'

'; } - + // List of project releases, where this string is used. $result = db_query('SELECT l.pid, p.title project_title, l.rid, r.title release_title, COUNT(l.lineno) as occurrence_count FROM {l10n_community_line} l INNER JOIN {l10n_community_project} p ON l.pid = p.pid INNER JOIN {l10n_community_release} r ON l.rid = r.rid WHERE l.sid = %d AND p.status = 1 GROUP BY l.rid ORDER BY l.pid, l.rid', $sid);