diff options
author | friendica <info@friendica.com> | 2012-12-16 00:44:38 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-12-16 00:44:38 -0800 |
commit | 76b289504b440fb19a16e0c3deb8c787658506ab (patch) | |
tree | ffb7870fdf9b6dda1e80fbd48cab1b76434bc079 | |
parent | 37974e5288adc391b32d72f5b4d6e9d698ee1777 (diff) | |
download | volse-hubzilla-76b289504b440fb19a16e0c3deb8c787658506ab.tar.gz volse-hubzilla-76b289504b440fb19a16e0c3deb8c787658506ab.tar.bz2 volse-hubzilla-76b289504b440fb19a16e0c3deb8c787658506ab.zip |
add live page loading and and endless scroll to home (mod_channel)
-rw-r--r-- | mod/channel.php | 68 | ||||
-rw-r--r-- | mod/network.php | 5 | ||||
-rw-r--r-- | mod/update_channel.php | 3 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/tpl/build_query.tpl | 2 |
5 files changed, 55 insertions, 25 deletions
diff --git a/mod/channel.php b/mod/channel.php index affef9613..62fcf1be7 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -38,7 +38,7 @@ function channel_aside(&$a) { } -function channel_content(&$a, $update = 0) { +function channel_content(&$a, $update = 0, $load = false) { $category = $datequery = $datequery2 = ''; @@ -131,7 +131,7 @@ function channel_content(&$a, $update = 0) { $sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups); - if($update) { + if(($update) && (! $load)) { $r = q("SELECT distinct(parent) AS `item_id` from item left join abook on item.author_xchan = abook.abook_xchan WHERE uid = %d AND item_restrict = 0 @@ -165,20 +165,24 @@ function channel_content(&$a, $update = 0) { $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); - $r = q("SELECT id AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d AND item_restrict = 0 - AND (item_flags & %d) and (item_flags & %d) - AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) - $sql_extra $sql_extra2 - ORDER BY created DESC $pager_sql ", - intval($a->profile['profile_uid']), - intval(ITEM_WALL), - intval(ITEM_THREAD_TOP), - intval(ABOOK_FLAG_BLOCKED) - - ); - + if($load) { + $r = q("SELECT id AS item_id FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE uid = %d AND item_restrict = 0 + AND (item_flags & %d) and (item_flags & %d) + AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) + $sql_extra $sql_extra2 + ORDER BY created DESC $pager_sql ", + intval($a->profile['profile_uid']), + intval(ITEM_WALL), + intval(ITEM_THREAD_TOP), + intval(ABOOK_FLAG_BLOCKED) + + ); + } + else { + $r = array(); + } } if($r) { @@ -203,14 +207,40 @@ function channel_content(&$a, $update = 0) { } - if(! $update) { + if((! $update) && (! $load)) { // 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 .= '<div id="live-channel"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; + + + $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + '$baseurl' => z_root(), + '$pgtype' => 'channel', + '$uid' => ((local_user()) ? local_user() : '0'), + '$gid' => '0', + '$cid' => '0', + '$cmin' => '0', + '$cmax' => '0', + '$star' => '0', + '$liked' => '0', + '$conv' => '0', + '$spam' => '0', + '$nouveau' => '0', + '$wall' => '1', + '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$search' => '', + '$order' => '', + '$file' => '', + '$cats' => (($category) ? $category : ''), + '$dend' => $datequery, + '$dbegin' => $datequery2 + )); + + } @@ -226,7 +256,7 @@ function channel_content(&$a, $update = 0) { } - $o .= conversation($a,$items,'channel',$update); + $o .= conversation($a,$items,'channel',$update,'client'); if(! $update) $o .= alt_pager($a,count($items)); diff --git a/mod/network.php b/mod/network.php index e19871602..7559de293 100644 --- a/mod/network.php +++ b/mod/network.php @@ -340,10 +340,6 @@ function network_content(&$a, $update = 0, $load = false) { } - - - - $contact_id = $a->cid; require_once('include/acl_selectors.php'); @@ -513,6 +509,7 @@ function network_content(&$a, $update = 0, $load = false) { '$search' => $search, '$order' => $order, '$file' => $file, + '$cats' =? '', '$dend' => $datequery, '$dbegin' => $datequery2 )); diff --git a/mod/update_channel.php b/mod/update_channel.php index 08b7bd5d7..19226297b 100644 --- a/mod/update_channel.php +++ b/mod/update_channel.php @@ -12,6 +12,7 @@ require_once('mod/channel.php'); function update_channel_content(&$a) { $profile_uid = intval($_GET['p']); + $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0); header("Content-type: text/html"); echo "<!DOCTYPE html><html><body>\r\n"; @@ -32,7 +33,7 @@ function update_channel_content(&$a) { * */ - $text = channel_content($a,$profile_uid); + $text = channel_content($a,$profile_uid,$load); $pattern = "/<img([^>]*) src=\"([^\"]*)\"/"; $replace = "<img\${1} dst=\"\${2}\""; diff --git a/version.inc b/version.inc index 26a6801cf..b127e983e 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-12-14.169 +2012-12-15.170 diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl index 4a2b0f60d..2af664d3c 100644 --- a/view/tpl/build_query.tpl +++ b/view/tpl/build_query.tpl @@ -19,6 +19,7 @@ var bParam_search = "$search"; var bParam_order = "$order"; var bParam_file = "$file"; + var bParam_cats = "$category"; var bParam_dend = "$dend"; var bParam_dbegin = "$dbegin"; @@ -38,6 +39,7 @@ if(bParam_wall != 0) bCmd = bCmd + "&wall=" + bParam_wall; if(bParam_search != "") bCmd = bCmd + "&search=" + bParam_search; if(bParam_file != "") bCmd = bCmd + "&file=" + bParam_file; + if(bParam_cats != "") bCmd = bCmd + "&cats=" + bParam_cats; if(bParam_dend != "") bCmd = bCmd + "&dend=" + bParam_dend; if(bParam_dbegin != "") bCmd = bCmd + "&dbegin=" + bParam_dbegin; if(bParam_page != 1) bCmd = bCmd + "&page=" + bParam_page; |