Index: i18n_access.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/i18n_access/i18n_access.module,v retrieving revision 1.2 diff -u -r1.2 i18n_access.module --- i18n_access.module 2 Feb 2009 16:50:16 -0000 1.2 +++ i18n_access.module 5 Jan 2010 12:11:42 -0000 @@ -61,11 +61,22 @@ $perms[$uid] = array(); } } + // adding the default languages if permission has been granted + if (user_access('access selected languages')) { + $perms[$uid] = array_merge($perms[$uid], drupal_map_assoc(variable_get('i18n_access_languages', array()))); + } return $perms[$uid]; } /** + * Implementation of hook_perm() + */ +function i18n_access_perm() { + return array('access selected languages'); +} + +/** * Implementation of hook_form_alter(). */ function i18n_access_form_alter(&$form, $form_state, $form_id) { @@ -180,8 +191,37 @@ return theme('table', $header, $rows); } +/** + * Implementation of hook_menu() + */ +function i18n_access_menu() { + $items = array(); - - - - + $items['admin/settings/language/access'] = array( + 'title' => t('Access'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('i18n_access_admin_settings'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 10, + ); + + return $items; +} + +/** + * Admin settings form + */ +function i18n_access_admin_settings() { + + $form['i18n_access_languages'] = array( + '#title' => t('Select the default access languages'), + '#type' => 'select', + '#multiple' => 'true', + '#options' => array(I18N_ACCESS_LANGUAGE_NEUTRAL => t('Language neutral')) + locale_language_list('name'), + '#default_value' => variable_get('i18n_access_languages', array()), + '#description' => t("This selection of languages will be connected with the 'access selected languages' permission which you can use to grant a role access to these languages at once.") + ); + + return system_settings_form($form); +} \ No newline at end of file