aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/delete_admin_notice.php13
-rw-r--r--engine/lib/admin.php5
-rw-r--r--languages/en.php4
-rw-r--r--views/default/css/admin.php5
-rw-r--r--views/default/js/admin.php20
-rw-r--r--views/default/object/admin_notice.php11
-rw-r--r--views/default/page/admin.php3
7 files changed, 58 insertions, 3 deletions
diff --git a/actions/admin/delete_admin_notice.php b/actions/admin/delete_admin_notice.php
new file mode 100644
index 000000000..a9c3b8758
--- /dev/null
+++ b/actions/admin/delete_admin_notice.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Removes an admin notice.
+ */
+
+$guid = get_input('guid');
+$notice = get_entity($guid);
+
+if (!(elgg_instanceof($notice, 'object', 'admin_notice') && $notice->delete())) {
+ register_error(elgg_echo("admin:notices:could_not_delete"));
+}
+
+forward(REFERER); \ No newline at end of file
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 8ef01e7cc..efb1a4581 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -25,6 +25,9 @@
*/
function elgg_add_admin_notice($id, $message) {
if ($id && $message) {
+ if (elgg_admin_notice_exists($id)) {
+ return false;
+ }
$admin_notice = new ElggObject();
$admin_notice->subtype = 'admin_notice';
// admins can see ACCESS_PRIVATE but no one else can.
@@ -173,6 +176,8 @@ function admin_init() {
elgg_register_action('admin/menu/save', '', 'admin');
+ elgg_register_action('admin/delete_admin_notice', '', 'admin');
+
elgg_register_action('admin/plugins/simple_update_states', '', 'admin');
elgg_register_action('profile/fields/reset', '', 'admin');
diff --git a/languages/en.php b/languages/en.php
index 375ba6135..ad052870a 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -606,6 +606,8 @@ $english = array(
'admin:plugins:category:extension' => 'Extensions',
'admin:plugins:category:service' => 'Service/API',
+ 'admin:notices:could_not_delete' => 'Could not delete notice.',
+
/**
* Plugins
@@ -971,6 +973,8 @@ Once you have logged in, we highly recommend that you change your password.
Upgrading Elgg documentation</a>. If you require assistance, please post to the
<a href="http://community.elgg.org/pg/groups/discussion/">Community Support Forums</a>.',
+ 'update:twitter_api:settings_found_unknown_status' => 'Twitter API (previously Twitter Service) settings were found, but its status could not be determined. Please re-activate it manually.',
+
'deprecated:function' => '%s() was deprecated by %s()',
/**
diff --git a/views/default/css/admin.php b/views/default/css/admin.php
index 2a107b1ca..c896095df 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -1072,7 +1072,7 @@ ul.admin_plugins {
color: black;
border: 1px solid blue;
font-weight: bold;
- padding:3px 10px;
+ padding: 3px 0px 3px 10px;
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
@@ -1083,6 +1083,9 @@ ul.admin_plugins {
border-radius: 4px;
}
+.admin_notices a {
+ float: right;
+}
.add-user form {
width:300px;
diff --git a/views/default/js/admin.php b/views/default/js/admin.php
index afffe95f0..2f2f59287 100644
--- a/views/default/js/admin.php
+++ b/views/default/js/admin.php
@@ -5,6 +5,7 @@
* @since 1.8
*/
?>
+//<script>
elgg.provide('elgg.admin');
elgg.admin.init = function () {
@@ -45,6 +46,9 @@ elgg.admin.init = function () {
handle: 'span.elgg-state-draggable',
stop: elgg.admin.moveProfileField
});
+
+ // admin notices delete ajax
+ $('a.elgg-admin-notice').click(elgg.admin.deleteNotice);
}
/**
@@ -146,4 +150,20 @@ elgg.admin.moveProfileField = function(e, ui) {
});
}
+/**
+ * Fires the ajax action to delete the admin notice then hides the notice.
+ *
+ * @return void
+ */
+elgg.admin.deleteNotice = function(e) {
+ e.preventDefault();
+ var $container = $(this).closest('p');
+
+ elgg.action($(this).attr('href'), {
+ success: function(json) {
+ $container.slideUp('medium');
+ }
+ });
+}
+
elgg.register_hook_handler('init', 'system', elgg.admin.init, 1000); \ No newline at end of file
diff --git a/views/default/object/admin_notice.php b/views/default/object/admin_notice.php
index 1a162ce4d..45485a1dc 100644
--- a/views/default/object/admin_notice.php
+++ b/views/default/object/admin_notice.php
@@ -6,6 +6,15 @@
if (isset($vars['entity']) && elgg_instanceof($vars['entity'], 'object', 'admin_notice')) {
$notice = $vars['entity'];
$message = $notice->description;
- echo "<p>$message</p>";
+
+ $delete = elgg_view('output/url', array(
+ 'href' => "action/admin/delete_admin_notice?guid=$notice->guid",
+ 'text' => '<span class="elgg-icon elgg-icon-delete"></span>',
+ 'encode' => false,
+ 'is_action' => true,
+ 'class' => 'elgg-admin-notice'
+ ));
+
+ echo "<p>$message$delete</p>";
}
diff --git a/views/default/page/admin.php b/views/default/page/admin.php
index b3871fe33..d0e7915cc 100644
--- a/views/default/page/admin.php
+++ b/views/default/page/admin.php
@@ -16,7 +16,8 @@ header("Content-type: text/html; charset=UTF-8");
$messages = $vars['sysmessages'];
$notices_html = '';
-if ($notices = elgg_get_admin_notices()) {
+$notices = elgg_get_admin_notices();
+if ($notices) {
foreach ($notices as $notice) {
$notices_html .= elgg_view_entity($notice);
}