X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fthreadednoticelist.php;h=919c9128311ed6be4df361132944c101d2e4826b;hb=bb087a965009fd93a5c02a9e10ab90adcc6b7963;hp=1298f179f9f724dd3c538edbfa17f599a82c4deb;hpb=35ce314bfb376b87c8b59410f59f96683640f958;p=quix0rs-gnu-social.git diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index 1298f179f9..919c912831 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -64,7 +64,7 @@ class ThreadedNoticeList extends NoticeList { $this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->element('h2', null, _('Notices')); - $this->out->elementStart('ol', array('class' => 'notices xoxo')); + $this->out->elementStart('ol', array('class' => 'notices threaded-notices xoxo')); $cnt = 0; $conversations = array(); @@ -182,7 +182,7 @@ class ThreadedNoticeListItem extends NoticeListItem } if ($notices) { - $this->out->elementStart('ul', 'notices threaded-notices xoxo'); + $this->out->elementStart('ul', 'notices threaded-replies xoxo'); if ($moreCutoff) { $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out); $item->show(); @@ -191,6 +191,12 @@ class ThreadedNoticeListItem extends NoticeListItem $item = new ThreadedNoticeListSubItem($notice, $this->out); $item->show(); } + // @fixme do a proper can-post check that's consistent + // with the JS side + if (common_current_user()) { + $item = new ThreadedNoticeListReplyItem($notice, $this->out); + $item->show(); + } $this->out->elementEnd('ul'); } } @@ -253,10 +259,7 @@ class ThreadedNoticeListMoreItem extends NoticeListItem function showStart() { - if (Event::handle('StartOpenNoticeListItemElement', array($this))) { - $id = (empty($this->repeat)) ? $this->notice->id : $this->repeat->id; - $this->out->elementStart('li', array('class' => 'notice-reply-comments')); - } + $this->out->elementStart('li', array('class' => 'notice-reply-comments')); } function showMiniForm() @@ -267,24 +270,50 @@ class ThreadedNoticeListMoreItem extends NoticeListItem $notice = new Notice(); $notice->conversation = $id; $n = $notice->count() - 1; - $msg = sprintf(_m('Show all %d comment', 'Show all %d comments', $n), $n); + $msg = sprintf(_m('Show %d reply', 'Show all %d replies', $n), $n); $this->out->element('a', array('href' => $url), $msg); + } +} - // @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'); - */ + +/** + * Placeholder for reply form... + * Same as get added at runtime via SN.U.NoticeInlineReplyPlaceholder + */ +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(); + } + + /** + * start a single notice. + * + * @return void + */ + + function showStart() + { + $this->out->elementStart('li', array('class' => 'notice-reply-placeholder')); + } + + function showMiniForm() + { + $this->out->element('input', array('class' => 'placeholder', + 'value' => _('Write a reply...'))); } } \ No newline at end of file