ajax reload fixes

This commit is contained in:
Friendika 2011-02-16 21:17:49 -08:00
parent c397a2f89b
commit 4bff52990e
7 changed files with 26 additions and 8 deletions

View file

@ -225,6 +225,10 @@
if(timer) clearTimeout(timer); if(timer) clearTimeout(timer);
timer = setTimeout(NavUpdate,10); timer = setTimeout(NavUpdate,10);
} }
if(data.reload) {
window.location.href=data.reload;
}
}, },
"json" "json"
); );

View file

@ -153,7 +153,8 @@ function display_content(&$a) {
} }
if($item['last-child']) { if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array( $comment = replace_macros($cmnt_tpl,array(
'$return_path' => '', // $_SESSION['return_url'], '$return_path' => '',
'$jsreload' => $_SESSION['return_url'],
'$type' => 'wall-comment', '$type' => 'wall-comment',
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$parent' => $item['parent'], '$parent' => $item['parent'],

View file

@ -496,10 +496,17 @@ function item_post(&$a) {
} }
} }
if((x($_POST,'return')) && strlen($_POST['return'])) logger('post_complete');
if((x($_POST,'return')) && strlen($_POST['return'])) {
logger('return: ' . $_POST['return']);
goaway($a->get_baseurl() . "/" . $_POST['return'] ); goaway($a->get_baseurl() . "/" . $_POST['return'] );
}
$json = array('success' => 1); $json = array('success' => 1);
if(x($_POST,'jsreload') && strlen($_POST['jsreload']))
$json['reload'] = $a->get_baseurl() . '/' . $_POST['jsreload'];
logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
echo json_encode($json); echo json_encode($json);
killme(); killme();
// NOTREACHED // NOTREACHED

View file

@ -340,7 +340,8 @@ function network_content(&$a, $update = 0) {
if($item['last-child']) { if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array( $comment = replace_macros($cmnt_tpl,array(
'$return_path' => '', // $_SESSION['return_url'], '$return_path' => '',
'$jsreload => '', // $_SESSION['return_url'],
'$type' => 'net-comment', '$type' => 'net-comment',
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$parent' => $item['parent'], '$parent' => $item['parent'],

View file

@ -1048,7 +1048,8 @@ function photos_content(&$a) {
if($can_post || can_write_wall($a,$owner_uid)) { if($can_post || can_write_wall($a,$owner_uid)) {
if($link_item['last-child']) { if($link_item['last-child']) {
$o .= replace_macros($cmnt_tpl,array( $o .= replace_macros($cmnt_tpl,array(
'$return_path' => '', // $return_url, '$return_path' => '',
'$jsreload' => $return_url,
'$type' => 'wall-comment', '$type' => 'wall-comment',
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
@ -1087,7 +1088,8 @@ function photos_content(&$a) {
if($can_post || can_write_wall($a,$owner_uid)) { if($can_post || can_write_wall($a,$owner_uid)) {
if($link_item['last-child']) { if($link_item['last-child']) {
$o .= replace_macros($cmnt_tpl,array( $o .= replace_macros($cmnt_tpl,array(
'$return_path' => $return_url, '$return_path' => '',
'$jsreload' => $return_url,
'$type' => 'wall-comment', '$type' => 'wall-comment',
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
@ -1115,7 +1117,8 @@ function photos_content(&$a) {
if($item['last-child']) { if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array( $comment = replace_macros($cmnt_tpl,array(
'$return_path' => $return_url, '$return_path' => '',
'$jsreload' => $return_url,
'$type' => 'wall-comment', '$type' => 'wall-comment',
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$parent' => $item['parent'], '$parent' => $item['parent'],

View file

@ -293,7 +293,8 @@ function profile_content(&$a, $update = 0) {
} }
if($item['last-child']) { if($item['last-child']) {
$comment = replace_macros($cmnt_tpl,array( $comment = replace_macros($cmnt_tpl,array(
'$return_path' => '', // $_SESSION['return_url'], '$return_path' => '',
'$jsreload' => '', // $_SESSION['return_url'],
'$type' => 'wall-comment', '$type' => 'wall-comment',
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$parent' => $item['parent'], '$parent' => $item['parent'],

View file

@ -4,6 +4,7 @@
<input type="hidden" name="profile_uid" value="$profile_uid" /> <input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="parent" value="$parent" /> <input type="hidden" name="parent" value="$parent" />
<input type="hidden" name="return" value="$return_path" /> <input type="hidden" name="return" value="$return_path" />
<input type="hidden" name="jsreload" value="$jsreload" />
<div class="comment-edit-photo" id="comment-edit-photo-$id" > <div class="comment-edit-photo" id="comment-edit-photo-$id" >
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a> <a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>