From b118ef633a3c1f3446f01a5b22db8fbfb5e4406a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 22 May 2009 10:03:47 -0400 Subject: Add Gravity to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/notice_source.sql b/db/notice_source.sql index 17720028d..7c31a9af4 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -9,6 +9,7 @@ VALUES ('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()), ('Facebook','Facebook','http://apps.facebook.com/identica/', now()), ('feed2omb','feed2omb','http://projects.ciarang.com/p/feed2omb/', now()), + ('gravity', 'Gravity', 'http://mobileways.de/gravity', now()), ('Gwibber','Gwibber','http://launchpad.net/gwibber', now()), ('HelloTxt','HelloTxt','http://hellotxt.com/', now()), ('identicatools','Laconica Tools','http://bitbucketlabs.net/laconica-tools/', now()), -- cgit v1.2.3-54-g00ecf From ef2a5c794e7fc82d7f19675a6a11af64135ef4ee Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 22 May 2009 16:19:14 +0000 Subject: Fixed in reply to JS link for Conversation page. Handles nested notices better. --- js/util.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index 31d9eb4f5..2dfaafd76 100644 --- a/js/util.js +++ b/js/util.js @@ -235,10 +235,10 @@ function NoticeHover() { function NoticeReply() { if ($('#notice_data-text').length > 0) { $('#content .notice').each(function() { - var notice = $(this); - $('.notice_reply', $(this)).click(function() { - var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname'); - NoticeReplySet(nickname.text(), $('.notice_id', notice).text()); + var notice = $(this)[0]; + $($('.notice_reply', notice)[0]).click(function() { + var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname'); + NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text()); return false; }); }); -- cgit v1.2.3-54-g00ecf From 456f3eeb50fc1cafaa66ab5c0bdcdcaa5ca4bcd0 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 22 May 2009 16:38:06 +0000 Subject: Removed unnecessary link to base stylesheet because default stylesheet calls base in 0.8.x --- install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.php b/install.php index bc82e5e37..1d411c221 100644 --- a/install.php +++ b/install.php @@ -295,13 +295,13 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" Install Laconica - + - - - + + +
-- cgit v1.2.3-54-g00ecf From 7e0a314768fed3c5964e9d404d33a243277559ce Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 24 May 2009 01:38:11 +0000 Subject: Using event bubbling instead of event handling thanks to Ara Pehlivanian http://arapehlivanian.com --- js/util.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/js/util.js b/js/util.js index 2dfaafd76..baa3f119e 100644 --- a/js/util.js +++ b/js/util.js @@ -203,7 +203,6 @@ $(document).ready(function(){ $("#notices_primary .notices").prepend(document._importNode(li, true)); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(2500); - NoticeHover(); NoticeReply(); } } @@ -221,17 +220,16 @@ $(document).ready(function(){ NoticeReply(); }); + function NoticeHover() { - $("#content .notice").hover( - function () { - $(this).addClass('hover'); - }, - function () { - $(this).removeClass('hover'); - } - ); + function mouseHandler(e) { + $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover'); + }; + $('#content .notices').mouseover(mouseHandler); + $('#content .notices').mouseout(mouseHandler); } + function NoticeReply() { if ($('#notice_data-text').length > 0) { $('#content .notice').each(function() { -- cgit v1.2.3-54-g00ecf From fde9b09435f6d7fc6cb3f8ccc37dcb3f5ccdb056 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 24 May 2009 01:53:08 +0000 Subject: Changing opacity to 1 only on the hovered notice item --- theme/default/css/display.css | 4 +++- theme/identica/css/display.css | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 16c9322a5..bc6bd2ee4 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -193,7 +193,9 @@ background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-r } .notices div.entry-content, -.notices div.notice-options { +.notices div.notice-options, +.notices li.hover .notices div.entry-content, +.notices li.hover .notices div.notice-options { opacity:0.4; } .notices li.hover div.entry-content, diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 2fb123a20..b181d9056 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -193,7 +193,9 @@ background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-r } .notices div.entry-content, -.notices div.notice-options { +.notices div.notice-options, +.notices li.hover .notices div.entry-content, +.notices li.hover .notices div.notice-options { opacity:0.4; } .notices li.hover div.entry-content, -- cgit v1.2.3-54-g00ecf From b5ac6e31f2f148164860aeabec6899b75d7292ec Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Sun, 24 May 2009 04:43:34 -0400 Subject: Rearranged attachment info to only appear on each applicable notice page and thru an ajax popup. --- actions/attachment.php | 10 ++++----- actions/attachment_ajax.php | 24 +------------------- actions/attachments.php | 2 -- actions/tag.php | 4 ++-- js/util.js | 7 +++--- lib/attachmentlist.php | 6 +---- lib/noticelist.php | 55 +++++++++++++++++++++------------------------ lib/router.php | 15 ++++++++++--- theme/base/css/display.css | 20 ++++++++++++++++- 9 files changed, 68 insertions(+), 75 deletions(-) diff --git a/actions/attachment.php b/actions/attachment.php index b9187ff08..c51c75120 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -31,8 +31,6 @@ if (!defined('LACONICA')) { exit(1); } -//require_once INSTALLDIR.'/lib/personalgroupnav.php'; -//require_once INSTALLDIR.'/lib/feedlist.php'; require_once INSTALLDIR.'/lib/attachmentlist.php'; /** @@ -67,11 +65,11 @@ class AttachmentAction extends Action { parent::prepare($args); - $id = $this->arg('attachment'); - - $this->attachment = File::staticGet($id); + if ($id = $this->trimmed('attachment')) { + $this->attachment = File::staticGet($id); + } - if (!$this->attachment) { + if (empty($this->attachment)) { $this->clientError(_('No such attachment.'), 404); return false; } diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php index 1620b27dd..6930dc112 100644 --- a/actions/attachment_ajax.php +++ b/actions/attachment_ajax.php @@ -45,26 +45,6 @@ require_once INSTALLDIR.'/actions/attachment.php'; class Attachment_ajaxAction extends AttachmentAction { - /** - * Load attributes based on database arguments - * - * Loads all the DB stuff - * - * @param array $args $_REQUEST array - * - * @return success flag - */ - - function prepare($args) - { - parent::prepare($args); - if (!$this->attachment) { - $this->clientError(_('No such attachment.'), 404); - return false; - } - return true; - } - /** * Show page, a template method. * @@ -87,7 +67,7 @@ class Attachment_ajaxAction extends AttachmentAction */ function showCore() { - $this->elementStart('div', array('id' => 'core')); + $this->elementStart('div', array('id' => 'ajaxcore')); if (Event::handle('StartShowContentBlock', array($this))) { $this->showContentBlock(); Event::handle('EndShowContentBlock', array($this)); @@ -95,8 +75,6 @@ class Attachment_ajaxAction extends AttachmentAction $this->elementEnd('div'); } - - /** * Last-modified date for page * diff --git a/actions/attachments.php b/actions/attachments.php index 6b31c839d..d3c90fec2 100644 --- a/actions/attachments.php +++ b/actions/attachments.php @@ -31,8 +31,6 @@ if (!defined('LACONICA')) { exit(1); } -//require_once INSTALLDIR.'/lib/personalgroupnav.php'; -//require_once INSTALLDIR.'/lib/feedlist.php'; require_once INSTALLDIR.'/lib/attachmentlist.php'; /** diff --git a/actions/tag.php b/actions/tag.php index 47420e4c3..e71ec06a8 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -49,8 +49,8 @@ class TagAction extends Action { $pop = new PopularNoticeSection($this); $pop->show(); - $freqatt = new FrequentAttachmentSection($this); - $freqatt->show(); +// $freqatt = new FrequentAttachmentSection($this); +// $freqatt->show(); } function title() diff --git a/js/util.js b/js/util.js index 2dfaafd76..4f2b036fa 100644 --- a/js/util.js +++ b/js/util.js @@ -17,9 +17,10 @@ */ $(document).ready(function(){ - $('.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:$(this).attr('href') + '/ajax'}); return false; }); +// 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:'http://laptop.waglo.com/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); // count character on keyup function counter(event){ diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 9485fe3d6..1be7b2fee 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -191,7 +191,7 @@ class AttachmentListItem extends Widget } function linkAttr() { - return array('class' => 'attachment', 'href' => common_local_url('attachment', array('attachment' => $this->attachment->id))); + return array('class' => 'attachment', 'href' => $this->attachment->url, 'id' => 'attachment-' . $this->attachment->id); } function showLink() { @@ -200,10 +200,6 @@ class AttachmentListItem extends Widget $this->out->elementStart('h4'); $this->out->element('a', $attr, $text); - if ($this->attachment->url !== $this->title()) - $this->out->element('span', null, " ({$this->attachment->url})"); - - $this->out->elementEnd('h4'); } diff --git a/lib/noticelist.php b/lib/noticelist.php index a52132171..e3361fc99 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -34,6 +34,7 @@ if (!defined('LACONICA')) { require_once INSTALLDIR.'/lib/favorform.php'; require_once INSTALLDIR.'/lib/disfavorform.php'; +require_once INSTALLDIR.'/lib/attachmentlist.php'; /** * widget for displaying a list of notices @@ -179,9 +180,10 @@ class NoticeListItem extends Widget { $this->showStart(); $this->showNotice(); - $this->showNoticeAttachments(); + $this->showNoticeAttachmentsIcon(); $this->showNoticeInfo(); $this->showNoticeOptions(); + $this->showNoticeAttachments(); $this->showEnd(); } @@ -193,45 +195,38 @@ class NoticeListItem extends Widget $this->out->elementEnd('div'); } - function showNoticeAttachments() - { + function showNoticeAttachments() { + if ($this->isUsedInList()) { + return; + } + $al = new AttachmentList($this->notice, $this->out); + $al->show(); + } + + function isUsedInList() { + return 'shownotice' !== $this->out->args['action']; + } + + function attachmentCount() { $f2p = new File_to_post; $f2p->post_id = $this->notice->id; $file = new File; $file->joinAdd($f2p); $file->selectAdd(); $file->selectAdd('file.id as id'); - $count = $file->find(true); - if (!$count) return; - if (1 === $count) { - $href = common_local_url('attachment', array('attachment' => $file->id)); - $att_class = 'attachment'; - } else { - $href = common_local_url('attachments', array('notice' => $this->notice->id)); - $att_class = 'attachments'; - } + return $file->find(true); + } - $clip = theme_path('images/icons/clip', 'base'); - if ('shownotice' === $this->out->args['action']) { - $height = '96px'; - $width = '83%'; - $width_att = '15%'; - $clip .= '-big.png'; - $top = '70px'; - } else { - $height = '48px'; - $width = '90%'; - $width_att = '8%'; - $clip .= '.png'; - $top = '20px'; + function showNoticeAttachmentsIcon() + { + if (!($this->isUsedInList() && ($count = $this->attachmentCount()))) { + return; } -if(0) - $this->out->elementStart('div', 'entry-attachments'); -else - $this->out->elementStart('p', array('class' => 'entry-attachments', 'style' => "float: right; width: $width_att; background: url($clip) no-repeat; text-align: right; height: $height;")); - $this->out->element('a', array('class' => $att_class, 'style' => "text-decoration: none; padding-top: $top; display: block; height: $height;", 'href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count); + $href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments'; + $this->out->elementStart('p', 'entry-attachments'); + $this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count); $this->out->elementEnd('p'); } diff --git a/lib/router.php b/lib/router.php index 70ee0f3fb..39c005609 100644 --- a/lib/router.php +++ b/lib/router.php @@ -151,26 +151,35 @@ class Router $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'), array('q' => '.+')); +/* + $m->connect('attachment/ajax_by_url/*url', + array('action' => 'attachment_ajax')); +*/ $m->connect('attachment/:attachment/ajax', array('action' => 'attachment_ajax'), - array('notice' => '[0-9]+')); + array('attachment' => '[0-9]+')); +/* + TODO + not used right now, will revisit later $m->connect('attachment/:attachment', array('action' => 'attachment'), - array('notice' => '[0-9]+')); - + array('attachment' => '[0-9]+')); +*/ // notice $m->connect('notice/new', array('action' => 'newnotice')); $m->connect('notice/new?replyto=:replyto', array('action' => 'newnotice'), array('replyto' => '[A-Za-z0-9_-]+')); +/* $m->connect('notice/:notice/attachments/ajax', array('action' => 'attachments_ajax'), array('notice' => '[0-9]+')); $m->connect('notice/:notice/attachments', array('action' => 'attachments'), array('notice' => '[0-9]+')); +*/ $m->connect('notice/:notice', array('action' => 'shownotice'), array('notice' => '[0-9]+')); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 5d2b5231c..cb4680c39 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -379,6 +379,12 @@ max-width:1003px; overflow:hidden; } +#ajaxcore { +width: 520px; +height: 600px; +background: #fff; +} + #core { position:relative; width:100%; @@ -1048,8 +1054,20 @@ margin-bottom:18px; margin-left:18px; } +p.entry-attachments { +float: right; +width: 8%; +background: url(../images/icons/clip.png) no-repeat; +text-align: right; +height: 48px; +} - +p.entry-attachments a { +text-decoration: none; +padding-top: 20px; +display: block; +height: 48px; +} /* TOP_POSTERS */ .section tbody td { -- cgit v1.2.3-54-g00ecf From 07dabe7889c566e1cd73c8e4c6b7b84af77e5b9f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 24 May 2009 21:16:26 +0000 Subject: Made conversation thread UI a bit more visible. Added right margin for notice options. --- theme/base/css/display.css | 17 +++++------------ theme/default/css/display.css | 8 ++++---- theme/identica/css/display.css | 8 ++++---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index cb4680c39..8f72460a8 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -748,15 +748,10 @@ border-top-style:dotted; .notices li { list-style-type:none; } -.notices li.hover { -border-radius:4px; --moz-border-radius:4px; --webkit-border-radius:4px; -} .notices .notices { margin-top:7px; -margin-left:3%; -width:97%; +margin-left:5%; +width:95%; float:left; } @@ -833,7 +828,7 @@ clear:left; float:left; font-size:0.95em; margin-left:59px; -width:65%; +width:60%; } #showstream .notice div.entry-content, #shownotice .notice div.entry-content { @@ -865,13 +860,11 @@ text-transform:lowercase; .notice-options { -padding-left:2%; -float:left; -width:50%; position:relative; font-size:0.95em; -width:12.5%; +width:90px; float:right; +margin-right:11px; } .notice-options a { diff --git a/theme/default/css/display.css b/theme/default/css/display.css index bc6bd2ee4..737db7ce9 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -214,16 +214,16 @@ background-color:#fcfcfc; } .notices .notices { -background-color:rgba(200, 200, 200, 0.025); +background-color:rgba(200, 200, 200, 0.050); } .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.050); +background-color:rgba(200, 200, 200, 0.100); } .notices .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.075); +background-color:rgba(200, 200, 200, 0.150); } .notices .notices .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.100); +background-color:rgba(200, 200, 200, 0.300); } /*END: NOTICES */ diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index b181d9056..f7abac482 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -214,16 +214,16 @@ background-color:#fcfcfc; } .notices .notices { -background-color:rgba(200, 200, 200, 0.025); +background-color:rgba(200, 200, 200, 0.050); } .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.050); +background-color:rgba(200, 200, 200, 0.100); } .notices .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.075); +background-color:rgba(200, 200, 200, 0.150); } .notices .notices .notices .notices .notices { -background-color:rgba(200, 200, 200, 0.100); +background-color:rgba(200, 200, 200, 0.300); } /*END: NOTICES */ -- cgit v1.2.3-54-g00ecf From bd70caace84758e6655f8db4957049492834a6c6 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Sun, 24 May 2009 18:06:19 -0400 Subject: Only show number of attachments if > 1 --- lib/noticelist.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/noticelist.php b/lib/noticelist.php index e3361fc99..51b8987fe 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -207,14 +207,12 @@ class NoticeListItem extends Widget return 'shownotice' !== $this->out->args['action']; } - function attachmentCount() { - $f2p = new File_to_post; - $f2p->post_id = $this->notice->id; - $file = new File; - $file->joinAdd($f2p); - $file->selectAdd(); - $file->selectAdd('file.id as id'); - return $file->find(true); + function attachmentCount($discriminant = true) { + $file_oembed = new File_oembed; + $query = "select count(*) as c from file_oembed join file_to_post on file_oembed.file_id = file_to_post.file_id where post_id=" . $this->notice->id; + $file_oembed->query($query); + $file_oembed->fetch(); + return intval($file_oembed->c); } function showNoticeAttachmentsIcon() @@ -224,7 +222,6 @@ class NoticeListItem extends Widget } $href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments'; - $this->out->elementStart('p', 'entry-attachments'); $this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count); $this->out->elementEnd('p'); -- cgit v1.2.3-54-g00ecf From b0a891e92b55ea6d3323e8efe528f46afda7c1fc Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Sun, 24 May 2009 18:40:11 -0400 Subject: Made ajax link to show attachment popups relative in util.js --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 1b75c5e22..6511c0380 100644 --- a/js/util.js +++ b/js/util.js @@ -20,7 +20,7 @@ $(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:'http://laptop.waglo.com/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); + $('.attachment').click(function() {$().jOverlay({url:'../attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); // count character on keyup function counter(event){ -- cgit v1.2.3-54-g00ecf From 5f3acc252738e408ea2447b7541eae66c1e9e09a Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Sun, 24 May 2009 21:13:42 -0400 Subject: 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 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(' 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 Binary files /dev/null and b/theme/base/images/icons/clip-inline.png differ -- cgit v1.2.3-54-g00ecf From 84edf12791dc3d44625b156cda6296f1f74f8a9d Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 11:13:13 -0400 Subject: Display thumbnail on hover over links in notices when appropriate. --- js/util.js | 13 +++++++++++++ lib/attachmentlist.php | 4 ++-- lib/router.php | 4 ++++ lib/util.php | 12 +++++++++++- theme/base/css/display.css | 8 ++++++++ 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/js/util.js b/js/util.js index b6848abaa..9ee2a1963 100644 --- a/js/util.js +++ b/js/util.js @@ -25,6 +25,19 @@ $(document).ready(function(){ //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'); + $('a.thumbnail').hover(function() { + anchor = $(this); + $.get('/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + $('#thumbnail').fadeIn('def'); + }); + }, + function() { + setTimeout(function() { + $('#thumbnail').fadeOut('slow', function() {$(this).remove();}); + }, 500); + } + ); // count character on keyup function counter(event){ diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 1be7b2fee..52aa5d9ee 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -171,7 +171,7 @@ class AttachmentListItem extends Widget } function linkTitle() { - return 'Our page for ' . $this->title(); + return $this->title(); } /** @@ -256,7 +256,7 @@ class Attachment extends AttachmentListItem } function linkTitle() { - return 'Direct link to ' . $this->title(); + return $this->attachment->url; } function showRepresentation() { diff --git a/lib/router.php b/lib/router.php index 39c005609..d1e2970c5 100644 --- a/lib/router.php +++ b/lib/router.php @@ -159,6 +159,10 @@ class Router array('action' => 'attachment_ajax'), array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/thumbnail', + array('action' => 'attachment_thumbnail'), + array('attachment' => '[0-9]+')); + /* TODO not used right now, will revisit later diff --git a/lib/util.php b/lib/util.php index 4a55cbfe5..d56f44f7b 100644 --- a/lib/util.php +++ b/lib/util.php @@ -503,8 +503,18 @@ function common_linkify($url) { $file = new File; $file->query($query); $file->fetch(); + if (!empty($file->file_id)) { - $attrs['class'] = 'attachment'; + $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 { + $attrs['class'] = 'attachment thumbnail'; + } $attrs['id'] = "attachment-{$file->file_id}"; } return XMLStringer::estring('a', $attrs, $display); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 8f72460a8..71a434c54 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1205,3 +1205,11 @@ display:none; .guide { clear:both; } + +#thumbnail { +position:absolute; +z-index: 999; +display: none; +left: 100px; +} + -- cgit v1.2.3-54-g00ecf From 01ce677ae399874e81dc21991faf821a539fa00a Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 16:49:32 +0000 Subject: Small bugfix to installer fixing fancy URL detection. --- index.php | 2 +- install.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 9ff1c2c56..c2972ec5f 100644 --- a/index.php +++ b/index.php @@ -64,7 +64,7 @@ function handleError($error) function main() { // quick check for fancy URL auto-detection support in installer. - if (isset($_SERVER['REDIRECT_URL']) && ('/check-fancy' === $_SERVER['REDIRECT_URL'])) { + if (isset($_SERVER['REDIRECT_URL']) && ((dirname($_SERVER['REQUEST_URI']) . '/check-fancy') === $_SERVER['REDIRECT_URL'])) { die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs."); } global $user, $action, $config; diff --git a/install.php b/install.php index 1d411c221..133f2b30f 100644 --- a/install.php +++ b/install.php @@ -116,16 +116,16 @@ function showForm() disable

Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.

-
  • - - -

    Database hostname

    -
  • Site path, following the "/" after the domain name in the URL. Empty is fine. Field should be filled automatically.

  • +
  • + + +

    Database hostname

    +
  • -- cgit v1.2.3-54-g00ecf From 0b96ca3d5957a0cb363813fe44cc1865bb6c4eb5 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 13:13:38 -0400 Subject: Oups, forget the attachment_thumbnail.php action file --- actions/attachment_thumbnail.php | 127 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 actions/attachment_thumbnail.php diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php new file mode 100644 index 000000000..32fab1324 --- /dev/null +++ b/actions/attachment_thumbnail.php @@ -0,0 +1,127 @@ +. + * + * @category Personal + * @package Laconica + * @author Evan Prodromou + * @copyright 2008-2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/actions/attachment.php'; + +/** + * Show notice attachments + * + * @category Personal + * @package Laconica + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +class Attachment_thumbnailAction extends AttachmentAction +{ + /** + * Show page, a template method. + * + * @return nothing + */ + function showPage() + { + if (Event::handle('StartShowBody', array($this))) { + $this->showCore(); + Event::handle('EndShowBody', array($this)); + } + } + + /** + * Show core. + * + * Shows local navigation, content block and aside. + * + * @return nothing + */ + function showCore() + { + $file_thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id); + if (empty($file_thumbnail->url)) { + return; + } + $url = $file_thumbnail->url; + + $attr = array( + 'id' => 'thumbnail' + , 'src' => $url + , 'alt' => 'Thumbnail' + ); + + $this->element('img', $attr); + + } + + /** + * Last-modified date for page + * + * When was the content of this page last modified? Based on notice, + * profile, avatar. + * + * @return int last-modified date as unix timestamp + */ +/* + function lastModified() + { + return max(strtotime($this->notice->created), + strtotime($this->profile->modified), + ($this->avatar) ? strtotime($this->avatar->modified) : 0); + } +*/ + + /** + * An entity tag for this page + * + * Shows the ETag for the page, based on the notice ID and timestamps + * for the notice, profile, and avatar. It's weak, since we change + * the date text "one hour ago", etc. + * + * @return string etag + */ +/* + function etag() + { + $avtime = ($this->avatar) ? + strtotime($this->avatar->modified) : 0; + + return 'W/"' . implode(':', array($this->arg('action'), + common_language(), + $this->notice->id, + strtotime($this->notice->created), + strtotime($this->profile->modified), + $avtime)) . '"'; + } +*/ +} + -- cgit v1.2.3-54-g00ecf From 7923e84fba66d8e3e7ec24a8a663f0c2c0f0e533 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 May 2009 18:54:45 +0000 Subject: Fixed URL for attachment thumbnail and XHR --- js/util.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/js/util.js b/js/util.js index 9ee2a1963..ffaedc690 100644 --- a/js/util.js +++ b/js/util.js @@ -23,20 +23,20 @@ $(document).ready(function(){ //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'); - $('a.thumbnail').hover(function() { - anchor = $(this); - $.get('/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { - anchor.append(data); - $('#thumbnail').fadeIn('def'); - }); - }, - function() { - setTimeout(function() { - $('#thumbnail').fadeOut('slow', function() {$(this).remove();}); - }, 500); - } + $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); + $('a.thumbnail').hover( + function() { + anchor = $(this); + $.get($('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + $('#thumbnail').fadeIn('def'); + }); + }, + function() { + setTimeout(function() { + $('#thumbnail').fadeOut('slow', function() {$(this).remove();}); + }, 500); + } ); // count character on keyup -- cgit v1.2.3-54-g00ecf From b22980586199a35a9800d9ff1ace6d1c6e9bf205 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 May 2009 15:02:28 -0400 Subject: Resetting some of the attachment styles. Will update in the next commit. --- theme/base/css/display.css | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 71a434c54..74f369142 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -379,12 +379,6 @@ max-width:1003px; overflow:hidden; } -#ajaxcore { -width: 520px; -height: 600px; -background: #fff; -} - #core { position:relative; width:100%; @@ -858,6 +852,16 @@ display:inline-block; text-transform:lowercase; } +.notice .attachment { +position:relative; +} +.notice .attachment img { +position:absolute; +top:11px; +left:0; +z-index:99; +} + .notice-options { position:relative; @@ -1047,20 +1051,6 @@ margin-bottom:18px; margin-left:18px; } -p.entry-attachments { -float: right; -width: 8%; -background: url(../images/icons/clip.png) no-repeat; -text-align: right; -height: 48px; -} - -p.entry-attachments a { -text-decoration: none; -padding-top: 20px; -display: block; -height: 48px; -} /* TOP_POSTERS */ .section tbody td { @@ -1205,11 +1195,3 @@ display:none; .guide { clear:both; } - -#thumbnail { -position:absolute; -z-index: 999; -display: none; -left: 100px; -} - -- cgit v1.2.3-54-g00ecf From 594454ced3d02ceb766bdbdce1dbfa871abec464 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 15:38:50 -0400 Subject: Single anchor to include thumbnail and title for attachment --- lib/attachmentlist.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 52aa5d9ee..2a0114b12 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -198,23 +198,22 @@ class AttachmentListItem extends Widget $attr = $this->linkAttr(); $text = $this->linkTitle(); $this->out->elementStart('h4'); - $this->out->element('a', $attr, $text); - + $this->out->elementStart('a', $attr); + $this->out->element('span', null, $text); + $this->showRepresentation(); + $this->out->elementEnd('a'); $this->out->elementEnd('h4'); } function showNoticeAttachment() { $this->showLink(); - $this->showRepresentation(); } function showRepresentation() { $thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id); if (!empty($thumbnail)) { - $this->out->elementStart('a', $this->linkAttr()/*'href' => $this->linkTo()*/); $this->out->element('img', array('alt' => 'nothing to say', 'src' => $thumbnail->url, 'width' => $thumbnail->width, 'height' => $thumbnail->height)); - $this->out->elementEnd('a'); } } -- cgit v1.2.3-54-g00ecf From 64d0767654d93de81a0779f04eb992c574bbdece Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 19:42:03 +0000 Subject: Removed more cruft from old attachment/attachements pages --- actions/tag.php | 2 -- lib/router.php | 22 +--------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/actions/tag.php b/actions/tag.php index e71ec06a8..e9351d241 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -49,8 +49,6 @@ class TagAction extends Action { $pop = new PopularNoticeSection($this); $pop->show(); -// $freqatt = new FrequentAttachmentSection($this); -// $freqatt->show(); } function title() diff --git a/lib/router.php b/lib/router.php index d1e2970c5..fc119821b 100644 --- a/lib/router.php +++ b/lib/router.php @@ -151,10 +151,6 @@ class Router $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'), array('q' => '.+')); -/* - $m->connect('attachment/ajax_by_url/*url', - array('action' => 'attachment_ajax')); -*/ $m->connect('attachment/:attachment/ajax', array('action' => 'attachment_ajax'), array('attachment' => '[0-9]+')); @@ -163,27 +159,11 @@ class Router array('action' => 'attachment_thumbnail'), array('attachment' => '[0-9]+')); -/* - TODO - not used right now, will revisit later - $m->connect('attachment/:attachment', - array('action' => 'attachment'), - array('attachment' => '[0-9]+')); -*/ - // notice - $m->connect('notice/new', array('action' => 'newnotice')); $m->connect('notice/new?replyto=:replyto', array('action' => 'newnotice'), array('replyto' => '[A-Za-z0-9_-]+')); -/* - $m->connect('notice/:notice/attachments/ajax', - array('action' => 'attachments_ajax'), - array('notice' => '[0-9]+')); - $m->connect('notice/:notice/attachments', - array('action' => 'attachments'), - array('notice' => '[0-9]+')); -*/ + $m->connect('notice/:notice', array('action' => 'shownotice'), array('notice' => '[0-9]+')); -- cgit v1.2.3-54-g00ecf From 01dad5729827870d87f87118c336dcf2acc4af32 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 May 2009 15:53:19 -0400 Subject: Markup cleanup for attachments --- actions/attachment.php | 2 -- actions/attachment_ajax.php | 2 +- js/util.js | 6 ------ lib/attachmentlist.php | 17 +++++++---------- lib/noticelist.php | 14 +------------- theme/base/css/display.css | 3 +++ 6 files changed, 12 insertions(+), 32 deletions(-) diff --git a/actions/attachment.php b/actions/attachment.php index c51c75120..16ee723d9 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -176,10 +176,8 @@ class AttachmentAction extends Action function showContent() { - $this->elementStart('ul', array('class' => 'attachments')); $ali = new Attachment($this->attachment, $this); $cnt = $ali->show(); - $this->elementEnd('ul'); } /** diff --git a/actions/attachment_ajax.php b/actions/attachment_ajax.php index 6930dc112..3d83393c5 100644 --- a/actions/attachment_ajax.php +++ b/actions/attachment_ajax.php @@ -67,7 +67,7 @@ class Attachment_ajaxAction extends AttachmentAction */ function showCore() { - $this->elementStart('div', array('id' => 'ajaxcore')); + $this->elementStart('div', array('id' => 'core')); if (Event::handle('StartShowContentBlock', array($this))) { $this->showContentBlock(); Event::handle('EndShowContentBlock', array($this)); diff --git a/js/util.js b/js/util.js index ffaedc690..cba6f822e 100644 --- a/js/util.js +++ b/js/util.js @@ -17,12 +17,6 @@ */ $(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; }); - - //FIXME - //need to link to proper url depending on site config (path name and theme, for instance) $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); $('a.thumbnail').hover( function() { diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 2a0114b12..d0478bad3 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -80,9 +80,9 @@ class AttachmentList extends Widget function show() { -// $this->out->elementStart('div', array('id' =>'attachments_primary')); - $this->out->elementStart('div', array('id' =>'content')); - $this->out->element('h2', null, _('Attachments')); + $this->out->elementStart('dl', array('id' =>'attachment')); + $this->out->element('dt', null, _('Attachments')); + $this->out->elementStart('dd'); $this->out->elementStart('ul', array('class' => 'attachments')); $atts = new File; @@ -92,8 +92,9 @@ class AttachmentList extends Widget $item->show(); } + $this->out->elementEnd('dd'); $this->out->elementEnd('ul'); - $this->out->elementEnd('div'); + $this->out->elementEnd('dl'); return count($att); } @@ -195,14 +196,10 @@ class AttachmentListItem extends Widget } function showLink() { - $attr = $this->linkAttr(); - $text = $this->linkTitle(); - $this->out->elementStart('h4'); - $this->out->elementStart('a', $attr); - $this->out->element('span', null, $text); + $this->out->elementStart('a', $this->linkAttr()); + $this->out->element('span', null, $this->linkTitle()); $this->showRepresentation(); $this->out->elementEnd('a'); - $this->out->elementEnd('h4'); } function showNoticeAttachment() diff --git a/lib/noticelist.php b/lib/noticelist.php index ae1438892..50a95cfcb 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -180,9 +180,9 @@ class NoticeListItem extends Widget { $this->showStart(); $this->showNotice(); + $this->showNoticeAttachments(); $this->showNoticeInfo(); $this->showNoticeOptions(); - $this->showNoticeAttachments(); $this->showEnd(); } @@ -214,18 +214,6 @@ class NoticeListItem extends Widget return intval($file_oembed->c); } - function showNoticeAttachmentsIcon() - { - if (!($this->isUsedInList() && ($count = $this->attachmentCount()))) { - return; - } - - $href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments'; - $this->out->elementStart('p', 'entry-attachments'); - $this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count); - $this->out->elementEnd('p'); - } - function showNoticeInfo() { $this->out->elementStart('div', 'entry-content'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 74f369142..aa76910f0 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -861,6 +861,9 @@ top:11px; left:0; z-index:99; } +#shownotice .notice .attachment img { +position:static; +} .notice-options { -- cgit v1.2.3-54-g00ecf From a598dcccba21daa6decefb7fb38882c1e77904eb Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Mon, 25 May 2009 19:58:31 +0000 Subject: Really removing the old files, thanks git! --- actions/attachments.php | 290 -------------------------------------- actions/attachments_ajax.php | 115 --------------- lib/attachmentsection.php | 80 ----------- lib/frequentattachmentsection.php | 66 --------- 4 files changed, 551 deletions(-) delete mode 100644 actions/attachments.php delete mode 100644 actions/attachments_ajax.php delete mode 100644 lib/attachmentsection.php delete mode 100644 lib/frequentattachmentsection.php diff --git a/actions/attachments.php b/actions/attachments.php deleted file mode 100644 index d3c90fec2..000000000 --- a/actions/attachments.php +++ /dev/null @@ -1,290 +0,0 @@ -. - * - * @category Personal - * @package Laconica - * @author Evan Prodromou - * @copyright 2008-2009 Control Yourself, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -if (!defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/attachmentlist.php'; - -/** - * Show notice attachments - * - * @category Personal - * @package Laconica - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -class AttachmentsAction extends Action -{ - /** - * Notice object to show - */ - - var $notice = null; - - /** - * Profile of the notice object - */ - - var $profile = null; - - /** - * Avatar of the profile of the notice object - */ - - var $avatar = null; - - /** - * Is this action read-only? - * - * @return boolean true - */ - - function isReadOnly($args) - { - return true; - } - - /** - * Last-modified date for page - * - * When was the content of this page last modified? Based on notice, - * profile, avatar. - * - * @return int last-modified date as unix timestamp - */ - - function lastModified() - { - return max(strtotime($this->notice->created), - strtotime($this->profile->modified), - ($this->avatar) ? strtotime($this->avatar->modified) : 0); - } - - /** - * An entity tag for this page - * - * Shows the ETag for the page, based on the notice ID and timestamps - * for the notice, profile, and avatar. It's weak, since we change - * the date text "one hour ago", etc. - * - * @return string etag - */ - - function etag() - { - $avtime = ($this->avatar) ? - strtotime($this->avatar->modified) : 0; - - return 'W/"' . implode(':', array($this->arg('action'), - common_language(), - $this->notice->id, - strtotime($this->notice->created), - strtotime($this->profile->modified), - $avtime)) . '"'; - } - - /** - * Title of the page - * - * @return string title of the page - */ - - function title() - { - return sprintf(_('%1$s\'s status on %2$s'), - $this->profile->nickname, - common_exact_date($this->notice->created)); - } - - - /** - * Load attributes based on database arguments - * - * Loads all the DB stuff - * - * @param array $args $_REQUEST array - * - * @return success flag - */ - - function prepare($args) - { - parent::prepare($args); - - $id = $this->arg('notice'); - - $this->notice = Notice::staticGet($id); - - if (!$this->notice) { - $this->clientError(_('No such notice.'), 404); - return false; - } - - -/* -// STOP if there are no attachments -// maybe even redirect if there's a single one -// RYM FIXME TODO - $this->clientError(_('No such attachment.'), 404); - return false; - -*/ - - - - - $this->profile = $this->notice->getProfile(); - - if (!$this->profile) { - $this->serverError(_('Notice has no profile'), 500); - return false; - } - - $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); - return true; - } - - - - /** - * Handle input - * - * Only handles get, so just show the page. - * - * @param array $args $_REQUEST data (unused) - * - * @return void - */ - - function handle($args) - { - parent::handle($args); - - if ($this->notice->is_local == 0) { - if (!empty($this->notice->url)) { - common_redirect($this->notice->url, 301); - } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) { - common_redirect($this->notice->uri, 301); - } - } else { - $f2p = new File_to_post; - $f2p->post_id = $this->notice->id; - $file = new File; - $file->joinAdd($f2p); - $file->selectAdd(); - $file->selectAdd('file.id as id'); - $count = $file->find(true); - if (!$count) return; - if (1 === $count) { - common_redirect(common_local_url('attachment', array('attachment' => $file->id)), 301); - } else { - $this->showPage(); - } - } - } - - /** - * Don't show local navigation - * - * @return void - */ - - function showLocalNavBlock() - { - } - - /** - * Fill the content area of the page - * - * Shows a single notice list item. - * - * @return void - */ - - function showContent() - { - $al = new AttachmentList($this->notice, $this); - $cnt = $al->show(); - } - - /** - * Don't show page notice - * - * @return void - */ - - function showPageNoticeBlock() - { - } - - /** - * Don't show aside - * - * @return void - */ - - function showAside() { - } - - /** - * Extra content - * - * We show the microid(s) for the author, if any. - * - * @return void - */ - - function extraHead() - { - $user = User::staticGet($this->profile->id); - - if (!$user) { - return; - } - - if ($user->emailmicroid && $user->email && $this->notice->uri) { - $id = new Microid('mailto:'. $user->email, - $this->notice->uri); - $this->element('meta', array('name' => 'microid', - 'content' => $id->toString())); - } - - if ($user->jabbermicroid && $user->jabber && $this->notice->uri) { - $id = new Microid('xmpp:', $user->jabber, - $this->notice->uri); - $this->element('meta', array('name' => 'microid', - 'content' => $id->toString())); - } - } -} - diff --git a/actions/attachments_ajax.php b/actions/attachments_ajax.php deleted file mode 100644 index 402d8b5e7..000000000 --- a/actions/attachments_ajax.php +++ /dev/null @@ -1,115 +0,0 @@ -. - * - * @category Personal - * @package Laconica - * @author Evan Prodromou - * @copyright 2008-2009 Control Yourself, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -if (!defined('LACONICA')) { - exit(1); -} - -//require_once INSTALLDIR.'/lib/personalgroupnav.php'; -//require_once INSTALLDIR.'/lib/feedlist.php'; -require_once INSTALLDIR.'/actions/attachments.php'; - -/** - * Show notice attachments - * - * @category Personal - * @package Laconica - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -class Attachments_ajaxAction extends AttachmentsAction -{ - function showContent() - { - } - - /** - * Fill the content area of the page - * - * Shows a single notice list item. - * - * @return void - */ - - function showContentBlock() - { - $al = new AttachmentList($this->notice, $this); - $cnt = $al->show(); - } - - /** - * Extra content - * - * We show the microid(s) for the author, if any. - * - * @return void - */ - - function extraHead() - { - } - - - /** - * Show page, a template method. - * - * @return nothing - */ - function showPage() - { - if (Event::handle('StartShowBody', array($this))) { - $this->showCore(); - Event::handle('EndShowBody', array($this)); - } - } - - /** - * Show core. - * - * Shows local navigation, content block and aside. - * - * @return nothing - */ - function showCore() - { - $this->elementStart('div', array('id' => 'core')); - if (Event::handle('StartShowContentBlock', array($this))) { - $this->showContentBlock(); - Event::handle('EndShowContentBlock', array($this)); - } - $this->elementEnd('div'); - } - - - - -} - diff --git a/lib/attachmentsection.php b/lib/attachmentsection.php deleted file mode 100644 index 20e620b9b..000000000 --- a/lib/attachmentsection.php +++ /dev/null @@ -1,80 +0,0 @@ -. - * - * @category Widget - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -if (!defined('LACONICA')) { - exit(1); -} - -define('ATTACHMENTS_PER_SECTION', 6); - -/** - * Base class for sections showing lists of attachments - * - * These are the widgets that show interesting data about a person - * group, or site. - * - * @category Widget - * @package Laconica - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -class AttachmentSection extends Section -{ - function showContent() - { - $attachments = $this->getAttachments(); - - $cnt = 0; - - $this->out->elementStart('ul', 'attachments'); - - while ($attachments->fetch() && ++$cnt <= ATTACHMENTS_PER_SECTION) { - $this->showAttachment($attachments); - } - - $this->out->elementEnd('ul'); - - return ($cnt > ATTACHMENTS_PER_SECTION); - } - - function getAttachments() - { - return null; - } - - function showAttachment($attachment) - { - $this->out->elementStart('li'); - $this->out->element('a', array('class' => 'attachment', 'href' => common_local_url('attachment', array('attachment' => $attachment->file_id))), "Attachment tagged {$attachment->c} times"); - $this->out->elementEnd('li'); - } -} - diff --git a/lib/frequentattachmentsection.php b/lib/frequentattachmentsection.php deleted file mode 100644 index 0ce0d1871..000000000 --- a/lib/frequentattachmentsection.php +++ /dev/null @@ -1,66 +0,0 @@ -. - * - * @category Widget - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -if (!defined('LACONICA')) { - exit(1); -} - -/** - * FIXME - * - * These are the widgets that show interesting data about a person - * group, or site. - * - * @category Widget - * @package Laconica - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - */ - -class FrequentAttachmentSection extends AttachmentSection -{ - function getAttachments() { - $notice_tag = new Notice_tag; - $query = 'select file_id, count(file_id) as c from notice_tag join file_to_post on post_id = notice_id where tag="' . $notice_tag->escape($this->out->tag) . '" group by file_id order by c desc'; - $notice_tag->query($query); - return $notice_tag; - } - - function title() - { - return sprintf(_('Attachments frequently tagged with %s'), $this->out->tag); - } - - function divId() - { - return 'frequent_attachments'; - } -} - -- cgit v1.2.3-54-g00ecf From 3877324fd8ddad36531fb80a5a2ae261015b9780 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 25 May 2009 17:30:57 -0400 Subject: Updated JS to show/hide attachment thumbnails with timers. Minor markup changes. --- actions/attachment_thumbnail.php | 11 +---------- js/util.js | 26 +++++++++++++++++--------- theme/base/css/display.css | 5 ++++- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php index 32fab1324..b4070e747 100644 --- a/actions/attachment_thumbnail.php +++ b/actions/attachment_thumbnail.php @@ -71,16 +71,7 @@ class Attachment_thumbnailAction extends AttachmentAction if (empty($file_thumbnail->url)) { return; } - $url = $file_thumbnail->url; - - $attr = array( - 'id' => 'thumbnail' - , 'src' => $url - , 'alt' => 'Thumbnail' - ); - - $this->element('img', $attr); - + $this->element('img', array('src' => $file_thumbnail->url, 'alt' => 'Thumbnail')); } /** diff --git a/js/util.js b/js/util.js index cba6f822e..b1b6ec82b 100644 --- a/js/util.js +++ b/js/util.js @@ -18,18 +18,26 @@ $(document).ready(function(){ $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); - $('a.thumbnail').hover( + $("a.thumbnail").hover( function() { - anchor = $(this); - $.get($('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { - anchor.append(data); - $('#thumbnail').fadeIn('def'); - }); + var anchor = $(this); + $("a.thumbnail").children('img').remove(); + + setTimeout(function() { + anchor.closest(".entry-title").addClass('ov'); + $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + }); + }, 250); + + setTimeout(function() { + anchor.children('img').remove(); + anchor.closest(".entry-title").removeClass('ov'); + }, 3000); }, function() { - setTimeout(function() { - $('#thumbnail').fadeOut('slow', function() {$(this).remove();}); - }, 500); + $(this).children('img').remove(); + $(this).closest(".entry-title").removeClass('ov'); } ); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index aa76910f0..9bc1417b1 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -798,6 +798,9 @@ float:left; width:100%; overflow:hidden; } +.notice .entry-title.ov { +overflow:visible; +} #shownotice .notice .entry-title { font-size:2.2em; } @@ -857,7 +860,7 @@ position:relative; } .notice .attachment img { position:absolute; -top:11px; +top:18px; left:0; z-index:99; } -- cgit v1.2.3-54-g00ecf From aa935986b6db6f3290467e4c60d6eab7de26ccb7 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 26 May 2009 01:43:24 +0000 Subject: Removed unnecessary call to base/css/display.css for 0.8.x --- theme/base/css/facebookapp.css | 1 - 1 file changed, 1 deletion(-) diff --git a/theme/base/css/facebookapp.css b/theme/base/css/facebookapp.css index 163b41fb4..9f269b96f 100644 --- a/theme/base/css/facebookapp.css +++ b/theme/base/css/facebookapp.css @@ -1,4 +1,3 @@ -@import url("display.css"); @import url("../../identica/css/display.css"); * { -- cgit v1.2.3-54-g00ecf From 0e8358bd2335bfc71ac5b2ee93e866fa5c571c89 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 26 May 2009 02:34:36 +0000 Subject: Updated stylesheet paths for facebook app --- lib/facebookaction.php | 4 ---- theme/base/css/facebookapp.css | 2 -- 2 files changed, 6 deletions(-) diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 043a078cd..00db79400 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -98,10 +98,6 @@ class FacebookAction extends Action // Add a timestamp to the file so Facebook cache wont ignore our changes $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css'); - $this->element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts)); - $theme = common_config('site', 'theme'); $ts = filemtime(INSTALLDIR. '/theme/' . $theme .'/css/display.css'); diff --git a/theme/base/css/facebookapp.css b/theme/base/css/facebookapp.css index 9f269b96f..e6b1c9ee5 100644 --- a/theme/base/css/facebookapp.css +++ b/theme/base/css/facebookapp.css @@ -1,5 +1,3 @@ -@import url("../../identica/css/display.css"); - * { font-size:14px; font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif; -- cgit v1.2.3-54-g00ecf From c93031c2aa49b8a044e896ca1e07f5f4f429308e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 26 May 2009 03:34:00 +0000 Subject: Reusing base stylesheet (instead of hoping for FB to import it) in FB app. --- lib/facebookaction.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 00db79400..637a6284d 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -97,6 +97,10 @@ class FacebookAction extends Action { // Add a timestamp to the file so Facebook cache wont ignore our changes $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css'); + + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts)); $theme = common_config('site', 'theme'); -- cgit v1.2.3-54-g00ecf