Unlimited level threading is now a site option.
This commit is contained in:
parent
25015d3ab9
commit
2fc0fcdc18
|
@ -303,7 +303,7 @@ function localize_item(&$item){
|
||||||
* Recursively prepare a thread for HTML
|
* Recursively prepare a thread for HTML
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $collapse_all=false) {
|
function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level=1) {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$wall_template = 'wall_thread.tpl';
|
$wall_template = 'wall_thread.tpl';
|
||||||
|
@ -463,11 +463,11 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||||
} else {
|
} else {
|
||||||
$indent = 'comment';
|
$indent = 'comment';
|
||||||
// Collapse comments
|
// Collapse comments
|
||||||
if(($nb_items > 2) || $collapse_all) {
|
if(($nb_items > 2) || ($thread_level > 2)) {
|
||||||
if($items_seen == 1) {
|
if($items_seen == 1) {
|
||||||
$firstcollapsed = true;
|
$firstcollapsed = true;
|
||||||
}
|
}
|
||||||
if($collapse_all) {
|
if($thread_level > 2) {
|
||||||
if($items_seen == $nb_items)
|
if($items_seen == $nb_items)
|
||||||
$lastcollapsed = true;
|
$lastcollapsed = true;
|
||||||
}
|
}
|
||||||
|
@ -581,11 +581,12 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_result['children'] = array();
|
$item_result['children'] = array();
|
||||||
if(count($item['children'])) {
|
// Show children of children only if enabled
|
||||||
$collapse_all_children = $collapse_all;
|
if(count($item['children'])
|
||||||
if(!$toplevelpost && !$collapse_all)
|
&& (($thread_level < 2) || get_config('system','thread_allow'))) {
|
||||||
$collapse_all_children = true;
|
|
||||||
$item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $collapse_all_children);
|
$thread_level++;
|
||||||
|
$item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level);
|
||||||
}
|
}
|
||||||
$item_result['private'] = $item['private'];
|
$item_result['private'] = $item['private'];
|
||||||
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
|
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
|
||||||
|
@ -796,6 +797,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false, $thr_c = fa
|
||||||
{
|
{
|
||||||
// Normal View
|
// Normal View
|
||||||
|
|
||||||
|
|
||||||
// Threaded comments, $thr_c is used for now since we don't know what other parts of friendica uses this function
|
// Threaded comments, $thr_c is used for now since we don't know what other parts of friendica uses this function
|
||||||
// Better not rely on the new code for stuff we haven't examined yet
|
// Better not rely on the new code for stuff we haven't examined yet
|
||||||
if($thr_c) {
|
if($thr_c) {
|
||||||
|
@ -810,7 +812,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false, $thr_c = fa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $previewing);
|
$threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -1168,6 +1170,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false, $thr_c = fa
|
||||||
|
|
||||||
$threads[$threadsid]['items'][] = $arr['output'];
|
$threads[$threadsid]['items'][] = $arr['output'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,7 @@ function admin_page_site_post(&$a){
|
||||||
$block_public = ((x($_POST,'block_public')) ? True : False);
|
$block_public = ((x($_POST,'block_public')) ? True : False);
|
||||||
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
||||||
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
|
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
|
||||||
|
$thread_allow = ((x($_POST,'thread_allow')) ? True : False);
|
||||||
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
|
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
|
||||||
$no_openid = !((x($_POST,'no_openid')) ? True : False);
|
$no_openid = !((x($_POST,'no_openid')) ? True : False);
|
||||||
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
|
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
|
||||||
|
@ -342,6 +343,7 @@ function admin_page_site_post(&$a){
|
||||||
} else {
|
} else {
|
||||||
set_config('system','directory_submit_url', $global_directory);
|
set_config('system','directory_submit_url', $global_directory);
|
||||||
}
|
}
|
||||||
|
set_config('system','thread_allow', $thread_allow);
|
||||||
|
|
||||||
set_config('system','block_extended_register', $no_multi_reg);
|
set_config('system','block_extended_register', $no_multi_reg);
|
||||||
set_config('system','no_openid', $no_openid);
|
set_config('system','no_openid', $no_openid);
|
||||||
|
@ -442,6 +444,7 @@ function admin_page_site(&$a) {
|
||||||
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")),
|
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")),
|
||||||
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
|
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
|
||||||
'$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
|
'$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
|
||||||
|
'$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
|
||||||
|
|
||||||
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
|
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
|
||||||
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
|
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
{{ inc field_checkbox.tpl with $field=$diaspora_enabled }}{{ endinc }}
|
{{ inc field_checkbox.tpl with $field=$diaspora_enabled }}{{ endinc }}
|
||||||
{{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }}
|
{{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }}
|
||||||
{{ inc field_input.tpl with $field=$global_directory }}{{ endinc }}
|
{{ inc field_input.tpl with $field=$global_directory }}{{ endinc }}
|
||||||
|
{{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }}
|
||||||
|
|
||||||
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
|
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue