--- /dev/null
+<?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
*/
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.
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');
'admin:plugins:category:extension' => 'Extensions',
'admin:plugins:category:service' => 'Service/API',
+ 'admin:notices:could_not_delete' => 'Could not delete notice.',
+
/**
* Plugins
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()',
/**
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);
border-radius: 4px;
}
+.admin_notices a {
+ float: right;
+}
.add-user form {
width:300px;
* @since 1.8
*/
?>
+//<script>
elgg.provide('elgg.admin');
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);
}
/**
});
}
+/**
+ * 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
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>";
}
$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);
}