From: Mikael Nordfeldth Date: Thu, 8 Jan 2015 19:19:43 +0000 (+0100) Subject: new noticelist classes for primary and section lists X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a3b9367c9aea253d560db7d9b16d625cd0953a62;p=quix0rs-gnu-social.git new noticelist classes for primary and section lists --- diff --git a/lib/noticelist.php b/lib/noticelist.php index 5c0e67adb0..6a430d210b 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -94,9 +94,8 @@ class NoticeList extends Widget * * @return int Total amount of notices actually available. */ - function show() + public function show() { - $this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->elementStart('ol', array('class' => 'notices xoxo')); $notices = $this->notice->fetchAll(); @@ -118,8 +117,6 @@ class NoticeList extends Widget } $this->out->elementEnd('ol'); - $this->out->elementEnd('div'); - return $total; } diff --git a/lib/noticesection.php b/lib/noticesection.php index 51c00d91bc..2c52d66a59 100644 --- a/lib/noticesection.php +++ b/lib/noticesection.php @@ -48,21 +48,10 @@ define('NOTICES_PER_SECTION', 6); class NoticeSection extends Section { - protected $addressees = false; - protected $attachments = false; - protected $maxchars = 140; - protected $options = false; - protected $show_n = NOTICES_PER_SECTION; - function showContent() { // args: notice object, html outputter, preference array for list and items - $list = new NoticeList($this->getNotices(), $this->out, - array('addressees' => $this->addressees, - 'attachments' => $this->attachments, - 'maxchars'=> $this->maxchars, - 'options' => $this->options, - 'show_n' => $this->show_n)); + $list = new SectionNoticeList($this->getNotices(), $this->out); $total = $list->show(); // returns total amount of notices available return ($total > NOTICES_PER_SECTION); // do we have more to show? } diff --git a/lib/primarynoticelist.php b/lib/primarynoticelist.php new file mode 100644 index 0000000000..791b810fe0 --- /dev/null +++ b/lib/primarynoticelist.php @@ -0,0 +1,54 @@ +. + * + * @category UI + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } + +/** + * widget for displaying a list of notices in the primary content area + * + * @category UI + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * @see Notice + * @see NoticeListItem + * @see ProfileNoticeList + */ +class PrimaryNoticeList extends NoticeList +{ + public function show() + { + $this->out->elementStart('div', array('id' =>'notices_primary')); + $total = parent::show(); + $this->out->elementEnd('div'); + return $total; + } +} diff --git a/lib/sectionnoticelist.php b/lib/sectionnoticelist.php new file mode 100644 index 0000000000..614d7b7a1a --- /dev/null +++ b/lib/sectionnoticelist.php @@ -0,0 +1,52 @@ +. + * + * @category UI + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } + +/** + * widget for displaying a list of notices in the primary content area + * + * @category UI + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * @see Notice + * @see NoticeListItem + * @see ProfileNoticeList + */ +class SectionNoticeList extends NoticeList +{ + protected $addressees = false; + protected $attachments = false; + protected $maxchars = 140; + protected $options = false; + protected $show_n = NOTICES_PER_SECTION; +}