From 3d9845f4a45f963161e31fe18d69ed31e38af003 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 12 Feb 2011 03:14:59 -0800 Subject: [PATCH 1/4] preliminary ajax comment setups --- mod/item.php | 4 +++- mod/network.php | 2 +- mod/profile.php | 2 +- view/comment_item.tpl | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mod/item.php b/mod/item.php index a83373f59..0d9a674f2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -490,7 +490,9 @@ function item_post(&$a) { } } - goaway($a->get_baseurl() . "/" . $_POST['return'] ); + if((x($_POST,'return')) && strlen($_POST['return'])) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); // NOTREACHED } diff --git a/mod/network.php b/mod/network.php index f11db45a8..f09b302e9 100644 --- a/mod/network.php +++ b/mod/network.php @@ -340,7 +340,7 @@ function network_content(&$a, $update = 0) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => $_SESSION['return_url'], + '$return_path' => '', // $_SESSION['return_url'], '$type' => 'net-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], diff --git a/mod/profile.php b/mod/profile.php index 8ec29d382..57abc479d 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -293,7 +293,7 @@ function profile_content(&$a, $update = 0) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => $_SESSION['return_url'], + '$return_path' => '', // $_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 6f63e39b7..2f1a8393f 100644 --- a/view/comment_item.tpl +++ b/view/comment_item.tpl @@ -18,4 +18,5 @@
+ From ee46a028d6e443d4cffcd24a99871d88089a93c9 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 12 Feb 2011 03:42:57 -0800 Subject: [PATCH 2/4] more test ajax comments --- include/main.js | 13 +++++++++++++ view/comment_item.tpl | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/main.js b/include/main.js index 63b34bd21..afe968daf 100644 --- a/include/main.js +++ b/include/main.js @@ -210,3 +210,16 @@ $('#panel').hide(); } + function post_comment(id) { + var typename = 'f-type-' + id; + var puidname = 'f-profile-uid-' + id; + var parname = 'f-parent-' + id; + var textname = 'comment-edit-text-' + id; + var type = $('input[id=typename]').val(); + var profile_uid = $('input[id=puidname]').val(); + var parent = $('input[id=parname]').val(); + var body = $('textarea[id=textname]').val(); + + alert(body); + + } \ No newline at end of file diff --git a/view/comment_item.tpl b/view/comment_item.tpl index 2f1a8393f..068cf0731 100644 --- a/view/comment_item.tpl +++ b/view/comment_item.tpl @@ -1,5 +1,5 @@
-
+ @@ -13,7 +13,7 @@
From 39dd36176bb3c72702d6964394d9409be4d6cdcd Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 14 Feb 2011 04:43:19 -0800 Subject: [PATCH 3/4] ajax comments --- include/main.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/include/main.js b/include/main.js index afe968daf..abd097e54 100644 --- a/include/main.js +++ b/include/main.js @@ -29,6 +29,7 @@ $(document).ready(function() { $.ajaxSetup({cache: false}); + msie = $.browser.msie ; NavUpdate(); // Allow folks to stop the ajax page updates with the pause/break key @@ -211,15 +212,22 @@ } function post_comment(id) { - var typename = 'f-type-' + id; - var puidname = 'f-profile-uid-' + id; - var parname = 'f-parent-' + id; - var textname = 'comment-edit-text-' + id; - var type = $('input[id=typename]').val(); - var profile_uid = $('input[id=puidname]').val(); - var parent = $('input[id=parname]').val(); - var body = $('textarea[id=textname]').val(); + $.post( + "item", + $("#comment-edit-form-" + id).serialize(), + function(data) { + if(data.success) { + $("#comment-edit-wrapper-" + id).hide(); + $("#comment-edit-text-" + id).val(''); + var tarea = document.getElementById("comment-edit-text-" + id); + if(tarea) + commentClose(tarea,id); + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); + } + }, + "json" + ); + return false; + } - alert(body); - - } \ No newline at end of file From df209907536a3c5e093b8ae95070ca9941c6c797 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 14 Feb 2011 04:43:49 -0800 Subject: [PATCH 4/4] ajax comments --- mod/item.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/item.php b/mod/item.php index 0d9a674f2..2cc2b9eb2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -492,6 +492,9 @@ function item_post(&$a) { if((x($_POST,'return')) && strlen($_POST['return'])) goaway($a->get_baseurl() . "/" . $_POST['return'] ); + + $json = array('success' => 1); + echo json_encode($json); killme(); // NOTREACHED }