From d6ad74c649c411190ac7a910888ef426ab14ad55 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 23 Mar 2015 10:59:54 +0100 Subject: indicate new or updated items --- mod/sharedwithme.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index b77c9dad1..8874a7898 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -42,7 +42,7 @@ function sharedwithme_content(&$a) { } //list files - $r = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", + $r = q("SELECT id, uid, object, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()), @@ -50,8 +50,10 @@ function sharedwithme_content(&$a) { ); $items =array(); + $ids = ''; if($r) { + foreach($r as $rr) { $object = json_decode($rr['object'],true); @@ -63,10 +65,27 @@ function sharedwithme_content(&$a) { $item['objfilename'] = $object['filename']; $item['objfilesize'] = userReadableSize($object['filesize']); $item['objedited'] = $object['edited']; + $item['unseen'] = $rr['item_unseen']; $items[] = $item; + if($item['unseen'] > 0) { + $ids .= " '" . $rr['id'] . "',"; + } + } + + } + + if($ids) { + + //remove trailing , + $ids = rtrim($ids, ","); + + q("UPDATE item SET item_unseen = 0 WHERE id in ( $ids ) AND uid = %d", + intval(local_channel()) + ); + } $o = profile_tabs($a, $is_owner, $channel['channel_address']); @@ -74,6 +93,7 @@ function sharedwithme_content(&$a) { $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array( '$header' => t('Files: shared with me'), '$name' => t('Name'), + '$label_new' => t('NEW'), '$size' => t('Size'), '$lastmod' => t('Last Modified'), '$dropall' => t('Remove all files'), -- cgit v1.2.3 From dd930f180ebb1983dd634fcf0d14369797425b55 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 23 Mar 2015 11:06:13 +0100 Subject: sql in -> IN --- mod/sharedwithme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index 8874a7898..bee072ea7 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -82,7 +82,7 @@ function sharedwithme_content(&$a) { //remove trailing , $ids = rtrim($ids, ","); - q("UPDATE item SET item_unseen = 0 WHERE id in ( $ids ) AND uid = %d", + q("UPDATE item SET item_unseen = 0 WHERE id IN ( $ids ) AND uid = %d", intval(local_channel()) ); -- cgit v1.2.3