zeros - theming for new categories/folder display

This commit is contained in:
friendica 2012-09-23 19:22:48 -07:00
parent b661e61d6a
commit 054f8edb59
8 changed files with 67 additions and 17 deletions

View File

@ -626,13 +626,12 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$indent .= ' shiny'; $indent .= ' shiny';
localize_item($item); localize_item($item);
$body = prepare_body($item,true); $body = prepare_body($item,true);
list($categories, $folders) = get_cats_and_terms($item); list($categories,$folders) = get_cats_and_terms($item);
$tmp_item = array( $tmp_item = array(
// collapse comments in template. I don't like this much... // collapse comments in template. I don't like this much...
@ -903,6 +902,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$body = prepare_body($item,true); $body = prepare_body($item,true);
list($categories, $folders) = get_cats_and_terms($item); list($categories, $folders) = get_cats_and_terms($item);
//$tmp_item = replace_macros($tpl,array( //$tmp_item = replace_macros($tpl,array(
$tmp_item = array( $tmp_item = array(

View File

@ -1115,24 +1115,25 @@ function get_cats_and_terms($item) {
if (count($categories)) $categories[count($categories)-1]['last'] = true; if (count($categories)) $categories[count($categories)-1]['last'] = true;
if(local_user() == $item['uid']) {
$matches = false; $first = true; $matches = false; $first = true;
$cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
$folders[] = array( $folders[] = array(
'name' => xmlify(file_tag_decode($mtch[1])), 'name' => xmlify(file_tag_decode($mtch[1])),
'url' => "#", 'url' => "#",
'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""), 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""),
'first' => $first, 'first' => $first,
'last' => false 'last' => false
); );
$first = false; $first = false;
}
} }
} }
if (count($folders)) $folders[count($folders)-1]['last'] = true; if (count($folders)) $folders[count($folders)-1]['last'] = true;
return array($categories, $folders); return array($categories, $folders);
} }

View File

@ -214,6 +214,10 @@ class Item extends BaseObject {
'tags' => $tags, 'tags' => $tags,
'hashtags' => $hashtags, 'hashtags' => $hashtags,
'mentions' => $mentions, 'mentions' => $mentions,
'txt_cats' => t('Categories:'),
'txt_folders' => t('Filed under:'),
'has_cats' => ((count($categories)) ? 'true' : ''),
'has_folders' => ((count($folders)) ? 'true' : ''),
'categories' => $categories, 'categories' => $categories,
'folders' => $folders, 'folders' => $folders,
'body' => template_escape($body), 'body' => template_escape($body),

View File

@ -30,6 +30,15 @@
<div class="wall-item-title" id="wall-item-title-$item.id">$item.title</div> <div class="wall-item-title" id="wall-item-title-$item.id">$item.title</div>
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-$item.id" >$item.body</div> <div class="wall-item-body" id="wall-item-body-$item.id" >$item.body</div>
{{ if $item.has_cats }}
<div class="categorytags"><span>$item.txt_cats {{ for $item.categories as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
{{ if $item.has_folders }}
<div class="filesavetags"><span>$item.txt_folders {{ for $item.folders as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
</div> </div>
<div class="wall-item-tools" id="wall-item-tools-$item.id"> <div class="wall-item-tools" id="wall-item-tools-$item.id">
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" > <div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$item.id" >

View File

@ -36,6 +36,15 @@
<span class='tag'>$tag</span> <span class='tag'>$tag</span>
{{ endfor }} {{ endfor }}
</div> </div>
{{ if $item.has_cats }}
<div class="categorytags"><span>$item.txt_cats {{ for $item.categories as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
{{ if $item.has_folders }}
<div class="filesavetags"><span>$item.txt_folders {{ for $item.folders as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
</div> </div>
</div> </div>
<div class="wall-item-tools" id="wall-item-tools-$item.id"> <div class="wall-item-tools" id="wall-item-tools-$item.id">

View File

@ -47,6 +47,15 @@
<span class='tag'>$tag</span> <span class='tag'>$tag</span>
{{ endfor }} {{ endfor }}
</div> </div>
{{ if $item.has_cats }}
<div class="categorytags"><span>$item.txt_cats {{ for $item.categories as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
{{ if $item.has_folders }}
<div class="filesavetags"><span>$item.txt_folders {{ for $item.folders as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
</div> </div>
</div> </div>
<div class="wall-item-tools" id="wall-item-tools-$item.id"> <div class="wall-item-tools" id="wall-item-tools-$item.id">

View File

@ -40,6 +40,15 @@
<span class='tag'>$tag</span> <span class='tag'>$tag</span>
{{ endfor }} {{ endfor }}
</div> </div>
{{ if $item.has_cats }}
<div class="categorytags"><span>$item.txt_cats {{ for $item.categories as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
{{ if $item.has_folders }}
<div class="filesavetags"><span>$item.txt_folders {{ for $item.folders as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
</div> </div>
</div> </div>
<div class="wall-item-tools" id="wall-item-tools-$item.id"> <div class="wall-item-tools" id="wall-item-tools-$item.id">

View File

@ -47,6 +47,15 @@
<span class='tag'>$tag</span> <span class='tag'>$tag</span>
{{ endfor }} {{ endfor }}
</div> </div>
{{ if $item.has_cats }}
<div class="categorytags"><span>$item.txt_cats {{ for $item.categories as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
{{ if $item.has_folders }}
<div class="filesavetags"><span>$item.txt_folders {{ for $item.folders as $cat }}$cat.name <a href="$cat.removeurl" title="$remove">[$remove]</a> {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }}
</div>
{{ endif }}
</div> </div>
</div> </div>
<div class="wall-item-tools" id="wall-item-tools-$item.id"> <div class="wall-item-tools" id="wall-item-tools-$item.id">