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

View file

@ -1,6 +1,6 @@
<?php
function oembed_replacecb($matches){
logger('oembedcb');
// logger('oembedcb');
$embedurl=$matches[1];
$j = oembed_fetch_url($embedurl);
$s = oembed_format_object($j);
@ -14,6 +14,9 @@ function oembed_fetch_url($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");
$ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);

View file

@ -874,6 +874,7 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) {
function prepare_body($item,$attach = false) {
$a = get_app();
call_hooks('prepare_body_init', $item);
$s = prepare_text($item['body']);
@ -916,7 +917,7 @@ function prepare_body($item,$attach = false) {
$matches = false;
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
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) {
if(strlen($x))
$x .= ',';
@ -931,11 +932,11 @@ function prepare_body($item,$attach = false) {
$x = '';
$cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
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) {
if(strlen($x))
$x .= ',';
$x .= file_tag_decode($mtch[1]);
$x .= '&nbsp;&nbsp;&nbsp;';
$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']))
$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;
}
.body-tag {
.body-tag, .filesavetags {
opacity: 0.5;
filter:alpha(opacity=50);
}
.body-tag:hover {
.body-tag:hover, .filesavetags:hover {
opacity: 1.0 !important;
filter:alpha(opacity=100) !important;
}

View file

@ -56,9 +56,11 @@
{{ 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="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 }}
{{ 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" >
{{ 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>

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="tagger-$item.id" onclick="itemTag($item.id); return false;" class="tag-item icon tagged" title="$item.star.tagger"></a>
{{ 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" >
{{ 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 }}