]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-19839, use samller user picture, shorter date format, remove cancle button in...
authordongsheng <dongsheng>
Tue, 28 Jul 2009 07:09:11 +0000 (07:09 +0000)
committerdongsheng <dongsheng>
Tue, 28 Jul 2009 07:09:11 +0000 (07:09 +0000)
comment/comment.js
lib/commentlib.php
theme/standard/styles_layout.css

index f3e2a9634418c83d2f635e652121b43eb80588bd..f27d524763ba275991fefb36c67821adcb9a9d03 100644 (file)
@@ -12,7 +12,7 @@ function cmt_replace(client_id,list,newcmt) {
         var val = template.innerHTML;
         val = val.replace('___name___', list[i].username);
         if (list[i]['delete']||newcmt) {
-            list[i].time += ' <a href="###" title="'+mstr.moodle.delete+'" onclick="delete_comment(\''+client_id+'\',\''+list[i].id+'\')"><img src="'+moodle_cfg.wwwroot+'/pix/t/delete.gif" /></a>';
+            list[i].content = '<div class="comment-delete"><a href="###" title="'+mstr.moodle.delete+'" onclick="delete_comment(\''+client_id+'\',\''+list[i].id+'\')"><img src="'+moodle_cfg.wwwroot+'/pix/t/delete.gif" /></a></div>' + list[i].content;
         }
         val = val.replace('___time___', list[i].time);
         val = val.replace('___picture___', list[i].avatar);
index a56dd3f55c42b51cb043b8c8b0d588270787c647..fb49a9f5fa19174b2cff386281cc69e463d3df53 100644 (file)
@@ -324,8 +324,15 @@ EOD;
     </div>
     <div class="fd" id="comment-action-{$this->cid}">
         <a href="###" onclick="post_comment('{$this->cid}')"> {$strsubmit} </a>
+EOD;
+        if ($this->env != 'block_comments') {
+            $html .= <<<EOD
         <span> | </span>
         <a href="###" onclick="view_comments('{$this->cid}')"> {$strcancel} </a>
+EOD;
+        }
+
+        $html .= <<<EOD
     </div>
 </div>
 <div style="clear:both"></div>
@@ -352,7 +359,7 @@ EOD;
      * @return mixed
      */
     public function get_comments($page = '') {
-        global $DB, $CFG, $USER;
+        global $DB, $CFG, $USER, $OUTPUT;
         if (empty($this->viewcap)) {
             return false;
         }
@@ -377,7 +384,7 @@ EOD;
             foreach ($records as &$c) {
                 $url = $CFG->httpswwwroot.'/user/view.php?id='.$c->userid.'&amp;course='.$this->course->id;
                 $c->username = '<a href="'.$url.'">'.fullname($c).'</a>';
-                $c->time = userdate($c->timecreated);
+                $c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
                 $user = new stdclass;
                 $user->id = $c->userid;
                 $user->picture = $c->picture;
@@ -385,7 +392,12 @@ EOD;
                 $user->lastname  = $c->lastname;
                 $user->imagealt  = $c->imagealt;
                 $c->content = format_text($c->content, $c->format);
-                $c->avatar = print_user_picture($user, $this->course->id, NULL, NULL, true);
+                $userpic = new user_picture();
+                $userpic->user = $user;
+                $userpic->courseid = $this->course->id;
+                $userpic->link = true;
+                $userpic->alttext = true;
+                $c->avatar = $OUTPUT->user_picture($userpic);
                 if (($USER->id == $c->userid) || !empty($candelete)) {
                     $c->delete = true;
                 }
@@ -459,7 +471,7 @@ EOD;
         $cmt_id = $DB->insert_record('comments', $newcmt);
         if (!empty($cmt_id)) {
             $newcmt->id = $cmt_id;
-            $newcmt->time = userdate($now);
+            $newcmt->time = userdate($now, get_string('strftimerecent', 'langconfig'));
             $newcmt->username = fullname($USER);
             $newcmt->content = format_text($newcmt->content);
             $newcmt->avatar = print_user_picture($USER, $this->course->id, NULL, 16, true);
@@ -545,7 +557,7 @@ EOD;
         $replacements[] = $cmt->avatar;
         $replacements[] = fullname($cmt);
         $replacements[] = $cmt->content;
-        $replacements[] = userdate($cmt->timecreated);
+        $replacements[] = userdate($cmt->timecreated, get_string('strftimerecent', 'langconfig'));
 
         // use html template to format a single comment.
         return str_replace($patterns, $replacements, $this->template);
index efd4c00b80b6dd6ec3b0da1a19b37c3ef12cc4d3..8e541ad9407daa0bec2e5b609b9cb8a3b35087a9 100644 (file)
@@ -5568,15 +5568,27 @@ wikiadminactions {
     padding: 2px;
 }
 .comment-userpicture {
-    width: 45px;
+    width: 20px;
     float:left;
 }
-.comment-userpicture img.userpicture{
-    width: 35px;
-    height: 35px;
+.comment-userpicture img.image{
+    width: 18px;
+    height: 18px;
 }
 .comment-content{
-    margin-left: 50px;
+    margin-left: 22px;
+}
+.comment-content div{
+    margin:0;
+    padding:0;
+}
+.comment-content p{
+    padding:0;
+    margin:0 18px 0 0;
+}
+.comment-delete{
+    float:right;
+    text-align:right;
 }
 .comment-container {
     float:left;