From: Zach Prezkuta Date: Tue, 9 Oct 2012 15:41:33 +0000 (-0600) Subject: allow themes to decide where live updates appear X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0ea89852d20e3bc99433c8d1392bf552269f6755;p=friendica.git allow themes to decide where live updates appear --- diff --git a/include/conversation.php b/include/conversation.php index b41f3f0b76..6b7c3afb03 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -374,33 +374,79 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $ssl_state = ((local_user()) ? true : false); $profile_owner = 0; - $page_writeable = false; + $page_writeable = false; + $live_update_div = ''; $previewing = (($preview) ? ' preview ' : ''); if($mode === 'network') { $profile_owner = local_user(); $page_writeable = true; + if(!$update) { + // The special div is needed for liveUpdate to kick in for this page. + // We only launch liveUpdate if you aren't filtering in some incompatible + // way and also you aren't writing a comment (discovered in javascript). + + $live_update_div = '
' . "\r\n" + . "\r\n"; + } } - - if($mode === 'profile') { + else if($mode === 'profile') { $profile_owner = $a->profile['profile_uid']; $page_writeable = can_write_wall($a,$profile_owner); - } - if($mode === 'notes') { + if(!$update) { + $tab = notags(trim($_GET['tab'])); + if($tab === 'posts') { + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + + $live_update_div = '
' . "\r\n" + . "\r\n"; + } + } + } + else if($mode === 'notes') { $profile_owner = local_user(); $page_writeable = true; + if(!$update) { + $live_update_div = '
' . "\r\n" + . "\r\n"; + } } - - if($mode === 'display') { + else if($mode === 'display') { $profile_owner = $a->profile['uid']; $page_writeable = can_write_wall($a,$profile_owner); + $live_update_div = '
' . "\r\n"; } - - if($mode === 'community') { + else if($mode === 'community') { $profile_owner = 0; $page_writeable = false; + if(!$update) { + $live_update_div = '
' . "\r\n" + . "\r\n"; + } + } + else if($mode === 'search') { + $live_update_div = '' . "\r\n"; } $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false); @@ -630,7 +676,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $o = replace_macros($page_template, array( '$baseurl' => $a->get_baseurl($ssl_state), - '$remove' => t('remove'), + '$live_update' => $live_update_div, + '$remove' => t('remove'), '$mode' => $mode, '$user' => $a->user, '$threads' => $threads, diff --git a/mod/community.php b/mod/community.php index 4f6c3d3c94..defc873b0a 100644 --- a/mod/community.php +++ b/mod/community.php @@ -32,8 +32,6 @@ function community_content(&$a, $update = 0) { $o .= '

' . t('Community') . '

'; if(! $update) { nav_set_selected('community'); - $o .= '
' . "\r\n"; - $o .= "\r\n"; } if(x($a->data,'search')) diff --git a/mod/display.php b/mod/display.php index 64df4cc6a9..be4a0ab9f9 100644 --- a/mod/display.php +++ b/mod/display.php @@ -14,7 +14,7 @@ function display_content(&$a) { require_once('include/acl_selectors.php'); - $o = '
' . "\r\n"; + $o = ''; $a->page['htmlhead'] .= get_markup_template('display-head.tpl'); @@ -78,7 +78,7 @@ function display_content(&$a) { return; } - if ($is_owner) + if ($is_owner) { $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); $x = array( @@ -93,7 +93,7 @@ function display_content(&$a) { 'profile_uid' => local_user() ); $o .= status_editor($a,$x,0,true); - + } $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups); diff --git a/mod/network.php b/mod/network.php index ef1fd877b1..4d3603843e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -584,31 +584,6 @@ function network_content(&$a, $update = 0) { $o .= get_events(); } - if(! $update) { - // The special div is needed for liveUpdate to kick in for this page. - // We only launch liveUpdate if you aren't filtering in some incompatible - // way and also you aren't writing a comment (discovered in javascript). - - $o .= '
' . "\r\n"; - $o .= "\r\n"; - } - $sql_extra3 = ''; if($datequery) { diff --git a/mod/notes.php b/mod/notes.php index afaa60f701..62796ed13f 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -66,10 +66,6 @@ function notes_content(&$a,$update = false) { $o .= status_editor($a,$x,$a->contact['id']); - $o .= '
' . "\r\n"; - $o .= "\r\n"; - } // Construct permissions diff --git a/mod/profile.php b/mod/profile.php index b33b181de1..e7135515ff 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -8,8 +8,6 @@ function profile_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; - $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); - if($a->argc > 1) $which = $a->argv[1]; else { @@ -33,6 +31,7 @@ function profile_init(&$a) { profile_load($a,$which,$profile); + $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); $userblock = (($a->profile['hidewall'] && (! local_user()) && (! remote_user())) ? true : false); if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) { @@ -309,16 +308,6 @@ function profile_content(&$a, $update = 0) { $o .= get_events(); } - if((! $update) && ($tab === 'posts')) { - - // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, - // because browser prefetching might change it on us. We have to deliver it with the page. - - $o .= '
' . "\r\n"; - $o .= "\r\n"; - } - if($is_owner) { $r = q("UPDATE `item` SET `unseen` = 0 diff --git a/mod/search.php b/mod/search.php index 87c72367e8..ac848a0cec 100644 --- a/mod/search.php +++ b/mod/search.php @@ -93,9 +93,7 @@ function search_content(&$a) { require_once('include/security.php'); require_once('include/conversation.php'); - $o = '' . "\r\n"; - - $o .= '

' . t('Search') . '

'; + $o = '

' . t('Search') . '

'; if(x($a->data,'search')) $search = notags(trim($a->data['search'])); diff --git a/view/conversation.tpl b/view/conversation.tpl index fccd9a8bb0..0e14646219 100644 --- a/view/conversation.tpl +++ b/view/conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $thread }}
{{ for $thread.items as $item }} diff --git a/view/theme/dispy/conversation.tpl b/view/theme/dispy/conversation.tpl index 4a93dacf37..8eae2d6d1c 100644 --- a/view/theme/dispy/conversation.tpl +++ b/view/theme/dispy/conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $thread }}
{{ for $thread.items as $item }} diff --git a/view/theme/dispy/threaded_conversation.tpl b/view/theme/dispy/threaded_conversation.tpl new file mode 100644 index 0000000000..3afb02c6ad --- /dev/null +++ b/view/theme/dispy/threaded_conversation.tpl @@ -0,0 +1,15 @@ +$live_update + +{{ for $threads as $item }} +{{ inc $item.template }}{{ endinc }} +{{ endfor }} + +
+ +{{ if $dropping }} + +
+{{ endif }} diff --git a/view/theme/facepark/conversation.tpl b/view/theme/facepark/conversation.tpl index fccd9a8bb0..0e14646219 100644 --- a/view/theme/facepark/conversation.tpl +++ b/view/theme/facepark/conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $thread }}
{{ for $thread.items as $item }} diff --git a/view/theme/frost-mobile/conversation.tpl b/view/theme/frost-mobile/conversation.tpl index 43b4d63ff0..54ddafbb1d 100644 --- a/view/theme/frost-mobile/conversation.tpl +++ b/view/theme/frost-mobile/conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $thread }}
{{ for $thread.items as $item }} diff --git a/view/theme/frost-mobile/threaded_conversation.tpl b/view/theme/frost-mobile/threaded_conversation.tpl index 6e017ac29b..26ff683f26 100644 --- a/view/theme/frost-mobile/threaded_conversation.tpl +++ b/view/theme/frost-mobile/threaded_conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $item }} {{ inc $item.template }}{{ endinc }} {{ endfor }} diff --git a/view/theme/quattro/conversation.tpl b/view/theme/quattro/conversation.tpl index 0d0faac373..36afc392eb 100644 --- a/view/theme/quattro/conversation.tpl +++ b/view/theme/quattro/conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $thread }}
{{ for $thread.items as $item }} diff --git a/view/theme/vier/threaded_conversation.tpl b/view/theme/vier/threaded_conversation.tpl index 13c38acb2b..ad510185ee 100644 --- a/view/theme/vier/threaded_conversation.tpl +++ b/view/theme/vier/threaded_conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $item }}
diff --git a/view/threaded_conversation.tpl b/view/threaded_conversation.tpl index f60839e495..56adc8c969 100644 --- a/view/threaded_conversation.tpl +++ b/view/threaded_conversation.tpl @@ -1,3 +1,5 @@ +$live_update + {{ for $threads as $item }} {{ inc $item.template }}{{ endinc }} {{ endfor }}