use a subclass for single notice items to show attachments
This commit is contained in:
parent
7bcaa858af
commit
e2becdb251
|
@ -209,7 +209,7 @@ class ShownoticeAction extends Action
|
|||
function showContent()
|
||||
{
|
||||
$this->elementStart('ol', array('class' => 'notices xoxo'));
|
||||
$nli = new NoticeListItem($this->notice, $this);
|
||||
$nli = new SingleNoticeItem($this->notice, $this);
|
||||
$nli->show();
|
||||
$this->elementEnd('ol');
|
||||
}
|
||||
|
@ -264,3 +264,29 @@ class ShownoticeAction extends Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingleNoticeItem extends NoticeListItem
|
||||
{
|
||||
/**
|
||||
* recipe function for displaying a single notice.
|
||||
*
|
||||
* We overload to show attachments.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function show()
|
||||
{
|
||||
$this->showStart();
|
||||
$this->showNotice();
|
||||
$this->showNoticeAttachments();
|
||||
$this->showNoticeInfo();
|
||||
$this->showNoticeOptions();
|
||||
$this->showEnd();
|
||||
}
|
||||
|
||||
function showNoticeAttachments() {
|
||||
$al = new AttachmentList($this->notice, $this->out);
|
||||
$al->show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,6 @@ class NoticeListItem extends Widget
|
|||
{
|
||||
$this->showStart();
|
||||
$this->showNotice();
|
||||
$this->showNoticeAttachments();
|
||||
$this->showNoticeInfo();
|
||||
$this->showNoticeOptions();
|
||||
$this->showEnd();
|
||||
|
@ -193,18 +192,6 @@ class NoticeListItem extends Widget
|
|||
$this->out->elementEnd('div');
|
||||
}
|
||||
|
||||
function showNoticeAttachments() {
|
||||
if ($this->isUsedInList()) {
|
||||
return;
|
||||
}
|
||||
$al = new AttachmentList($this->notice, $this->out);
|
||||
$al->show();
|
||||
}
|
||||
|
||||
function isUsedInList() {
|
||||
return 'shownotice' !== $this->out->args['action'];
|
||||
}
|
||||
|
||||
function showNoticeInfo()
|
||||
{
|
||||
$this->out->elementStart('div', 'entry-content');
|
||||
|
|
Loading…
Reference in New Issue
Block a user