themes lib MDL-24895 Multiple fixes to better handle overflow.

Major tasks undertaken in this patch:
* New format_text argument, overflowdiv.
* New page layout Report.
* Review of all format_text calls.
* Added support for the report layout to all themes.
* Changed forum post display from tables to divs.
This commit is contained in:
Sam Hemelryk 2010-11-05 02:53:47 +00:00
parent 2412f8b882
commit 367a75fae4
125 changed files with 3366 additions and 2062 deletions

View file

@ -23,7 +23,7 @@ require_once($CFG->libdir.'/adminlib.php');
require_once('locallib.php');
require_login();
admin_externalpage_setup('comments');
admin_externalpage_setup('comments', '', null, '', array('pagelayout'=>'report'));
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/comment:delete', $context);

View file

@ -413,6 +413,7 @@ EOD;
$comments = array();
$candelete = has_capability('moodle/comment:delete', $this->context);
$formatoptions = array('overflowdiv' => true);
$rs = $DB->get_recordset_sql($sql, $params, $start, $CFG->commentsperpage);
foreach ($rs as $u) {
$c = new stdClass();
@ -424,7 +425,7 @@ EOD;
$c->profileurl = $url->out();
$c->fullname = fullname($u);
$c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
$c->content = format_text($c->content, $c->format);
$c->content = format_text($c->content, $c->format, $formatoptions);
$c->avatar = $OUTPUT->user_picture($u, array('size'=>18));
if (($USER->id == $u->id) || !empty($candelete)) {
@ -513,7 +514,7 @@ EOD;
$newcmt->fullname = fullname($USER);
$url = new moodle_url('/user/view.php', array('id'=>$USER->id, 'course'=>$this->courseid));
$newcmt->profileurl = $url->out();
$newcmt->content = format_text($newcmt->content, $format);
$newcmt->content = format_text($newcmt->content, $format, array('overflowdiv'=>true));
$newcmt->avatar = $OUTPUT->user_picture($USER, array('size'=>16));
return $newcmt;
} else {

View file

@ -47,11 +47,12 @@ class comment_manager {
WHERE u.id=c.userid ORDER BY c.timecreated ASC";
$comments = array();
$formatoptions = array('overflowdiv' => true);
if ($records = $DB->get_records_sql($sql, array(), $start, $this->perpage)) {
foreach ($records as $item) {
$item->fullname = fullname($item);
$item->time = userdate($item->timecreated);
$item->content = format_text($item->content);
$item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
$comments[] = $item;
unset($item->firstname);
unset($item->lastname);