From: Dongsheng Cai Date: Thu, 17 Dec 2009 04:54:13 +0000 (+0000) Subject: "MDL-21141, fixed yui connection file and let requires->css ignore existing css files" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=70f83b5803a7dddc3cfe2bafba02bf63cdd695f5;p=moodle.git "MDL-21141, fixed yui connection file and let requires->css ignore existing css files" --- diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index 6789fe9a73..312d5e88bd 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -186,18 +186,20 @@ class page_requirements_manager { public function css($stylesheet, $fullurl = false) { global $CFG; - if ($this->headdone) { - throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet); - } - if (!$fullurl) { - if (!file_exists($CFG->dirroot . '/' . strtok($stylesheet, '?'))) { - throw new coding_exception('Attempt to require a CSS file that does not exist.', $stylesheet); - } - $url = $CFG->httpswwwroot . '/' . $stylesheet; + if (isset($this->linkedrequirements[$url])) { + return; } else { - $url = $stylesheet; - } - if (!isset($this->linkedrequirements[$url])) { + if ($this->headdone) { + throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet); + } + if (!$fullurl) { + if (!file_exists($CFG->dirroot . '/' . strtok($stylesheet, '?'))) { + throw new coding_exception('Attempt to require a CSS file that does not exist.', $stylesheet); + } + $url = $CFG->httpswwwroot . '/' . $stylesheet; + } else { + $url = $stylesheet; + } $this->linkedrequirements[$url] = new required_css($this, $url); } } @@ -1239,8 +1241,10 @@ function ajax_resolve_yui2_lib($libname) { $jsurls[] = $libpath . '/'. $js . '/' . $js . '.js'; } } else if ($js == 'connection') { + // connection.js provides full features of HTTP transaction $jsurls[] = $libpath . '/' . $js . '/' . $js . $suffix; - $jsurls[] = $libpath . '/' . $js . '/' . $js . '_core' . $suffix; + // connnection_core.js prvides base HTTP transaction support + //$jsurls[] = $libpath . '/' . $js . '/' . $js . '_core' . $suffix; } else { $jsurls[] = $libpath . '/' . $js . '/' . $js . $suffix; }