From b26bc253a11316bf2c7216d2b8731d9dddb430a0 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 28 Jul 2009 07:09:11 +0000 Subject: [PATCH] "MDL-19839, use samller user picture, shorter date format, remove cancle button in block, change the position of deteling button" --- comment/comment.js | 2 +- lib/commentlib.php | 22 +++++++++++++++++----- theme/standard/styles_layout.css | 22 +++++++++++++++++----- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/comment/comment.js b/comment/comment.js index f3e2a96344..f27d524763 100644 --- a/comment/comment.js +++ b/comment/comment.js @@ -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 += ' '; + list[i].content = '
' + list[i].content; } val = val.replace('___time___', list[i].time); val = val.replace('___picture___', list[i].avatar); diff --git a/lib/commentlib.php b/lib/commentlib.php index a56dd3f55c..fb49a9f5fa 100644 --- a/lib/commentlib.php +++ b/lib/commentlib.php @@ -324,8 +324,15 @@ EOD;
{$strsubmit} +EOD; + if ($this->env != 'block_comments') { + $html .= << | {$strcancel} +EOD; + } + + $html .= <<
@@ -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.'&course='.$this->course->id; $c->username = ''.fullname($c).''; - $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); diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index efd4c00b80..8e541ad940 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -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; -- 2.39.5