// And finally remove the entry from the database
return parent::delete($useWhere);
}
+
+ public function getTitle()
+ {
+ $title = $this->title ?: $this->filename;
+
+ return $title ?: null;
+ }
}
*/
function show()
{
- $att = $this->notice->attachments();
- if (empty($att)) return 0;
+ $attachments = $this->notice->attachments();
+ $representable = false;
+ foreach ($attachments as $key=>$att) {
+ // Only show attachments representable with a title
+ if ($att->getTitle() === null) {
+ unset($attachments[$key]);
+ }
+ }
+ if (!count($attachments)) {
+ return 0;
+ }
+
$this->showListStart();
- foreach ($att as $n=>$attachment) {
- $item = $this->newListItem($attachment);
+ foreach ($attachments as $att) {
+ $item = $this->newListItem($att);
$item->show();
}
$this->showListEnd();
- return count($att);
+ return count($attachments);
}
function showListStart()
}
function title() {
- return $this->attachment->title ?: $this->attachment->filename;
+ return $this->attachment->getTitle();
}
function linkTitle() {
{
function showListStart()
{
- $this->out->elementStart('div', array('class' => 'attachments'));
- }
-
- function showListEnd()
- {
- $this->out->elementEnd('div');
+ $this->out->element('h2', null, _('Attachments'));
+ parent::showListStart();
}
/**
{
// XXX: RDFa
// TODO: add notice_type class e.g., notice_video, notice_image
- $this->out->elementStart('span', array('class' => 'inline-attachment'));
+ $this->out->elementStart('li', array('class' => 'inline-attachment'));
}
/**
*/
function showEnd()
{
- $this->out->elementEnd('span');
+ $this->out->elementEnd('li');
}
}