From 180b95deaf306a2117fbb9652c1d28f6df52bc48 Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Fri, 22 May 2015 15:19:43 -0400 Subject: [PATCH] Added debug mode option to Environment configuration (DBOINCP-141) --- .../modules/boincuser/boincuser.admin.inc | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drupal/sites/default/boinc/modules/boincuser/boincuser.admin.inc b/drupal/sites/default/boinc/modules/boincuser/boincuser.admin.inc index 1788f5c31c..836a3dea94 100644 --- a/drupal/sites/default/boinc/modules/boincuser/boincuser.admin.inc +++ b/drupal/sites/default/boinc/modules/boincuser/boincuser.admin.inc @@ -42,6 +42,7 @@ function boincuser_admin_environment(&$form_state) { 'boinc_user_image_dir' => variable_get('boinc_user_image_dir', ''), 'boinc_host_sched_logs_dir' => variable_get('boinc_host_sched_logs_dir', ''), 'boinc_server_status_url' => variable_get('boinc_server_status_url', ''), + 'boinc_debug_mode' => variable_get('boinc_debug_mode', 0), ); //drupal_set_message(print_r($default, true)); //drupal_set_message(print_r($form_state, true)); @@ -49,10 +50,21 @@ function boincuser_admin_environment(&$form_state) { $show_overrides = FALSE; if ($default['boinc_root_dir']) { foreach ($default as $key => $dir) { - if ($key == 'boinc_root_dir') continue; - if (!$dir) { - $default[$key] = $form_state['values'][$key]; - $show_overrides = TRUE; + switch ($key) { + case 'boinc_config_xml_dir': + case 'boinc_html_inc_dir': + case 'boinc_project_config_dir': + case 'boinc_user_image_dir': + // If any of these values are not set, show the overrides section + if (!$dir) { + $default[$key] = $form_state['values'][$key]; + $show_overrides = TRUE; + break; + } + break; + default: + } + if ($show_overrides) { break; } } @@ -121,6 +133,11 @@ function boincuser_admin_environment(&$form_state) { '#default_value' => $default['boinc_host_sched_logs_dir'], '#description' => t('The filesystem directory that contains host scheduler logs'), ); + $form['boinc_debug_mode'] = array( + '#type' => 'checkbox', + '#title' => t('Show debug messages in system log'), + '#default_value' => $default['boinc_debug_mode'] + ); return system_settings_form($form); }