Merge branch 'ajaxcomms'

Conflicts:
	view/comment_item.tpl
This commit is contained in:
Friendika 2011-02-14 04:46:49 -08:00
commit b87ddbd58a
5 changed files with 32 additions and 5 deletions

View file

@ -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
@ -210,3 +211,23 @@
$('#panel').hide();
}
function post_comment(id) {
$.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;
}

View file

@ -490,7 +490,12 @@ function item_post(&$a) {
}
}
goaway($a->get_baseurl() . "/" . $_POST['return'] );
if((x($_POST,'return')) && strlen($_POST['return']))
goaway($a->get_baseurl() . "/" . $_POST['return'] );
$json = array('success' => 1);
echo json_encode($json);
killme();
// NOTREACHED
}

View file

@ -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'],

View file

@ -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'],

View file

@ -1,5 +1,5 @@
<div class="comment-$wwedit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
<form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" >
<form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" onsubmit="post_comment($id); return false;">
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="parent" value="$parent" />
@ -13,9 +13,10 @@
<div class="comment-edit-text-end"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
<input type="submit" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="Submit" />
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="Submit" />
</div>
<div class="comment-edit-end"></div>
</form>
</div>