Index: l10n_community/moderate.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/moderate.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 moderate.inc --- l10n_community/moderate.inc 18 Sep 2009 18:03:19 -0000 1.1.2.3 +++ l10n_community/moderate.inc 16 Oct 2009 09:48:50 -0000 @@ -49,10 +49,14 @@ function l10n_community_moderate_page($l * Filters used to present this moderation view. */ function l10n_community_moderation_form(&$form_state, $strings = array(), $language = NULL, $filters) { + // Replace some values by their string representation for URL redirects. + l10n_community_flat_filters($filters); + $form['#redirect'] = array($_GET['q'], $filters); + $form['pager'] = array( '#value' => theme('pager', NULL, $filters['limit'], 0) ); - + // Keep language code in form for further reference. $form['langcode'] = array( '#type' => 'value', Index: l10n_community/translate.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/translate.inc,v retrieving revision 1.1.2.7.2.21 diff -u -p -r1.1.2.7.2.21 translate.inc --- l10n_community/translate.inc 15 Oct 2009 08:46:40 -0000 1.1.2.7.2.21 +++ l10n_community/translate.inc 16 Oct 2009 09:48:50 -0000 @@ -186,11 +186,7 @@ function l10n_community_filter_form_subm if ($form_state['values']['op'] == t('Filter')) { $filters = l10n_community_build_filter_values($form_state['values']); // Replace some values by their string representation. - foreach (array('project' => 'uri', 'author' => 'name') as $name => $key) { - if (!empty($filters[$name])) { - $filters[$name] = $filters[$name]->$key; - } - } + l10n_community_flat_filters($filters); // Redirect keeping the relevant filters intact in the URL. $form_state['redirect'] = array($_GET['q'], $filters); @@ -268,11 +264,7 @@ function l10n_community_translate_form(& $filters['page'] = (int) $_GET['page']; } // Replace some values by their string representation for URL redirects. - foreach (array('project' => 'uri', 'author' => 'name') as $name => $key) { - if (!empty($filters[$name])) { - $filters[$name] = $filters[$name]->$key; - } - } + l10n_community_flat_filters($filters); $form = array( '#tree' => TRUE, @@ -767,3 +759,19 @@ function l10n_community_build_filter_val } return $filter; } + +/** + * Helper function used to replace complex data filters (like objects or arrays) with their string representation. + * + * @param $filters + * Associative array with filters passed. This array is passed by reference and will be altered here. + */ +function l10n_community_flat_filters(&$filters) { + static $replacements = array('project' => 'uri', 'author' => 'name'); + + foreach ($replacements as $name => $key) { + if (!empty($filters[$name])) { + $filters[$name] = $filters[$name]->$key; + } + } +}