Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
This commit is contained in:
commit
b53b6b8769
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
14
js/util.js
14
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 = '<div id="notice_data-attach_selected" class="success">'+$(this).val()+'</div>';
|
||||
function NoticeDataAttach() {
|
||||
NDA = $('#notice_data-attach');
|
||||
NDA.change(function() {
|
||||
S = '<div id="notice_data-attach_selected" class="success"><code>'+$(this).val()+'</code> <button>×</button></div>';
|
||||
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('');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -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');
|
||||
|
35
lib/util.php
35
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);
|
||||
}
|
||||
|
||||
|
@ -518,6 +518,18 @@ 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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user