Skip to content

Commit

Permalink
"MDL-19118, improve comments pagination"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Mar 18, 2010
1 parent d0e36ce commit 3e34183
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion comment/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 8 additions & 6 deletions comment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,14 @@ public function output($return = true) {
// 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)) {
Expand Down Expand Up @@ -369,7 +371,7 @@ public function get_comments($page = '') {
if (empty($this->viewcap)) {
return false;
}
$CFG->commentsperpage = 3;
$CFG->commentsperpage = 15;
if (!is_numeric($page)) {
$page = 0;
}
Expand Down Expand Up @@ -435,7 +437,7 @@ public function get_pagination($page = 0) {
} 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) {
Expand Down Expand Up @@ -551,8 +553,8 @@ public function print_comments($page = 0, $return = true, $nonjs = true) {

if ($nonjs) {
$html .= '</ul>';
$html .= $this->get_pagination($page);
}
$html .= $this->get_pagination($page);
$sesskey = sesskey();
$returnurl = qualified_me();
$strsubmit = get_string('submit');
Expand Down

0 comments on commit 3e34183

Please sign in to comment.