').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
- var notifications_empty = unescape($("#nav-notifications-menu").html());
+ var notifications_all = unescape($('
').append( $("#nav-" + notifyType + "-see-all").clone() ).html()); //outerHtml hack
+ var notifications_mark = unescape($('
').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 = ""+this.name+"" + ' ' + this.message;
+ text = ""+this.name+"" + ' ' + this.message + '
';
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 @@