]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
updated the diagnostics plugin to use the new admin backend
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 29 Dec 2010 22:39:25 +0000 (22:39 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 29 Dec 2010 22:39:25 +0000 (22:39 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7762 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/diagnostics/index.php [deleted file]
mod/diagnostics/start.php
mod/diagnostics/views/default/admin/utilities/diagnostics.php [new file with mode: 0644]
mod/diagnostics/views/default/diagnostics/forms/download.php
mod/diagnostics/views/default/diagnostics/runalltests.php [deleted file]

diff --git a/mod/diagnostics/index.php b/mod/diagnostics/index.php
deleted file mode 100644 (file)
index 1ef9e53..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Elgg diagnostics
- *
- * @package ElggDiagnostics
- */
-
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-admin_gatekeeper();
-elgg_set_context('admin');
-
-// system diagnostics
-$content = elgg_view_title(elgg_echo('diagnostics'));
-$content .= "<div class='admin_settings diagnostics'>";
-$content .= "<h3>".elgg_echo('diagnostics:report')."</h3>".elgg_echo('diagnostics:description') . elgg_view('diagnostics/forms/download');
-
-// unit tests
-$content .= "<h3>".elgg_echo('diagnostics:unittester')."</h3>";
-$test_body = "<p>" . elgg_echo('diagnostics:unittester:description') . "</p>";
-$test_body .= "<p>" . elgg_echo('diagnostics:unittester:warning') . "</p>";
-
-if (isset($CONFIG->debug)) {
-       // create a button to run tests
-       $js = "onclick=\"window.location='".elgg_get_site_url()."engine/tests/suite.php'\"";
-       $params = array('value' => elgg_echo('diagnostics:test:executeall'), 'js' => $js);
-       $test_body .= elgg_view('input/button', $params);
-} else {
-       // no tests when not in debug mode
-       $test_body .= elgg_echo('diagnostics:unittester:debug');
-}
-
-$content .= $test_body;
-$content .= "</div>";
-
-$body = elgg_view_layout("one_column_with_sidebar", array('content' => $content));
-echo elgg_view_page(elgg_echo('diagnostics'), $body);
index a80513b6c05ed26e08651f77adb4ca2778100786..b161e47c4f060f78d97e5532298cb61c37e0a945 100644 (file)
@@ -5,45 +5,23 @@
  * @package ElggDiagnostics
  */
 
+elgg_register_event_handler('init', 'system', 'diagnostics_init');
+
 /**
  * Initialise the diagnostics tool
  *
  */
 function diagnostics_init() {
-       global $CONFIG;
 
        // Register a page handler, so we can have nice URLs
        register_page_handler('diagnostics','diagnostics_page_handler');
 
-       // Register some actions
-       elgg_register_action("diagnostics/download", $CONFIG->pluginspath . "diagnostics/actions/download.php");
-}
+       // Add admin menu item
+       elgg_add_admin_menu_item('diagnostics', elgg_echo('diagnostics'), 'utilities');
 
-/**
- * Adding the diagnostics to the admin menu
- *
- */
-function diagnostics_pagesetup() {
-       if (elgg_get_context() == 'admin' && isadminloggedin()) {
-               elgg_register_menu_item('page', array(
-                       'name' => 'diagnostics',
-                       'title' => elgg_echo('diagnostics'),
-                       'url' => 'pg/diagnostics/',
-                       'context' => 'admin',
-               ));
-       }
-}
-
-/**
- * Diagnostics page.
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function diagnostics_page_handler($page) {
-       global $CONFIG;
-
-       // only interested in one page for now
-       include($CONFIG->pluginspath . "diagnostics/index.php");
+       // Register some actions
+       $file = elgg_get_plugin_path() . "diagnostics/actions/download.php";
+       elgg_register_action("diagnostics/download", $file, 'admin');
 }
 
 /**
@@ -175,10 +153,6 @@ function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params) {
        return $returnvalue;
 }
 
-// Initialise log browser
-elgg_register_event_handler('init','system','diagnostics_init');
-elgg_register_event_handler('pagesetup','system','diagnostics_pagesetup');
-
 elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_basic_hook", 0); // show basics first
 elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_plugins_hook", 2); // Now the plugins
 elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_sigs_hook", 1); // Now the signatures
diff --git a/mod/diagnostics/views/default/admin/utilities/diagnostics.php b/mod/diagnostics/views/default/admin/utilities/diagnostics.php
new file mode 100644 (file)
index 0000000..44e6fa1
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+
+$title = elgg_view_title(elgg_echo('diagnostics'));
+
+$diagnostics = "<h3>".elgg_echo('diagnostics:report')."</h3>";
+$diagnostics .= elgg_echo('diagnostics:description');
+$diagnostics .= elgg_view('diagnostics/forms/download');
+
+// unit tests
+$unit_tests = "<h3>".elgg_echo('diagnostics:unittester')."</h3>";
+$unit_tests .= "<p>" . elgg_echo('diagnostics:unittester:description') . "</p>";
+$unit_tests .= "<p>" . elgg_echo('diagnostics:unittester:warning') . "</p>";
+
+if (isset($CONFIG->debug)) {
+       // create a button to run tests
+       $params = array(
+               'text' => elgg_echo('diagnostics:test:executeall'),
+               'href' => elgg_get_site_url() . 'engine/tests/suite.php',
+               'class' => 'elgg-submit-button',
+       );
+       $unit_tests .= elgg_view('output/url', $params);
+} else {
+       // no tests when not in debug mode
+       $unit_tests .= elgg_echo('diagnostics:unittester:debug');
+}
+
+// display admin body
+echo <<<HTML
+$title
+<div class="admin_settings diagnostics">
+       $diagnostics
+       $unit_tests
+</div>
+HTML;
index cbbd414df9ed182dfc549dc1a4d27da4d6aa5b7c..e5d9af5576f604e868881776e777d7ba88f00cd8 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-       /**
-        * Elgg diagnostics
-        * 
-        * @package ElggDiagnostics
-        */
-       
-       $form_body = elgg_view('input/submit', array('value' => elgg_echo('diagnostics:download')));
-       echo elgg_view('input/form', array('body' => $form_body, 'action' => "action/diagnostics/download"));
-?>
\ No newline at end of file
+/**
+ * Elgg diagnostics
+ * 
+ * @package ElggDiagnostics
+ */
+
+$form_body = elgg_view('input/submit', array('value' => elgg_echo('diagnostics:download')));
+echo elgg_view('input/form', array('body' => $form_body, 'action' => "action/diagnostics/download"));
diff --git a/mod/diagnostics/views/default/diagnostics/runalltests.php b/mod/diagnostics/views/default/diagnostics/runalltests.php
deleted file mode 100644 (file)
index 05dd05d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-       /**
-        * Elgg diagnostics - unit tester
-        * 
-        * @package ElggDiagnostics
-        */
-
-       $form_body .= elgg_view('input/submit', array('internalname' => 'execute', 'value' => elgg_echo('diagnostics:test:executeall')));
-
-       echo elgg_view('input/form', array('action' => "pg/diagnostics/tests/all", 'body' => $form_body));      
-?>
\ No newline at end of file