From 83d9f0fb10ec8a9afc5150e115ddeba1c9eb2314 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 26 Aug 2009 02:19:37 -0700 Subject: [PATCH] inline replies --- app/omb/plugins/omb.php | 4 ++++ app/omb/plugins/wp.php | 13 +++++------- db/boot.php | 1 + wp-content/themes/p2/comments.php | 2 +- wp-content/themes/p2/header.php | 34 +++++++++++++++++++++++++++++++ wp-content/themes/p2/index.php | 4 ++-- 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/omb/plugins/omb.php b/app/omb/plugins/omb.php index 2a9b7ce..40101f0 100755 --- a/app/omb/plugins/omb.php +++ b/app/omb/plugins/omb.php @@ -367,6 +367,10 @@ function wp_set_post_fields_after( &$model, &$rec ) { $rec->set_value( 'uri', $request->url_for( array( 'resource'=>'__'.$rec->id, ))); + if (isset($_POST['parent_id']) && is_numeric($_POST['parent_id']) && is_ajax()) { + $rec->set_value( 'parent_id',$_POST['parent_id']); + $rec->set_value( 'local',1); + } $rec->save_changes(); } } diff --git a/app/omb/plugins/wp.php b/app/omb/plugins/wp.php index 253dd93..36b806e 100755 --- a/app/omb/plugins/wp.php +++ b/app/omb/plugins/wp.php @@ -22,11 +22,8 @@ function post_reply_link($arr,$post_id) { global $the_post,$request; if (!isset($the_post->id)) return; - - echo $arr['before'].'' . $txt['wp_reply'] . ''; + $ccrurl = 'JavaScript:inline_comment('.$post_id.','.$post_id.');'; + echo $arr['before'].'' . $txt['wp_reply'] . ''; } @@ -71,12 +68,12 @@ function render_comment(&$post,&$profile,&$parent) { // $cctime = date( "g:i A" , strtotime($post->created) ); // $ccdate = date( get_settings('date_format'), strtotime($post->created) ); $ccurl = $request->url_for(array('resource'=>'posts','id'=>$post->id)); - $ccrurl = $request->url_for(array('resource'=>'posts','id'=>$parent->id)); + $ccrurl = 'JavaScript:inline_comment('.$post->id.','.$parent->id.');'; $comments .= '

'; $comments .= ' '; // $comments .= $cctime.' on '.$ccdate; $comments .= ''; - $comments .= 'Permalink | ' . $txt['wp_reply'] . ''; + $comments .= 'Permalink | ' . $txt['wp_reply'] . ''; if ( get_profile_id() == $post->profile_id ) { $comments .= ' | '.$txt['wp_Edit'].''; $comments .= ' | '.$txt['wp_remove'].''; @@ -1384,7 +1381,7 @@ function profile_get_avatar(&$profile,$size='normal') { $TwitterUser =& $db->model('TwitterUser'); $tu = $TwitterUser->find_by('profile_id',$profile->id); if ($tu && !empty($tu->screen_name)) - return 'http://twivatar.org/'.$tu->screen_name.'/'.$size; + return 'http://dbscript.net/twivatar/index.php?size='.$size.'&user='.$tu->screen_name; return $profile->avatar; } diff --git a/db/boot.php b/db/boot.php index 3dc4d90..9442d08 100755 --- a/db/boot.php +++ b/db/boot.php @@ -610,6 +610,7 @@ // echo value after single-field Ajax PUT call after_filter( 'ajax_put_field', 'update_from_post' ); +after_filter( 'ajax_put_field', 'insert_from_post' ); // authenticate yourself without OpenID diff --git a/wp-content/themes/p2/comments.php b/wp-content/themes/p2/comments.php index 331e681..1e08944 100644 --- a/wp-content/themes/p2/comments.php +++ b/wp-content/themes/p2/comments.php @@ -11,7 +11,7 @@ if ( have_comments ) { - echo "
\n"; + echo "
id."\" class=\"commentlist\">\n"; wp_list_comments(array('callback' => 'prologue_comment')); echo "
\n"; if ( get_option('page_comments') && (get_query_var('cpage') > 1 || get_query_var('cpage') < get_comment_pages_count() ) ) { diff --git a/wp-content/themes/p2/header.php b/wp-content/themes/p2/header.php index 80be881..caec520 100644 --- a/wp-content/themes/p2/header.php +++ b/wp-content/themes/p2/header.php @@ -50,6 +50,40 @@ function facebook_onlogin() { + + + + > diff --git a/wp-content/themes/p2/index.php b/wp-content/themes/p2/index.php index 34680c6..f2dc8d0 100644 --- a/wp-content/themes/p2/index.php +++ b/wp-content/themes/p2/index.php @@ -70,8 +70,8 @@ function test(data) { data = data.substring(0,(data.length - 10)); eval( "data = " + data ); - if (data['in_reply_to'] > 0) { - var selectr = "#prologue-"+data['in_reply_to']+" ul#comments"; + if (data['in_reply_to']) { + var selectr = data['in_reply_to']; $(selectr).append(data['html']); } else { $("#postlist").prepend(data['html']);