This commit is contained in:
friendica 2012-09-21 18:10:32 -07:00
commit b6b8f40fa9
8 changed files with 133 additions and 52 deletions

View file

@ -350,6 +350,7 @@ function visible_activity($item) {
return true;
}
/**
* Recursively prepare a thread for HTML
*/
@ -629,6 +630,10 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$body = prepare_body($item,true);
list($categories, $folders) = get_cats_and_terms($item);
$tmp_item = array(
// collapse comments in template. I don't like this much...
'comment_firstcollapsed' => $firstcollapsed,
@ -640,6 +645,8 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
'tags' => template_escape($tags),
'hashtags' => template_escape($hashtags),
'mentions' => template_escape($mentions),
'categories' => $categories,
'folders' => $folders,
'body' => template_escape($body),
'text' => strip_tags(template_escape($body)),
'id' => $item['item_id'],
@ -685,6 +692,8 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
$item_result = $arr['output'];
if($firstcollapsed) {
$item_result['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$item_result['hidden_comments_num'] = $total_children;
$item_result['hidden_comments_text'] = tt('comment', 'comments', $total_children);
$item_result['hide_text'] = t('show more');
}
@ -890,6 +899,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(
'template' => $tpl,
@ -906,6 +916,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'tags' => template_escape($tags),
'hashtags' => template_escape($hashtags),
'mentions' => template_escape($mentions),
'categories' => $categories,
'folders' => $folders,
'text' => strip_tags(template_escape($body)),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
@ -983,6 +995,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$o = replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl($ssl_state),
'$remove' => t('remove'),
'$mode' => $mode,
'$user' => $a->user,
'$threads' => $threads,

View file

@ -1016,35 +1016,8 @@ function prepare_body($item,$attach = false) {
}
$s .= '<div class="clear"></div></div>';
}
$matches = false;
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) {
// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG);
foreach($matches as $mtch) {
if(strlen($x))
$x .= ',';
$x .= xmlify(file_tag_decode($mtch[1]))
. ((local_user() == $item['uid']) ? ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . xmlify(file_tag_decode($mtch[1])) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>' : '');
}
if(strlen($x))
$s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
}
$matches = 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);
foreach($matches as $mtch) {
if(strlen($x))
$x .= '&nbsp;&nbsp;&nbsp;';
$x .= xmlify(file_tag_decode($mtch[1])) . ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(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>';
}
// Look for spoiler
$spoilersearch = '<blockquote class="spoiler">';
@ -1098,6 +1071,72 @@ function prepare_text($text) {
}}
/**
* returns
* [
* //categories [
* {
* 'name': 'category name',
* 'removeurl': 'url to remove this category',
* 'first': 'is the first in this array? true/false',
* 'last': 'is the last in this array? true/false',
* } ,
* ....
* ],
* // folders [
* 'name': 'folder name',
* 'removeurl': 'url to remove this folder',
* 'first': 'is the first in this array? true/false',
* 'last': 'is the last in this array? true/false',
* } ,
* ....
* ]
* ]
*/
function get_cats_and_terms($item) {
$a = get_app();
$categories = array();
$folders = array();
$matches = false; $first = true;
$cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$categories[] = array(
'name' => xmlify(file_tag_decode($mtch[1])),
'url' => "#",
'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . xmlify(file_tag_decode($mtch[1])):""),
'first' => $first,
'last' => false
);
$first = false;
}
}
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 (count($folders)) $folders[count($folders)-1]['last'] = true;
return array($categories, $folders);
}
/**
* return atom link elements for all of our hubs
*/

View file

@ -584,6 +584,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
if (!$comments_collapsed){
$threads[$threadsid]['num_comments'] = sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),$comments[$item['parent']] );
$threads[$threadsid]['hidden_comments_num'] = $comments[$item['parent']];
$threads[$threadsid]['hidden_comments_text'] = tt('comment', 'comments', $comments[$item['parent']]);
$threads[$threadsid]['hide_text'] = t('show more');
$comments_collapsed = true;
$comment_firstcollapsed = true;

View file

