Sync objects with upstream

This commit is contained in:
Domovoy 2012-08-23 10:54:21 +02:00
parent f1bc2afbfe
commit 3e5c711a72
2 changed files with 14 additions and 2 deletions

View File

@ -27,6 +27,7 @@ class Item extends BaseObject {
private $owner_photo = ''; private $owner_photo = '';
private $owner_name = ''; private $owner_name = '';
private $wall_to_wall = false; private $wall_to_wall = false;
private $threaded = false;
public function __construct($data) { public function __construct($data) {
$a = $this->get_app(); $a = $this->get_app();
@ -39,6 +40,9 @@ class Item extends BaseObject {
$ssl_state = ((local_user()) ? true : false); $ssl_state = ((local_user()) ? true : false);
$this->redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $this->get_data_value('cid') ; $this->redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $this->get_data_value('cid') ;
if(get_config('system','thread_allow') && $a->theme_thread_allow)
$this->threaded = true;
// Prepare the children // Prepare the children
if(count($data['children'])) { if(count($data['children'])) {
foreach($data['children'] as $item) { foreach($data['children'] as $item) {
@ -200,6 +204,7 @@ class Item extends BaseObject {
'osparkle' => $osparkle, 'osparkle' => $osparkle,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'title' => template_escape($item['title']), 'title' => template_escape($item['title']),
'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'])), 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
'lock' => $lock, 'lock' => $lock,
'location' => template_escape($location), 'location' => template_escape($location),
@ -251,7 +256,7 @@ class Item extends BaseObject {
$result['private'] = $item['private']; $result['private'] = $item['private'];
$result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : ''); $result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : '');
if(get_config('system','thread_allow') && $a->theme_thread_allow) { if($this->is_threaded()) {
$result['flatten'] = false; $result['flatten'] = false;
$result['threaded'] = true; $result['threaded'] = true;
} }
@ -267,6 +272,10 @@ class Item extends BaseObject {
return $this->get_data_value('id'); return $this->get_data_value('id');
} }
public function is_threaded() {
return $this->threaded;
}
/** /**
* Add a child item * Add a child item
*/ */
@ -490,7 +499,8 @@ class Item extends BaseObject {
$qcomment = (($qc) ? explode("\n",$qc) : null); $qcomment = (($qc) ? explode("\n",$qc) : null);
} }
$comment_box = replace_macros($template,array( $comment_box = replace_macros($template,array(
'$return_path' => '', '$return_path' => '',
'$threaded' => $this->is_threaded(),
'$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''), '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
'$type' => (($conv->get_mode() === 'profile') ? 'wall-comment' : 'net-comment'), '$type' => (($conv->get_mode() === 'profile') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(), '$id' => $this->get_id(),

View File

@ -93,10 +93,12 @@
{{ inc $item.template }}{{ endinc }} {{ inc $item.template }}{{ endinc }}
{{ endfor }} {{ endfor }}
{{ if $item.comment }}
{{ if $item.flatten }} {{ if $item.flatten }}
<div class="wall-item-comment-wrapper" > <div class="wall-item-comment-wrapper" >
$item.comment $item.comment
</div> </div>
{{ endif }} {{ endif }}
{{ endif }}
</div> </div>
{{if $item.comment_lastcollapsed}}</div>{{endif}} {{if $item.comment_lastcollapsed}}</div>{{endif}}