doomy doom doom
This commit is contained in:
parent
32321de5e0
commit
551b196a35
|
@ -356,9 +356,4 @@ class SingleNoticeItem extends DoFollowListItem
|
||||||
$this->profile->fullname :
|
$this->profile->fullname :
|
||||||
$this->profile->nickname));
|
$this->profile->nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNoticeAttachments() {
|
|
||||||
$al = new AttachmentList($this->notice, $this->out);
|
|
||||||
$al->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,16 +431,19 @@ var SN = { // StatusNet
|
||||||
//imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
|
//imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
|
||||||
|
|
||||||
notice.find('a.attachment').each(function() {
|
notice.find('a.attachment').each(function() {
|
||||||
|
/*
|
||||||
var attachId = ($(this).attr('id').substring('attachment'.length + 1));
|
var attachId = ($(this).attr('id').substring('attachment'.length + 1));
|
||||||
if (attachId) {
|
if (attachId) {
|
||||||
var thumbUrl = $('address .url')[0].href+'attachment/' + attachId + '/thumb';
|
var thumbUrl = $('address .url')[0].href+'attachment/' + attachId + '/thumb';
|
||||||
var thumb = $('<div class="inline_thumb">Thumb: <img/></div>');
|
var thumb = $('<div class="attachment-thumb">Thumb: <img/></div>');
|
||||||
thumb.find('img').attr('src', thumbUrl).last();
|
thumb.find('img').attr('src', thumbUrl).last();
|
||||||
notice.append(thumb);
|
notice.find('.entry-title .entry-content').append(thumb);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('#shownotice').length == 0) {
|
if ($('#shownotice').length == 0) {
|
||||||
|
/*
|
||||||
var t;
|
var t;
|
||||||
notice.find('a.thumbnail').hover(
|
notice.find('a.thumbnail').hover(
|
||||||
function() {
|
function() {
|
||||||
|
@ -465,6 +468,7 @@ var SN = { // StatusNet
|
||||||
$(this).closest('.entry-title').removeClass('ov');
|
$(this).closest('.entry-title').removeClass('ov');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -181,9 +181,11 @@ class AttachmentListItem extends Widget
|
||||||
*/
|
*/
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->showStart();
|
if ($this->attachment->isEnclosure()) {
|
||||||
$this->showNoticeAttachment();
|
$this->showStart();
|
||||||
$this->showEnd();
|
$this->showNoticeAttachment();
|
||||||
|
$this->showEnd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkAttr() {
|
function linkAttr() {
|
||||||
|
@ -203,9 +205,44 @@ class AttachmentListItem extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRepresentation() {
|
function showRepresentation() {
|
||||||
|
$thumb = $this->getThumbInfo();
|
||||||
|
if ($thumb) {
|
||||||
|
$thumb = $this->sizeThumb($thumb);
|
||||||
|
$this->out->element('img', array('alt' => '', 'src' => $thumb->url, 'width' => $thumb->width, 'height' => $thumb->height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getThumbInfo()
|
||||||
|
{
|
||||||
$thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
|
$thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
|
||||||
if (!empty($thumbnail)) {
|
if ($thumbnail) {
|
||||||
$this->out->element('img', array('alt' => '', 'src' => $thumbnail->url, 'width' => $thumbnail->width, 'height' => $thumbnail->height));
|
return $thumbnail;
|
||||||
|
} else {
|
||||||
|
switch ($this->attachment->mimetype) {
|
||||||
|
case 'image/gif':
|
||||||
|
case 'image/png':
|
||||||
|
case 'image/jpg':
|
||||||
|
case 'image/jpeg':
|
||||||
|
$thumb = (object)array();
|
||||||
|
$thumb->url = $this->attachment->url;
|
||||||
|
$thumb->width = 100;
|
||||||
|
$thumb->height = 75; // @fixme
|
||||||
|
return $thumb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sizeThumb($thumbnail) {
|
||||||
|
$maxWidth = 100;
|
||||||
|
$maxHeight = 75;
|
||||||
|
if ($thumbnail->width > $maxWidth) {
|
||||||
|
$thumb = clone($thumbnail);
|
||||||
|
$thumb->width = $maxWidth;
|
||||||
|
$thumb->height = intval($thumbnail->height * $maxWidth / $thumbnail->width);
|
||||||
|
return $thumb;
|
||||||
|
} else {
|
||||||
|
return $thumbnail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +271,9 @@ class AttachmentListItem extends Widget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used for one-off attachment action
|
||||||
|
*/
|
||||||
class Attachment extends AttachmentListItem
|
class Attachment extends AttachmentListItem
|
||||||
{
|
{
|
||||||
function showLink() {
|
function showLink() {
|
||||||
|
@ -414,18 +454,4 @@ class Attachment extends AttachmentListItem
|
||||||
|
|
||||||
return $scrubbed;
|
return $scrubbed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFallback()
|
|
||||||
{
|
|
||||||
// If we don't know how to display an attachment inline, we probably
|
|
||||||
// shouldn't have gotten to this point.
|
|
||||||
//
|
|
||||||
// But, here we are... displaying details on a file or remote URL
|
|
||||||
// either on the main view or in an ajax-loaded lightbox. As a lesser
|
|
||||||
// of several evils, we'll try redirecting to the actual target via
|
|
||||||
// client-side JS.
|
|
||||||
|
|
||||||
common_log(LOG_ERR, "Empty or unknown type for file id {$this->attachment->id}; falling back to client-side redirect.");
|
|
||||||
$this->out->raw('<script>window.location = ' . json_encode($this->attachment->url) . ';</script>');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,6 +208,7 @@ class NoticeListItem extends Widget
|
||||||
$this->showStart();
|
$this->showStart();
|
||||||
if (Event::handle('StartShowNoticeItem', array($this))) {
|
if (Event::handle('StartShowNoticeItem', array($this))) {
|
||||||
$this->showNotice();
|
$this->showNotice();
|
||||||
|
$this->showNoticeAttachments();
|
||||||
$this->showNoticeInfo();
|
$this->showNoticeInfo();
|
||||||
$this->showNoticeOptions();
|
$this->showNoticeOptions();
|
||||||
Event::handle('EndShowNoticeItem', array($this));
|
Event::handle('EndShowNoticeItem', array($this));
|
||||||
|
@ -383,6 +384,11 @@ class NoticeListItem extends Widget
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showNoticeAttachments() {
|
||||||
|
$al = new AttachmentList($this->notice, $this->out);
|
||||||
|
$al->show();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show the link to the main page for the notice
|
* show the link to the main page for the notice
|
||||||
*
|
*
|
||||||
|
|
|
@ -1150,7 +1150,8 @@ border-radius:4px;
|
||||||
-webkit-border-radius:4px;
|
-webkit-border-radius:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice div.entry-content {
|
.notice div.entry-content,
|
||||||
|
.notice dl.entry-content {
|
||||||
clear:left;
|
clear:left;
|
||||||
float:left;
|
float:left;
|
||||||
font-size:0.95em;
|
font-size:0.95em;
|
||||||
|
@ -1325,6 +1326,7 @@ margin-left:4px;
|
||||||
.notice .attachment.more {
|
.notice .attachment.more {
|
||||||
padding-left:0;
|
padding-left:0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
.notice .attachment img {
|
.notice .attachment img {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:18px;
|
top:18px;
|
||||||
|
@ -1334,20 +1336,30 @@ z-index:99;
|
||||||
#shownotice .notice .attachment img {
|
#shownotice .notice .attachment img {
|
||||||
position:static;
|
position:static;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#attachments {
|
|
||||||
|
/* Small inline attachment list */
|
||||||
|
#attachments ol li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
#attachments dt {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#shownotice #attachments {
|
||||||
clear:both;
|
clear:both;
|
||||||
float:left;
|
float:left;
|
||||||
width:100%;
|
width:100%;
|
||||||
margin-top:18px;
|
margin-top:18px;
|
||||||
}
|
}
|
||||||
#attachments dt {
|
#shownotice #attachments dt {
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
font-size:1.3em;
|
font-size:1.3em;
|
||||||
margin-bottom:4px;
|
margin-bottom:4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#attachments ol li {
|
#shownotice #attachments ol li {
|
||||||
margin-bottom:18px;
|
margin-bottom:18px;
|
||||||
list-style-type:decimal;
|
list-style-type:decimal;
|
||||||
float:left;
|
float:left;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user