]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
comments use the media view now
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 6 Dec 2010 01:48:53 +0000 (01:48 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 6 Dec 2010 01:48:53 +0000 (01:48 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7544 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/views.php
languages/en.php
views/default/annotation/generic_comment.php
views/default/annotation/list.php [new file with mode: 0644]
views/default/comments/forms/edit.php [deleted file]
views/default/forms/comments/add.php [new file with mode: 0644]
views/default/layout_elements/media.php

index 3885babf1ff528f9467aef9c1fef7f7007bffdec..d2e63d1a5732c0fa821531aee574c5e3f6c73f65 100644 (file)
@@ -836,34 +836,14 @@ $list_type_toggle = true, $pagination = true) {
  * @access private
  */
 function elgg_view_annotation_list($annotations, $count, $offset, $limit) {
-       $count = (int) $count;
-       $offset = (int) $offset;
-       $limit = (int) $limit;
-
-       $html = "";
-
-       $nav = elgg_view('navigation/pagination', array(
-               'baseurl' => $_SERVER['REQUEST_URI'],
-               'offset' => $offset,
-               'count' => $count,
-               'limit' => $limit,
-               'word' => 'annoff',
-               'nonefound' => false,
-       ));
-
-       $html .= $nav;
-
-       if (is_array($annotations) && sizeof($annotations) > 0) {
-               foreach ($annotations as $annotation) {
-                       $html .= elgg_view_annotation($annotation, true);
-               }
-       }
-
-       if ($count) {
-               $html .= $nav;
-       }
+       $params = array(
+               'annotations' => $annotations,
+               'count' => (int) $count,
+               'offset' => (int) $offset,
+               'limit' => (int) $limit,
+       );
 
-       return $html;
+       return elgg_view('annotation/list', $params);
 }
 
 /**
@@ -959,13 +939,19 @@ function elgg_view_comments($entity, $add_comment = true) {
        if ($comemnts) {
                return $comments;
        } else {
+               $params = array(
+                       'entity' => $entity,
+                       'show_add_form' => $add_comment,
+               );
+               $comments = elgg_view('comments/list', $params);
+       /*
                $comments = list_annotations($entity->getGUID(), 'generic_comment');
 
                //display the new comment form if required
                if ($add_comment) {
                        $comments .= elgg_view('comments/forms/edit', array('entity' => $entity));
                }
-
+*/
                return $comments;
        }
 }
index cad8a93c3cea698563e5ce9652dc68dc50b284c3..e4e17d9b99b26c918ef70a3cb377d8703d774d16 100644 (file)
@@ -923,7 +923,7 @@ If you requested this click on the link below, otherwise ignore this email.
        'generic_comments:text' => "Comment",
        'generic_comments:latest' => "Latest comments",
        'generic_comment:posted' => "Your comment was successfully posted.",
-       'generic_comment:deleted' => "Your comment was successfully deleted.",
+       'generic_comment:deleted' => "The comment was successfully deleted.",
        'generic_comment:blank' => "Sorry, you need to actually put something in your comment before we can save it.",
        'generic_comment:notfound' => "Sorry, we could not find the specified item.",
        'generic_comment:notdeleted' => "Sorry, we could not delete this comment.",
index bb0127bfebb599f7f134a304e2afb6a41f4576f3..63633d3b5700f4c86317c34af1d02b0a7ba51d78 100644 (file)
@@ -20,7 +20,6 @@ if (!$entity || !$commenter) {
        return true;
 }
 
-
 $friendlytime = elgg_view_friendly_time($comment->time_created);
 
 $commenter_icon = elgg_view("profile/icon", array('entity' => $commenter, 'size' => 'tiny'));
@@ -31,6 +30,31 @@ $entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>";
 
 if ($full_view) {
 
+       $delete_button = '';
+       if ($comment->canEdit()) {
+               $delete_button = elgg_view("output/confirmlink",array(
+                                                       'href' => "action/comments/delete?annotation_id={$comment->id}",
+                                                       'text' => elgg_echo('delete'),
+                                                       'confirm' => elgg_echo('deleteconfirm')
+                                               ));
+               $delete_button = "<span class=\"delete-button\">$delete_button</span>";
+       }
+
+       $comment_text = elgg_view("output/longtext", array("value" => $comment->value));
+
+       $body = <<<HTML
+<p class="mbn">
+       $delete_button
+       $commenter_link
+       <span class="entity-subtext">
+               $friendlytime
+       </span>
+       $comment_text
+</p>
+HTML;
+
+       echo elgg_view_media($commenter_icon, $body, array('id' => "comment-$comment->id"));
+
 } else {
        // brief view
 
@@ -39,57 +63,10 @@ if ($full_view) {
        $on = elgg_echo('on');
 
        $body = <<<HTML
-<span class="entity-subtext">$commenter_link $on <span class='entity-title'>$entity_link</span> ($friendlytime)</span>
+<span class="entity-subtext">
+       $commenter_link $on <span class='entity-title'>$entity_link</span> ($friendlytime)
+</span>
 HTML;
 
        echo elgg_view_media($commenter_icon, $body);
-       
-       // @todo remove this once the full view has been rewritten
-       return true;
 }
-
-
-// @todo - below needs to be rewritten like the brief view
-
-$owner = get_user($vars['annotation']->owner_guid);
-
-?>
-<a class="anchor_link" name="comment_<?php echo $vars['annotation']->id; ?>"></a>
-<div class="generic-comment clearfix">
-       <div class="generic-comment-icon">
-               <?php
-                       echo elgg_view("profile/icon", array(
-                                       'entity' => $owner,
-                                       'size' => 'tiny'
-                                       ));
-               ?>
-       </div>
-
-       <div class="generic-comment-details">
-               <?php
-               // if the user looking at the comment can edit, show the delete link
-               if ($vars['annotation']->canEdit()) {
-               ?>
-                       <span class="delete-button">
-                               <?php echo elgg_view("output/confirmlink",array(
-                                               'href' => "action/comments/delete?annotation_id=" . $vars['annotation']->id,
-                                               'text' => elgg_echo('delete'),
-                                               'confirm' => elgg_echo('deleteconfirm')
-                                               ));
-                               ?>
-                       </span>
-               <?php
-                       } //end of can edit if statement
-               ?>
-               <p class="generic-comment-owner">
-                       <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a>
-                       <span class="entity-subtext">
-                               <?php echo elgg_view_friendly_time($vars['annotation']->time_created); ?>
-                       </span>
-               </p>
-               <!-- output the actual comment -->
-               <div class="generic-comment-body">
-                       <?php echo elgg_view("output/longtext",array("value" => $vars['annotation']->value)); ?>
-               </div>
-       </div>
-</div>
\ No newline at end of file
diff --git a/views/default/annotation/list.php b/views/default/annotation/list.php
new file mode 100644 (file)
index 0000000..f432ad6
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Annotation list
+ *
+ * @uses $vars['annotations']
+ * @uses $vars['limit']
+ * @uses $vars['offset']
+ * @uses $vars['count']
+ * @uses $vars['pagination']
+ */
+
+$offset = $vars['offset'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+$annotations = $vars['annotations'];
+$pagination = elgg_get_array_value('pagination', $vars, true);
+
+$html = "";
+$nav = "";
+
+if ($pagination) {
+       $nav .= elgg_view('navigation/pagination', array(
+               'baseurl' => $_SERVER['REQUEST_URI'],
+               'offset' => $offset,
+               'count' => $count,
+               'limit' => $limit,
+               'word' => 'annoff',
+               'nonefound' => false,
+       ));
+}
+
+if (is_array($annotations) && count($annotations) > 0) {
+       $html .= '<ul class="elgg-annotation-list elgg-list">';
+       foreach ($annotations as $annotation) {
+                       $html .= '<li>';
+                       $html .= elgg_view_annotation($annotation, true);
+                       $html .= '</li>';
+       }
+       $html .= '</ul>';
+}
+
+if ($count) {
+       $html .= $nav;
+}
+
+echo $html;
diff --git a/views/default/comments/forms/edit.php b/views/default/comments/forms/edit.php
deleted file mode 100644 (file)
index 3c26bf7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Elgg comments add form
- *
- * @package Elgg
- *
- * @uses $vars['entity']
- */
-        
-        if (isset($vars['entity']) && isloggedin()) {
-        
-                $form_body = "<div class='comment margin-top'><p class='longtext_inputarea'><label>".elgg_echo("generic_comments:text")."</label>" . elgg_view('input/longtext',array('internalname' => 'generic_comment')) . "</p>";
-                $form_body .= elgg_view('input/hidden', array('internalname' => 'entity_guid', 'value' => $vars['entity']->getGUID()));
-                $form_body .= elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))) . "</div>";
-                
-                echo elgg_view('input/form', array('body' => $form_body, 'action' => "action/comments/add"));
-
-    }
-    
-?>
\ No newline at end of file
diff --git a/views/default/forms/comments/add.php b/views/default/forms/comments/add.php
new file mode 100644 (file)
index 0000000..74ee5ba
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Elgg comments add form
+ *
+ * @package Elgg
+ *
+ * @uses $vars['entity']
+ */
+
+if (isset($vars['entity']) && isloggedin()) {
+?>
+<p class="mbn">
+       <label><?php echo elgg_echo("generic_comments:text"); ?></label>
+       <?php echo elgg_view('input/longtext', array('internalname' => 'generic_comment')); ?>
+</p>
+<?php
+
+       echo elgg_view('input/hidden', array(
+               'internalname' => 'entity_guid',
+               'value' => $vars['entity']->getGUID()
+       ));
+       echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post")));
+}
index 5f4e51d5729fb27668b58a2b2cf5bdc19c3b6729..fcf0fba776eeb2d8c8620c18f9907d955ce9f307 100644 (file)
@@ -12,8 +12,9 @@
  * @uses $vars['body']        HTML content of the body block
  * @uses $vars['icon']        HTML content of the icon block
  * @uses $vars['class']       Optional additional class for media element
+ * @uses $vars['id']          Optional id for the media element
  * @uses $vars['body_class']  Optional additional class for body block
- * @uses $vars['icon_class']   Optional additional class for icon block
+ * @uses $vars['icon_class']  Optional additional class for icon block
  */
 
 $body = elgg_get_array_value('body', $vars, '');
@@ -25,6 +26,11 @@ if ($additional_class) {
        $class = "$class $additional_class";
 }
 
+$id = '';
+if (isset($vars['id'])) {
+       $id = "id=\"{$vars['id']}\"";
+}
+
 $body_class = 'elgg-body';
 $additional_class = elgg_get_array_value('body_class', $vars, '');
 if ($additional_class) {
@@ -42,7 +48,7 @@ if ($icon_block) {
 }
 
 echo <<<HTML
-<div class="$class clearfix">
+<div class="$class clearfix" $id>
        $icon_block$body
 </div>
 HTML;