mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
1. jQuery뿐 아니라 여러 javascript 의 플러그인 사용을 위해 template handler에 <!--%load_js_plugin("이름")--> 기능 추가 ( ./common/js/plugins/이름/plugin.load 파일에 기재된 js/css, 또는 lang을 import 함)
2. 1번에 의해 ui.datepicker, ui.tree를 플러그인으로 빼서 적용 3. jquery의 버전별 이름이 생길 문제를 대비하여 jquery.js로 파일 이름 변경 4. js/css파일들은 크기보다 그 개수가 적어야 함으로 jquery-1.2.6.fix.js를 common.js 파일로 통합 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5083 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d2d9b2c3a2
commit
5d549bffd7
57 changed files with 149 additions and 366 deletions
|
|
@ -135,8 +135,7 @@
|
|||
else $this->allow_rewrite = false;
|
||||
|
||||
// 기본 JS/CSS 등록
|
||||
$this->addJsFile("./common/js/jquery-1.2.6.js");
|
||||
$this->addJsFile("./common/js/jquery-1.2.6.fix.js"); // jQuery 1.2.6 bug fix
|
||||
$this->addJsFile("./common/js/jquery.js");
|
||||
$this->addJsFile("./common/js/x.js");
|
||||
$this->addJsFile("./common/js/common.js");
|
||||
$this->addJsFile("./common/js/xml_handler.js");
|
||||
|
|
@ -1054,6 +1053,33 @@
|
|||
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->css_files), "css");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief javascript plugin load
|
||||
**/
|
||||
function loadJavascriptPlugin($plugin_name) {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_loadJavascriptPlugin($plugin_name);
|
||||
}
|
||||
|
||||
function _loadJavascriptPlugin($plugin_name) {
|
||||
$plugin_path = './common/js/plugins/'.$plugin_name.'/';
|
||||
if(!is_dir($plugin_path)) return;
|
||||
|
||||
$info_file = $plugin_path.'plugin.load';
|
||||
if(!file_exists($info_file)) return;
|
||||
|
||||
$list = file($info_file);
|
||||
for($i=0,$cnt=count($list);$i<$cnt;$i++) {
|
||||
$filename = trim($list[$i]);
|
||||
if(!$filename) continue;
|
||||
if(substr($filename,0,2)=='./') $filename = substr($filename,2);
|
||||
if(preg_match('/\.js$/i',$filename)) $this->_addJsFile($plugin_path.$filename, false, '');
|
||||
elseif(preg_match('/\.css$/i',$filename)) $this->_addCSSFile($plugin_path.$filename, false, 'all','');
|
||||
}
|
||||
|
||||
if(is_dir($plugin_path.'lang')) $this->_loadLang($plugin_path.'lang');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HtmlHeader 추가
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@
|
|||
// unload css/ js <!--%unload("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media는 css에만 적용)
|
||||
$buff = preg_replace_callback('!<\!--%unload\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileUnloadCode'), $buff);
|
||||
|
||||
// javascript plugin import
|
||||
$buff = preg_replace_callback('!<\!--%load_js_plugin\(\"([^\"]*?)\"\)-->!is', array($this, '_compileLoadJavascriptPlugin'), $buff);
|
||||
|
||||
|
||||
// 파일에 쓰기 전에 직접 호출되는 것을 방지
|
||||
$buff = sprintf('%s%s%s','<?php if(!defined("__ZBXE__")) exit();?>',"\n",$buff);
|
||||
|
||||
|
|
@ -357,6 +361,16 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief javascript 플러그인 import
|
||||
* javascript 플러그인의 경우 optimized = false로 동작하도록 고정시킴
|
||||
**/
|
||||
function _compileLoadJavascriptPlugin($matches) {
|
||||
$base_path = $this->tpl_path;
|
||||
$plugin = trim($matches[1]);
|
||||
return sprintf('<?php Context::loadJavascriptPlugin("%s"); ?>', $plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <!--%filename-->의 확장자를 봐서 css/ js 파일을 제거하도록 수정
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue