aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/enotify.php6
-rw-r--r--js/main.js16
-rw-r--r--mod/notify.php1
-rw-r--r--mod/ping.php39
-rw-r--r--view/theme/redbasic/css/style.css7
-rw-r--r--view/tpl/nav.tpl12
6 files changed, 64 insertions, 17 deletions
diff --git a/include/enotify.php b/include/enotify.php
index 140baf104..0e83adf08 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -324,11 +324,11 @@ function notification($params) {
}
$itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
- $msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
+ $msg = str_replace('$itemlink',$itemlink,$epreamble);
$r = q("update notify set msg = '%s' where id = %d and uid = %d limit 1",
dbesc($msg),
intval($notify_id),
- intval($params['uid'])
+ intval($datarray['uid'])
);
@@ -345,7 +345,7 @@ function notification($params) {
$r = q("select `id` from `notify-threads` where `master-parent-item` = %d and `receiver-uid` = %d limit 1",
intval($params['parent']),
- intval($params['uid']) );
+ intval($datarray['uid']) );
// If so, create the record of it and use a message-id smtp header.
diff --git a/js/main.js b/js/main.js
index 59c55551b..169717404 100644
--- a/js/main.js
+++ b/js/main.js
@@ -534,11 +534,11 @@ function updateConvItems(mode,data) {
/* notifications template */
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
- var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
- var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
- var notifications_empty = unescape($("#nav-notifications-menu").html());
+ var notifications_all = unescape($('<div>').append( $("#nav-" + notifyType + "-see-all").clone() ).html()); //outerHtml hack
+ var notifications_mark = unescape($('<div>').append( $("#nav-" + notifyType + "-mark-all").clone() ).html()); //outerHtml hack
+ var notifications_empty = unescape($("#nav-" + notifyType + "-menu").html());
- var notify_menu = $("#nav-notifications-menu");
+ var notify_menu = $("#nav-" + notifyType + "-menu");
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
$.get(pingExCmd,function(data) {
@@ -549,16 +549,16 @@ function updateConvItems(mode,data) {
if(data.notify.length==0){
- $("#nav-notifications-menu").html(notifications_empty);
+ $("#nav-" + notifyType + "-menu").html(notifications_empty);
} else {
- $("#nav-notifications-menu").html(notifications_all + notifications_mark);
+ $("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark);
$(data.notify).each(function() {
- text = "<span class='contactname'>"+this.name+"</span>" + ' ' + this.message;
+ text = "<span class='contactname'>"+this.name+"</span>" + ' ' + this.message + '<br />';
html = notifications_tpl.format(this.notify_link,this.photo,text,this.when,this.class);
- $("#nav-notifications-menu").append(html);
+ $("#nav-" + notifyType + "-menu").append(html);
});
}
diff --git a/mod/notify.php b/mod/notify.php
index dd26bfe7e..3157e8ce8 100644
--- a/mod/notify.php
+++ b/mod/notify.php
@@ -23,6 +23,7 @@ function notify_init(&$a) {
goaway($a->get_baseurl(true));
}
+
if(argc() > 2 && argv(1) === 'mark' && argv(2) === 'all' ) {
$r = q("update notify set seen = 1 where uid = %d",
intval(local_user())
diff --git a/mod/ping.php b/mod/ping.php
index 76d139711..b128cffeb 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -82,6 +82,42 @@ function ping_init(&$a) {
'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
'message' => strip_tags(bbcode($zz['msg']))
);
+ logger('notifs: ' . print_r($notifs,true));
+ }
+
+
+ }
+
+ echo json_encode(array('notify' => $notifs));
+ killme();
+
+ }
+
+
+ if(argc() > 1 && argv(1) === 'messages') {
+
+ $channel = $a->get_channel();
+ $t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan
+ where channel_id = %d and ( mail_flags & %d ) and not (mail_flags & %d )
+ and from_xchan != '%s' order by created desc limit 0,50",
+ intval(local_user()),
+ intval(MAIL_SEEN),
+ intval(MAIL_DELETED),
+ dbesc($channel['channel_hash'])
+ );
+
+ if($t) {
+ foreach($t as $zz) {
+// $msg = sprintf( t('sent you a private message.'), $zz['xchan_name']);
+ $notifs[] = array(
+ 'notify_link' => $a->get_baseurl() . '/message/' . $zz['id'],
+ 'name' => $zz['xchan_name'],
+ 'url' => $zz['xchan_url'],
+ 'photo' => $zz['xchan_photo_s'],
+ 'when' => relative_date($zz['created']),
+ 'class' => (($zz['mail_flags'] & MAIL_SEEN) ? 'notify-seen' : 'notify-unseen'),
+ 'message' => t('sent you a private message'),
+ );
}
}
@@ -90,6 +126,9 @@ function ping_init(&$a) {
}
+
+
+
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index d6cee8825..b855a045a 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -3774,6 +3774,13 @@ ul.menu-popup {
/* top: 90px; */
/* left: 400px; */
}
+
+.notify-menus {
+ width: 320px !important;
+ max-height: 400px;
+ overflow-y: scroll;overflow-style:scrollbar;
+}
+
#nav-notifications-menu {
width: 320px;
max-height: 400px;
diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl
index c952ca93c..1b4247280 100644
--- a/view/tpl/nav.tpl
+++ b/view/tpl/nav.tpl
@@ -29,7 +29,7 @@
<li id="nav-mail-link" class="nav-menu $sel.messages">
<a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" ><span class="icon mail">$nav.messages.1</span></a>
<span id="mail-update" class="nav-notify fakelink" rel="#nav-messages-menu"></span>
- <ul id="nav-messages-menu" class="menu-popup" rel="messages">
+ <ul id="nav-messages-menu" class="menu-popup notify-menus" rel="messages">
<li id="nav-messages-see-all"><a href="$nav.messages.all.0">$nav.messages.all.1</a></li>
<li id="nav-messages-mark-all"><a href="#">$nav.messages.mark.1</a></li>
<li class="empty">$emptynotifications</li>
@@ -54,12 +54,12 @@
{{ if $nav.notifications }}
- <li id="nav-notifications-linkmenu" class="nav-menu fakelink">
- <a rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
+ <li id="nav-notify-linkmenu" class="nav-menu fakelink">
+ <a rel="#nav-notify-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
<span id="notify-update" class="nav-notify"></span>
- <ul id="nav-notifications-menu" class="menu-popup" rel="notify">
- <li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
- <li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
+ <ul id="nav-notify-menu" class="menu-popup notify-menus" rel="notify">
+ <li id="nav-notify-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
+ <li id="nav-notify-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
<li class="empty">$emptynotifications</li>
</ul>
</li>