From 17c9081b86de87164ba51bacd7fe4c2b596f264f Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Mon, 31 Jan 2011 20:45:47 +0000 Subject: [PATCH] [gh-64] Merging from testing into staging git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@463 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/modules/unl/unl.module | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module index 992ac35b..78c2518e 100644 --- a/sites/all/modules/unl/unl.module +++ b/sites/all/modules/unl/unl.module @@ -85,6 +85,11 @@ function unl_permission() { 'description' => t('If this is not checked, a user can not change the permissions of the administrator role. Requires the "Administer permissions" permission.'), 'restrict access' => TRUE, ), + + 'unl theme settings' => array( + 'title' => t('Change Theme Settings'), + 'description' => t('Allow this role to change the current theme settings.'), + ) ); } @@ -103,6 +108,16 @@ function unl_menu() { 'file' => 'unl_migration.php', ); + $items['admin/themes'] = array( + 'title' => 'Appearance', + 'description' => 'Configure your theme.', + 'access callback' => 'unl_user_access', + 'access arguments' => array(array('!administer themes', 'unl theme settings')), + 'page callback' => 'drupal_get_form', + 'position' => 'left', + 'weight' => -6, + ); + if (conf_path() == 'sites/default') { $items['admin/sites/unl'] = array( 'title' => 'UNL Site Creation Tool', @@ -133,6 +148,15 @@ function unl_menu() { return $items; } +function unl_menu_alter(&$items) +{ + foreach (array('module', 'file', 'page arguments') as $key) { + $items['admin/themes'][$key] = $items['admin/appearance/settings/' . variable_get('theme_default')][$key]; + } + + return $items; +} + function unl_form_alter(&$form, $form_state, $form_id) { // Make new menu items expanded by default. if ($form_id == 'menu_edit_item' && $form['mlid']['#value'] == 0) { @@ -318,4 +342,20 @@ function unl_url_outbound_alter(&$path, &$options, $original_path) { $options['https'] = (bool) (variable_get('https', 0) && !$generic_user); } - +function unl_user_access($permissions, $account = NULL) { + foreach ($permissions as $permission) { + if (substr($permission, 0, 1) == '!') { + $permission = substr($permission, 1); + $result = !user_access($permission, $account); + } + else { + $result = user_access($permission, $account); + } + + if (!$result) { + return FALSE; + } + } + + return TRUE; +} -- GitLab