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.

This commit is contained in:
Robin Millette 2009-05-24 21:13:42 -04:00
parent 69f9bce276
commit 5f3acc2527
4 changed files with 16 additions and 2 deletions

View File

@ -20,7 +20,11 @@ $(document).ready(function(){
// attachments and attachment pages not used at the moment except for attachment_ajax version // 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; }); // $('.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; }); // }, 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 // count character on keyup
function counter(event){ function counter(event){

View File

@ -180,7 +180,6 @@ class NoticeListItem extends Widget
{ {
$this->showStart(); $this->showStart();
$this->showNotice(); $this->showNotice();
$this->showNoticeAttachmentsIcon();
$this->showNoticeInfo(); $this->showNoticeInfo();
$this->showNoticeOptions(); $this->showNoticeOptions();
$this->showNoticeAttachments(); $this->showNoticeAttachments();

View File

@ -496,6 +496,17 @@ function common_linkify($url) {
} }
$attrs = array('href' => $longurl, 'rel' => 'external'); $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); return XMLStringer::estring('a', $attrs, $display);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB