diff options
author | friendica <info@friendica.com> | 2013-10-13 21:14:04 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-13 21:14:04 -0700 |
commit | db42e4d2f92dacb02662dc298871300dfea75651 (patch) | |
tree | 3a1345c05a18870674f476d9f2746742bc707f35 /include/text.php | |
parent | 454aa6bff38ee540b7467f3caa3d6651b70f14ef (diff) | |
download | volse-hubzilla-db42e4d2f92dacb02662dc298871300dfea75651.tar.gz volse-hubzilla-db42e4d2f92dacb02662dc298871300dfea75651.tar.bz2 volse-hubzilla-db42e4d2f92dacb02662dc298871300dfea75651.zip |
attachment icons revisited
Diffstat (limited to 'include/text.php')
-rwxr-xr-x | include/text.php | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/include/text.php b/include/text.php index a3f2a651c..bcb1f9438 100755 --- a/include/text.php +++ b/include/text.php @@ -1015,45 +1015,30 @@ function unobscure(&$item) { } - -function prepare_body(&$item,$attach = false) { - - $a = get_app(); - - - - call_hooks('prepare_body_init', $item); - - unobscure($item); - - $s = prepare_text($item['body'],$item['mimetype']); - - $prep_arr = array('item' => $item, 'html' => $s); - call_hooks('prepare_body', $prep_arr); - $s = $prep_arr['html']; - - if(! $attach) { - return $s; - } - +function theme_attachments(&$item) { $arr = json_decode_plus($item['attach']); - if(count($arr)) { - $s .= '<div class="body-attach">'; + if(is_array($arr) && count($arr)) { + $attaches = array(); foreach($arr as $r) { - $matches = false; $icon = ''; $icontype = substr($r['type'],0,strpos($r['type'],'/')); switch($icontype) { case 'video': + $icon = 'icon-facetime-video'; + break; case 'audio': + $icon = 'icon-volume-up'; + break; case 'image': + $icon = 'icon-camera'; + break; case 'text': - $icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>'; + $icon = 'icon-align-justify'; break; default: - $icon = '<div class="attachtype icon s22 type-unkn"></div>'; + $icon = 'icon-question'; break; } @@ -1062,12 +1047,49 @@ function prepare_body(&$item,$attach = false) { $title = t('unknown.???'); $title .= ' ' . $r['length'] . ' ' . t('bytes'); - $url = $a->get_baseurl() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision']; + $url = z_root() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision']; $s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>'; + $attaches[] = array('title' => $title, 'url' => $url, 'icon' => $icon ); + } - $s .= '<div class="clear"></div></div>'; + + } + $s = replace_macros(get_markup_template('item_attach.tpl'), array( + '$attaches' => $attaches + )); + + return $s; + +} + + + +function prepare_body(&$item,$attach = false) { + + $a = get_app(); + + + + call_hooks('prepare_body_init', $item); + + unobscure($item); + + $s = prepare_text($item['body'],$item['mimetype']); + + $prep_arr = array('item' => $item, 'html' => $s); + call_hooks('prepare_body', $prep_arr); + $s = $prep_arr['html']; + + if(! $attach) { + return $s; + } + + + $s .= theme_attachments($item); + + // At some point in time, posttags were removed from the threaded conversation templates, but remained in the search_item template. // Code to put them back was added into include/conversation.php and/or include/ItemObject.php but under new class names // Then it was discovered that the following bits remained of the old code. |