summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-05-24 21:13:42 -0400
committerRobin Millette <millette@controlyourself.ca>2009-05-24 21:13:42 -0400
commit5f3acc252738e408ea2447b7541eae66c1e9e09a (patch)
tree456796bb29a31e521d133396d2adb9538f6f22b2 /lib
parent69f9bce276d86538c176e0c26e734ba694119864 (diff)
Removed big clip and replaced with smaller inline one next to each URL (in a notice) that's actually an attachment. Overlay (popup) on click.
Diffstat (limited to 'lib')
-rw-r--r--lib/noticelist.php1
-rw-r--r--lib/util.php11
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 51b8987fe..ae1438892 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -180,7 +180,6 @@ class NoticeListItem extends Widget
{
$this->showStart();
$this->showNotice();
- $this->showNoticeAttachmentsIcon();
$this->showNoticeInfo();
$this->showNoticeOptions();
$this->showNoticeAttachments();
diff --git a/lib/util.php b/lib/util.php
index fbef8764a..4a55cbfe5 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -496,6 +496,17 @@ function common_linkify($url) {
}
$attrs = array('href' => $longurl, 'rel' => 'external');
+
+// if this URL is an attachment, then we set class='attachment' and id='attahcment-ID'
+// where ID is the id of the attachment for the given URL.
+ $query = "select file_oembed.file_id as file_id from file join file_oembed on file.id = file_oembed.file_id where file.url='$longurl'";
+ $file = new File;
+ $file->query($query);
+ $file->fetch();
+ if (!empty($file->file_id)) {
+ $attrs['class'] = 'attachment';
+ $attrs['id'] = "attachment-{$file->file_id}";
+ }
return XMLStringer::estring('a', $attrs, $display);
}