"MDL-19839, use samller user picture, shorter date format, remove cancle button in block, change the position of deteling button"

This commit is contained in:
dongsheng
2009-07-28 07:09:11 +00:00
parent 6bcdbe4463
commit b26bc253a1
3 changed files with 35 additions and 11 deletions
+1 -1
View 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);
+17 -5
View 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);
+17 -5
View 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;