]> git.mxchange.org Git - friendica.git/commitdiff
Flatten children when threads are disabled
authorDomovoy <domovoy@errlock.org>
Fri, 3 Aug 2012 20:28:21 +0000 (22:28 +0200)
committerDomovoy <domovoy@errlock.org>
Fri, 3 Aug 2012 20:28:21 +0000 (22:28 +0200)
include/conversation.php
view/theme/darkzero/style.css
view/wall_thread.tpl

index e1caa0447388f67dbd35790e878d83c5740718b0..76348561f8abb7925299f0077782a7bf6cdd9f36 100644 (file)
@@ -581,13 +581,27 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
                }
 
                $item_result['children'] = array();
-               // Show children of children only if enabled
-               if(count($item['children'])
-               && (($thread_level < 2) || get_config('system','thread_allow'))) {
+               if(count($item['children'])) {
                        $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, ($thread_level + 1));
                }
                $item_result['private'] = $item['private'];
                $item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
+
+               /*
+                * I don't like this very much...
+                */
+               if(get_config('system','thread_allow')) {
+                       $item_result['flatten'] = false;
+                       $item_result['threaded'] = true;
+               }
+               else {
+                       $item_result['flatten'] = true;
+                       $item_result['threaded'] = false;
+                       if(!$toplevelpost) {
+                               $item_result['comment'] = false;
+                       }
+               }
+               
                $result[] = $item_result;
        }
 
@@ -1134,9 +1148,16 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
 function get_item_children($arr, $parent) {
        $children = array();
        foreach($arr as $item) {
-               if(($item['id'] != $item['parent']) && ($item['thr-parent'] == $parent['uri'])) {
-                       $item['children'] = get_item_children($arr, $item);
-                       $children[] = $item;
+               if($item['id'] != $item['parent']) {
+                       if(get_config('system','thread_allow')) {
+                               if($item['thr-parent'] == $parent['uri']) {
+                                       $item['children'] = get_item_children($arr, $item);
+                                       $children[] = $item;
+                               }
+                       }
+                       else if($item['parent'] == $parent['id']) {
+                               $children[] = $item;
+                       }
                }
        }
        return $children;
index e9b4bc8b2b21d6f20f943f21710ce77ada391f5e..dda180bbd226fffccdeee31f31d57dd28bffe0c0 100644 (file)
@@ -29,6 +29,7 @@ background: #444;
 }
 .wall-item-tools {     background-color: #444444;   background-image: none;}
 .comment-wwedit-wrapper{ background-color: #444444; }
+.toplevel_item > .wall-item-comment-wrapper > .comment-wwedit-wrapper{ background-color: #333333; }
 .comment-edit-preview{ color: #000000; }
 .wall-item-content-wrapper.comment { background-color: #444444; border: 0px;}
 .photo-top-album-name{ background-color: #333333; }
index 31c70b27d2cddd5242096fb6112a9a55b4d062ed..600f755b12cd69c6592ca30be2f0d370ecb7d271 100644 (file)
                                {{ 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>
                                {{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
-                       <div class="wall-item-delete-end"></div>                        
-<div class="wall-item-comment-wrapper" >
-       $item.comment
-</div>
+                       <div class="wall-item-delete-end"></div>
+                       {{ if $item.threaded }}
+                       {{ if $item.comment }}
+                       <div class="wall-item-comment-wrapper" >
+                               $item.comment
+                       </div>
+                       {{ endif }}
+                       {{ endif }}
                </div>
        </div>
        <div class="wall-item-wrapper-end"></div>
        {{ inc $item.template }}{{ endinc }}
 {{ endfor }}
 
+{{ if $item.flatten }}
+<div class="wall-item-comment-wrapper" >
+       $item.comment
+</div>
+{{ endif }}
 </div>
 {{if $item.comment_lastcollapsed}}</div>{{endif}}