]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'master' into notify
authorfriendica <info@friendica.com>
Thu, 23 Feb 2012 08:30:17 +0000 (00:30 -0800)
committerfriendica <info@friendica.com>
Thu, 23 Feb 2012 08:30:17 +0000 (00:30 -0800)
include/enotify.php
include/nav.php
js/main.js
mod/notifications.php
mod/ping.php
view/nav.tpl
view/notify.tpl [new file with mode: 0755]
view/theme/testbubble/nav.tpl
view/theme/testbubble/style.css

index 7fa83cfa416151a19e40ad3c145a38273c678265..1eb3b54762a5d9a04127173525d200bc5940c799 100755 (executable)
@@ -30,16 +30,16 @@ function notification($params) {
                $preamble = sprintf( t('%s sent you a new private message at %s.'),$params['source_name'],$sitename);
                $epreamble = sprintf( t('%s sent you %s.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]');
                $sitelink = t('Please visit %s to view and/or reply to your private messages.');
-               $tsitelink = sprintf( $sitelink, $siteurl . '/message' );
-               $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message">' . $sitename . '</a>');
-               $itemlink = $siteurl . '/message';
+               $tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] );
+               $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>');
+               $itemlink = $siteurl . '/message/' . $params['item']['id'];
        }
 
        if($params['type'] == NOTIFY_COMMENT) {
 
                $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 );
index c8a44af80b0c9085efa7d939b3cce14d769b0752..511ca07fc0079ef41736260f964bd3883adbcee6 100755 (executable)
@@ -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 system notifications seen'), '','');
 
                }
 
index 4cb278ee8766ed7fc4f65a0e3dbe733b12499501..3a10ae468cd1e300a232d94e51fc6ed932e61a9c 100755 (executable)
@@ -89,6 +89,7 @@
                /* 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());
                
                /* nav update event  */
                                $("#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",
index 635639d892b7be550561806a4fce4175205971ca..5831c1b7ab418bee23406452cf60b2c2c5c8896f 100755 (executable)
@@ -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');
index 9c2e385d66857f28a1024bd6f2893e397d67ea2b..2898042a3d5e120311be23ac76f1a971d6d75b3f 100644 (file)
@@ -12,6 +12,13 @@ function ping_init(&$a) {
        $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
        if(local_user()){
 
+               $z = q("select * from notify where seen = 0 and uid = %d
+                       order by date desc",
+                       intval(local_user())
+               );
+
+
+
                $tags = array();
                $comments = array();
                $likes = array();
@@ -142,6 +149,22 @@ function ping_init(&$a) {
                $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
                
                echo '  <notif count="'.$tot.'">';
+
+               require_once('include/bbcode.php');
+
+               if(count($z)) {
+                       foreach($z as $zz) {
+                               echo xmlize($a->get_baseurl() . '/notify/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), bbcode($zz['msg']));
+
+                       }
+               }
+
+
+
+
+
+/*
+
                if ($intro>0){
                        foreach ($intros as $i) { 
                                echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") );
@@ -195,6 +218,8 @@ function ping_init(&$a) {
                        };
                }
 
+*/
+
                echo "  </notif>";
        }
        echo " <sysmsgs>";
index dffa6e5201c6f505fae508f59cb3f5932508b81a..8c872864c2c0e2ad0a1b4c62d1387c3baca9da84 100755 (executable)
@@ -43,6 +43,7 @@
                        <li  id="nav-notifications-linkmenu" class="nav-menu-icon"><a href="$nav.notifications.0" rel="#nav-notifications-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">
+                                       <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 class="empty">$emptynotifications</li>
                                </ul>
diff --git a/view/notify.tpl b/view/notify.tpl
new file mode 100755 (executable)
index 0000000..73cc9f9
--- /dev/null
@@ -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>
\ No newline at end of file
index acbea5bf84f3a0669e1b82fbde18faf80393a31a..d657a11c57afbb6b7057ba8ce355828a2ea0e461 100755 (executable)
@@ -6,9 +6,11 @@
        <div id="notifications">        
                {{ if $nav.network }}<a rel="#nav-notifications-menu" id="net-update" class="nav-ajax-update" href="$nav.network.0" title="$nav.network.1"></a>{{ endif }}
                {{ if $nav.home }}<a rel="#nav-notifications-menu" id="home-update" class="nav-ajax-update" href="$nav.home.0" title="$nav.home.1"></a>{{ endif }}
-               {{ if $nav.notifications }}<a rel="#nav-notifications-menu" id="intro-update" class="nav-ajax-update" href="$nav.notifications.0" title="$nav.notifications.1"></a>{{ endif }}
+<!--           {{ if $nav.notifications }}<a rel="#nav-notifications-menu" id="intro-update" class="nav-ajax-update" href="$nav.notifications.0" title="$nav.notifications.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 }}
                <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 class="empty">$emptynotifications</li>
                </ul>
index fcb7bea7a1feb32937139215e7b28e48e02bc34e..c6f66d5adc03fa677694b463021bd811831c1c80 100755 (executable)
@@ -3202,6 +3202,10 @@ ul.menu-popup {
        background-color:#b20202;
 }
 
+#nav-notifications-menu a:hover {
+       text-decoration: underline;
+}
+
 .notif-item a {
        vertical-align: middle;
        color: #626262;