]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Removed big clip and replaced with smaller inline one next to each URL (in a notice...
authorRobin Millette <millette@controlyourself.ca>
Mon, 25 May 2009 01:13:42 +0000 (21:13 -0400)
committerRobin Millette <millette@controlyourself.ca>
Mon, 25 May 2009 01:13:42 +0000 (21:13 -0400)
js/util.js
lib/noticelist.php
lib/util.php
theme/base/images/icons/clip-inline.png [new file with mode: 0644]

index 6511c0380da3215f0eff0972f431373896153cf4..b6848abaa271b69bbd89df6b4578d9db72e25907 100644 (file)
@@ -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){
index 51b8987fe96d29654ccdb7c0de6c75e4594309db..ae143889218caf15df47ac8ca4652ec3faa7d245 100644 (file)
@@ -180,7 +180,6 @@ class NoticeListItem extends Widget
     {
         $this->showStart();
         $this->showNotice();
-        $this->showNoticeAttachmentsIcon();
         $this->showNoticeInfo();
         $this->showNoticeOptions();
         $this->showNoticeAttachments();
index fbef8764a783fa60b2df42f76f72fb7a537bc40d..4a55cbfe5921000ea573a4ffb3ab34e1b0799542 100644 (file)
@@ -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 (file)
index 0000000..870f8b2
Binary files /dev/null and b/theme/base/images/icons/clip-inline.png differ