From 15eaacc12ad0ffe19d42b6d2508c4469ba005bfd Mon Sep 17 00:00:00 2001
From: cash
Date: Wed, 8 Dec 2010 02:37:26 +0000
Subject: Fixes #2189 created the object/list view with semantic markup
git-svn-id: http://code.elgg.org/elgg/trunk@7560 36083f99-b078-4883-b0ff-0f9b5a30f544
---
views/default/annotation/generic_comment.php | 2 +-
views/default/annotation/list.php | 46 -------------------
views/default/comments/list.php | 20 ---------
views/default/layout/elements/comments.php | 20 +++++++++
views/default/layout/objects/list.php | 67 ++++++++++++++++++++++++++++
5 files changed, 88 insertions(+), 67 deletions(-)
delete mode 100644 views/default/annotation/list.php
delete mode 100644 views/default/comments/list.php
create mode 100644 views/default/layout/elements/comments.php
create mode 100644 views/default/layout/objects/list.php
(limited to 'views')
diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php
index 63633d3b5..c6fea8b41 100644
--- a/views/default/annotation/generic_comment.php
+++ b/views/default/annotation/generic_comment.php
@@ -53,7 +53,7 @@ if ($full_view) {
HTML;
- echo elgg_view_media($commenter_icon, $body, array('id' => "comment-$comment->id"));
+ echo elgg_view_media($commenter_icon, $body);
} else {
// brief view
diff --git a/views/default/annotation/list.php b/views/default/annotation/list.php
deleted file mode 100644
index f432ad640..000000000
--- a/views/default/annotation/list.php
+++ /dev/null
@@ -1,46 +0,0 @@
- $_SERVER['REQUEST_URI'],
- 'offset' => $offset,
- 'count' => $count,
- 'limit' => $limit,
- 'word' => 'annoff',
- 'nonefound' => false,
- ));
-}
-
-if (is_array($annotations) && count($annotations) > 0) {
- $html .= '';
- foreach ($annotations as $annotation) {
- $html .= '- ';
- $html .= elgg_view_annotation($annotation, true);
- $html .= '
';
- }
- $html .= '
';
-}
-
-if ($count) {
- $html .= $nav;
-}
-
-echo $html;
diff --git a/views/default/comments/list.php b/views/default/comments/list.php
deleted file mode 100644
index 6dbe51483..000000000
--- a/views/default/comments/list.php
+++ /dev/null
@@ -1,20 +0,0 @@
-';
-
-echo list_annotations($vars['entity']->getGUID(), 'generic_comment');
-
-if ($show_add_form) {
- $form_vars = array('name' => 'elgg_add_comment');
- echo elgg_view_form('comments/add', $form_vars, $vars);
-}
-
-echo '';
diff --git a/views/default/layout/elements/comments.php b/views/default/layout/elements/comments.php
new file mode 100644
index 000000000..6dbe51483
--- /dev/null
+++ b/views/default/layout/elements/comments.php
@@ -0,0 +1,20 @@
+';
+
+echo list_annotations($vars['entity']->getGUID(), 'generic_comment');
+
+if ($show_add_form) {
+ $form_vars = array('name' => 'elgg_add_comment');
+ echo elgg_view_form('comments/add', $form_vars, $vars);
+}
+
+echo '';
diff --git a/views/default/layout/objects/list.php b/views/default/layout/objects/list.php
new file mode 100644
index 000000000..b65e79102
--- /dev/null
+++ b/views/default/layout/objects/list.php
@@ -0,0 +1,67 @@
+ element
+ * @uses $vars['item_class'] Additional CSS class for the elements
+ */
+
+$items = $vars['items'];
+$offset = $vars['offset'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+$base_url = $vars['base_url'];
+$pagination = elgg_get_array_value('pagination', $vars, true);
+$full_view = elgg_get_array_value('full_view', $vars, false);
+
+$list_class = 'elgg-list';
+if (isset($vars['list_class'])) {
+ $list_class = "{$vars['list_class']} $list_class";
+}
+
+$item_class = 'elgg-list-item';
+if (isset($vars['item_class'])) {
+ $item_class = "{$vars['item_class']} $item_class";
+}
+
+$html = "";
+$nav = "";
+
+if ($pagination) {
+ $nav .= elgg_view('navigation/pagination', array(
+ 'baseurl' => $base_url,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+ ));
+}
+
+if (is_array($items) && count($items) > 0) {
+ $html .= "";
+ foreach ($items as $item) {
+ if (elgg_instanceof($item)) {
+ $id = "item-{$item->getGUID()}";
+ } else {
+ $id = "item-{$item->id}";
+ }
+ $html .= "- ";
+ $html .= elgg_view_list_item($item, $full_view);
+ $html .= '
';
+ }
+ $html .= '
';
+}
+
+if ($count) {
+ $html .= $nav;
+}
+
+echo $html;
--
cgit v1.2.3