new notify sort of working in testbubble

This commit is contained in:
friendica 2012-02-22 23:34:30 -08:00
parent 808b886a3e
commit 41636a50aa
6 changed files with 52 additions and 3 deletions

View File

@ -39,7 +39,7 @@ function notification($params) {
$subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename); $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']); $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.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl ); $tsitelink = sprintf( $sitelink, $siteurl );

View File

@ -116,7 +116,8 @@ function nav(&$a) {
if($_SESSION['page_flags'] == PAGE_NORMAL) { if($_SESSION['page_flags'] == PAGE_NORMAL) {
$nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests')); $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications')); $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'), '','');
} }

View File

@ -89,6 +89,7 @@
/* notifications template */ /* notifications template */
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html()); 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_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_empty = unescape($("#nav-notifications-menu").html());
/* nav update event */ /* nav update event */
@ -117,7 +118,7 @@
$("#nav-notifications-linkmenu").addClass("on"); $("#nav-notifications-linkmenu").addClass("on");
nnm = $("#nav-notifications-menu"); nnm = $("#nav-notifications-menu");
nnm.html(notifications_all); nnm.html(notifications_all + notifications_mark);
//nnm.attr('popup','true'); //nnm.attr('popup','true');
eNotif.children("note").each(function(){ 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(){ function setupFieldRichtext(){
tinyMCE.init({ tinyMCE.init({
theme : "advanced", theme : "advanced",

View File

@ -67,6 +67,11 @@ function notifications_content(&$a) {
$o = ''; $o = '';
$tabs = array( $tabs = array(
array(
'label' => t('System'),
'url'=>$a->get_baseurl() . '/notifications/system',
'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
),
array( array(
'label' => t('Network'), 'label' => t('Network'),
'url'=>$a->get_baseurl() . '/notifications/network', 'url'=>$a->get_baseurl() . '/notifications/network',
@ -295,6 +300,36 @@ function notifications_content(&$a) {
'$notif_content' => $notif_content, '$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')) { } else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');

3
view/notify.tpl Executable file
View File

@ -0,0 +1,3 @@
<div class="notif-item">
<a href="$item_link" target="friendica-notifications"><img src="$item_image" class="notif-image">$item_text <span class="notif-when">$item_when</span></a>
</div>

View File

@ -10,6 +10,7 @@
{{ if $nav.introductions }}<a rel="#nav-notifications-menu" id="intro-update" class="nav-ajax-update" href="$nav.introductions.0" title="$nav.introductions.1"></a>{{ endif }} {{ if $nav.introductions }}<a rel="#nav-notifications-menu" id="intro-update" class="nav-ajax-update" href="$nav.introductions.0" title="$nav.introductions.1"></a>{{ endif }}
{{ if $nav.messages }}<a rel="#nav-notifications-menu" id="mail-update" class="nav-ajax-update" href="$nav.messages.0" title="$nav.messages.1"></a>{{ endif }} {{ if $nav.messages }}<a rel="#nav-notifications-menu" id="mail-update" class="nav-ajax-update" href="$nav.messages.0" title="$nav.messages.1"></a>{{ endif }}
<ul id="nav-notifications-menu" class="menu-popup"> <ul id="nav-notifications-menu" class="menu-popup">
<li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
<li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li> <li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
<li class="empty">$emptynotifications</li> <li class="empty">$emptynotifications</li>
</ul> </ul>