]> git.mxchange.org Git - friendica.git/commitdiff
ajax reload fixes
authorFriendika <info@friendika.com>
Thu, 17 Feb 2011 05:17:49 +0000 (21:17 -0800)
committerFriendika <info@friendika.com>
Thu, 17 Feb 2011 05:17:49 +0000 (21:17 -0800)
include/main.js
mod/display.php
mod/item.php
mod/network.php
mod/photos.php
mod/profile.php
view/comment_item.tpl

index abd097e54a07bcfd7442377823039f264b52e8b4..df7de2e76963cd55189411f86b25f2b260a19649 100644 (file)
                                        if(timer) clearTimeout(timer);
                                        timer = setTimeout(NavUpdate,10);
                                }
+                               if(data.reload) {
+                                       window.location.href=data.reload;
+                               }
+                                       
                        },
                        "json"  
          );  
index 03003f3c0ca44c4fdd3008e21c2970c663b8ec94..bdf6a6f974f4a19c0f99645c14d00ccdda14a4e5 100644 (file)
@@ -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'],
index cbdd11eb976eecf590eeee067db7a527f7cdc158..8c6b181c0d557dfdbd4631e45fb09359d0375877 100644 (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'] );
-
+       }
        $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
index 3658c601e32f6f712d5eb6e8088ed407d524a5dc..bb0850d68126f6c80271c8ae816bb43a978c7394 100644 (file)
@@ -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'],
index a44eb5a5f509a6667b274e73cd8923acf236ef14..27cb1beb1f12a009020541057036bb43046224f3 100644 (file)
@@ -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'],
index 0723d64fb85c09ce90a3031fcf52542315ccaf73..3a393eea0a7d290fd3c5bbec8a82c0c2325f1ace 100644 (file)
@@ -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'],
index 885d735eda1b473134dcb780df77e50466cda687..dabbd6e87bc4c6b7f64acd58dd2ab889b6443be0 100644 (file)
@@ -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>