From 7b8a289c6b0af262de82efa607e838e37a236f8a Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 13 Feb 2008 16:42:41 +0000 Subject: Further message handling in the template git-svn-id: https://code.elgg.org/elgg/trunk@26 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 23 +++++++++++++++++++-- engine/start.php | 2 +- views/default/messages/errors/exception.php | 27 ------------------------- views/default/messages/exceptions/exception.php | 27 +++++++++++++++++++++++++ views/default/messages/list.php | 25 +++++++++++++++++++++++ views/default/pageshell.php | 7 +++++++ 6 files changed, 81 insertions(+), 30 deletions(-) delete mode 100644 views/default/messages/errors/exception.php create mode 100644 views/default/messages/exceptions/exception.php create mode 100644 views/default/messages/list.php diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 63baf16d5..7f98954a4 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -107,6 +107,25 @@ return $content; } + + /** + * Returns a representation of a full 'page' (which might be an HTML page, RSS file, etc, depending on the current view) + * + * @param unknown_type $title + * @param unknown_type $body + * @return unknown + */ + + function page_draw($title, $body) { + + return elgg_view('pageshell', array( + 'title' => $title, + 'body' => $body, + 'messages' => system_messages() + ) + ); + + } /** * Library loading and handling @@ -399,8 +418,8 @@ function __elgg_php_exception_handler($exception) { - $body = elgg_view("messages/errors/exception",array('object' => $exception)); - echo elgg_view("pageshell", array("title" => "Exception", "body" => $body)); + $body = elgg_view("messages/exceptions/exception",array('object' => $exception)); + echo page_draw("Exception", $body); } diff --git a/engine/start.php b/engine/start.php index 03274ae4b..73a1e6b2d 100644 --- a/engine/start.php +++ b/engine/start.php @@ -22,7 +22,7 @@ } if (!@include_once(dirname(__FILE__) . "/lib/elgglib.php")) { // Main Elgg library - throw new InstallationException("Could not load the main Elgg library."); + throw new InstallationException("Elgg could not load its main library."); } /** diff --git a/views/default/messages/errors/exception.php b/views/default/messages/errors/exception.php deleted file mode 100644 index 8973db714..000000000 --- a/views/default/messages/errors/exception.php +++ /dev/null @@ -1,27 +0,0 @@ - - -

- - getMessage()); - - ?> - -

\ No newline at end of file diff --git a/views/default/messages/exceptions/exception.php b/views/default/messages/exceptions/exception.php new file mode 100644 index 000000000..8973db714 --- /dev/null +++ b/views/default/messages/exceptions/exception.php @@ -0,0 +1,27 @@ + + +

+ + getMessage()); + + ?> + +

\ No newline at end of file diff --git a/views/default/messages/list.php b/views/default/messages/list.php new file mode 100644 index 000000000..bac2fab56 --- /dev/null +++ b/views/default/messages/list.php @@ -0,0 +1,25 @@ + $list ) { + echo elgg_view("messages/{$register}/list", array('object' => $list)); + } + + } + +?> \ No newline at end of file diff --git a/views/default/pageshell.php b/views/default/pageshell.php index a751143ee..eb10afc8e 100644 --- a/views/default/pageshell.php +++ b/views/default/pageshell.php @@ -13,7 +13,9 @@ * * @uses $vars['title'] The page title * @uses $vars['body'] The main content of the page + * @uses $vars['messages'] A 2d array of various message registers, passed from system_messages() */ + ?> @@ -21,6 +23,11 @@ <?php echo $vars['title']; ?> + 'messages')); + + ?>

-- cgit v1.2.3