Index: l10n_community/import.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/import.inc,v retrieving revision 1.1.2.5.2.13 diff -u -p -r1.1.2.5.2.13 import.inc --- l10n_community/import.inc 8 Oct 2009 07:17:45 -0000 1.1.2.5.2.13 +++ l10n_community/import.inc 21 Oct 2009 16:55:14 -0000 @@ -30,6 +30,8 @@ function l10n_community_import_page($lan * Translation import form. */ function l10n_community_import_form($form_state, $langcode, $perm) { + global $user; + $form['#attributes']['enctype'] = 'multipart/form-data'; $form['langcode'] = array( @@ -39,31 +41,48 @@ function l10n_community_import_form($for $form['file'] = array( '#type' => 'file', - '#title' => t('Translation file'), + '#title' => t('Gettext .po file with translations'), '#size' => 50, - '#description' => t('A Gettext Portable Object (.po) file to upload.'), + '#description' => t('The maximum allowed size for uploads is %maxsize.', array('%maxsize' => format_size(file_upload_max_size()))), ); - $form['is_suggestion'] = array( - '#title' => t('Store as suggestions'), - '#type' => 'checkbox', - '#description' => t('Check if the translations you import need discussion. If checked, all translations in the imported file will be saved as suggestions.'), - ); - // Restrict to suggestions if no permission to submit translations directly. - if ($perm != L10N_PERM_ALL) { - $form['is_suggestion']['#type'] = 'value'; - $form['is_suggestion']['#value'] = 1; + + if ($perm == L10N_PERM_ALL) { + // If can submit translations, offer option to pick mode. + $form['is_suggestion'] = array( + '#title' => t('Status'), + '#type' => 'radios', + '#default_value' => 0, + '#options' => array( + 0 => t('Store as approved translations'), + 1 => t('Store as suggestions needing approval, possibly discussion'), + ), + ); + } + else { + // Restrict to suggestions if no permission to submit translations directly. + $form['is_suggestion'] = array( + '#type' => 'value', + '#value' => 1, + ); } if (($import_account = variable_get('l10n_community_import_user', '')) && ($account = user_load(array('name' => $import_account)))) { // If available, let the user import with attribution to a bulk import user. - $form['attribute_to_import_account'] = array( - '#title' => t('Attribute to %name', array('%name' => $import_account)), - '#type' => 'checkbox', - '#description' => t('If the imported translations were worked on by a team of people, it is common curtesy, to attribute them to this user to ensure you do not claim credit for work of the whole team.'), + $form['import_uid'] = array( + '#title' => t('Attribute import to'), + '#type' => 'radios', + '#default_value' => $user->uid, + '#options' => array( + $user->uid => t('Yourself (%name)', array('%name' => $user->name)), + $account->uid => $import_account, + ), + '#description' => t('When importing the result of teamwork, If the imported translations were worked on by a team of people, it is common curtesy to not attribute them to your personal username to ensure you do not claim credit for work of the whole team.'), ); + } + else { $form['import_uid'] = array( '#type' => 'value', - '#value' => $account->uid, + '#value' => $user->uid, ); } @@ -88,14 +107,8 @@ function l10n_community_import_form_subm @set_time_limit(240); } - // Calculate the uid to use for attribution. - $uid = $user->uid; - if (!empty($form_state['values']['attribute_to_import_account'])) { - $uid = $form_state['values']['import_uid']; - } - // Do the actual parsing on the local file. - if (l10n_community_import($file, $form_state['values']['langcode'], $form_state['values']['is_suggestion'], $uid)) { + if (l10n_community_import($file, $form_state['values']['langcode'], $form_state['values']['is_suggestion'], $form_state['values']['import_uid'])) { // Get status report on what was done in the process. list($inserted, $updated, $unchanged, $suggested, $duplicates) = _l10n_community_import_one_string(); drupal_set_message(t('The translation was successfully imported.')); Index: l10n_community/l10n_community.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.admin.inc,v retrieving revision 1.1.2.11 diff -u -p -r1.1.2.11 l10n_community.admin.inc --- l10n_community/l10n_community.admin.inc 18 Sep 2009 18:03:18 -0000 1.1.2.11 +++ l10n_community/l10n_community.admin.inc 21 Oct 2009 16:55:14 -0000 @@ -38,8 +38,8 @@ function l10n_community_settings_form() '#default_value' => variable_get('l10n_community_project_per_page', 10), ); $form['l10n_community_import_user'] = array( - '#title' => t('User associated with bulk imports'), - '#description' => t('The user associated with imports of Gettext files which have been translated by a team, so assigning the current user importing them would not be appropriate.'), + '#title' => t('Account associated with bulk imports'), + '#description' => t('The account associated with imports of Gettext files which have been translated by a team, so assigning the current user importing them would not be appropriate. Suggested username for this account is Multiple contributors to indicate the team nature.'), '#type' => 'textfield', '#default_value' => variable_get('l10n_community_import_user', ''), '#autocomplete_path' => 'user/autocomplete',