X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnoticelist.php;h=0e80a9778ef6568a288fa444b4058af9aa46a02f;hb=b8de7935568e631bc99aec6120f2bc4090f50fec;hp=004905056276acf142a87db0627e94fa35e221d5;hpb=8fce42160738aab1b58755b36136cd9a968b3d27;p=quix0rs-gnu-social.git diff --git a/lib/noticelist.php b/lib/noticelist.php index 0049050562..0e80a9778e 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 @@ -85,7 +86,7 @@ class NoticeList extends Widget { $this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->element('h2', null, _('Notices')); - $this->out->elementStart('ul', array('class' => 'notices')); + $this->out->elementStart('ol', array('class' => 'notices xoxo')); $cnt = 0; @@ -100,7 +101,7 @@ class NoticeList extends Widget $item->show(); } - $this->out->elementEnd('ul'); + $this->out->elementEnd('ol'); $this->out->elementEnd('div'); return $cnt; @@ -180,85 +181,42 @@ class NoticeListItem extends Widget $this->showStart(); $this->showNotice(); $this->showNoticeAttachments(); - $this->showNoticeOptions(); $this->showNoticeInfo(); + $this->showNoticeOptions(); $this->showEnd(); } function showNotice() { -if(0) - $this->out->elementStart('entry-title'); -else - - if ('shownotice' === $this->out->args['action']) { - $width = '85%'; - } else { - $width = '90%'; - } - - - $this->out->elementStart('div', array('class' => 'entry-title', 'style' => "float: left; width: $width;")); + $this->out->elementStart('div', 'entry-title'); $this->showAuthor(); $this->showContent(); $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() { -if(0) $this->out->elementStart('div', 'entry-content'); -else - - if ('shownotice' === $this->out->args['action']) { - $width = '85%'; - } else { - $width = '90%'; - } - - $this->out->elementStart('div', array('class' => 'entry-content', 'style' => "float: left; width: $width;")); $this->showNoticeLink(); $this->showNoticeSource(); $this->showContext(); @@ -269,10 +227,7 @@ else { $user = common_current_user(); if ($user) { -if(0) $this->out->elementStart('div', 'notice-options'); -else - $this->out->elementStart('div', array('class' => 'notice-options', 'style' => 'float: right; width: 16%;')); $this->showFaveForm(); $this->showReplyLink(); $this->showDeleteLink();