aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php10
-rw-r--r--engine/lib/views.php8
-rw-r--r--views/default/messages/list.php23
-rw-r--r--views/default/page_elements/messages.php28
-rw-r--r--views/default/page_shells/admin.php2
-rw-r--r--views/default/page_shells/default.php2
-rw-r--r--views/default/page_shells/walled_garden.php2
7 files changed, 40 insertions, 35 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index dcc468cd7..e6bbb3c01 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -608,7 +608,7 @@ function get_register($register_name) {
* whether the message addition was successful.
* @todo Clean up. Separate registering messages and retrieving them.
*/
-function system_messages($message = null, $register = "messages", $count = false) {
+function system_messages($message = null, $register = "success", $count = false) {
if (!isset($_SESSION['msg'])) {
$_SESSION['msg'] = array();
}
@@ -665,10 +665,10 @@ function count_messages($register = "") {
*
* @param string|array $message Message or messages to add
*
- * @return Bool
+ * @return bool
*/
function system_message($message) {
- return system_messages($message, "messages");
+ return system_messages($message, "success");
}
/**
@@ -678,10 +678,10 @@ function system_message($message) {
*
* @param string|array $error Error or errors to add
*
- * @return true|false Success response
+ * @return bool
*/
function register_error($error) {
- return system_messages($error, "errors");
+ return system_messages($error, "error");
}
/**
diff --git a/engine/lib/views.php b/engine/lib/views.php
index d2e63d1a5..17b93926c 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -563,10 +563,10 @@ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array())
if (count_messages()) {
// get messages - try for errors first
- $sysmessages = system_messages(NULL, "errors");
- if (count($sysmessages["errors"]) == 0) {
+ $messages = system_messages(NULL, "error");
+ if (count($messages["error"]) == 0) {
// no errors so grab rest of messages
- $sysmessages = system_messages(null, "");
+ $messages = system_messages(null, "");
} else {
// we have errors - clear out remaining messages
system_messages(null, "");
@@ -575,7 +575,7 @@ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array())
$vars['title'] = $title;
$vars['body'] = $body;
- $vars['sysmessages'] = $sysmessages;
+ $vars['sysmessages'] = $messages;
// Draw the page
$output = elgg_view("page_shells/$page_shell", $vars);
diff --git a/views/default/messages/list.php b/views/default/messages/list.php
deleted file mode 100644
index dad1c23ab..000000000
--- a/views/default/messages/list.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Elgg global system message list
- * Lists all system messages
- *
- * @package Elgg
- * @subpackage Core
- *
- * @uses $vars['object'] The array of message registers
- */
-
-if (!empty($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) {
-?>
-
-<ul class="elgg-system-messages">
-<?php
- foreach ($vars['object'] as $register => $list ) {
- echo elgg_view("messages/{$register}/list", array('object' => $list));
- }
-?>
-</ul>
-<?php
-}
diff --git a/views/default/page_elements/messages.php b/views/default/page_elements/messages.php
new file mode 100644
index 000000000..f44d1204b
--- /dev/null
+++ b/views/default/page_elements/messages.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Elgg global system message list
+ * Lists all system messages
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['object'] The array of message registers
+ */
+
+if (isset($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) {
+
+ echo '<ul class="elgg-system-messages">';
+
+ foreach ($vars['object'] as $type => $list ) {
+ foreach ($list as $message) {
+ echo "<li class=\"elgg-state-$type radius8\">";
+ echo elgg_view('output/longtext', array(
+ 'value' => $message,
+ 'parse_urls' => false
+ ));
+ echo '</li>';
+ }
+ }
+
+ echo '</ul>';
+}
diff --git a/views/default/page_shells/admin.php b/views/default/page_shells/admin.php
index 9fdbf2e28..ff427a6b7 100644
--- a/views/default/page_shells/admin.php
+++ b/views/default/page_shells/admin.php
@@ -24,6 +24,6 @@ if (empty($vars['title'])) {
}
echo elgg_view('page_elements/html_begin', $vars);
-echo elgg_view('messages/list', array('object' => $vars['sysmessages']));
+echo elgg_view('page_elements/messages', array('object' => $vars['sysmessages']));
echo elgg_view('page_elements/content', $vars);
echo elgg_view('page_elements/html_end', $vars); \ No newline at end of file
diff --git a/views/default/page_shells/default.php b/views/default/page_shells/default.php
index 3c643933a..3380188d9 100644
--- a/views/default/page_shells/default.php
+++ b/views/default/page_shells/default.php
@@ -27,7 +27,7 @@ if (empty($vars['title'])) {
echo elgg_view('page_elements/html_begin', $vars);
echo '<div class="elgg-page">';
-echo elgg_view('messages/list', array('object' => $vars['sysmessages']));
+echo elgg_view('page_elements/messages', array('object' => $vars['sysmessages']));
echo elgg_view('page_elements/topbar', $vars);
echo elgg_view('page_elements/header', $vars);
echo elgg_view('page_elements/body', $vars);
diff --git a/views/default/page_shells/walled_garden.php b/views/default/page_shells/walled_garden.php
index 5c4e54b75..dbd8d3ac0 100644
--- a/views/default/page_shells/walled_garden.php
+++ b/views/default/page_shells/walled_garden.php
@@ -268,7 +268,7 @@ body {background: white;}
</style>
<?php
-$view = elgg_view('messages/list', array('object' => $vars['sysmessages']));
+$view = elgg_view('page_elements/messages', array('object' => $vars['sysmessages']));
echo "<div id='walledgarden_sysmessages' class='clearfix'>$view</div>";
echo '<div id="walledgarden_container"><div id="walledgarden" class="clearfix">';