-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
4 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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(); | ||
|
33 changes: 33 additions & 0 deletions
33
MarkNotification/plugins/default/notifications/pages/notification/notification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |