mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-30 08:39:58 +09:00
ccl 에디터 컴포넌트 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3476 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
566a3ff8b5
commit
50d0073ba1
7 changed files with 255 additions and 0 deletions
100
modules/editor/components/cc_license/cc_license.class.php
Executable file
100
modules/editor/components/cc_license/cc_license.class.php
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
/**
|
||||
* @class cc_license
|
||||
* @author zero <zero@zeroboard.com>
|
||||
* @brief CCL 출력 에디터 컴포넌트
|
||||
**/
|
||||
|
||||
class cc_license extends EditorHandler {
|
||||
|
||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
||||
**/
|
||||
function cc_license($editor_sequence, $component_path) {
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
|
||||
**/
|
||||
function getPopupContent() {
|
||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
||||
Context::set("tpl_path", $tpl_path);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
|
||||
*
|
||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
// 지정된 옵션을 구함
|
||||
$ccl_title = $xml_obj->attrs->ccl_title;
|
||||
$ccl_use_mark = $xml_obj->attrs->ccl_use_mark;
|
||||
$ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial;
|
||||
$ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification;
|
||||
|
||||
// 가로/ 세로 크기를 구함
|
||||
preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i',$xml_obj->attrs->style,$matches);
|
||||
$width = trim($matches[3][0]);
|
||||
if(!$width) $width = "90%";
|
||||
$height = trim($matches[3][1]);
|
||||
if(!$height) $height = "50";
|
||||
|
||||
// 언어파일을 읽음
|
||||
Context::loadLang($this->component_path.'/lang');
|
||||
$default_title = Context::getLang('ccl_default_title');
|
||||
if(!$ccl_title) $ccl_title = $default_title;
|
||||
|
||||
$default_message = Context::getLang('ccl_default_message');
|
||||
|
||||
$option = Context::getLang('ccl_options');
|
||||
|
||||
// 영리 이용 체크
|
||||
if($ccl_allow_commercial == 'N') $opt1 = '-nc';
|
||||
else $opt1 = '';
|
||||
|
||||
// 수정 표시 체크
|
||||
if($ccl_allow_modification == 'N') $opt2 = '-nd';
|
||||
elseif($ccl_allow_modification == 'SA') $opt2 = '-sa';
|
||||
else $opt2 = '';
|
||||
|
||||
// 버전
|
||||
$version = '/3.0';
|
||||
|
||||
// 언어에 따른 설정
|
||||
$lang_type = Context::getLangType();
|
||||
if($lang_type != 'en') $lang_file = 'deed.'.strtolower($lang_file);
|
||||
|
||||
// 마크 이용시
|
||||
$ccl_image = '';
|
||||
if($ccl_use_mark == "Y") {
|
||||
$ccl_image = sprintf('
|
||||
<a href="license" href="http://creativecommons.org/licenses/by%s%s%s%s" onclick="window.open(this.href); return false;"><img src="http://i.creativecommons.org/l/by%s%s%s/88x31.png" alt="Creative Commons License" style="margin-bottom:5px;border:0;" /></a><br />',
|
||||
$opt1, $opt2, $version, $lang_file,
|
||||
$opt1, $opt2, $version, $lang_file
|
||||
);
|
||||
}
|
||||
|
||||
// 결과물 생성
|
||||
$text = $ccl_image . sprintf($default_message, $opt1, $opt2, $opt3, $opt4, $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version);
|
||||
|
||||
$style = sprintf('<style type="text/css">.cc_license { clear:both; margin:20px auto 20px auto; padding:8px; width:%s;border:1px solid #c0c0c0; color:#808080; text-align:center; } .cc_license legend { font-weight:bold; } .cc_license a { color:#404040; text-decoration:none; } .cc_license a:hover { text-decoration:underline; </style>', $width);
|
||||
$output = sprintf('%s<fieldset class="cc_license"><legend>%s</legend>%s</fieldset>', $style, $ccl_title, $text);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
modules/editor/components/cc_license/ccl_logo.gif
Normal file
BIN
modules/editor/components/cc_license/ccl_logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
modules/editor/components/cc_license/icon.gif
Normal file
BIN
modules/editor/components/cc_license/icon.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
8
modules/editor/components/cc_license/info.xml
Executable file
8
modules/editor/components/cc_license/info.xml
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component version="0.1">
|
||||
<title xml:lang="ko">Creative Commons Licenses</title>
|
||||
<author email_address="zero@zeroboard.com" link="http://zeroboard.com" date="2008. 1. 7">
|
||||
<name xml:lang="ko">zero</name>
|
||||
<description xml:lang="ko">CCL 라이센스를 출력합니다.</description>
|
||||
</author>
|
||||
</component>
|
||||
29
modules/editor/components/cc_license/lang/ko.lang.php
Normal file
29
modules/editor/components/cc_license/lang/ko.lang.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/cc_license/lang/ko.lang.php
|
||||
* @author zero <zero@zeroboard.com>
|
||||
* @brief 위지윅에디터(editor) 모듈 > CCL 출력 에디터 컴포넌트
|
||||
**/
|
||||
|
||||
$lang->ccl_default_title = '크리에이티브 커먼즈 코리아 저작자표시';
|
||||
$lang->ccl_default_message = '이 저작물은 <a rel="license" href="http://creativecommons.org/licenses/by%s%s%s%s" onclick="winopen(this.href);return false;">%s%s%s%s</a>에 따라 이용하실 수 있습니다';
|
||||
|
||||
$lang->ccl_title = '제목';
|
||||
$lang->ccl_use_mark = '마크 사용';
|
||||
$lang->ccl_allow_commercial = '영리목적 허용';
|
||||
$lang->ccl_allow_modification = '저작물 변경 허용';
|
||||
|
||||
$lang->ccl_allow = '허용';
|
||||
$lang->ccl_disallow = '금지';
|
||||
$lang->ccl_sa = '동일 조건 변경';
|
||||
|
||||
$lang->ccl_options = array(
|
||||
'ccl_allow_commercial' => array('Y'=>'-영리', 'N'=>'-비영리'),
|
||||
'ccl_allow_modification' => array('Y'=>'-변경금지', 'N'=>'-변경금지', 'SA'=>'-동일조건변경허락'),
|
||||
);
|
||||
|
||||
$lang->about_ccl_title = '제목을 표시합니다. 비워져 있으면 기본 메세지가 출력됩니다.';
|
||||
$lang->about_ccl_use_mark = '마크의 출력 여부를 선택할 수 있습니다. (기본: 출력)';
|
||||
$lang->about_ccl_allow_commercial = '영리목적 이용을 허가 여부를 선택할 수 있습니다 (기본: 허용안함)';
|
||||
$lang->about_ccl_allow_modification = '저작물의 변경 여부를 허용할 수 있습니다. (기본: 동일 조건 변경)';
|
||||
?>
|
||||
50
modules/editor/components/cc_license/tpl/popup.html
Executable file
50
modules/editor/components/cc_license/tpl/popup.html
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
<!--%import("popup.js")-->
|
||||
<!--%import("../lang")-->
|
||||
|
||||
<div id="popHeadder">
|
||||
<h3>{$component_info->title} ver. {$component_info->version}</h3>
|
||||
</div>
|
||||
|
||||
<form action="./" method="get" onSubmit="return false" id="fo">
|
||||
<div id="popBody">
|
||||
<table cellspacing="0" class="adminTable">
|
||||
<col width="120" />
|
||||
<col />
|
||||
<tr>
|
||||
<th scope="row">{$lang->ccl_title}</th>
|
||||
<td>
|
||||
<input type="text" name="ccl_title" class="inputTypeText w400" />
|
||||
<p>{$lang->about_ccl_title}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{$lang->ccl_use_mark}</th>
|
||||
<td>
|
||||
<select name="ccl_use_mark"><option value="Y" selected="selected">{$lang->use}</option><option value="N">{$lang->notuse}</option></select>
|
||||
<p>{$lang->about_ccl_use_mark}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{$lang->ccl_allow_commercial}</th>
|
||||
<td>
|
||||
<select name="ccl_allow_commercial"><option value="Y">{$lang->ccl_allow}</option><option value="N" selected="selected">{$lang->ccl_disallow}</option></select>
|
||||
<p>{$lang->about_ccl_allow_commercial}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{$lang->ccl_allow_modification}</th>
|
||||
<td>
|
||||
<select name="ccl_allow_modification"><option value="Y">{$lang->ccl_allow}</option><option value="N">{$lang->ccl_disallow}</option><option value="SA" selected="selected">{$lang->ccl_sa}</option></select>
|
||||
<p>{$lang->about_ccl_allow_modification}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="popFooter" class="tCenter">
|
||||
<a href="#" onclick="insertCode()" class="button"><span>{$lang->cmd_insert}</span></a>
|
||||
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
|
||||
<a href="#" onclick="winopen('./?module=editor&act=dispEditorComponentInfo&component_name={$component_info->component_name}','ComponentInfo','left=10,top=10,width=10,height=10,resizable=no,scrollbars=no,toolbars=no');return false;" class="button"><span>{$lang->about_component}</span></a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
68
modules/editor/components/cc_license/tpl/popup.js
Executable file
68
modules/editor/components/cc_license/tpl/popup.js
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 멀티미디어 컴포넌트 코드를 체크하여
|
||||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
var selected_node = null;
|
||||
function getCode() {
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
|
||||
if(typeof(opener)=='undefined') return;
|
||||
|
||||
// 부모창의 선택된 객체가 img가 아니면 pass~
|
||||
var node = opener.editorPrevNode;
|
||||
if(!node || node.nodeName != 'IMG') return;
|
||||
|
||||
selected_node = node;
|
||||
|
||||
// 이미 정의되어 있는 변수에서 데이터를 구함
|
||||
var ccl_title = node.getAttribute('ccl_title');
|
||||
var ccl_use_mark = node.getAttribute('ccl_use_mark');
|
||||
var ccl_allow_commercial = node.getAttribute('ccl_allow_commercial');
|
||||
var ccl_allow_modification = node.getAttribute('ccl_allow_modification');
|
||||
|
||||
// form문에 적용
|
||||
var fo_obj = xGetElementById('fo');
|
||||
fo_obj.ccl_title.value = ccl_title;
|
||||
|
||||
if(ccl_use_mark == 'Y') fo_obj.ccl_use_mark.selectedIndex = 0;
|
||||
else fo_obj.ccl_use_mark.selectedIndex = 1;
|
||||
|
||||
if(ccl_allow_commercial == 'Y') fo_obj.ccl_allow_commercial.selectedIndex = 0;
|
||||
else fo_obj.ccl_allow_commercial.selectedIndex = 1;
|
||||
|
||||
if(ccl_allow_modification == 'Y') fo_obj.ccl_allow_modification.selectedIndex = 0;
|
||||
else if(ccl_allow_modification== 'N') fo_obj.ccl_allow_modification.selectedIndex = 1;
|
||||
else fo_obj.ccl_allow_modification.selectedIndex = 2;
|
||||
}
|
||||
|
||||
/* 추가 버튼 클릭시 부모창의 위지윅 에디터에 인용구 추가 */
|
||||
function insertCode() {
|
||||
if(typeof(opener)=='undefined') return;
|
||||
|
||||
var fo_obj = xGetElementById('fo');
|
||||
|
||||
var ccl_title = escape(fo_obj.ccl_title.value);
|
||||
var ccl_use_mark = fo_obj.ccl_use_mark.options[fo_obj.ccl_use_mark.selectedIndex].value;
|
||||
var ccl_allow_commercial = fo_obj.ccl_allow_commercial.options[fo_obj.ccl_allow_commercial.selectedIndex].value;
|
||||
var ccl_allow_modification = fo_obj.ccl_allow_modification.options[fo_obj.ccl_allow_modification.selectedIndex].value;
|
||||
|
||||
var content = '';
|
||||
|
||||
var style = "width:90%; margin:20px auto 20px auto; height:50px; border:1px solid #c0c0c0; background: transparent url('./modules/editor/components/cc_license/ccl_logo.gif') no-repeat center center;";
|
||||
|
||||
var text = '<br /><img editor_component="cc_license" ccl_title="'+ccl_title+'" ccl_use_mark="'+ccl_use_mark+'" ccl_allow_commercial="'+ccl_allow_commercial+'" ccl_allow_modification="'+ccl_allow_modification+'" style="'+style+'" src="./common/tpl/images/blank.gif" alt="ccl" /><br />';
|
||||
|
||||
if(selected_node) {
|
||||
selected_node.setAttribute('ccl_title', ccl_title);
|
||||
selected_node.setAttribute('ccl_use_mark', ccl_use_mark);
|
||||
selected_node.setAttribute('ccl_allow_commercial', ccl_allow_commercial);
|
||||
selected_node.setAttribute('ccl_allow_modification', ccl_allow_modification);
|
||||
} else {
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
|
||||
opener.editorReplaceHTML(iframe_obj, text);
|
||||
}
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
window.close();
|
||||
}
|
||||
|
||||
xAddEventListener(window, 'load', getCode);
|
||||
Loading…
Add table
Add a link
Reference in a new issue