attachment display

This commit is contained in:
Friendika 2011-05-24 20:41:29 -07:00
parent 4447739702
commit 87de839974
5 changed files with 46 additions and 4 deletions

View file

@ -2540,8 +2540,40 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) { if(! function_exists('prepare_body')) {
function prepare_body($item) { function prepare_body($item,$attach = false) {
return prepare_text($item['body']);
$s = prepare_text($item['body']);
if(! $attach)
return $s;
$arr = explode(',',$item['attach']);
if(count($arr)) {
foreach($arr as $r) {
$matches = false;
$icon = '';
$cnt = preg_match('|\[attach\]href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" title=\"(.+?)\"\[\/attach\]|',$r,$matches);
if($cnt) {
$icontype = strtolower(substr($matches[3],0,strpos($matches[3],'/')));
switch($icontype) {
case 'video':
case 'audio':
case 'image':
case 'text':
$icon = '<div class="attachtype type-' . $attachtype . '"></div>';
break;
default:
$icon = '<div class="attachtype type-unkn"></div>';
break;
}
$title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1]));
$title .= ' ' . $matches[2] . ' ' . t('bytes');
$s .= '<a href="' . strip_tags($matches[1]) . '" title="' . $title . '" >' . $icon . '</a>';
}
}
}
$s .= '<div class="clear"></div>';
return $s;
}} }}
if(! function_exists('prepare_text')) { if(! function_exists('prepare_text')) {

View file

@ -183,6 +183,8 @@ function conversation(&$a, $items, $mode, $update) {
$drop = replace_macros($droptpl,array('$id' => $item['id'])); $drop = replace_macros($droptpl,array('$id' => $item['id']));
$lock = '<div class="wall-item-lock"></div>'; $lock = '<div class="wall-item-lock"></div>';
$body = prepare_body($item);
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$id' => $item['item_id'], '$id' => $item['item_id'],
@ -194,7 +196,7 @@ function conversation(&$a, $items, $mode, $update) {
'$lock' => $lock, '$lock' => $lock,
'$thumb' => $profile_avatar, '$thumb' => $profile_avatar,
'$title' => $item['title'], '$title' => $item['title'],
'$body' => smilies(bbcode($item['body'])), '$body' => $body,
'$ago' => relative_date($item['created']), '$ago' => relative_date($item['created']),
'$location' => $location, '$location' => $location,
'$indent' => '', '$indent' => '',
@ -441,6 +443,9 @@ function conversation(&$a, $items, $mode, $update) {
// Build the HTML // Build the HTML
$body = prepare_body($item);
$tmp_item = replace_macros($template,array( $tmp_item = replace_macros($template,array(
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$linktitle' => sprintf( t('View %s\'s profile'), $profile_name), '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name),
@ -455,7 +460,7 @@ function conversation(&$a, $items, $mode, $update) {
'$osparkle' => $osparkle, '$osparkle' => $osparkle,
'$sparkle' => $sparkle, '$sparkle' => $sparkle,
'$title' => $item['title'], '$title' => $item['title'],
'$body' => smilies(bbcode($item['body'])), '$body' => $body,
'$ago' => relative_date($item['created']), '$ago' => relative_date($item['created']),
'$lock' => $lock, '$lock' => $lock,
'$location' => $location, '$location' => $location,

View file

@ -807,6 +807,7 @@ section { margin: 10px 11% 0px 11%; font-size: 0.8em; padding-right: 230px;}
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
padding: 3px;
background-image: url('../../../images/content-types.gif'); background-image: url('../../../images/content-types.gif');
} }

View file

@ -2426,6 +2426,8 @@ a.mail-list-link {
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
padding: 3px;
float: left;
background-image: url('../../../images/content-types.gif'); background-image: url('../../../images/content-types.gif');
} }

View file

@ -2443,6 +2443,8 @@ a.mail-list-link {
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
padding: 3px;
float: left;
background-image: url('../../../images/content-types.gif'); background-image: url('../../../images/content-types.gif');
} }