"MDL-19118, improve comments pagination"

This commit is contained in:
Dongsheng Cai 2010-03-18 09:57:32 +00:00
parent d0e36ce531
commit 3e34183a97
2 changed files with 9 additions and 7 deletions

View File

@ -265,7 +265,7 @@ M.core_comment = {
register_pagination: function() {
var scope = this;
// page buttons
Y.all('#comment-paging-'+this.client_id+' a').each(
Y.all('#comment-pagination-'+this.client_id+' a').each(
function(node, id) {
node.on('click', function(e, node) {
var id = node.get('id');

View File

@ -313,12 +313,14 @@ EOD;
// in comments block, we print comments list right away
if ($this->env == 'block_comments') {
$html .= $this->print_comments(0, true, false);
}
$html .= <<<EOD
$html .= '</ul>';
$html .= $this->get_pagination(0);
} else {
$html .= <<<EOD
</ul>
<div id="comment-pagination-{$this->cid}" class="comment-pagination"></div>
EOD;
}
// print posting textarea
if (!empty($this->postcap)) {
@ -369,7 +371,7 @@ EOD;
if (empty($this->viewcap)) {
return false;
}
$CFG->commentsperpage = 3;
$CFG->commentsperpage = 15;
if (!is_numeric($page)) {
$page = 0;
}
@ -435,7 +437,7 @@ EOD;
} else {
// return ajax paging bar
$str = '';
$str .= '<div class="comment-paging" id="comment-paging-'.$this->cid.'">';
$str .= '<div class="comment-paging" id="comment-pagination-'.$this->cid.'">';
for ($p=0; $p<$pages; $p++) {
$extra = '';
if ($p == $page) {
@ -551,8 +553,8 @@ EOD;
if ($nonjs) {
$html .= '</ul>';
$html .= $this->get_pagination($page);
}
$html .= $this->get_pagination($page);
$sesskey = sesskey();
$returnurl = qualified_me();
$strsubmit = get_string('submit');