diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-01 12:13:20 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-01 12:13:20 +0000 |
commit | f4adea3198f441663835ea4e45f622483adb444e (patch) | |
tree | ef61bc9b6cde3e60083fea9c6dd6a17ceb2aebe9 /mod/file | |
parent | 01693c67dbb7ed686b6fa03faba875eb11fea160 (diff) | |
download | elgg-f4adea3198f441663835ea4e45f622483adb444e.tar.gz elgg-f4adea3198f441663835ea4e45f622483adb444e.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Using mime types
git-svn-id: https://code.elgg.org/elgg/trunk@591 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file')
-rw-r--r-- | mod/file/actions/upload.php | 1 | ||||
-rw-r--r-- | mod/file/index.php | 3 | ||||
-rw-r--r-- | mod/file/start.php | 5 | ||||
-rw-r--r-- | mod/file/views/default/file/file.php | 3 | ||||
-rw-r--r-- | mod/file/views/default/file/icon.php | 23 |
5 files changed, 33 insertions, 2 deletions
diff --git a/mod/file/actions/upload.php b/mod/file/actions/upload.php index 881470bc7..05b0150f6 100644 --- a/mod/file/actions/upload.php +++ b/mod/file/actions/upload.php @@ -19,6 +19,7 @@ $prefix = "/file/"; $file = new ElggFile(); $file->setFilename($_FILES['upload']['name']); + $file->setMimeType($_FILES['upload']['type']); $file->open("write"); $file->write(get_uploaded_file('upload')); diff --git a/mod/file/index.php b/mod/file/index.php index 577233276..896eb9e94 100644 --- a/mod/file/index.php +++ b/mod/file/index.php @@ -6,6 +6,9 @@ * @author Marcus Povey * @copyright Curverider Ltd 2008 * @link http://elgg.com/ + * + * + * TODO: File icons, download & mime types */ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); diff --git a/mod/file/start.php b/mod/file/start.php index 98ee4ff46..3c5fbb80d 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -87,12 +87,13 @@ $tags = $file->getMetaData("tag"); if (!is_array($tags)) $tags = array($tags); - + // Draw file return elgg_view("file/file", array( "tags" => $tags, "title" => $file->title, - "description" => $file->description + "description" => $file->description, + "mime" => $file->getMimeType() )); } diff --git a/mod/file/views/default/file/file.php b/mod/file/views/default/file/file.php index 1b2beae53..cbb3034b6 100644 --- a/mod/file/views/default/file/file.php +++ b/mod/file/views/default/file/file.php @@ -15,12 +15,15 @@ $title = $vars['title']; $desc = $vars['description']; + $mime = $vars['mimetype']; + ?> <div class="file"> <table width="100%"> <tr> <td valign="top"> <div class="file_icon"> + <?php echo elgg_view("file/icon", array("mime" => $mime)); ?> </div> </td> <td valign="top"> diff --git a/mod/file/views/default/file/icon.php b/mod/file/views/default/file/icon.php new file mode 100644 index 000000000..266a60a47 --- /dev/null +++ b/mod/file/views/default/file/icon.php @@ -0,0 +1,23 @@ +<?php + /** + * Elgg file icons. + * Displays an icon, depending on its mime type, for a file. + * Optionally you can specify a size. + * + * @package ElggFile + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + + $mime = $vars['mimetype']; + + $width = $vars['width']; + $height = $vars['height']; + + if (!$width) $width = 100; + if (!$height) $height = 100; + + echo $mime; +?>
\ No newline at end of file |