기본 이모티콘을 select로 선택가능하게 하고 3개의 이모티콘 팩 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3043 201d5d3c-b55e-5fd7-737f-ddc643e51545
|
|
@ -10,6 +10,7 @@
|
|||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
var $emoticon_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
||||
|
|
@ -17,31 +18,34 @@
|
|||
function emoticon($editor_sequence, $component_path) {
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
$this->emoticon_path = sprintf('%s%s/images',eregi_replace('^\.\/','',$this->component_path),'tpl','images');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 이모티콘 파일 목록을 리턴
|
||||
**/
|
||||
function getEmoticonList() {
|
||||
$emoticon = Context::get('emoticon');
|
||||
if(!$emoticon || !eregi("^([a-z0-9\_]+)$",$emoticon)) return new Object(-1,'msg_invalid_request');
|
||||
|
||||
$list = $this->getEmoticons($emoticon);
|
||||
|
||||
$this->add('emoticons', implode("\n",$list));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 재귀적으로 이모티콘이 될 법한 파일들을 하위 디렉토리까지 전부 검색한다. 8,000개까지는 테스트 해봤는데 스택오버프로우를 일으킬지 어떨지는 잘 모르겠음.(2007.9.6, 베니)
|
||||
**/
|
||||
function getEmoticons($path, $source_path) {
|
||||
$path = ereg_replace('\/$','',$path);
|
||||
function getEmoticons($path) {
|
||||
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path);
|
||||
$output = array();
|
||||
|
||||
$oDir = dir($path);
|
||||
$oDir = dir($emoticon_path);
|
||||
while($file = $oDir->read()) {
|
||||
if(in_array($file, array('.','..'))) continue;
|
||||
|
||||
$new_path = $path.'/'.$file;
|
||||
|
||||
if(is_dir($new_path)) {
|
||||
$sub_output = $this->getEmoticons($new_path, $source_path);
|
||||
if(is_array($sub_output) && count($sub_output)) $output = array_merge($output, $sub_output);
|
||||
if(substr($file,0,1)=='.') continue;
|
||||
if(eregi('\.(jpg|jpeg|gif|png)$',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file));
|
||||
}
|
||||
|
||||
if(eregi('(jpg|jpeg|gif|png)$',$new_path)) $output[] = str_replace($source_path.'/', '', $new_path);
|
||||
}
|
||||
|
||||
$oDir->close();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -49,18 +53,18 @@
|
|||
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
|
||||
**/
|
||||
function getPopupContent() {
|
||||
// 이모티콘 디렉토리 목록을 가져옴
|
||||
$emoticon_list = FileHandler::readDir($this->emoticon_path);
|
||||
Context::set('emoticon_list', $emoticon_list);
|
||||
|
||||
// 첫번째 이모티콘 디렉토리의 이미지 파일을 구함
|
||||
$emoticons = $this->getEmoticons($emoticon_list[0]);
|
||||
Context::set('emoticons', $emoticons);
|
||||
|
||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
||||
Context::set("tpl_path", $tpl_path);
|
||||
|
||||
// 이모티콘을 모두 가져옴
|
||||
|
||||
$emoticon_path = sprintf('%s%s/images',eregi_replace('^\.\/','',$this->component_path),'tpl','images');
|
||||
$emoticon_list = $this->getEmoticons($emoticon_path, $emoticon_path);
|
||||
Context::set('emoticon_list', $emoticon_list);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 9 KiB |
|
After Width: | Height: | Size: 6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 9 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 7 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 4 KiB |
|
After Width: | Height: | Size: 15 KiB |