From 5f3acc252738e408ea2447b7541eae66c1e9e09a Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Sun, 24 May 2009 21:13:42 -0400 Subject: [PATCH] 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. --- js/util.js | 6 +++++- lib/noticelist.php | 1 - lib/util.php | 11 +++++++++++ theme/base/images/icons/clip-inline.png | Bin 0 -> 1646 bytes 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 theme/base/images/icons/clip-inline.png diff --git a/js/util.js b/js/util.js index 6511c0380d..b6848abaa2 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(' Attachment'); // count character on keyup function counter(event){ diff --git a/lib/noticelist.php b/lib/noticelist.php index 51b8987fe9..ae14388921 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 fbef8764a7..4a55cbfe59 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 0000000000000000000000000000000000000000..870f8b2e8ff32f1b5e19a9a2389648bfdfd47ec9 GIT binary patch literal 1646 zcmV-!29f!RP)71Q{00004b3#c}2nYxW zd95B}{OcTWhu4z*Pi$1#~vVrphs~40I$efG23$1a(&&Fb+O8)mEZW0{~4pk z__m|bQSWxUy@U_~j{?kImQAnxVC8fcba*cxys&d7ZYbBCe`)Uxu6;@$+CP#6ve)n*qFyw?Oyf!g-)k-Orhh-V|d z>OI)I7C#_{3yv1NrSs`d(3k0vv3X+)E`58cg|^ZfilRyf2M7DDR%?L#^O{gkQ_saD zMN+4z6gN`;7t39r8?jBh?O>z1adDzAG1w8)q4FQ_pT{!R`20Sj*XwnY39%7E2mtuv zmGP%!mAwAGK>&aqpX_)n?$x-eZew>aIU!l4AJ98-J-z@4Gyu@;^?JuiSd9Qcfe->V zf_

7o0oApk((p~9tYr0poajCs5eryGwN+i8xzCwMsSwl3RNoT>09>Fg*xJB1yg#FVhM!Gl)q}-@4LE=+7>22_*=$Zih&=I5 z?#A4R)YnoEIj%dNQecIuwzAd`(HCI|g+j;f3g&LijYxSd<&ep2nwKCX#I@XLp+XfQ zgCt0rU@+J=Iy&l^7$E?_ho60z$R%>WcubxkPQd9cWi3}Jo~l$R6sPTW`{a=V0POm5 z*GzM~xr+UR})KN@bqdZ=uz1VVR3rx`C2#CLsb((P7MtWv4jvY?2clm zW@kZ%tK*I7*Qe80$dwpRna2PkXfehHmSt~s?rk6dDDpM=+bjAiwuF8RH9xocIZTcgoz5HKV?rT>5MaQ0rFlP;|5Of!ydB?uaq0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