From 5cc5bae4a91a6f0ac7bf3569d268e203da78274d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 25 Jun 2009 17:00:32 +0000 Subject: Adds a scrollbar if the filename is too long for the attached file --- theme/base/css/display.css | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index bfcc9a7fa..c8f23e4f5 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -517,6 +517,7 @@ clear:both; width:81.5%; margin-bottom:0; line-height:1.618; +overflow:auto; } /* entity_profile */ -- cgit v1.2.3-54-g00ecf From 0eb77e67532cbbdfd1f099303ae8e1614296b87a Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 25 Jun 2009 18:57:39 +0000 Subject: Added fragment identifier to the "in context" URL which points to the notice location in the Conversation page. --- lib/noticelist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/noticelist.php b/lib/noticelist.php index 6f05c63d6..44726a17b 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -432,7 +432,7 @@ class NoticeListItem extends Widget $this->out->elementStart('dl', 'response'); $this->out->element('dt', null, _('To')); $this->out->elementStart('dd'); - $this->out->element('a', array('href' => $convurl), + $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id), _('in context')); $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); -- cgit v1.2.3-54-g00ecf From 27076227620d0beca7586affa8e89154a1648d70 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Jun 2009 12:52:10 -0700 Subject: Return clippy to his rightful place next to attachments --- lib/util.php | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/lib/util.php b/lib/util.php index 30b767c3e..f6d50b180 100644 --- a/lib/util.php +++ b/lib/util.php @@ -497,6 +497,22 @@ function common_linkify($url) { $attrs = array('href' => $longurl, 'rel' => 'external'); + $is_attachment = false; + $attachment_id = null; + $has_thumb = false; + + // Check to see whether there's a filename associated with this URL. + // If there is, it's an upload and qualifies as an attachment + + $localfile = File::staticGet('url', $longurl); + + if (!empty($localfile)) { + if (isset($localfile->filename)) { + $is_attachment = true; + $attachment_id = $localfile->id; + } + } + // 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. // @@ -504,24 +520,35 @@ function common_linkify($url) { // we're currently picking up oembeds only. // I think the best option is another file_view table in the db // and associated dbobject. + $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)) { + $is_attachment = true; + $attachment_id = $file->file_id; + $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 { + if (!empty($file2)) { + $has_thumb = true; + } + } + + // Add clippy + if ($is_attachment) { + $attrs['class'] = 'attachment'; + if ($has_thumb) { $attrs['class'] = 'attachment thumbnail'; } - $attrs['id'] = "attachment-{$file->file_id}"; + $attrs['id'] = "attachment-{$attachment_id}"; } + return XMLStringer::estring('a', $attrs, $display); } -- cgit v1.2.3-54-g00ecf From d1d5347ba3a567205fef36633b52f19a24485a42 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 25 Jun 2009 20:36:02 +0000 Subject: Using transparent background colour instead of solid for notice on hover --- theme/default/css/display.css | 2 +- theme/identica/css/display.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/default/css/display.css b/theme/default/css/display.css index f592e930f..89197bddb 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -245,7 +245,7 @@ div.notice-options input { font-family:sans-serif; } #content .notices li:hover { -background-color:#FCFCFC; +background-color:rgba(240, 240, 240, 0.2); } #conversation .notices li:hover { background-color:transparent; diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 09ad4c972..025debf34 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -245,7 +245,7 @@ div.notice-options input { font-family:sans-serif; } #content .notices li:hover { -background-color:#FCFCFC; +background-color:rgba(240, 240, 240, 0.2); } #conversation .notices li:hover { background-color:transparent; -- cgit v1.2.3-54-g00ecf From 03d31911e18f8ca0ba2f8425943b4c244114a066 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Jun 2009 13:51:29 -0700 Subject: FileAction redirections weren't being added (e.g.: /notice/$notice_id/file) --- actions/newnotice.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index 3677f54c2..15caff6ea 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -326,6 +326,8 @@ class NewnoticeAction extends Action } $this->maybeAddRedir($file_id, $short); + + return $file; } function maybeAddRedir($file_id, $url) @@ -350,7 +352,8 @@ class NewnoticeAction extends Action { File_to_post::processNew($filerec->id, $notice->id); - $this->maybeAddRedir($filerec->id, common_local_url('file', array('notice' => $this->notice->id))); + $this->maybeAddRedir($filerec->id, + common_local_url('file', array('notice' => $notice->id))); } /** -- cgit v1.2.3-54-g00ecf From 6a0571d51b0cafb0dbc7caf3aa61cdfd17d6c7ce Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 25 Jun 2009 21:01:07 +0000 Subject: Added functionality to remove the notice data attachment --- js/util.js | 14 ++++++++++---- theme/base/css/display.css | 11 +++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index 9156045bb..e7c54b74a 100644 --- a/js/util.js +++ b/js/util.js @@ -222,6 +222,7 @@ $(document).ready(function(){ } $("#notice_data-text").val(""); $("#notice_data-attach").val(""); + $('#notice_data-attach_selected').remove(); counter(); } $("#form_notice").removeClass("processing"); @@ -233,7 +234,7 @@ $(document).ready(function(){ $("#form_notice").each(addAjaxHidden); NoticeReply(); NoticeAttachments(); - NoticeDataAttachSelected(); + NoticeDataAttach(); }); function NoticeReply() { @@ -312,10 +313,15 @@ function NoticeAttachments() { ); } -function NoticeDataAttachSelected() { - $('#notice_data-attach').change(function() { - S = '
'+$(this).val()+'
'; +function NoticeDataAttach() { + NDA = $('#notice_data-attach'); + NDA.change(function() { + S = '
'+$(this).val()+'
'; NDAS = $('#notice_data-attach_selected'); (NDAS.length > 0) ? NDAS.replaceWith(S) : $('#form_notice').append(S); + $('#notice_data-attach_selected button').click(function(){ + $('#notice_data-attach_selected').remove(); + NDA.val(''); + }); }); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index c8f23e4f5..78fcd7ece 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -517,8 +517,19 @@ clear:both; width:81.5%; margin-bottom:0; line-height:1.618; +} +#form_notice #notice_data-attach_selected code { +float:left; +width:90%; +display:block; +font-size:1.1em; +line-height:1.8; overflow:auto; } +#form_notice #notice_data-attach_selected button { +float:right; +font-size:0.8em; +} /* entity_profile */ .entity_profile { -- cgit v1.2.3-54-g00ecf