]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #508 from fermionic/no-theme-control-of-live-update-location
authorfermionic <fermion@gmx.com>
Thu, 11 Oct 2012 00:34:28 +0000 (17:34 -0700)
committerfermionic <fermion@gmx.com>
Thu, 11 Oct 2012 00:34:28 +0000 (17:34 -0700)
allow themes to decide where live updates appear

16 files changed:
include/conversation.php
mod/community.php
mod/display.php
mod/network.php
mod/notes.php
mod/profile.php
mod/search.php
view/conversation.tpl
view/theme/dispy/conversation.tpl
view/theme/dispy/threaded_conversation.tpl [new file with mode: 0644]
view/theme/facepark/conversation.tpl
view/theme/frost-mobile/conversation.tpl
view/theme/frost-mobile/threaded_conversation.tpl
view/theme/quattro/conversation.tpl
view/theme/vier/threaded_conversation.tpl
view/threaded_conversation.tpl

index b41f3f0b76ef98c32eed38b6e36b05cf7f262f25..6b7c3afb031ceac2174d3a139a07b7c2fd146944 100644 (file)
@@ -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 = '<div id="live-network"></div>' . "\r\n"
+                               . "<script> var profile_uid = " . $_SESSION['uid'] 
+                               . "; var netargs = '" . substr($a->cmd,8)
+                               . '?f='
+                               . ((x($_GET,'cid'))    ? '&cid='    . $_GET['cid']    : '')
+                               . ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '') 
+                               . ((x($_GET,'star'))   ? '&star='   . $_GET['star']   : '') 
+                               . ((x($_GET,'order'))  ? '&order='  . $_GET['order']  : '') 
+                               . ((x($_GET,'bmark'))  ? '&bmark='  . $_GET['bmark']  : '') 
+                               . ((x($_GET,'liked'))  ? '&liked='  . $_GET['liked']  : '') 
+                               . ((x($_GET,'conv'))   ? '&conv='   . $_GET['conv']   : '') 
+                               . ((x($_GET,'spam'))   ? '&spam='   . $_GET['spam']   : '') 
+                               . ((x($_GET,'nets'))   ? '&nets='   . $_GET['nets']   : '') 
+                               . ((x($_GET,'cmin'))   ? '&cmin='   . $_GET['cmin']   : '') 
+                               . ((x($_GET,'cmax'))   ? '&cmax='   . $_GET['cmax']   : '') 
+                               . ((x($_GET,'file'))   ? '&file='   . $_GET['file']   : '') 
+
+                               . "'; var profile_page = " . $a->pager['page'] . "; </script>\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 = '<div id="live-profile"></div>' . "\r\n"
+                                       . "<script> var profile_uid = " . $a->profile['profile_uid'] 
+                                       . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                       }
+               }
+       }
+       else if($mode === 'notes') {
                $profile_owner = local_user();
                $page_writeable = true;
+               if(!$update) {
+                       $live_update_div = '<div id="live-notes"></div>' . "\r\n"
+                               . "<script> var profile_uid = " . local_user() 
+                               . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\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 = '<div id="live-display"></div>' . "\r\n";
        }
-
-       if($mode === 'community') {
+       else if($mode === 'community') {
                $profile_owner = 0;
                $page_writeable = false;
+               if(!$update) {
+                       $live_update_div = '<div id="live-community"></div>' . "\r\n"
+                               . "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+               }
+       }
+       else if($mode === 'search') {
+               $live_update_div = '<div id="live-search"></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,
index 4f6c3d3c94c399c724023cb752968925881f52b2..defc873b0adaca306594fd2b14ab8d0903d7418e 100644 (file)
@@ -32,8 +32,6 @@ function community_content(&$a, $update = 0) {
        $o .= '<h3>' . t('Community') . '</h3>';
        if(! $update) {
                nav_set_selected('community');
-               $o .= '<div id="live-community"></div>' . "\r\n";
-               $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
        }
 
        if(x($a->data,'search'))
index 64df4cc6a9d7fc36a952a107f2845ccfaa21bf7c..be4a0ab9f9d47552deee2ed24e4da59902d4b4c0 100644 (file)
@@ -14,7 +14,7 @@ function display_content(&$a) {
        require_once('include/acl_selectors.php');
 
 
-       $o = '<div id="live-display"></div>' . "\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);
 
index ef1fd877b19708997524d9c7e53d2ed94cf4c789..4d3603843eb8633856c3524af7df184c128d8389 100644 (file)
@@ -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 .= '<div id="live-network"></div>' . "\r\n";
-               $o .= "<script> var profile_uid = " . $_SESSION['uid'] 
-                       . "; var netargs = '" . substr($a->cmd,8)
-                       . '?f='
-                       . ((x($_GET,'cid'))    ? '&cid='    . $_GET['cid']    : '')
-                       . ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '') 
-                       . ((x($_GET,'star'))   ? '&star='   . $_GET['star']   : '') 
-                       . ((x($_GET,'order'))  ? '&order='  . $_GET['order']  : '') 
-                       . ((x($_GET,'bmark'))  ? '&bmark='  . $_GET['bmark']  : '') 
-                       . ((x($_GET,'liked'))  ? '&liked='  . $_GET['liked']  : '') 
-                       . ((x($_GET,'conv'))   ? '&conv='   . $_GET['conv']   : '') 
-                       . ((x($_GET,'spam'))   ? '&spam='   . $_GET['spam']   : '') 
-                       . ((x($_GET,'nets'))   ? '&nets='   . $_GET['nets']   : '') 
-                       . ((x($_GET,'cmin'))   ? '&cmin='   . $_GET['cmin']   : '') 
-                       . ((x($_GET,'cmax'))   ? '&cmax='   . $_GET['cmax']   : '') 
-                       . ((x($_GET,'file'))   ? '&file='   . $_GET['file']   : '') 
-
-                       . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
-       }
-
        $sql_extra3 = '';
 
        if($datequery) {
index afaa60f7016623c91d36432cd303c5b0fcd6140b..62796ed13f8fc0dc7757895aaa114b9cfc41dd07 100644 (file)
@@ -66,10 +66,6 @@ function notes_content(&$a,$update = false) {
 
        $o .= status_editor($a,$x,$a->contact['id']);
 
-               $o .= '<div id="live-notes"></div>' . "\r\n";
-               $o .= "<script> var profile_uid = " . local_user() 
-                       . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
-
        }
 
        // Construct permissions
index b33b181de1b1b7332611799ac225d366c12fd48a..e7135515ff11fcb0405571f9079b7c6e06c69675 100644 (file)
@@ -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 .= '<div id="live-profile"></div>' . "\r\n";
-               $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] 
-                       . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
-       }
-
 
        if($is_owner) {
                $r = q("UPDATE `item` SET `unseen` = 0 
index 87c72367e83af4ea438c699f0d18b73104f3a6a1..ac848a0ceced8af051aee13655c98c95155d61f3 100644 (file)
@@ -93,9 +93,7 @@ function search_content(&$a) {
        require_once('include/security.php');
        require_once('include/conversation.php');
 
-       $o = '<div id="live-search"></div>' . "\r\n";
-
-       $o .= '<h3>' . t('Search') . '</h3>';
+       $o = '<h3>' . t('Search') . '</h3>';
 
        if(x($a->data,'search'))
                $search = notags(trim($a->data['search']));
index fccd9a8bb0872ca09243995b141068baf4244f93..0e1464621975cb8c3b4cbcde36324ce999ff7ffb 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $thread }}
 <div id="tread-wrapper-$thread.id" class="tread-wrapper">
        {{ for $thread.items as $item }}
index 4a93dacf3744bbb5dfd4c550507a652e76485fcd..8eae2d6d1c76ce6186b8f331ac88010c4b817633 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $thread }}
 <div id="tread-wrapper-$thread.id" class="tread-wrapper">
        {{ 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 (file)
index 0000000..3afb02c
--- /dev/null
@@ -0,0 +1,15 @@
+$live_update
+
+{{ for $threads as $item }}
+{{ inc $item.template }}{{ endinc }}
+{{ endfor }}
+
+<div id="conversation-end"></div>
+
+{{ if $dropping }}
+<div id="item-delete-selected" class="fakelink" onclick="deleteCheckedItems(); return false;">
+  <div id="item-delete-selected-icon" class="icon drophide" title="$dropping" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></div>
+  <div id="item-delete-selected-desc" >$dropping</div>
+</div>
+<div id="item-delete-selected-end"></div>
+{{ endif }}
index fccd9a8bb0872ca09243995b141068baf4244f93..0e1464621975cb8c3b4cbcde36324ce999ff7ffb 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $thread }}
 <div id="tread-wrapper-$thread.id" class="tread-wrapper">
        {{ for $thread.items as $item }}
index 43b4d63ff0caa3686f3fed7f094a065a52c0e1c9..54ddafbb1d52d276f986fb04a7a4094550fbc79f 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $thread }}
 <div id="tread-wrapper-$thread.id" class="tread-wrapper">
        {{ for $thread.items as $item }}
index 6e017ac29b18a81109bf84f82b0f693db860b72d..26ff683f264d26c74f7936d028c358ce0c2784df 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $item }}
 {{ inc $item.template }}{{ endinc }}
 {{ endfor }}
index 0d0faac37377147c7b2fe49c9412975395462308..36afc392eb504df939f75710ee25ced25131e498 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $thread }}
 <div id="tread-wrapper-$thread.id" class="tread-wrapper">
        {{ for $thread.items as $item }}
index 13c38acb2b40471374c4d8cd19a73f0717ba1dde..ad510185ee9f1911cb8e27e17554c6fb36e7fabc 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $item }}
 
 <div id="tread-wrapper-$item.id" class="tread-wrapper {{ if $item.threaded }}threaded{{ endif }}">
index f60839e4958a53426b849df1f53794908c74dc8c..56adc8c969047eebd22a125cce812b773d18f12d 100644 (file)
@@ -1,3 +1,5 @@
+$live_update
+
 {{ for $threads as $item }}
 {{ inc $item.template }}{{ endinc }}
 {{ endfor }}