summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/util.js6
-rw-r--r--lib/noticelist.php1
-rw-r--r--lib/util.php11
-rw-r--r--theme/base/images/icons/clip-inline.pngbin0 -> 1646 bytes
4 files changed, 16 insertions, 2 deletions
diff --git a/js/util.js b/js/util.js
index 6511c0380..b6848abaa 100644
--- a/js/util.js
+++ b/js/util.js
@@ -20,7 +20,11 @@ $(document).ready(function(){
// attachments and attachment pages not used at the moment except for attachment_ajax version
// $('.attachments').click(function() {$().jOverlay({zIndex:999, success:function(html) {$('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
// }, url:$(this).attr('href') + '/ajax'}); return false; });
- $('.attachment').click(function() {$().jOverlay({url:'../attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; });
+
+ //FIXME
+ //need to link to proper url depending on site config (path name and theme, for instance)
+ $('a.attachment').click(function() {$().jOverlay({url:'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; });
+ $('.entry-title a.attachment').append('&nbsp;<img style="display: inline; vertical-align: middle" src="/theme/base/images/icons/clip-inline.png" alt="Attachment" />');
// count character on keyup
function counter(event){
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);
}
diff --git a/theme/base/images/icons/clip-inline.png b/theme/base/images/icons/clip-inline.png
new file mode 100644
index 000000000..870f8b2e8
--- /dev/null
+++ b/theme/base/images/icons/clip-inline.png
Binary files differ