@ -143,10 +143,20 @@ class Item extends BaseObject {
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
$tags=array();
$hashtags = array();
$mentions = array();
foreach(explode(',',$item['tag']) as $tag){
$tag = trim($tag);
if ($tag!="") $tags[] = bbcode($tag);
}
if ($tag!="") {
$t = bbcode($tag);
$tags[] = $t;
if($t[0] == '#')
$hashtags[] = $t;
elseif($t[0] == '@')
$mentions[] = $t;
}
}
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
@ -195,11 +205,17 @@ class Item extends BaseObject {
$body = prepare_body($item,true);
list($categories, $folders) = get_cats_and_terms($item);
$tmp_item = array(
'template' => $this->get_template(),
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
'tags' => $tags,
'hashtags' => $hashtags,
'mentions' => $mentions,
'categories' => $categories,
'folders' => $folders,
'body' => template_escape($body),
'text' => strip_tags(template_escape($body)),
'id' => $this->get_id(),
@ -254,6 +270,8 @@ class Item extends BaseObject {
if(($nb_children > 2) || ($thread_level > 1)) {
$result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$result['children'][0]['hidden_comments_num'] = $total_children;
$result['children'][0]['hidden_comments_text'] = tt('comment', 'comments', $total_children);
$result['children'][0]['hide_text'] = t('show more');
if($thread_level > 1) {
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
@ -264,6 +282,11 @@ class Item extends BaseObject {
}
}
if ($this->is_toplevel()) {
$result['total_comments_num'] = $total_children;
$result['total_comments_text'] = tt('comment', 'comments', $total_children);
}
$result['private'] = $item['private'];
$result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : '');

View file

@ -25,6 +25,13 @@
echo $file . "\n";
include_once($file);
}
echo "Directory: object\n";
$files = glob('object/*.php');
foreach($files as $file) {
echo $file . "\n";
include_once($file);
}
echo "Directory: addon\n";
$dirs = glob('addon/*');

View file

@ -1,13 +0,0 @@
<div class="profile-match-wrapper">
<div class="profile-match-photo">
<a href="$url">
<img src="$photo" alt="$name" />
</a>
</div>
<span><a href="$url">$name</a>$inttxt<br />$tags</span>
<div class="profile-match-break"></div>
{{ if $connlnk }}
<div class="profile-match-connect"><a href="$connlnk" title="$conntxt">$conntxt</a></div>
{{ endif }}
<div class="profile-match-end"></div>
</div>

View file

@ -3,7 +3,7 @@
Smoothly
Created by Anne Walk and Devlon Duthie on 2011-09-24
Modified by alex@friendica.pixelbits.de on 2012-09-17
Modified by alex@friendica.pixelbits.de on 2012-09-20
** Colors **
@ -20,7 +20,6 @@ Orange - #fec01d
body {
margin: 0 auto;
padding-bottom: 3em;
/*position: relative;*/
width: 960px;
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
font-size: 15px;
@ -1122,7 +1121,7 @@ profile-jot-banner-wrapper {
.wall-item-outside-wrapper {
max-width: 100%;
border-bottom: 1px solid #dedede;
margin-top: 20px;
/*margin-top: 20px;*/
margin-bottom: 20px;
padding-right: 10px;
padding-left: 12px;
@ -1445,7 +1444,7 @@ profile-jot-banner-wrapper {
overflow: auto;
margin-top: 20px;
float: right;
width: 230px;
width: 250px;
}
/* ============ */
@ -1457,9 +1456,19 @@ profile-jot-banner-wrapper {
color: #898989;
margin-left: 60px;
}
.tread-wrapper {
border: 0px solid #CDCDCD;
border-radius: 5px 5px 5px 5px;
margin-bottom: 20px;
background-color: #E2E2E2;
}
.collapsed-comments,
.hide-comments-outer,
.wall-item-outside-wrapper.comment {
margin-left: 70px;
margin-left: 30px;
margin-bottom: 20px;
}
.wall-item-outside-wrapper.comment .wall-item-photo {
@ -1504,7 +1513,7 @@ profile-jot-banner-wrapper {
.comment-wwedit-wrapper,
.comment-edit-wrapper {
margin: 0px 0px 0px 80px;
margin: 0px 0px 5px 0px;
}
.comment-wwedit-wrapper img,
@ -1516,7 +1525,7 @@ profile-jot-banner-wrapper {
.comment-edit-photo-link {
float: left;
width: 40px;
width: 30px;
}
.comment-edit-text-empty {
@ -3485,6 +3494,7 @@ footer {
clear: both;
}
#profile-jot-text-loading,
#profile-jot-text {
height: 20px;
color: #cccccc;
@ -3795,7 +3805,7 @@ ul.menu-popup {
}
.qcomment {
opacity: 0;
opacity: 0.8;
filter: alpha(opacity=0);
}

View file

@ -3,7 +3,7 @@
/*
* Name: Smoothly
* Description: Like coffee with milk. Theme works fine with iPad[2].
* Version: Version 0.9.19-4
* Version: Version 0.9.20-3
* Author: Alex <https://friendica.pixelbits.de/profile/alex>
* Maintainer: Alex <https://friendica.pixelbits.de/profile/alex>
* Screenshot: <a href="screenshot.png">Screenshot</a>