Skip to content

Commit

Permalink
v6.1.2.0
Browse files Browse the repository at this point in the history
V6.1.2.0 ~ Added javascript to perform the calls so that the page doesn't have to refresh each time you mark or delete a notification.

Added the Delete All Reactions as a button on the bottom of the Notifications dropdown, next to the See All link.
  • Loading branch information
Michieal authored Mar 6, 2022
1 parent f8f204a commit 1de9bbb
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 6 deletions.
10 changes: 10 additions & 0 deletions MarkNotification/plugins/default/css/marknotif.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,13 @@
border-radius: 3px;
padding: 5px
}

.apop-bottom-link{
float:right;
position:relative;
display:inline;
border: 1px solid white;
border-radius: 3px;
margin-top: -5px;
margin-right: 5px;
}
50 changes: 50 additions & 0 deletions MarkNotification/plugins/default/js/marknotif.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Apophis Software Component for OSSN v. 6.1.
*
* @package Apophis Software MarkNotification
* @author Apophis Software
* @copyright (C) Apophis Software
* @license Open Source Social Network License (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence
* @link https://www.apophissoftware.com/
*/
// <script>
Ossn.register_callback('ossn', 'init', 'MarkNotification_js_init');
function MarkNotification_js_init(){

$(document).ready(function(){
$('body').delegate('.apop-notif-read', 'click', function(){
var $guid = $(this).attr('data-guid');
});
$('body').delegate('.apop-notif-delete', 'click', function(){
var $guid = $(this).attr('data-guid');
});
});
}

function mnInstant(type, guid) {
let xhr = new XMLHttpRequest();

if (type == 1) {
let url = Ossn.site_url + "action/mark/delete?guid=" + guid.toString();
url = Ossn.AddTokenToUrl(url);

xhr.open('PUT', url, true);
xhr.setRequestHeader("Content-Type", "application/json")
xhr.send(null);

Ossn.trigger_message('Notification has been deleted. You may have to refresh to see it removed.','success' );
Ossn.NotificationsCheck();
}

if (type == 2) {
let url = Ossn.site_url + "action/mark/read?guid=" + guid.toString();
url = Ossn.AddTokenToUrl(url);

xhr.open('PUT', url, true);
xhr.setRequestHeader("Content-Type", "application/json")
xhr.send(null);

Ossn.trigger_message('Notification has been Marked Read. You may have to refresh to see it changed.','success' );
Ossn.NotificationsCheck();
}
}
10 changes: 4 additions & 6 deletions MarkNotification/plugins/default/notifications/pages/all.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php
/**
* Open Source Social Network
*
* @package (openteknik.com).ossn
* @author OSSN Core Team <[email protected]>
* @copyright (C) OpenTeknik LLC
* @license Open Source Social Network License (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence
* @link https://www.opensource-socialnetwork.org/
* @package MarkNotification
* @author Michieal O'Sullivan
* @copyright (C) Apophis Software. (C) OpenTeknik LLC, for base code.
* @license GNU General Public License https://www.gnu.org/licenses/gpl-3.0.en.html; Base code: (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence
*/

$get = new OssnNotifications;
Expand All @@ -26,7 +25,6 @@
$data = "<a href='" . $link . "' class='apop-notif-delete-button' title='" . $notif_title . "' >" . $notif_text . "</a>";
$list .= '<div>' . $data . '<br/><br/></div>';


if ($notifications) {
foreach ($notifications as $item) {
$list .= $item->toTemplate();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Open Source Social Network
* @link https://www.opensource-socialnetwork.org/
* @package MarkNotification
* @author Michieal O'Sullivan
* @copyright (C) Apophis Software. (C) OpenTeknik LLC, for base code.
* @license GNU General Public License https://www.gnu.org/licenses/gpl-3.0.en.html; Base code: (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence
*/
?>
<div class="messages-inner">
<?php
echo '<div class="ossn-notifications-all">';
if (!empty($params['notifications'])) {
foreach ($params['notifications'] as $not) {
echo $not;
}
}
echo '</div>';
?>
</div>
<div class="bottom-all">
<?php
$notif_text = ossn_print('mark:notification:delete:likes');
$notif_title = ossn_print('mark:notification:delete:likes:title');
$link = htmlspecialchars(ossn_site_url("action/mark/delete?dal=1", true));
$bottomlink = "<a href='" . $link . "' class='apop-bottom-link' title='" . $notif_title . "' >" . $notif_text . "</a>";

if (isset($params['seeall'])) {
?>
<a href="<?php echo $params['seeall']; ?>"><?php echo ossn_print('see:all'); ?></a> <?php echo $bottomlink;?>
<?php } ?>
</div>

0 comments on commit 1de9bbb

Please sign in to comment.