Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
This commit is contained in:
commit
b4e649fe90
|
@ -276,13 +276,15 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function getUploadedAttachment() {
|
function getUploadedAttachment() {
|
||||||
$post = clone $this;
|
$post = clone $this;
|
||||||
$query = 'select file.url as uploaded from file join file_to_post on file.id = file_id where post_id=' . $post->escape($post->id) . ' and url like "%/notice/%/file"';
|
$query = 'select file.url as up, file.id as i from file join file_to_post on file.id = file_id where post_id=' . $post->escape($post->id) . ' and url like "%/notice/%/file"';
|
||||||
$post->query($query);
|
$post->query($query);
|
||||||
$post->fetch();
|
$post->fetch();
|
||||||
$ret = $post->uploaded;
|
if (empty($post->up) || empty($post->i)) {
|
||||||
// var_dump($post);
|
$ret = false;
|
||||||
|
} else {
|
||||||
|
$ret = array($post->up, $post->i);
|
||||||
|
}
|
||||||
$post->free();
|
$post->free();
|
||||||
// die();
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ class NoticeForm extends Form
|
||||||
$this->out->element('dd', array('id' => 'notice_text-count'),
|
$this->out->element('dd', array('id' => 'notice_text-count'),
|
||||||
'140');
|
'140');
|
||||||
$this->out->elementEnd('dl');
|
$this->out->elementEnd('dl');
|
||||||
|
$this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
|
||||||
$this->out->element('label', array('for' => 'notice_data-attach'), _('Attach'));
|
$this->out->element('label', array('for' => 'notice_data-attach'), _('Attach'));
|
||||||
$this->out->element('input', array('id' => 'notice_data-attach',
|
$this->out->element('input', array('id' => 'notice_data-attach',
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
|
@ -157,7 +158,6 @@ class NoticeForm extends Form
|
||||||
$this->out->hidden('notice_return-to', $this->action, 'returnto');
|
$this->out->hidden('notice_return-to', $this->action, 'returnto');
|
||||||
}
|
}
|
||||||
$this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto');
|
$this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto');
|
||||||
$this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -366,7 +366,7 @@ class NoticeListItem extends Widget
|
||||||
}
|
}
|
||||||
$uploaded = $this->notice->getUploadedAttachment();
|
$uploaded = $this->notice->getUploadedAttachment();
|
||||||
if ($uploaded) {
|
if ($uploaded) {
|
||||||
$this->out->element('a', array('href' => $uploaded, 'class' => 'attachment'), $uploaded);
|
$this->out->element('a', array('href' => $uploaded[0], 'class' => 'attachment', 'id' => 'attachment-' . $uploaded[1]), $uploaded[0]);
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user