This commit is contained in:
friendica 2015-03-23 15:37:13 -07:00
commit 0f8fdf1a3e
3 changed files with 22 additions and 3 deletions

View File

@ -42,7 +42,7 @@ function sharedwithme_content(&$a) {
} }
//list files //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_POST),
dbesc(ACTIVITY_OBJ_FILE), dbesc(ACTIVITY_OBJ_FILE),
intval(local_channel()), intval(local_channel()),
@ -50,8 +50,10 @@ function sharedwithme_content(&$a) {
); );
$items =array(); $items =array();
$ids = '';
if($r) { if($r) {
foreach($r as $rr) { foreach($r as $rr) {
$object = json_decode($rr['object'],true); $object = json_decode($rr['object'],true);
@ -63,10 +65,27 @@ function sharedwithme_content(&$a) {
$item['objfilename'] = $object['filename']; $item['objfilename'] = $object['filename'];
$item['objfilesize'] = userReadableSize($object['filesize']); $item['objfilesize'] = userReadableSize($object['filesize']);
$item['objedited'] = $object['edited']; $item['objedited'] = $object['edited'];
$item['unseen'] = $rr['item_unseen'];
$items[] = $item; $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']); $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( $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array(
'$header' => t('Files: shared with me'), '$header' => t('Files: shared with me'),
'$name' => t('Name'), '$name' => t('Name'),
'$label_new' => t('NEW'),
'$size' => t('Size'), '$size' => t('Size'),
'$lastmod' => t('Last Modified'), '$lastmod' => t('Last Modified'),
'$dropall' => t('Remove all files'), '$dropall' => t('Remove all files'),

View File

@ -21,4 +21,3 @@
.cloud-index-tool { .cloud-index-tool {
padding: 7px 10px; padding: 7px 10px;
} }

View File

@ -14,7 +14,7 @@
{{foreach $items as $item}} {{foreach $items as $item}}
<tr id="cloud-index-{{$item.id}}"> <tr id="cloud-index-{{$item.id}}">
<td><i class="{{$item.objfiletypeclass}}" title="{{$item.objfiletype}}"></i></td> <td><i class="{{$item.objfiletypeclass}}" title="{{$item.objfiletype}}"></i></td>
<td><a href="{{$item.objurl}}">{{$item.objfilename}}</a></td> <td><a href="{{$item.objurl}}">{{$item.objfilename}}</a>{{if $item.unseen}}&nbsp;<span class="label label-success">{{$label_new}}</span>{{/if}}</td>
<td class="cloud-index-tool"><a href="/sharedwithme/{{$item.id}}/drop" title="{{$drop}}" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a></td> <td class="cloud-index-tool"><a href="/sharedwithme/{{$item.id}}/drop" title="{{$drop}}" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a></td>
<td class="hidden-xs">{{$item.objfilesize}}</td> <td class="hidden-xs">{{$item.objfilesize}}</td>
<td class="hidden-xs">{{$item.objedited}}</td> <td class="hidden-xs">{{$item.objedited}}</td>