diff options
author | Robin Millette <millette@controlyourself.ca> | 2009-05-25 11:13:13 -0400 |
---|---|---|
committer | Robin Millette <millette@controlyourself.ca> | 2009-05-25 11:13:13 -0400 |
commit | 84edf12791dc3d44625b156cda6296f1f74f8a9d (patch) | |
tree | 5de74fe285407a93c1ab6ff9270994b4512df8aa /lib | |
parent | 5f3acc252738e408ea2447b7541eae66c1e9e09a (diff) |
Display thumbnail on hover over links in notices when appropriate.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attachmentlist.php | 4 | ||||
-rw-r--r-- | lib/router.php | 4 | ||||
-rw-r--r-- | lib/util.php | 12 |
3 files changed, 17 insertions, 3 deletions
diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 1be7b2fee..52aa5d9ee 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -171,7 +171,7 @@ class AttachmentListItem extends Widget } function linkTitle() { - return 'Our page for ' . $this->title(); + return $this->title(); } /** @@ -256,7 +256,7 @@ class Attachment extends AttachmentListItem } function linkTitle() { - return 'Direct link to ' . $this->title(); + return $this->attachment->url; } function showRepresentation() { diff --git a/lib/router.php b/lib/router.php index 39c005609..d1e2970c5 100644 --- a/lib/router.php +++ b/lib/router.php @@ -159,6 +159,10 @@ class Router array('action' => 'attachment_ajax'), array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/thumbnail', + array('action' => 'attachment_thumbnail'), + array('attachment' => '[0-9]+')); + /* TODO not used right now, will revisit later diff --git a/lib/util.php b/lib/util.php index 4a55cbfe5..d56f44f7b 100644 --- a/lib/util.php +++ b/lib/util.php @@ -503,8 +503,18 @@ function common_linkify($url) { $file = new File; $file->query($query); $file->fetch(); + if (!empty($file->file_id)) { - $attrs['class'] = 'attachment'; + $query = "select file_thumbnail.file_id as file_id from file join file_thumbnail on file.id = file_thumbnail.file_id where file.url='$longurl'"; + $file2 = new File; + $file2->query($query); + $file2->fetch(); + + if (empty($file2->file_id)) { + $attrs['class'] = 'attachment'; + } else { + $attrs['class'] = 'attachment thumbnail'; + } $attrs['id'] = "attachment-{$file->file_id}"; } return XMLStringer::estring('a', $attrs, $display); |