]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2242. Can now delete admin notices manually.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Mar 2011 00:24:04 +0000 (00:24 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Mar 2011 00:24:04 +0000 (00:24 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8737 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/admin/delete_admin_notice.php [new file with mode: 0644]
engine/lib/admin.php
languages/en.php
views/default/css/admin.php
views/default/js/admin.php
views/default/object/admin_notice.php
views/default/page/admin.php

diff --git a/actions/admin/delete_admin_notice.php b/actions/admin/delete_admin_notice.php
new file mode 100644 (file)
index 0000000..a9c3b87
--- /dev/null
@@ -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
index 8ef01e7cce00aeded6350cfa0202abb6e06cc824..efb1a458140958d1d6e9efa97eea09858c6511d0 100644 (file)
@@ -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');
index 375ba613510848f76939d58d0e50e30c21c6e690..ad052870ad3f3717a7d0a64ee7e6aac8ca744d3c 100644 (file)
@@ -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()',
 
 /**
index 2a107b1ca3996070bb8ebc116a7f4c6c894b9fdc..c896095df791b76781e532e891f7d854d748fc42 100644 (file)
@@ -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;
index afffe95f086092ba7337ce45f23e3bdb5acf86b9..2f2f5928771e847b2dae2752d9fc9dda1bbb2432 100644 (file)
@@ -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
index 1a162ce4d184405812c9cddc5a190e2e62312e72..45485a1dcb12c6041e30d3e6a133325e083c6556 100644 (file)
@@ -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>";
 }
 
index b3871fe3370872f5d7326b5f64a65f035f269fde..d0e7915ccd5b126801e85f01604332e7a536e80f 100644 (file)
@@ -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);
        }