From e120cb1a5300f2e38820aa05ec9ac21073a934e0 Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Wed, 10 Jun 2009 14:17:46 -0400 Subject: [PATCH] Uploaded content now displays in overlay (and removed var_dump crap) --- classes/Notice.php | 6 ++---- lib/noticeform.php | 2 +- lib/noticelist.php | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 0b1017e126..530c6daa7d 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -279,13 +279,11 @@ class Notice extends Memcached_DataObject 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"'; + $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->fetch(); - $ret = $post->uploaded; -// var_dump($post); + $ret = array($post->up, $post->i); $post->free(); -// die(); return $ret; } diff --git a/lib/noticeform.php b/lib/noticeform.php index 5d7cf194ee..3212f382ad 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -148,6 +148,7 @@ class NoticeForm extends Form $this->out->element('dd', array('id' => 'notice_text-count'), '140'); $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('input', array('id' => 'notice_data-attach', 'type' => 'file', @@ -157,7 +158,6 @@ class NoticeForm extends Form $this->out->hidden('notice_return-to', $this->action, 'returnto'); } $this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto'); - $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); } /** diff --git a/lib/noticelist.php b/lib/noticelist.php index 9ace341d80..fadc238a4d 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -366,7 +366,7 @@ class NoticeListItem extends Widget } $uploaded = $this->notice->getUploadedAttachment(); 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'); }