diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-07-06 03:55:10 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-07-06 03:55:10 -0700 |
commit | e4ad206bfd288463a37cfd4f86e6f343e3a35f77 (patch) | |
tree | 6a7c84a815467fc34d7ce266b682f7816427f50d /mod/developers/views | |
parent | d15c4bdf3388b7eca709bd81c522ac1ebf087f0a (diff) | |
parent | b3382a41496bee4b66bc69421b9612bedfb77913 (diff) | |
download | elgg-e4ad206bfd288463a37cfd4f86e6f343e3a35f77.tar.gz elgg-e4ad206bfd288463a37cfd4f86e6f343e3a35f77.tar.bz2 |
Merge pull request #54 from cash/dev-tools
Fixes #3564 Adds the inspection tool and logging to the web page
Diffstat (limited to 'mod/developers/views')
7 files changed, 149 insertions, 7 deletions
diff --git a/mod/developers/views/default/admin/developers/inspect.php b/mod/developers/views/default/admin/developers/inspect.php new file mode 100644 index 000000000..cfa3de2ea --- /dev/null +++ b/mod/developers/views/default/admin/developers/inspect.php @@ -0,0 +1,14 @@ +<?php +/** +* Inspect View +* +* Inspect global variables of Elgg +*/ + +elgg_load_js('jquery.jstree'); +elgg_load_css('jquery.jstree'); + +echo elgg_view_form('developers/inspect', array('class' => 'developers-form-inspect')); + +echo '<div id="developers-inspect-results"></div>'; +echo elgg_view('graphics/ajax_loader', array('id' => 'developers-ajax-loader')); diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index 705ad00c6..287f4d99e 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -3,13 +3,6 @@ * Developer settings */ -$sections = array( - 'simple_cache' => 'checkbox', - 'view_path_cache' => 'checkbox', - 'display_errors' => 'checkbox', - 'debug_level' => 'pulldown', -); - $data = array( 'simple_cache' => array( 'type' => 'checkbox', @@ -39,6 +32,30 @@ $data = array( 'NOTICE' => elgg_echo('developers:debug:notice'), ), ), + + 'screen_log' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('screen_log', 'developers') == 1, + ), + + 'show_strings' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('show_strings', 'developers') == 1, + ), + + 'wrap_views' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('wrap_views', 'developers') == 1, + ), + + 'log_events' => array( + 'type' => 'checkbox', + 'value' => 1, + 'checked' => elgg_get_plugin_setting('log_events', 'developers') == 1, + ), ); $form_vars = array('id' => 'developer-settings-form'); diff --git a/mod/developers/views/default/developers/css.php b/mod/developers/views/default/developers/css.php index 5e8419945..4690945a9 100644 --- a/mod/developers/views/default/developers/css.php +++ b/mod/developers/views/default/developers/css.php @@ -12,3 +12,12 @@ #developer-settings-form label { margin-right: 5px; } +.elgg-page .jstree-default.jstree-focused { + background-color: transparent; +} +.developers-log { + background-color: #EBF5FF; + border: 1px solid #999; + color: #666; + padding: 20px; +} diff --git a/mod/developers/views/default/developers/log.php b/mod/developers/views/default/developers/log.php new file mode 100644 index 000000000..98120ca98 --- /dev/null +++ b/mod/developers/views/default/developers/log.php @@ -0,0 +1,18 @@ +<?php +/** + * Logging information + */ + +$cache = elgg_get_config('log_cache'); +$items = $cache->get(); + +echo '<div class="developers-log">'; +if ($items) { + foreach ($items as $item) { + echo '<pre>'; + print_r($item); + echo '</pre>'; + } +} + +echo '</div>';
\ No newline at end of file diff --git a/mod/developers/views/default/developers/tree.php b/mod/developers/views/default/developers/tree.php new file mode 100644 index 000000000..a8e47333b --- /dev/null +++ b/mod/developers/views/default/developers/tree.php @@ -0,0 +1,18 @@ +<?php +/** + * Displays a tree for inspection + * + * @uses $vars['tree'] + */ + +echo "<ul>"; +foreach ($vars['tree'] as $key => $arr) { + echo "<li><a>$key</a>"; + echo "<ul>"; + foreach ($arr as $value) { + echo "<li><a>$value</a></li>"; + } + echo "</ul>"; + echo "</li>"; +} +echo "</ul>"; diff --git a/mod/developers/views/default/forms/developers/inspect.php b/mod/developers/views/default/forms/developers/inspect.php new file mode 100644 index 000000000..a1b433fea --- /dev/null +++ b/mod/developers/views/default/forms/developers/inspect.php @@ -0,0 +1,23 @@ +<?php +/** + * Configuration inspection form + */ + +echo '<div>'; +echo '<p>' . elgg_echo('developers:inspect:help') . '</p>'; + +echo elgg_view('input/dropdown', array( + 'name' => 'inspect_type', + 'options_values' => array( + 'Actions' => 'Actions', + 'Events' => 'Events', + 'Plugin Hooks' => 'Plugin Hooks', + 'Simple Cache' => 'Simple Cache', + 'Views' => 'Views', + 'Web Services' => 'Web Services', + 'Widgets' => 'Widgets', + ), +)); + +echo elgg_view('input/submit', array('value' => elgg_echo('submit'))); +echo '</div>'; diff --git a/mod/developers/views/default/js/developers/developers.php b/mod/developers/views/default/js/developers/developers.php new file mode 100644 index 000000000..e6c249eb1 --- /dev/null +++ b/mod/developers/views/default/js/developers/developers.php @@ -0,0 +1,43 @@ +<?php +/** + * Elgg developers tool JavaScript + */ +?> + +elgg.provide('elgg.dev'); + +elgg.dev.init = function() { + $('.developers-form-inspect').live('submit', elgg.dev.inspectSubmit); +} + +/** + * Submit the inspect form through Ajax + * + * Requires the jQuery Form Plugin. + * + * @param {Object} event + */ +elgg.dev.inspectSubmit = function(event) { + + $("#developers-inspect-results").hide(); + $("#developers-ajax-loader").show(); + + $(this).ajaxSubmit({ + success : function(response) { + if (response) { + $("#developers-inspect-results").html(response.output); + $("#developers-inspect-results").jstree({ + "plugins" : [ "themes", "html_data" ], + "themes" : {"icons" : false} + }).bind("loaded.jstree", function() { + $("#developers-inspect-results").fadeIn(); + $("#developers-ajax-loader").hide(); + }); + } + } + }); + + event.preventDefault(); +} + +elgg.register_hook_handler('init', 'system', elgg.dev.init);
\ No newline at end of file |