]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added new view for the full display of objects
authorcash <cash.costello@gmail.com>
Tue, 25 Oct 2011 23:18:09 +0000 (19:18 -0400)
committercash <cash.costello@gmail.com>
Tue, 25 Oct 2011 23:18:09 +0000 (19:18 -0400)
mod/blog/views/default/object/blog.php
mod/bookmarks/views/default/object/bookmarks.php
mod/file/views/default/object/file.php
mod/pages/views/default/object/page_top.php
views/default/object/elements/full.php [new file with mode: 0644]

index b51b769a242d77e6f9e8eb9930a76255a1051de6..05ddf62c7e79d15eaedb6539ec20052a018cd01c 100644 (file)
@@ -66,8 +66,6 @@ if ($full) {
                'class' => 'blog-post',
        ));
 
-       $header = elgg_view_title($blog->title);
-
        $params = array(
                'entity' => $blog,
                'title' => false,
@@ -76,15 +74,14 @@ if ($full) {
                'tags' => $tags,
        );
        $params = $params + $vars;
-       $list_body = elgg_view('object/elements/summary', $params);
+       $summary = elgg_view('object/elements/summary', $params);
 
-       $blog_info = elgg_view_image_block($owner_icon, $list_body);
-
-       echo <<<HTML
-$header
-$blog_info
-$body
-HTML;
+       echo elgg_view('object/elements/full', array(
+               'title' => $blog->title,
+               'summary' => $summary,
+               'icon' => $owner_icon,
+               'body' => $body,
+       ));
 
 } else {
        // brief view
index bdd623bb562aca82f1b97091e33aac226814584f..ba8029a54affdf48d936931b3695cea0bb31f6d4 100644 (file)
@@ -58,7 +58,6 @@ if (elgg_in_context('widgets')) {
 }
 
 if ($full && !elgg_in_context('gallery')) {
-       $header = elgg_view_title($bookmark->title);
 
        $params = array(
                'entity' => $bookmark,
@@ -68,19 +67,24 @@ if ($full && !elgg_in_context('gallery')) {
                'tags' => $tags,
        );
        $params = $params + $vars;
-       $list_body = elgg_view('object/elements/summary', $params);
-       $bookmark_info = elgg_view_image_block($owner_icon, $list_body);
+       $summary = elgg_view('object/elements/summary', $params);
 
        $bookmark_icon = elgg_view_icon('push-pin-alt');
-       echo <<<HTML
-$header
-$bookmark_info
+       $body = <<<HTML
 <div class="bookmark elgg-content mts">
        $bookmark_icon<span class="elgg-heading-basic mbs">$link</span>
        $description
 </div>
 HTML;
 
+       echo elgg_view('object/elements/full', array(
+               'entity' => $bookmark,
+               'title' => $bookmark->title,
+               'icon' => $owner_icon,
+               'summary' => $summary,
+               'body' => $body,
+       ));
+
 } elseif (elgg_in_context('gallery')) {
        echo <<<HTML
 <div class="bookmarks-gallery-item">
@@ -124,4 +128,4 @@ HTML;
        $body = elgg_view('object/elements/summary', $params);
        
        echo elgg_view_image_block($owner_icon, $body);
-}
\ No newline at end of file
+}
index 874d8fb071e4f7da4b855659adba76751dda9ca3..81421133fb0abdf420c47002df614c25c4f61a42 100644 (file)
@@ -19,8 +19,6 @@ $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,
@@ -69,8 +67,6 @@ 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,
@@ -79,17 +75,18 @@ if ($full && !elgg_in_context('gallery')) {
                '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">';
index 08cdd6e2d702b20542fbc89ac45ec7e01c2b06a6..0a1c33458e0f610840dcbc44c2047e0566dba092 100644 (file)
@@ -86,14 +86,15 @@ if ($full) {
                'tags' => $tags,
        );
        $params = $params + $vars;
-       $list_body = elgg_view('object/elements/summary', $params);
-
-       $info = elgg_view_image_block($page_icon, $list_body);
+       $summary = elgg_view('object/elements/summary', $params);
 
-       echo <<<HTML
-$info
-$body
-HTML;
+       echo elgg_view('object/elements/full', array(
+               'entity' => $page,
+               'title' => false,
+               'icon' => $page_icon,
+               'summary' => $summary,
+               'body' => $body,
+       ));
 
 } else {
        // brief view
diff --git a/views/default/object/elements/full.php b/views/default/object/elements/full.php
new file mode 100644 (file)
index 0000000..4a29914
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Object full rendering
+ *
+ * Sample output
+ * <h2>Title</h3>
+ * <div class="elgg-content">
+ *     <div class="elgg-image-block">
+ *     </div>
+ *     <div class="elgg-output">
+ *     </div>
+ * </div>
+ *
+ * @uses $vars['entity']   ElggEntity
+ * @uses $vars['title']    Title (false for no title)
+ * @uses $vars['icon']     HTML for the content icon
+ * @uses $vars['summary']  HTML for the content summary
+ * @uses $vars['body']     HTML for the content body
+ * @uses $vars['class']    Optional additional class for the content wrapper
+ */
+
+$title = elgg_extract('title', $vars);
+$icon = elgg_extract('icon', $vars);
+$summary = elgg_extract('summary', $vars);
+$body = elgg_extract('body', $vars);
+$class = elgg_extract('class', $vars);
+if ($class) {
+       $class = "elgg-content $class";
+} else {
+       $class = "elgg-content";
+}
+
+if ($title) {
+       $title = elgg_view_title($title);
+}
+
+$header = elgg_view_image_block($icon, $summary);
+
+echo <<<HTML
+$title
+<div class="$class">
+$header
+$body
+</div>
+HTML;