From 054f8edb59b85d8cdadfce007d51226291c73efa Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Sep 2012 19:22:48 -0700 Subject: [PATCH] zeros - theming for new categories/folder display --- include/conversation.php | 6 +++--- include/text.php | 29 +++++++++++++++-------------- object/Item.php | 4 ++++ view/search_item.tpl | 9 +++++++++ view/wall_item.tpl | 9 +++++++++ view/wall_thread.tpl | 9 +++++++++ view/wallwall_item.tpl | 9 +++++++++ view/wallwall_thread.tpl | 9 +++++++++ 8 files changed, 67 insertions(+), 17 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index b8546ce014..1bdde5e9ff 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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) $indent .= ' shiny'; + localize_item($item); $body = prepare_body($item,true); - list($categories, $folders) = get_cats_and_terms($item); - - + list($categories,$folders) = get_cats_and_terms($item); $tmp_item = array( // 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); + list($categories, $folders) = get_cats_and_terms($item); //$tmp_item = replace_macros($tpl,array( $tmp_item = array( diff --git a/include/text.php b/include/text.php index 9b55078cbe..23e3e50611 100644 --- a/include/text.php +++ b/include/text.php @@ -1115,24 +1115,25 @@ function get_cats_and_terms($item) { if (count($categories)) $categories[count($categories)-1]['last'] = true; - - $matches = false; $first = true; - $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); - if($cnt) { - foreach($matches as $mtch) { - $folders[] = array( - 'name' => xmlify(file_tag_decode($mtch[1])), - 'url' => "#", - 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""), - 'first' => $first, - 'last' => false - ); - $first = false; + if(local_user() == $item['uid']) { + $matches = false; $first = true; + $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $folders[] = array( + 'name' => xmlify(file_tag_decode($mtch[1])), + 'url' => "#", + 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""), + 'first' => $first, + 'last' => false + ); + $first = false; + } } } if (count($folders)) $folders[count($folders)-1]['last'] = true; - + return array($categories, $folders); } diff --git a/object/Item.php b/object/Item.php index 04d52a896e..ed439e4d29 100644 --- a/object/Item.php +++ b/object/Item.php @@ -214,6 +214,10 @@ class Item extends BaseObject { 'tags' => $tags, 'hashtags' => $hashtags, 'mentions' => $mentions, + 'txt_cats' => t('Categories:'), + 'txt_folders' => t('Filed under:'), + 'has_cats' => ((count($categories)) ? 'true' : ''), + 'has_folders' => ((count($folders)) ? 'true' : ''), 'categories' => $categories, 'folders' => $folders, 'body' => template_escape($body), diff --git a/view/search_item.tpl b/view/search_item.tpl index 8d8a0dbd4d..de3c58839c 100644 --- a/view/search_item.tpl +++ b/view/search_item.tpl @@ -30,6 +30,15 @@
$item.title
$item.body
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wall_item.tpl b/view/wall_item.tpl index e4eabb9e5c..7fe8794d81 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -36,6 +36,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wall_thread.tpl b/view/wall_thread.tpl index e3f0436a3b..86a937fef5 100644 --- a/view/wall_thread.tpl +++ b/view/wall_thread.tpl @@ -47,6 +47,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wallwall_item.tpl b/view/wallwall_item.tpl index e8044532a3..ff2bc00e47 100644 --- a/view/wallwall_item.tpl +++ b/view/wallwall_item.tpl @@ -40,6 +40,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
diff --git a/view/wallwall_thread.tpl b/view/wallwall_thread.tpl index 68bb3bc9d5..211f951328 100644 --- a/view/wallwall_thread.tpl +++ b/view/wallwall_thread.tpl @@ -47,6 +47,15 @@ $tag {{ endfor }}
+ {{ if $item.has_cats }} +
$item.txt_cats {{ for $item.categories as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }} + + {{ if $item.has_folders }} +
$item.txt_folders {{ for $item.folders as $cat }}$cat.name [$remove] {{ if $cat.last }}{{ else }}, {{ endif }}{{ endfor }} +
+ {{ endif }}
-- 2.39.5