diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-05-26 23:24:01 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-05-26 23:24:01 -0400 |
commit | 648d967226f3b47aa6237d2be9d1a82df4f78402 (patch) | |
tree | 2592f56f0073ee21ce320a158233fdb1bd2710c4 /lib/noticelist.php | |
parent | 6335c9cf59b384da24506c4a3f799315fbbc4b09 (diff) | |
parent | 0b53a820c2b4224b66b2a24f67302b4c5ca1deed (diff) |
Merge branch '0.8.x' into userdesign
Conflicts:
lib/attachmentlist.php
lib/noticelist.php
Diffstat (limited to 'lib/noticelist.php')
-rw-r--r-- | lib/noticelist.php | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/lib/noticelist.php b/lib/noticelist.php index ba3526509..8aab83433 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -34,6 +34,7 @@ if (!defined('LACONICA')) { require_once INSTALLDIR.'/lib/favorform.php'; require_once INSTALLDIR.'/lib/disfavorform.php'; +require_once INSTALLDIR.'/lib/attachmentlist.php'; /** * widget for displaying a list of notices @@ -192,45 +193,24 @@ class NoticeListItem extends Widget $this->out->elementEnd('div'); } - function showNoticeAttachments() - { - $f2p = new File_to_post; - $f2p->post_id = $this->notice->id; - $file = new File; - $file->joinAdd($f2p); - $file->selectAdd(); - $file->selectAdd('file.id as id'); - $count = $file->find(true); - if (!$count) return; - if (1 === $count) { - $href = common_local_url('attachment', array('attachment' => $file->id)); - $att_class = 'attachment'; - } else { - $href = common_local_url('attachments', array('notice' => $this->notice->id)); - $att_class = 'attachments'; + function showNoticeAttachments() { + if ($this->isUsedInList()) { + return; } + $al = new AttachmentList($this->notice, $this->out); + $al->show(); + } - $clip = theme_path('images/icons/clip', 'base'); - if ('shownotice' === $this->out->args['action']) { - $height = '96px'; - $width = '83%'; - $width_att = '15%'; - $clip .= '-big.png'; - $top = '70px'; - } else { - $height = '48px'; - $width = '90%'; - $width_att = '8%'; - $clip .= '.png'; - $top = '20px'; - } -if(0) - $this->out->elementStart('div', 'entry-attachments'); -else - $this->out->elementStart('p', array('class' => 'entry-attachments', 'style' => "float: right; width: $width_att; background: url($clip) no-repeat; text-align: right; height: $height;")); - $this->out->element('a', array('class' => $att_class, 'style' => "text-decoration: none; padding-top: $top; display: block; height: $height;", 'href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count); + function isUsedInList() { + return 'shownotice' !== $this->out->args['action']; + } - $this->out->elementEnd('p'); + function attachmentCount($discriminant = true) { + $file_oembed = new File_oembed; + $query = "select count(*) as c from file_oembed join file_to_post on file_oembed.file_id = file_to_post.file_id where post_id=" . $this->notice->id; + $file_oembed->query($query); + $file_oembed->fetch(); + return intval($file_oembed->c); } function showNoticeInfo() |