diff options
author | Friendika <info@friendika.com> | 2011-02-16 21:17:49 -0800 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-02-16 21:17:49 -0800 |
commit | 4bff52990e5f340cf879abf7c1cdaea7ee928d74 (patch) | |
tree | 6b97ae3fe0430f3c94565692cc97da81f0065de8 | |
parent | c397a2f89bf3c2c609852f5bfc618c1d0cb0b709 (diff) | |
download | volse-hubzilla-4bff52990e5f340cf879abf7c1cdaea7ee928d74.tar.gz volse-hubzilla-4bff52990e5f340cf879abf7c1cdaea7ee928d74.tar.bz2 volse-hubzilla-4bff52990e5f340cf879abf7c1cdaea7ee928d74.zip |
ajax reload fixes
-rw-r--r-- | include/main.js | 4 | ||||
-rw-r--r-- | mod/display.php | 3 | ||||
-rw-r--r-- | mod/item.php | 11 | ||||
-rw-r--r-- | mod/network.php | 3 | ||||
-rw-r--r-- | mod/photos.php | 9 | ||||
-rw-r--r-- | mod/profile.php | 3 | ||||
-rw-r--r-- | view/comment_item.tpl | 1 |
7 files changed, 26 insertions, 8 deletions
diff --git a/include/main.js b/include/main.js index abd097e54..df7de2e76 100644 --- a/include/main.js +++ b/include/main.js @@ -225,6 +225,10 @@ if(timer) clearTimeout(timer); timer = setTimeout(NavUpdate,10); } + if(data.reload) { + window.location.href=data.reload; + } + }, "json" ); diff --git a/mod/display.php b/mod/display.php index 03003f3c0..bdf6a6f97 100644 --- a/mod/display.php +++ b/mod/display.php @@ -153,7 +153,8 @@ function display_content(&$a) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload' => $_SESSION['return_url'], '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/item.php b/mod/item.php index cbdd11eb9..8c6b181c0 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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'] ); - + } $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); killme(); // NOTREACHED diff --git a/mod/network.php b/mod/network.php index 3658c601e..bb0850d68 100644 --- a/mod/network.php +++ b/mod/network.php @@ -340,7 +340,8 @@ function network_content(&$a, $update = 0) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload => '', // $_SESSION['return_url'], '$type' => 'net-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/photos.php b/mod/photos.php index a44eb5a5f..27cb1beb1 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1048,7 +1048,8 @@ function photos_content(&$a) { if($can_post || can_write_wall($a,$owner_uid)) { if($link_item['last-child']) { $o .= replace_macros($cmnt_tpl,array( - '$return_path' => '', // $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $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($link_item['last-child']) { $o .= replace_macros($cmnt_tpl,array( - '$return_path' => $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], @@ -1115,7 +1117,8 @@ function photos_content(&$a) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => $return_url, + '$return_path' => '', + '$jsreload' => $return_url, '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/profile.php b/mod/profile.php index 0723d64fb..3a393eea0 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -293,7 +293,8 @@ function profile_content(&$a, $update = 0) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', // $_SESSION['return_url'], + '$return_path' => '', + '$jsreload' => '', // $_SESSION['return_url'], '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/view/comment_item.tpl b/view/comment_item.tpl index 885d735ed..dabbd6e87 100644 --- a/view/comment_item.tpl +++ b/view/comment_item.tpl @@ -4,6 +4,7 @@ <input type="hidden" name="profile_uid" value="$profile_uid" /> <input type="hidden" name="parent" value="$parent" /> <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" > <a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a> |