more work on filer, comment level and file tag removal

This commit is contained in:
friendica 2012-03-13 20:46:37 -07:00
parent de017d1ed7
commit 4972d7ef6e
7 changed files with 57 additions and 23 deletions

View File

@ -560,25 +560,28 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
); );
$star = false; $star = false;
$filer = false;
$isstarred = "unstarred"; $isstarred = "unstarred";
if ($profile_owner == local_user() && $toplevelpost) { if ($profile_owner == local_user()) {
$isstarred = (($item['starred']) ? "starred" : "unstarred"); if($toplevelpost) {
$isstarred = (($item['starred']) ? "starred" : "unstarred");
$star = array( $star = array(
'do' => t("add star"), 'do' => t("add star"),
'undo' => t("remove star"), 'undo' => t("remove star"),
'toggle' => t("toggle star status"), 'toggle' => t("toggle star status"),
'classdo' => (($item['starred']) ? "hidden" : ""), 'classdo' => (($item['starred']) ? "hidden" : ""),
'classundo' => (($item['starred']) ? "" : "hidden"), 'classundo' => (($item['starred']) ? "" : "hidden"),
'starred' => t('starred'), 'starred' => t('starred'),
'tagger' => t("add tag"), 'tagger' => t("add tag"),
'filer' => t("file as"), 'classtagger' => "",
'classtagger' => "", );
); }
$filer = t("file as");
} }
$photo = $item['photo']; $photo = $item['photo'];
$thumb = $item['thumb']; $thumb = $item['thumb'];
@ -672,6 +675,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'edpost' => $edpost, 'edpost' => $edpost,
'isstarred' => $isstarred, 'isstarred' => $isstarred,
'star' => $star, 'star' => $star,
'filer' => $filer,
'drop' => $drop, 'drop' => $drop,
'vote' => $likebuttons, 'vote' => $likebuttons,
'like' => $like, 'like' => $like,

View File

@ -1,6 +1,6 @@
<?php <?php
function oembed_replacecb($matches){ function oembed_replacecb($matches){
logger('oembedcb'); // logger('oembedcb');
$embedurl=$matches[1]; $embedurl=$matches[1];
$j = oembed_fetch_url($embedurl); $j = oembed_fetch_url($embedurl);
$s = oembed_format_object($j); $s = oembed_format_object($j);
@ -14,6 +14,9 @@ function oembed_fetch_url($embedurl){
$txt = Cache::get($embedurl); $txt = Cache::get($embedurl);
// These media files should now be caught in bbcode.php
// left here as a fallback in case this is called from another source
$noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm"); $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm");
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION); $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);

View File

@ -874,6 +874,7 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) { if(! function_exists('prepare_body')) {
function prepare_body($item,$attach = false) { function prepare_body($item,$attach = false) {
$a = get_app();
call_hooks('prepare_body_init', $item); call_hooks('prepare_body_init', $item);
$s = prepare_text($item['body']); $s = prepare_text($item['body']);
@ -916,7 +917,7 @@ function prepare_body($item,$attach = false) {
$matches = false; $matches = false;
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER); $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG); // logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG);
foreach($matches as $mtch) { foreach($matches as $mtch) {
if(strlen($x)) if(strlen($x))
$x .= ','; $x .= ',';
@ -931,11 +932,11 @@ function prepare_body($item,$attach = false) {
$x = ''; $x = '';
$cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER); $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) { if($cnt) {
logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG); // logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG);
foreach($matches as $mtch) { foreach($matches as $mtch) {
if(strlen($x)) if(strlen($x))
$x .= ','; $x .= '&nbsp;&nbsp;&nbsp;';
$x .= file_tag_decode($mtch[1]); $x .= file_tag_decode($mtch[1]). ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . file_tag_decode($mtch[1]) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
} }
if(strlen($x) && (local_user() == $item['uid'])) if(strlen($x) && (local_user() == $item['uid']))
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>'; $s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';

21
mod/filerm.php Normal file
View File

@ -0,0 +1,21 @@
<?php
function filerm_content(&$a) {
if(! local_user()) {
killme();
}
$term = notags(trim($_GET['term']));
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
logger('filerm: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term))
file_tag_unsave_file(local_user(),$item_id,$term);
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
killme();
}

View File

@ -2615,12 +2615,12 @@ aside input[type='text'] {
margin-top: 10px; margin-top: 10px;
} }
.body-tag { .body-tag, .filesavetags {
opacity: 0.5; opacity: 0.5;
filter:alpha(opacity=50); filter:alpha(opacity=50);
} }
.body-tag:hover { .body-tag:hover, .filesavetags:hover {
opacity: 1.0 !important; opacity: 1.0 !important;
filter:alpha(opacity=100) !important; filter:alpha(opacity=100) !important;
} }

View File

@ -56,9 +56,11 @@
{{ if $item.star }} {{ if $item.star }}
<a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a> <a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a>
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a> <a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.star.filer"></a>
{{ endif }} {{ endif }}
{{ if $item.filer }}
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
{{ endif }}
<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" >
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }} {{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}
</div> </div>

View File

@ -61,6 +61,9 @@
<a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a> <a href="#" id="starred-$item.id" onclick="dostar($item.id); return false;" class="star-item icon $item.isstarred" title="$item.star.toggle"></a>
<a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a> <a href="#" id="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
{{ endif }} {{ endif }}
{{ if $item.filer }}
<a href="#" id="filer-$item.id" onclick="itemFiler($item.id); return false;" class="filer-item filer-icon" title="$item.filer"></a>
{{ endif }}
<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" >
{{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }} {{ if $item.drop.dropping }}<a href="item/drop/$item.id" onclick="return confirmDelete();" class="icon drophide" title="$item.drop.delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a>{{ endif }}