ajax page loads
This commit is contained in:
parent
f535554cfa
commit
6911beca2f
@ -346,6 +346,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||
$page_writeable = false;
|
||||
}
|
||||
|
||||
|
||||
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
|
||||
|
||||
|
||||
if($update)
|
||||
$return_url = $_SESSION['return_url'];
|
||||
else
|
||||
@ -869,14 +873,26 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||
}
|
||||
}
|
||||
|
||||
$page_template = get_markup_template("conversation.tpl");
|
||||
$o = replace_macros($page_template, array(
|
||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||
'$mode' => $mode,
|
||||
'$user' => $a->user,
|
||||
'$threads' => $threads,
|
||||
'$dropping' => ($dropping?t('Delete Selected Items'):False),
|
||||
));
|
||||
logger('threads: ' . count($threads) . ' update: ' . $update);
|
||||
|
||||
if($update) {
|
||||
$page_template = get_markup_template("conv.tpl");
|
||||
$o = replace_macros($page_template, array(
|
||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||
'$mode' => $mode,
|
||||
'$user' => $a->user,
|
||||
'$threads' => $threads,
|
||||
));
|
||||
}
|
||||
else {
|
||||
$page_template = get_markup_template("conv_frame.tpl");
|
||||
$o = replace_macros($page_template, array(
|
||||
'$baseurl' => $a->get_baseurl($ssl_state),
|
||||
'$mode' => $mode,
|
||||
'$user' => $a->user,
|
||||
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
||||
));
|
||||
}
|
||||
|
||||
return $o;
|
||||
}}
|
||||
|
@ -33,6 +33,8 @@
|
||||
var last_popup_menu = null;
|
||||
var last_popup_button = null;
|
||||
|
||||
var page_load = true;
|
||||
|
||||
$(function() {
|
||||
$.ajaxSetup({cache: false});
|
||||
|
||||
@ -314,7 +316,10 @@ function updateConvItems(mode,data) {
|
||||
prev = 'live-' + src;
|
||||
|
||||
in_progress = true;
|
||||
var udargs = ((netargs.length) ? '/' + netargs : '');
|
||||
|
||||
var udargs = ((page_load) ? '/load' : '');
|
||||
page_load = false;
|
||||
|
||||
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0);
|
||||
|
||||
$.get(update_url,function(data) {
|
||||
|
@ -235,7 +235,7 @@ function network_query_get_sel_tab($a) {
|
||||
}
|
||||
|
||||
|
||||
function network_content(&$a, $update = 0) {
|
||||
function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
require_once('include/conversation.php');
|
||||
|
||||
@ -451,10 +451,6 @@ function network_content(&$a, $update = 0) {
|
||||
if(count($r)) {
|
||||
$sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) ";
|
||||
$o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
|
||||
if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
|
||||
notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
notice( t('Invalid contact.') . EOL);
|
||||
@ -581,7 +577,7 @@ function network_content(&$a, $update = 0) {
|
||||
);
|
||||
}
|
||||
|
||||
if($update) {
|
||||
if($update && ! $load) {
|
||||
|
||||
// only setup pagination on initial page view
|
||||
$pager_sql = '';
|
||||
@ -601,8 +597,10 @@ function network_content(&$a, $update = 0) {
|
||||
}
|
||||
|
||||
$simple_update = (($update) ? " and `item`.`unseen` = 1 " : '');
|
||||
if($load)
|
||||
$simple_update = '';
|
||||
|
||||
if($nouveau) {
|
||||
if($nouveau && $load) {
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
@ -624,8 +622,8 @@ function network_content(&$a, $update = 0) {
|
||||
|
||||
$items = fetch_post_tags($items);
|
||||
}
|
||||
else {
|
||||
|
||||
elseif($load) {
|
||||
logger('loading:');
|
||||
// Normal conversation view
|
||||
|
||||
|
||||
@ -636,7 +634,7 @@ function network_content(&$a, $update = 0) {
|
||||
|
||||
// Fetch a page full of parent items for this page
|
||||
|
||||
if($update) {
|
||||
if($update && (! $load)) {
|
||||
$r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
||||
@ -649,7 +647,6 @@ function network_content(&$a, $update = 0) {
|
||||
}
|
||||
else {
|
||||
|
||||
dbg(1);
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
@ -659,7 +656,7 @@ dbg(1);
|
||||
ORDER BY `item`.$ordering DESC $pager_sql ",
|
||||
intval(local_user())
|
||||
);
|
||||
dbg(0);
|
||||
|
||||
}
|
||||
|
||||
// Then fetch all the children of the parents that are on this page
|
||||
@ -697,6 +694,7 @@ dbg(0);
|
||||
}
|
||||
}
|
||||
|
||||
logger('items: ' . count($items));
|
||||
|
||||
// We aren't going to try and figure out at the item, group, and page
|
||||
// level which items you've seen and which you haven't. If you're looking
|
||||
|
@ -8,13 +8,13 @@ require_once('include/group.php');
|
||||
function update_network_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";
|
||||
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
||||
|
||||
|
||||
$text = network_content($a,$profile_uid);
|
||||
$text = network_content($a,$profile_uid, $load);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
Reference in New Issue
Block a user