From 41636a50aa4fd3f53ad9f9e9d797bfcc37ba8e13 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 22 Feb 2012 23:34:30 -0800 Subject: [PATCH] new notify sort of working in testbubble --- include/enotify.php | 2 +- include/nav.php | 3 ++- js/main.js | 11 ++++++++++- mod/notifications.php | 35 +++++++++++++++++++++++++++++++++++ view/notify.tpl | 3 +++ view/theme/testbubble/nav.tpl | 1 + 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100755 view/notify.tpl diff --git a/include/enotify.php b/include/enotify.php index 6af2243f0d..1eb3b54762 100755 --- a/include/enotify.php +++ b/include/enotify.php @@ -39,7 +39,7 @@ function notification($params) { $subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename); $preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']); - $epreamble = sprintf( t('%s commented on %s you have been following.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('an item/conversation') . '[/url]'); + $epreamble = sprintf( t('%s commented in %s.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a watched conversation') . '[/url]'); $sitelink = t('Please visit %s to view and/or reply to the conversation.'); $tsitelink = sprintf( $sitelink, $siteurl ); diff --git a/include/nav.php b/include/nav.php index c8a44af80b..6fee7adb24 100755 --- a/include/nav.php +++ b/include/nav.php @@ -116,7 +116,8 @@ function nav(&$a) { if($_SESSION['page_flags'] == PAGE_NORMAL) { $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests')); $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications')); - $nav['notifications']['all']=array('notifications/network', t('See all notifications', "", "")); + $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", ""); + $nav['notifications']['mark'] = array('', t('Mark all notifications seen'), '',''); } diff --git a/js/main.js b/js/main.js index 4cb278ee87..3a10ae468c 100755 --- a/js/main.js +++ b/js/main.js @@ -89,6 +89,7 @@ /* notifications template */ var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html()); var notifications_all = unescape($('
').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack + var notifications_mark = unescape($('
').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack var notifications_empty = unescape($("#nav-notifications-menu").html()); /* nav update event */ @@ -117,7 +118,7 @@ $("#nav-notifications-linkmenu").addClass("on"); nnm = $("#nav-notifications-menu"); - nnm.html(notifications_all); + nnm.html(notifications_all + notifications_mark); //nnm.attr('popup','true'); eNotif.children("note").each(function(){ @@ -518,6 +519,14 @@ function checkboxhighlight(box) { } } +function notifyMarkAll() { + $.get('notify/mark/all', function(data) { + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,1000); + }); +} + + function setupFieldRichtext(){ tinyMCE.init({ theme : "advanced", diff --git a/mod/notifications.php b/mod/notifications.php index 635639d892..5831c1b7ab 100755 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -67,6 +67,11 @@ function notifications_content(&$a) { $o = ''; $tabs = array( + array( + 'label' => t('System'), + 'url'=>$a->get_baseurl() . '/notifications/system', + 'sel'=> (($a->argv[1] == 'system') ? 'active' : ''), + ), array( 'label' => t('Network'), 'url'=>$a->get_baseurl() . '/notifications/network', @@ -295,6 +300,36 @@ function notifications_content(&$a) { '$notif_content' => $notif_content, )); + } else if (($a->argc > 1) && ($a->argv[1] == 'system')) { + + $notif_tpl = get_markup_template('notifications.tpl'); + + $not_tpl = get_markup_template('notify.tpl'); + require_once('include/bbcode.php'); + + $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", + intval(local_user()) + ); + + if (count($r) > 0) { + foreach ($r as $it) { + $notif_content .= replace_macros($not_tpl,array( + '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], + '$item_image' => $it['photo'], + '$item_text' => strip_tags(bbcode($it['msg'])), + '$item_when' => relative_date($it['date']) + )); + } + } else { + $notif_content .= t('No more system notifications.'); + } + + $o .= replace_macros($notif_tpl,array( + '$notif_header' => t('System'), + '$tabs' => $tabs, + '$notif_content' => $notif_content, + )); + } else if (($a->argc > 1) && ($a->argv[1] == 'personal')) { $notif_tpl = get_markup_template('notifications.tpl'); diff --git a/view/notify.tpl b/view/notify.tpl new file mode 100755 index 0000000000..73cc9f9480 --- /dev/null +++ b/view/notify.tpl @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/view/theme/testbubble/nav.tpl b/view/theme/testbubble/nav.tpl index 9051fcb06a..d657a11c57 100755 --- a/view/theme/testbubble/nav.tpl +++ b/view/theme/testbubble/nav.tpl @@ -10,6 +10,7 @@ {{ if $nav.introductions }}{{ endif }} {{ if $nav.messages }}{{ endif }} -- 2.39.5