Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x

This commit is contained in:
Evan Prodromou 2009-06-09 21:48:56 -07:00
commit ed627bb4bd
8 changed files with 54 additions and 6 deletions

View File

@ -269,6 +269,18 @@ class Notice extends Memcached_DataObject
return true;
}
function getUploadedAttachment() {
$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"';
$post->query($query);
$post->fetch();
$ret = $post->uploaded;
// var_dump($post);
$post->free();
// die();
return $ret;
}
function hasAttachments() {
$post = clone $this;
$query = "select count(file_id) as n_attachments from file join file_to_post on (file_id = file.id) join notice on (post_id = notice.id) where post_id = " . $post->escape($post->id);

View File

@ -188,6 +188,7 @@ $config =
'application/vnd.oasis.opendocument.formula-template',
'application/vnd.oasis.opendocument.text-master',
'application/vnd.oasis.opendocument.text-web',
'application/x-zip',
'application/zip',
'text/plain',
'video/mpeg',

View File

@ -151,7 +151,8 @@ class NoticeForm extends Form
$this->out->element('label', array('for' => 'notice_data-attach'), _('Attach'));
$this->out->element('input', array('id' => 'notice_data-attach',
'type' => 'file',
'name' => 'attach'));
'name' => 'attach',
'title' => _('Attach a file')));
if ($this->action) {
$this->out->hidden('notice_return-to', $this->action, 'returnto');
}

View File

@ -364,6 +364,10 @@ class NoticeListItem extends Widget
// versions (>> 0.4.x)
$this->out->raw(common_render_content($this->notice->content, $this->notice));
}
$uploaded = $this->notice->getUploadedAttachment();
if ($uploaded) {
$this->out->element('a', array('href' => $uploaded, 'class' => 'attachment'), $uploaded);
}
$this->out->elementEnd('p');
}
@ -395,10 +399,6 @@ class NoticeListItem extends Widget
'title' => $dt),
common_date_string($this->notice->created));
$f2p = File_to_post::staticGet('post_id', $this->notice->id);
if (!empty($f2p)) {
$this->out->text(_(' (with attachments) '));
}
$this->out->elementEnd('a');
$this->out->elementEnd('dd');
$this->out->elementEnd('dl');

View File

@ -454,7 +454,6 @@ margin-bottom:7px;
}
#form_notice label[for=notice_data-attach] {
text-indent:-9999px;
display:block;
}
#form_notice label[for=notice_data-attach],
#form_notice #notice_data-attach {

View File

@ -446,6 +446,27 @@ float:left;
font-size:1.3em;
margin-bottom:7px;
}
#form_notice label {
display:block;
float:left;
font-size:1.3em;
margin-bottom:7px;
}
#form_notice label[for=notice_data-attach] {
text-indent:-9999px;
}
#form_notice label[for=notice_data-attach],
#form_notice #notice_data-attach {
position:absolute;
top:25px;
right:49px;
width:16px;
height:16px;
cursor:pointer;
}
#form_notice #notice_data-attach {
text-indent:-279px;
}
#form_notice #notice_submit label {
display:none;
}

View File

@ -102,6 +102,13 @@ color:#333;
#form_notice.warning #notice_text-count {
color:#000;
}
#form_notice label[for=notice_data-attach] {
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
}
#form_notice #notice_data-attach {
opacity:0;
}
#form_notice.processing #notice_action-submit {
background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
cursor:wait;

View File

@ -82,6 +82,13 @@ color:#333;
#form_notice.warning #notice_text-count {
color:#000;
}
#form_notice label[for=notice_data-attach] {
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
}
#form_notice #notice_data-attach {
opacity:0;
}
#form_notice.processing #notice_action-submit {
background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
cursor:wait;