forked from GNUsocial/gnu-social
Merge branch '0.8.x' of git://gitorious.org/laconica/dev into 0.8.x
This commit is contained in:
commit
31743dd368
@ -31,8 +31,6 @@ if (!defined('LACONICA')) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//require_once INSTALLDIR.'/lib/personalgroupnav.php';
|
|
||||||
//require_once INSTALLDIR.'/lib/feedlist.php';
|
|
||||||
require_once INSTALLDIR.'/lib/attachmentlist.php';
|
require_once INSTALLDIR.'/lib/attachmentlist.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,11 +65,11 @@ class AttachmentAction extends Action
|
|||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
$id = $this->arg('attachment');
|
if ($id = $this->trimmed('attachment')) {
|
||||||
|
|
||||||
$this->attachment = File::staticGet($id);
|
$this->attachment = File::staticGet($id);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->attachment) {
|
if (empty($this->attachment)) {
|
||||||
$this->clientError(_('No such attachment.'), 404);
|
$this->clientError(_('No such attachment.'), 404);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,26 +45,6 @@ require_once INSTALLDIR.'/actions/attachment.php';
|
|||||||
|
|
||||||
class Attachment_ajaxAction extends AttachmentAction
|
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.
|
* Show page, a template method.
|
||||||
*
|
*
|
||||||
@ -87,7 +67,7 @@ class Attachment_ajaxAction extends AttachmentAction
|
|||||||
*/
|
*/
|
||||||
function showCore()
|
function showCore()
|
||||||
{
|
{
|
||||||
$this->elementStart('div', array('id' => 'core'));
|
$this->elementStart('div', array('id' => 'ajaxcore'));
|
||||||
if (Event::handle('StartShowContentBlock', array($this))) {
|
if (Event::handle('StartShowContentBlock', array($this))) {
|
||||||
$this->showContentBlock();
|
$this->showContentBlock();
|
||||||
Event::handle('EndShowContentBlock', array($this));
|
Event::handle('EndShowContentBlock', array($this));
|
||||||
@ -95,8 +75,6 @@ class Attachment_ajaxAction extends AttachmentAction
|
|||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last-modified date for page
|
* Last-modified date for page
|
||||||
*
|
*
|
||||||
|
@ -31,8 +31,6 @@ if (!defined('LACONICA')) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//require_once INSTALLDIR.'/lib/personalgroupnav.php';
|
|
||||||
//require_once INSTALLDIR.'/lib/feedlist.php';
|
|
||||||
require_once INSTALLDIR.'/lib/attachmentlist.php';
|
require_once INSTALLDIR.'/lib/attachmentlist.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,8 +49,8 @@ class TagAction extends Action
|
|||||||
{
|
{
|
||||||
$pop = new PopularNoticeSection($this);
|
$pop = new PopularNoticeSection($this);
|
||||||
$pop->show();
|
$pop->show();
|
||||||
$freqatt = new FrequentAttachmentSection($this);
|
// $freqatt = new FrequentAttachmentSection($this);
|
||||||
$freqatt->show();
|
// $freqatt->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('.attachments').click(function() {$().jOverlay({zIndex:999, success:function(html) {$('.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
|
||||||
}, 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; });
|
||||||
$('.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; });
|
||||||
|
|
||||||
// count character on keyup
|
// count character on keyup
|
||||||
function counter(event){
|
function counter(event){
|
||||||
|
@ -191,7 +191,7 @@ class AttachmentListItem extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
function linkAttr() {
|
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() {
|
function showLink() {
|
||||||
@ -200,10 +200,6 @@ class AttachmentListItem extends Widget
|
|||||||
$this->out->elementStart('h4');
|
$this->out->elementStart('h4');
|
||||||
$this->out->element('a', $attr, $text);
|
$this->out->element('a', $attr, $text);
|
||||||
|
|
||||||
if ($this->attachment->url !== $this->title())
|
|
||||||
$this->out->element('span', null, " ({$this->attachment->url})");
|
|
||||||
|
|
||||||
|
|
||||||
$this->out->elementEnd('h4');
|
$this->out->elementEnd('h4');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ if (!defined('LACONICA')) {
|
|||||||
|
|
||||||
require_once INSTALLDIR.'/lib/favorform.php';
|
require_once INSTALLDIR.'/lib/favorform.php';
|
||||||
require_once INSTALLDIR.'/lib/disfavorform.php';
|
require_once INSTALLDIR.'/lib/disfavorform.php';
|
||||||
|
require_once INSTALLDIR.'/lib/attachmentlist.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* widget for displaying a list of notices
|
* widget for displaying a list of notices
|
||||||
@ -179,9 +180,10 @@ class NoticeListItem extends Widget
|
|||||||
{
|
{
|
||||||
$this->showStart();
|
$this->showStart();
|
||||||
$this->showNotice();
|
$this->showNotice();
|
||||||
$this->showNoticeAttachments();
|
$this->showNoticeAttachmentsIcon();
|
||||||
$this->showNoticeInfo();
|
$this->showNoticeInfo();
|
||||||
$this->showNoticeOptions();
|
$this->showNoticeOptions();
|
||||||
|
$this->showNoticeAttachments();
|
||||||
$this->showEnd();
|
$this->showEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,45 +195,35 @@ class NoticeListItem extends Widget
|
|||||||
$this->out->elementEnd('div');
|
$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($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()
|
||||||
{
|
{
|
||||||
$f2p = new File_to_post;
|
if (!($this->isUsedInList() && ($count = $this->attachmentCount()))) {
|
||||||
$f2p->post_id = $this->notice->id;
|
return;
|
||||||
$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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$clip = theme_path('images/icons/clip', 'base');
|
$href = common_local_url('shownotice', array('notice' => $this->notice->id)) . '#attachments';
|
||||||
if ('shownotice' === $this->out->args['action']) {
|
$this->out->elementStart('p', 'entry-attachments');
|
||||||
$height = '96px';
|
$this->out->element('a', array('href' => $href, 'title' => "# of attachments: $count"), $count === 1 ? '' : $count);
|
||||||
$width = '83%';
|
|
||||||
$width_att = '15%';
|
|
||||||
$clip .= '-big.png';
|
|
||||||
$top = '70px';
|
|
||||||
} else {
|
|
||||||
$height = '48px';
|
|
||||||
$width = '90%';
|
|
||||||
$width_att = '8%';
|
|
||||||
$clip .= '.png';
|
|
||||||
$top = '20px';
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,26 +151,35 @@ class Router
|
|||||||
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
|
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
|
||||||
array('q' => '.+'));
|
array('q' => '.+'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
$m->connect('attachment/ajax_by_url/*url',
|
||||||
|
array('action' => 'attachment_ajax'));
|
||||||
|
*/
|
||||||
$m->connect('attachment/:attachment/ajax',
|
$m->connect('attachment/:attachment/ajax',
|
||||||
array('action' => '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',
|
$m->connect('attachment/:attachment',
|
||||||
array('action' => 'attachment'),
|
array('action' => 'attachment'),
|
||||||
array('notice' => '[0-9]+'));
|
array('attachment' => '[0-9]+'));
|
||||||
|
*/
|
||||||
// notice
|
// notice
|
||||||
|
|
||||||
$m->connect('notice/new', array('action' => 'newnotice'));
|
$m->connect('notice/new', array('action' => 'newnotice'));
|
||||||
$m->connect('notice/new?replyto=:replyto',
|
$m->connect('notice/new?replyto=:replyto',
|
||||||
array('action' => 'newnotice'),
|
array('action' => 'newnotice'),
|
||||||
array('replyto' => '[A-Za-z0-9_-]+'));
|
array('replyto' => '[A-Za-z0-9_-]+'));
|
||||||
|
/*
|
||||||
$m->connect('notice/:notice/attachments/ajax',
|
$m->connect('notice/:notice/attachments/ajax',
|
||||||
array('action' => 'attachments_ajax'),
|
array('action' => 'attachments_ajax'),
|
||||||
array('notice' => '[0-9]+'));
|
array('notice' => '[0-9]+'));
|
||||||
$m->connect('notice/:notice/attachments',
|
$m->connect('notice/:notice/attachments',
|
||||||
array('action' => 'attachments'),
|
array('action' => 'attachments'),
|
||||||
array('notice' => '[0-9]+'));
|
array('notice' => '[0-9]+'));
|
||||||
|
*/
|
||||||
$m->connect('notice/:notice',
|
$m->connect('notice/:notice',
|
||||||
array('action' => 'shownotice'),
|
array('action' => 'shownotice'),
|
||||||
array('notice' => '[0-9]+'));
|
array('notice' => '[0-9]+'));
|
||||||
|
@ -379,6 +379,12 @@ max-width:1003px;
|
|||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ajaxcore {
|
||||||
|
width: 520px;
|
||||||
|
height: 600px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
#core {
|
#core {
|
||||||
position:relative;
|
position:relative;
|
||||||
width:100%;
|
width:100%;
|
||||||
@ -742,15 +748,10 @@ border-top-style:dotted;
|
|||||||
.notices li {
|
.notices li {
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
}
|
}
|
||||||
.notices li.hover {
|
|
||||||
border-radius:4px;
|
|
||||||
-moz-border-radius:4px;
|
|
||||||
-webkit-border-radius:4px;
|
|
||||||
}
|
|
||||||
.notices .notices {
|
.notices .notices {
|
||||||
margin-top:7px;
|
margin-top:7px;
|
||||||
margin-left:3%;
|
margin-left:5%;
|
||||||
width:97%;
|
width:95%;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +828,7 @@ clear:left;
|
|||||||
float:left;
|
float:left;
|
||||||
font-size:0.95em;
|
font-size:0.95em;
|
||||||
margin-left:59px;
|
margin-left:59px;
|
||||||
width:65%;
|
width:60%;
|
||||||
}
|
}
|
||||||
#showstream .notice div.entry-content,
|
#showstream .notice div.entry-content,
|
||||||
#shownotice .notice div.entry-content {
|
#shownotice .notice div.entry-content {
|
||||||
@ -859,13 +860,11 @@ text-transform:lowercase;
|
|||||||
|
|
||||||
|
|
||||||
.notice-options {
|
.notice-options {
|
||||||
padding-left:2%;
|
|
||||||
float:left;
|
|
||||||
width:50%;
|
|
||||||
position:relative;
|
position:relative;
|
||||||
font-size:0.95em;
|
font-size:0.95em;
|
||||||
width:12.5%;
|
width:90px;
|
||||||
float:right;
|
float:right;
|
||||||
|
margin-right:11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-options a {
|
.notice-options a {
|
||||||
@ -1048,8 +1047,20 @@ margin-bottom:18px;
|
|||||||
margin-left: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 */
|
/* TOP_POSTERS */
|
||||||
.section tbody td {
|
.section tbody td {
|
||||||
|
@ -214,16 +214,16 @@ background-color:#fcfcfc;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.notices .notices {
|
.notices .notices {
|
||||||
background-color:rgba(200, 200, 200, 0.025);
|
|
||||||
}
|
|
||||||
.notices .notices .notices {
|
|
||||||
background-color:rgba(200, 200, 200, 0.050);
|
background-color:rgba(200, 200, 200, 0.050);
|
||||||
}
|
}
|
||||||
|
.notices .notices .notices {
|
||||||
|
background-color:rgba(200, 200, 200, 0.100);
|
||||||
|
}
|
||||||
.notices .notices .notices .notices {
|
.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 {
|
.notices .notices .notices .notices .notices {
|
||||||
background-color:rgba(200, 200, 200, 0.100);
|
background-color:rgba(200, 200, 200, 0.300);
|
||||||
}
|
}
|
||||||
/*END: NOTICES */
|
/*END: NOTICES */
|
||||||
|
|
||||||
|
@ -214,16 +214,16 @@ background-color:#fcfcfc;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.notices .notices {
|
.notices .notices {
|
||||||
background-color:rgba(200, 200, 200, 0.025);
|
|
||||||
}
|
|
||||||
.notices .notices .notices {
|
|
||||||
background-color:rgba(200, 200, 200, 0.050);
|
background-color:rgba(200, 200, 200, 0.050);
|
||||||
}
|
}
|
||||||
|
.notices .notices .notices {
|
||||||
|
background-color:rgba(200, 200, 200, 0.100);
|
||||||
|
}
|
||||||
.notices .notices .notices .notices {
|
.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 {
|
.notices .notices .notices .notices .notices {
|
||||||
background-color:rgba(200, 200, 200, 0.100);
|
background-color:rgba(200, 200, 200, 0.300);
|
||||||
}
|
}
|
||||||
/*END: NOTICES */
|
/*END: NOTICES */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user