Index: civicrm_theme.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/civicrm_theme/civicrm_theme.module,v retrieving revision 1.1 diff -u -u -p -r1.1 civicrm_theme.module --- civicrm_theme.module 1 Mar 2007 12:14:21 -0000 1.1 +++ civicrm_theme.module 11 Sep 2007 08:10:57 -0000 @@ -2,17 +2,33 @@ // $Id: civicrm_theme.module,v 1.1 2007/03/01 12:14:21 douggreen Exp $ function civicrm_theme_menu($may_cache) { + $items = array(); if ($may_cache) { + $items[] = array( + 'path' => 'admin/settings/civicrm_theme', + 'title' => t('CiviCRM Theme'), + 'description' => t('Set CiviCRM Theme options'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'civicrm_theme_admin_settings', + 'access' => user_access('administer site configuration'), + ); } elseif (arg(0) == 'civicrm') { global $custom_theme; - $theme_var = arg(1) == 'admin' ? 'civicrm_admin_theme' : 'civicrm_theme'; - if (($custom_theme = variable_get($theme_var, '0')) != '0') { + if (($custom_theme = variable_get(_civicrm_theme_get_var(), '0')) != '0') { $path = drupal_get_path('module', 'system'); drupal_add_css($path .'/admin.css', 'module'); } } - return array(); + return $items; +} + +function _civicrm_theme_get_var() { + $arg1 = arg(1); + if ($arg1 == 'admin' || ($arg1 == 'dashboard' && variable_get('civicrm_theme_dashboard', 0))) { + return 'civicrm_admin_theme'; + } + return 'civicrm_theme'; } function civicrm_form_alter($form_id, &$form) { @@ -34,3 +50,20 @@ function civicrm_form_alter($form_id, &$ $form = array_merge(array_slice($form, 0, 1), $newform, array_slice($form, 1)); } } + +function civicrm_theme_admin_settings() { + $form = array(); + $form['pages'] = array( + '#type' => 'fieldset', + '#title' => t('Admin Pages'), + '#collapsed' => FALSE, + '#collapsible' => FALSE, + ); + $form['pages']['civicrm_theme_dashboard'] = array( + '#type' => 'checkbox', + '#title' => t('Dashboard'), + '#default_value' => variable_get('civicrm_theme_dashboard', FALSE), + '#description' => t('Define additional CiviCRM pages which are really admin pages'), + ); + return system_settings_form($form); +}