function divId()
{
- return 'popular_notices';
+ return 'attachment_section';
}
}
return false;
}
+ function divId()
+ {
+ return 'invite_button';
+ }
+
function showContent()
{
$this->out->element(
protected $addressees = true;
protected $attachments = true;
+ protected $id_prefix = null;
protected $maxchars = 0;
protected $options = true;
protected $show_n = NOTICES_PER_PAGE;
$this->$key = (bool)$prefs[$key];
}
}
-
+ // string preferences
+ foreach(array('id_prefix') as $key) {
+ if (array_key_exists($key, $prefs)) {
+ $this->$key = $prefs[$key];
+ }
+ }
}
/**
{
$prefs = array('addressees' => $this->addressees,
'attachments' => $this->attachments,
+ 'id_prefix' => $this->id_prefix,
'maxchars' => $this->maxchars,
'options' => $this->options);
return new NoticeListItem($notice, $this->out, $prefs);
protected $addressees = true;
protected $attachments = true;
+ protected $id_prefix = null;
protected $options = true;
protected $maxchars = 0; // if <= 0 it means use full posts
$this->$key = (bool)$prefs[$key];
}
}
+ // string preferences
+ foreach(array('id_prefix') as $key) {
+ if (array_key_exists($key, $prefs)) {
+ $this->$key = $prefs[$key];
+ }
+ }
}
/**
if (!empty($this->notice->source)) {
$class .= ' notice-source-'.$this->notice->source;
}
+ $id_prefix = (strlen($this->id_prefix) ? $this->id_prefix . '-' : '');
$this->out->elementStart('li', array('class' => $class,
- 'id' => 'notice-' . $id));
+ 'id' => "${id_prefix}notice-${id}"));
Event::handle('EndOpenNoticeListItemElement', array($this));
}
}
* @link http://status.net/
*/
-class NoticeSection extends Section
+abstract 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 SectionNoticeList($this->getNotices(), $this->out);
+ $prefs = array();
+ foreach (array('addressees', 'attachments', 'maxchars', 'options', 'show_n') as $key) {
+ $prefs[$key] = $this->$key;
+ }
+ $prefs['id_prefix'] = $this->divId();
+
+ // args: notice object, html outputter, preference array for notice lists and their items
+ $list = new NoticeList($this->getNotices(), $this->out, $prefs);
$total = $list->show(); // returns total amount of notices available
- return ($total > NOTICES_PER_SECTION); // do we have more to show?
+ return ($total > $this->show_n); // do we have more to show?
}
function getNotices()
* @link http://status.net/
*/
-class ProfileSection extends Section
+abstract class ProfileSection extends Section
{
function showContent()
{
* @link http://status.net/
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
-
-require_once INSTALLDIR.'/lib/widget.php';
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Base class for sections
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-class Section extends Widget
+abstract class Section extends Widget
{
/**
* Show the form
$this->out->elementEnd('p');
}
- function divId()
- {
- return 'generic_section';
- }
+ abstract public function divId();
function title()
{
{
protected $viewer;
- function __construct($out, $viewer)
+ function __construct($out, Profile $viewer=null)
{
parent::__construct($out);
$this->viewer = $viewer;
function divId()
{
- return 'popular_notices';
+ return 'popular_section';
}
function moreUrl()