diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-15 02:07:22 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-15 02:07:22 +0000 |
commit | e1e9ccd8d3f8a0d773ed7af4fb886781fd45cb3a (patch) | |
tree | 735ba973f656f573253e2deb89ab9f05c5a5c38b /mod/developers | |
parent | 002417221f727d93b20eebc40bb85509d1584880 (diff) | |
download | elgg-e1e9ccd8d3f8a0d773ed7af4fb886781fd45cb3a.tar.gz elgg-e1e9ccd8d3f8a0d773ed7af4fb886781fd45cb3a.tar.bz2 |
Fixes #3009 a bare bones developer tools settings
git-svn-id: http://code.elgg.org/elgg/trunk@8713 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/developers')
-rw-r--r-- | mod/developers/actions/developers/settings.php | 23 | ||||
-rw-r--r-- | mod/developers/languages/en.php | 17 | ||||
-rw-r--r-- | mod/developers/manifest.xml | 4 | ||||
-rw-r--r-- | mod/developers/start.php | 11 | ||||
-rw-r--r-- | mod/developers/views/default/admin/developers/settings.php | 41 | ||||
-rw-r--r-- | mod/developers/views/default/forms/developers/settings.php | 37 |
6 files changed, 102 insertions, 31 deletions
diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php index 56509282f..d8be34866 100644 --- a/mod/developers/actions/developers/settings.php +++ b/mod/developers/actions/developers/settings.php @@ -3,4 +3,27 @@ * Save the developer settings */ +$site = elgg_get_site_entity(); + +if (get_input('simple_cache')) { + elgg_enable_simplecache(); +} else { + elgg_disable_simplecache(); +} + +if (get_input('view_path_cache')) { + elgg_enable_filepath_cache(); +} else { + elgg_disable_filepath_cache(); +} + +elgg_set_plugin_setting('display_errors', get_input('display_errors'), 'developers'); + +$debug = get_input('debug_level'); +if ($debug) { + set_config('debug', $debug, $site->getGUID()); +} else { + unset_config('debug', $site->getGUID()); +} + forward(REFERER); diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 8bc1f596a..41bdcdddb 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -12,13 +12,18 @@ $english = array( // settings 'developers:label:simple_cache' => 'Use simple cache', - 'developers:help:simple_cache' => 'Turn off this file cache when developing', - 'developers:label:views_cache' => 'Use view path cache', - 'developers:help:views_cache' => 'Turn this off when developing', + 'developers:help:simple_cache' => 'Turn off the file cache when developing. Otherwise, changes to your views (including css) will be ignored.', + 'developers:label:view_path_cache' => 'Use view path cache', + 'developers:help:view_path_cache' => 'Turn this off when developing. Otherwise, new views in your plugins will not be registered.', 'developers:label:debug_level' => "Trace level", - 'developers:help:debug_level' => "", - 'developers:label:' => '', - 'developers:help:' => '', + 'developers:help:debug_level' => "This controls the amount of information logged. See elgg_log() for more information.", + 'developers:label:display_errors' => 'Display fatal PHP errors', + 'developers:help:display_errors' => "By default, Elgg's .htaccess file supresses the display of fatal errors.", + + 'developers:debug:off' => 'Off', + 'developers:debug:error' => 'Error', + 'developers:debug:warning' => 'Warning', + 'developers:debug:notice' => 'Notice', // theme preview 'theme_preview:general' => 'General', diff --git a/mod/developers/manifest.xml b/mod/developers/manifest.xml index ae1059e59..4a7ed82bd 100644 --- a/mod/developers/manifest.xml +++ b/mod/developers/manifest.xml @@ -5,8 +5,8 @@ <version>1.0</version> <category>bundled</category> <category>development</category> - <blurb>Developer tools</blurb> - <description>A set of tools for writing plugins and themes.</description> + <blurb>Developer tools for Elgg</blurb> + <description>A set of tools for writing plugins and themes. It is recommended that you have this plugin at the top of the plugin list.</description> <website>http://www.elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> <license>GNU Public License version 2</license> diff --git a/mod/developers/start.php b/mod/developers/start.php index 3c2f6bd5f..dc8e6f66e 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -3,6 +3,9 @@ * Elgg developer tools */ +// we want to run this as soon as possible - other plugins should not need to do this +developers_process_settings(); + elgg_register_event_handler('init', 'system', 'developers_init'); function developers_init() { @@ -16,6 +19,14 @@ function developers_init() { elgg_register_action('developers/settings', "$action_base/settings.php", 'admin'); } +function developers_process_settings() { + if (elgg_get_plugin_setting('display_errors', 'developers') == 1) { + ini_set('display_errors', 1); + } else { + ini_set('display_errors', 0); + } +} + function developers_setup_menu() { if (elgg_in_context('admin')) { elgg_register_admin_menu_item('develop', 'settings', 'developers'); diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index 990d77263..705ad00c6 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -3,5 +3,44 @@ * Developer settings */ +$sections = array( + 'simple_cache' => 'checkbox', + 'view_path_cache' => 'checkbox', + 'display_errors' => 'checkbox', + 'debug_level' => 'pulldown', +); + +$data = array( + 'simple_cache' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_config('simplecache_enabled') == 1, + ), + + 'view_path_cache' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_config('viewpath_cache_enabled') == 1, + ), + + 'display_errors' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('display_errors', 'developers') == 1, + ), + + 'debug_level' => array( + 'type' => 'dropdown', + 'value' => elgg_get_config('debug'), + 'options_values' => array( + false => elgg_echo('developers:debug:off'), + 'ERROR' => elgg_echo('developers:debug:error'), + 'WARNING' => elgg_echo('developers:debug:warning'), + 'NOTICE' => elgg_echo('developers:debug:notice'), + ), + ), +); + $form_vars = array('id' => 'developer-settings-form'); -echo elgg_view_form('developers/settings', $form_vars, array());
\ No newline at end of file +$body_vars = array('data' => $data); +echo elgg_view_form('developers/settings', $form_vars, $body_vars); diff --git a/mod/developers/views/default/forms/developers/settings.php b/mod/developers/views/default/forms/developers/settings.php index 2a3825500..371a2de2b 100644 --- a/mod/developers/views/default/forms/developers/settings.php +++ b/mod/developers/views/default/forms/developers/settings.php @@ -2,40 +2,33 @@ /** * Settings form body * - * @uses $vars['values'] Array of current values - * @uses $vars['options'] Array of possible options + * @uses $vars['values'] */ $form_body = '<p>' . elgg_echo('elgg_dev_tools:settings:explanation') . '</p>'; -$sections = array( - 'simple_cache' => 'checkbox', - 'views_cache' => 'checkbox', - //'display_errors' => 'checkbox', - 'debug_level' => 'pulldown', -); - -foreach ($sections as $name => $type) { - echo '<p>'; - if ($type == 'checkbox') { - echo elgg_view("input/$type", array( - 'internalname' => $name, - 'value' => $vars['settings'][$name], +foreach ($vars['data'] as $name => $info) { + echo '<div>'; + if ($info['type'] == 'checkbox') { + echo elgg_view("input/checkbox", array( + 'name' => $name, + 'value' => $info['value'], + 'checked' => $info['checked'], )); echo '<label>' . elgg_echo("developers:label:$name") . '</label>'; echo '<span class="elgg-text-help">' . elgg_echo("developers:help:$name") . '</span>'; } else { echo '<label>' . elgg_echo("developers:label:$name") . '</label>'; - echo elgg_view("input/$type", array( - 'internalname' => $name, - 'value' => $vars['settings'][$name], - 'options' => $vars['options'][$name], + echo elgg_view("input/{$info['type']}", array( + 'name' => $name, + 'value' => $info['value'], + 'options_values' => $info['options_values'], )); echo '<span class="elgg-text-help">' . elgg_echo("developers:help:$name") . '</span>'; } - echo '</p>'; + echo '</div>'; } -echo '<p>'; +echo '<div>'; echo elgg_view('input/submit', array('value' => elgg_echo('save'))); -echo '</p>';
\ No newline at end of file +echo '</div>'; |