mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
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:
parent
2412f8b882
commit
367a75fae4
125 changed files with 3366 additions and 2062 deletions
|
@ -5526,8 +5526,10 @@ class admin_setting_manageportfolio extends admin_setting {
|
|||
* added to the turn blocks editing on/off form, so this page reloads correctly.
|
||||
* @param string $actualurl if the actual page being viewed is not the normal one for this
|
||||
* page (e.g. admin/roles/allowassin.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
|
||||
* @param array $options Additional options that can be specified for page setup.
|
||||
* pagelayout - This option can be used to set a specific pagelyaout, admin is default.
|
||||
*/
|
||||
function admin_externalpage_setup($section, $extrabutton = '', array $extraurlparams = null, $actualurl = '') {
|
||||
function admin_externalpage_setup($section, $extrabutton = '', array $extraurlparams = null, $actualurl = '', array $options = array()) {
|
||||
global $CFG, $PAGE, $USER, $SITE, $OUTPUT;
|
||||
|
||||
$PAGE->set_context(null); // hack - set context to something, by default to system context
|
||||
|
@ -5549,7 +5551,10 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
|
|||
die;
|
||||
}
|
||||
|
||||
if ($section === 'upgradesettings') {
|
||||
if (!empty($options['pagelayout'])) {
|
||||
// A specific page layout has been requested.
|
||||
$PAGE->set_pagelayout($options['pagelayout']);
|
||||
} else if ($section === 'upgradesettings') {
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
|
|
|
@ -838,6 +838,9 @@ class moodle_page {
|
|||
* in the standard theme.
|
||||
*/
|
||||
public function set_pagelayout($pagelayout) {
|
||||
if (!empty($this->_wherethemewasinitialised) && $pagelayout != $this->_pagelayout) {
|
||||
debugging('Page layout has already been set and cannot be changed.', DEBUG_DEVELOPER);
|
||||
}
|
||||
$this->_pagelayout = $pagelayout;
|
||||
}
|
||||
|
||||
|
@ -1203,11 +1206,6 @@ class moodle_page {
|
|||
public function initialise_theme_and_output() {
|
||||
global $OUTPUT, $PAGE, $SITE;
|
||||
|
||||
// If you have lost all blocks on a page and cannot work out why
|
||||
// try uncommenting this this debugging line and seeing what you get.
|
||||
// Chances are the theme and output are being initialised prematurely.
|
||||
// debugging('Initialising theme and output with layout '.$this->_pagelayout, DEBUG_DEVELOPER);
|
||||
|
||||
if (!empty($this->_wherethemewasinitialised)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1187,7 +1187,7 @@ class flexible_table {
|
|||
$this->wrap_html_start();
|
||||
// Start of main data table
|
||||
|
||||
echo html_writer::start_tag('div', array('class'=>'flexible-wrap'));
|
||||
echo html_writer::start_tag('div', array('class'=>'no-overflow'));
|
||||
echo '<table'.$this->make_attributes_string($this->attributes).'>';
|
||||
|
||||
}
|
||||
|
|
|
@ -940,6 +940,19 @@ function format_text_menu() {
|
|||
* This function should mainly be used for long strings like posts,
|
||||
* answers, glossary items etc. For short strings @see format_string().
|
||||
*
|
||||
* <pre>
|
||||
* Options:
|
||||
* trusted : If true the string won't be cleaned. Default false required noclean=true.
|
||||
* noclean : If true the string won't be cleaned. Default false required trusted=true.
|
||||
* nocache : If true the strign will not be cached and will be formatted every call. Default false.
|
||||
* filter : If true the string will be run through applicable filters as well. Default true.
|
||||
* para : If true then the returned string will be wrapped in div tags. Default true.
|
||||
* newlines : If true then lines newline breaks will be converted to HTML newline breaks. Default true.
|
||||
* context : The context that will be used for filtering.
|
||||
* overflowdiv : If set to true the formatted text will be encased in a div
|
||||
* with the class no-overflow before being returned. Default false.
|
||||
* </pre>
|
||||
*
|
||||
* @todo Finish documenting this function
|
||||
*
|
||||
* @staticvar array $croncache
|
||||
|
@ -983,6 +996,9 @@ function format_text($text, $format = FORMAT_MOODLE, $options = NULL, $courseid_
|
|||
if (!isset($options['newlines'])) {
|
||||
$options['newlines'] = true;
|
||||
}
|
||||
if (!isset($options['overflowdiv'])) {
|
||||
$options['overflowdiv'] = false;
|
||||
}
|
||||
|
||||
// Calculate best context
|
||||
if (empty($CFG->version) or $CFG->version < 2010072800 or during_initial_install()) {
|
||||
|
@ -1092,6 +1108,10 @@ function format_text($text, $format = FORMAT_MOODLE, $options = NULL, $courseid_
|
|||
'relies on it. Please seek out and destroy that filter code.', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
if (!empty($options['overflowdiv'])) {
|
||||
$text = html_writer::tag('div', $text, array('class'=>'no-overflow'));
|
||||
}
|
||||
|
||||
if (empty($options['nocache']) and !empty($CFG->cachetext)) {
|
||||
if (CLI_SCRIPT) {
|
||||
// special static cron cache - no need to store it in db if its not already there
|
||||
|
@ -1367,7 +1387,7 @@ function format_module_intro($module, $activity, $cmid, $filter=true) {
|
|||
global $CFG;
|
||||
require_once("$CFG->libdir/filelib.php");
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cmid);
|
||||
$options = (object)array('noclean'=>true, 'para'=>false, 'filter'=>$filter, 'context'=>$context);
|
||||
$options = array('noclean'=>true, 'para'=>false, 'filter'=>$filter, 'context'=>$context, 'overflowdiv'=>true);
|
||||
$intro = file_rewrite_pluginfile_urls($activity->intro, 'pluginfile.php', $context->id, 'mod_'.$module, 'intro', null);
|
||||
return trim(format_text($intro, $activity->introformat, $options, null));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue