diff options
Diffstat (limited to 'mod/file/views')
-rw-r--r-- | mod/file/views/default/embed/file/content.php | 61 | ||||
-rw-r--r-- | mod/file/views/default/embed/file_upload/content.php | 13 | ||||
-rw-r--r-- | mod/file/views/default/file/group_module.php | 2 | ||||
-rw-r--r-- | mod/file/views/default/icon/object/file.php | 25 | ||||
-rw-r--r-- | mod/file/views/default/object/file.php | 28 | ||||
-rw-r--r-- | mod/file/views/default/river/object/file/create.php | 2 | ||||
-rw-r--r-- | mod/file/views/default/widgets/filerepo/content.php | 1 | ||||
-rw-r--r-- | mod/file/views/rss/file/enclosure.php | 16 | ||||
-rw-r--r-- | mod/file/views/rss/object/file.php | 21 |
9 files changed, 59 insertions, 110 deletions
diff --git a/mod/file/views/default/embed/file/content.php b/mod/file/views/default/embed/file/content.php deleted file mode 100644 index 865a158a7..000000000 --- a/mod/file/views/default/embed/file/content.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * List files available for upload - */ - -$active_section = elgg_extract('active_section', $vars); - -$options = array( - 'owner_guid' => elgg_get_logged_in_user_guid(), - 'type_subtype_pair' => array('object' => 'file'), - 'count' => true -); - -$count = elgg_get_entities($options); - -if ($count) { - echo "<div class='embed_modal_$active_section'>"; - - unset($options['count']); - $items = elgg_get_entities($options); - - foreach ($items as $item) { - - // different entity types have different title attribute names. - $title = isset($item->name) ? $item->name : $item->title; - // don't let it be too long - $title = elgg_get_excerpt($title); - - $author_text = elgg_echo('byline', array($owner->name)); - $date = elgg_view_friendly_time($item->time_created); - - $subtitle = "$author_text $date"; - - $icon = "<img src=\"{$item->getIconURL($icon_size)}\" />" . htmlentities($title, ENT_QUOTES, 'UTF-8'); - - $embed_code = elgg_view('output/url', array( - 'href' => $item->getURL(), - 'title' => $title, - 'text' => $icon, - 'encode_text' => FALSE - )); - - $item_icon = elgg_view_entity_icon($item, $icon_size); - - $params = array( - 'title' => $title, - 'entity' => $item, - 'subtitle' => $subtitle, - 'tags' => FALSE, - ); - $list_body = elgg_view('object/elements/summary', $params); - - // @todo JS 1.8: is this approach better than inline js? - echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_image_block($item_icon, $list_body) . '</div>'; - echo "<script type=\"text/javascript\"> - $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . "); - </script>"; - } - - echo '</div>'; -}
\ No newline at end of file diff --git a/mod/file/views/default/embed/file_upload/content.php b/mod/file/views/default/embed/file_upload/content.php index 13c18f745..4d3db0d97 100644 --- a/mod/file/views/default/embed/file_upload/content.php +++ b/mod/file/views/default/embed/file_upload/content.php @@ -5,11 +5,12 @@ $form_vars = array( 'enctype' => 'multipart/form-data', - 'class' => 'elgg-form', + 'class' => 'elgg-form-embed', ); -$upload_content = elgg_view_form('file/upload', $form_vars); +echo elgg_view_form('file/upload', $form_vars); -echo "<div class='mbm'>" . elgg_echo('embed:upload_type') . "$input</div>"; -echo "<div class='embed-upload'>"; -echo $upload_content; -echo "</div>";
\ No newline at end of file +// the tab we want to be forwarded to after upload is complete +echo elgg_view('input/hidden', array( + 'name' => 'embed_forward', + 'value' => 'file', +));
\ No newline at end of file diff --git a/mod/file/views/default/file/group_module.php b/mod/file/views/default/file/group_module.php index c37b13927..ad6c58dbb 100644 --- a/mod/file/views/default/file/group_module.php +++ b/mod/file/views/default/file/group_module.php @@ -12,6 +12,7 @@ if ($group->file_enable == "no") { $all_link = elgg_view('output/url', array( 'href' => "file/group/$group->guid/all", 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, )); elgg_push_context('widgets'); @@ -33,6 +34,7 @@ if (!$content) { $new_link = elgg_view('output/url', array( 'href' => "file/add/$group->guid", 'text' => elgg_echo('file:add'), + 'is_trusted' => true, )); echo elgg_view('groups/profile/module', array( diff --git a/mod/file/views/default/icon/object/file.php b/mod/file/views/default/icon/object/file.php index 6357d418f..a3190310b 100644 --- a/mod/file/views/default/icon/object/file.php +++ b/mod/file/views/default/icon/object/file.php @@ -2,9 +2,11 @@ /** * File icon view * - * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method - * @uses $vars['size'] topbar, tiny, small, medium (default), large, master - * @uses $vars['href'] Optional override for link + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] topbar, tiny, small, medium (default), large, master + * @uses $vars['href'] Optional override for link + * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class added to link */ $entity = $vars['entity']; @@ -16,6 +18,7 @@ if (!in_array($vars['size'], $sizes)) { } $title = $entity->title; +$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); $url = $entity->getURL(); if (isset($vars['href'])) { @@ -23,8 +26,13 @@ if (isset($vars['href'])) { } $class = ''; +if (isset($vars['img_class'])) { + $class = $vars['img_class']; +} if ($entity->thumbnail) { - $class = 'class="elgg-photo"'; + $class = "class=\"elgg-photo $class\""; +} else if ($class) { + $class = "class=\"$class\""; } $img_src = $entity->getIconURL($vars['size']); @@ -32,10 +40,15 @@ $img_src = elgg_format_url($img_src); $img = "<img $class src=\"$img_src\" alt=\"$title\" />"; if ($url) { - echo elgg_view('output/url', array( + $params = array( 'href' => $url, 'text' => $img, - )); + 'is_trusted' => true, + ); + if (isset($vars['link_class'])) { + $params['class'] = $vars['link_class']; + } + echo elgg_view('output/url', $params); } else { echo $img; } diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 95e190d35..1db9863c9 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -19,11 +19,10 @@ $excerpt = elgg_get_excerpt($file->description); $mime = $file->mimetype; $base_type = substr($mime, 0, strpos($mime,'/')); -$body = elgg_view('output/longtext', array('value' => $file->description)); - $owner_link = elgg_view('output/url', array( 'href' => "file/owner/$owner->username", 'text' => $owner->name, + 'is_trusted' => true, )); $author_text = elgg_echo('byline', array($owner_link)); @@ -39,6 +38,7 @@ if ($comments_count != 0) { $comments_link = elgg_view('output/url', array( 'href' => $file->getURL() . '#file-comments', 'text' => $text, + 'is_trusted' => true, )); } else { $comments_link = ''; @@ -51,7 +51,7 @@ $metadata = elgg_view_menu('entity', array( 'class' => 'elgg-menu-hz', )); -$subtitle = "$author_text $date $categories $comments_link"; +$subtitle = "$author_text $date $comments_link $categories"; // do not show the metadata and controls in widget view if (elgg_in_context('widgets')) { @@ -67,27 +67,25 @@ if ($full && !elgg_in_context('gallery')) { $extra = elgg_view("file/specialcontent/$base_type/default", $vars); } - $header = elgg_view_title($file->title); - $params = array( 'entity' => $file, - 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle, 'tags' => $tags, ); $params = $params + $vars; - $list_body = elgg_view('object/elements/summary', $params); + $summary = elgg_view('object/elements/summary', $params); - $file_info = elgg_view_image_block($file_icon, $list_body); + $text = elgg_view('output/longtext', array('value' => $file->description)); + $body = "$text $extra"; - echo <<<HTML -$file_info -<div class="file elgg-content"> - $body - $extra -</div> -HTML; + echo elgg_view('object/elements/full', array( + 'entity' => $file, + 'title' => false, + 'icon' => $file_icon, + 'summary' => $summary, + 'body' => $body, + )); } elseif (elgg_in_context('gallery')) { echo '<div class="file-gallery-item">'; diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php index dad629120..e8e6142e0 100644 --- a/mod/file/views/default/river/object/file/create.php +++ b/mod/file/views/default/river/object/file/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/file/views/default/widgets/filerepo/content.php b/mod/file/views/default/widgets/filerepo/content.php index 4288b9e56..f3e152de3 100644 --- a/mod/file/views/default/widgets/filerepo/content.php +++ b/mod/file/views/default/widgets/filerepo/content.php @@ -25,6 +25,7 @@ if ($content) { $more_link = elgg_view('output/url', array( 'href' => $url, 'text' => elgg_echo('file:more'), + 'is_trusted' => true, )); echo "<span class=\"elgg-widget-more\">$more_link</span>"; } else { diff --git a/mod/file/views/rss/file/enclosure.php b/mod/file/views/rss/file/enclosure.php new file mode 100644 index 000000000..fb4a899d9 --- /dev/null +++ b/mod/file/views/rss/file/enclosure.php @@ -0,0 +1,16 @@ +<?php +/** + * Link to download the file + * + * @uses $vars['entity'] + */ + +if (elgg_instanceof($vars['entity'], 'object', 'file')) { + $download_url = elgg_get_site_url() . 'file/download/' . $vars['entity']->getGUID(); + $size = $vars['entity']->size(); + $mime_type = $vars['entity']->getMimeType(); + echo <<<END + + <enclosure url="$download_url" length="$size" type="$mime_type" />"; +END; +} diff --git a/mod/file/views/rss/object/file.php b/mod/file/views/rss/object/file.php deleted file mode 100644 index a0660d6c8..000000000 --- a/mod/file/views/rss/object/file.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Elgg RSS file object view - * - * @package ElggFile - * @subpackage Core - */ -$title = $vars['entity']->title; -if (empty($title)) { - $title = elgg_get_excerpt($vars['entity']->description, 32); -} -?> - -<item> - <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid> - <pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate> - <link><?php echo $vars['entity']->getURL(); ?></link> - <title><![CDATA[<?php echo $title; ?>]]></title> - <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description> - <enclosure url="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" /> -</item> |