diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-09 21:48:56 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-09 21:48:56 -0700 |
commit | ed627bb4bd6424325478412055d295b185f9f662 (patch) | |
tree | feb95836538735a5059519293143403079249648 | |
parent | adfb79a9bbdfb43f35c0f022c1de6118b10ce115 (diff) | |
parent | 207750e75774c823328889cb4102aad6a0b12281 (diff) |
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
-rw-r--r-- | classes/Notice.php | 12 | ||||
-rw-r--r-- | lib/common.php | 1 | ||||
-rw-r--r-- | lib/noticeform.php | 3 | ||||
-rw-r--r-- | lib/noticelist.php | 8 | ||||
-rw-r--r-- | theme/base/css/display.css | 1 | ||||
-rw-r--r-- | theme/biz/css/base.css | 21 | ||||
-rw-r--r-- | theme/biz/css/display.css | 7 | ||||
-rw-r--r-- | theme/default/css/display.css | 7 |
8 files changed, 54 insertions, 6 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index ca67306df..895b5d2c7 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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); diff --git a/lib/common.php b/lib/common.php index ceb50337c..5aafdfe0e 100644 --- a/lib/common.php +++ b/lib/common.php @@ -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', diff --git a/lib/noticeform.php b/lib/noticeform.php index 5a6c7cf38..5d7cf194e 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -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'); } diff --git a/lib/noticelist.php b/lib/noticelist.php index 5513e317e..9ace341d8 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -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'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 7eea54eb2..dc275e19f 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -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 { diff --git a/theme/biz/css/base.css b/theme/biz/css/base.css index 0e37a6ee4..696fd0645 100644 --- a/theme/biz/css/base.css +++ b/theme/biz/css/base.css @@ -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; } diff --git a/theme/biz/css/display.css b/theme/biz/css/display.css index 14092d964..3af4c06b9 100644 --- a/theme/biz/css/display.css +++ b/theme/biz/css/display.css @@ -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; diff --git a/theme/default/css/display.css b/theme/default/css/display.css index e08a4783b..34f6b3b8a 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -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; |