MDL-21124 towards full JS support in themes

This commit is contained in:
Petr Skoda 2009-12-20 23:06:57 +00:00
parent 38aafea249
commit e68c5f36cf
3 changed files with 108 additions and 17 deletions

View file

@ -381,7 +381,7 @@ class theme_config {
$baseconfig = $config;
}
$configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts',
$configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts',
'parents_exclude_javascripts', 'layouts', 'resource_mp3player_colors',
'filter_mediaplugin_colors', 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow');
@ -607,20 +607,6 @@ class theme_config {
}
}
/**
* Get the javascript URL of this theme
* @param bool $encoded false means use & and true use & in URLs
* @return moodle_url
*/
public function javascript_url() {
global $CFG;
$rev = theme_get_revision();
$params = array('theme'=>$this->name,'rev'=>$rev);
return new moodle_url($CFG->httpswwwroot.'/theme/javascripts.php', $params);
}
/**
* Returns the content of the one huge CSS merged from all style sheets.
* @return string
@ -741,6 +727,30 @@ class theme_config {
return $css;
}
/**
* Get the javascript URL of this theme
* @param bool $encoded false means use & and true use & in URLs
* @return moodle_url
*/
public function javascript_url() {
global $CFG;
$rev = theme_get_revision();
$params = array('theme'=>$this->name,'rev'=>$rev);
return new moodle_url($CFG->httpswwwroot.'/theme/javascripts.php', $params);
}
/**
* Returns the content of the one huge javascript file merged from all theme javascript files.
* @return string
*/
public function javascript_content() {
//TODO: load contents of all theme JS files
return '/*not yet fully implemented*/';
}
protected function post_process($css) {
// now resolve all image locations
if (preg_match_all('/\[\[pix:([a-z_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {

View file

@ -367,7 +367,7 @@ class core_renderer extends renderer_base {
// Get the theme javascript
$jsurl = $this->page->theme->javascript_url();
$this->page->requires->js($jsurl->out_raw(), true)->in_head();
$this->page->requires->js($jsurl->out(), true)->in_head();
// Perform a browser environment check for the flash version. Should only run once per login session.
if (isloggedin() && !empty($CFG->excludeoldflashclients) && empty($SESSION->flashversion)) {