1. JS/CSS 파일 제거 문법 추가

: Context.class.php에 unloadCSSFile, unloadJsFile 추가 (파일명과 옵션이 일치해야 제거됨)
: templateHandler에 <!--%unload(..)--> 추가
2. optmized된 JS/CSS 통합 파일을 제일 먼저 불러오도록 순서 변경


git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4580 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-10-01 07:25:31 +00:00
parent 2f44b9c980
commit 81ac933a7a
3 changed files with 97 additions and 4 deletions

View file

@ -152,7 +152,7 @@
$this->addJsFile("./common/js/xml_handler.js");
$this->addJsFile("./common/js/xml_js_filter.js");
$this->addCSSFile("./common/css/default.css");
$this->addCSSFile("./common/css/button.css");
$this->addCSSFile("./common/css/button.css",false);
// 관리자 페이지일 경우 관리자 공용 CSS 추가
if(Context::get('module')=='admin' || strpos(Context::get('act'),'Admin')>0) $this->addCssFile("./modules/admin/tpl/css/admin.css", false);
@ -849,10 +849,29 @@
**/
function _addJsFile($file, $optimized, $targetie) {
if(in_array($file, $this->js_files)) return;
//if(!preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
$this->js_files[] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
}
/**
* @brief js file을 제거
**/
function unloadJsFile($file, $optimized = true, $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_unloadJsFile($file, $optimized, $targetie);
}
/**
* @brief js file을 제거
**/
function _unloadJsFile($file, $optimized, $targetie) {
foreach($this->js_files as $key => $val) {
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['targetie'] == $targetie) {
unset($this->js_files[$key]);
return;
}
}
}
/**
* @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함
**/
@ -903,6 +922,26 @@
$this->css_files[] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
}
/**
* @brief css file을 제거
**/
function unloadCSSFile($file, $optimized = true, $media = 'all', $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_unloadCSSFile($file, $optimized, $media, $targetie);
}
/**
* @brief css file을 제거
**/
function _unloadCSSFile($file, $optimized, $media, $targetie) {
foreach($this->css_files as $key => $val) {
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['media'] == $media && $val['targetie'] == $targetie) {
unset($this->css_files[$key]);
return;
}
}
}
/**
* @brief CSS file 목록 return
**/