From: Brion Vibber Date: Mon, 28 Feb 2011 20:41:03 +0000 (-0800) Subject: quickie inline reply posting form X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2370208540e3669218910b77f538412d6eb1660e;p=quix0rs-gnu-social.git quickie inline reply posting form --- diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index 933a051f38..871a0eb068 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -171,6 +171,10 @@ class ThreadedNoticeListItem extends NoticeListItem $item = new ThreadedNoticeListSubItem($notice, $this->out); $item->show(); } + if (common_current_user()) { + $item = new ThreadedNoticeListReplyItem($this->notice, $this->out); + $item->show(); + } $this->out->elementEnd('ul'); } @@ -195,4 +199,48 @@ class ThreadedNoticeListSubItem extends NoticeListItem { // } +} + +/** + * Show a mini inline posting form for replies. + */ +class ThreadedNoticeListReplyItem extends NoticeListItem +{ + + /** + * recipe function for displaying a single notice. + * + * This uses all the other methods to correctly display a notice. Override + * it or one of the others to fine-tune the output. + * + * @return void + */ + + function show() + { + $this->showStart(); + $this->showMiniForm(); + $this->showEnd(); + } + + function showMiniForm() + { + $replyToId = $this->notice->id; + $id = 'replyto-notice-' + $replyToId; + $url = common_local_url('newnotice'); + + // @fixme replace this with an ajax-friendly form pair? + $this->out->elementStart('form', + array('id' => $id, + 'class' => 'replyform', + 'method' => 'post', + 'action' => $url)); + $this->out->hidden('token', common_session_token()); + $this->out->hidden("$id-inreplyto", $replyToId, "inreplyto"); + $this->out->element('textarea', array('name' => 'status_textarea')); + $this->out->elementStart('div', array('class' => 'controls')); + $this->out->submit("$id-submit", _m('Send reply')); + $this->out->elementEnd('div'); + $this->out->elementEnd('form'); + } } \ No newline at end of file