From 50d0073ba1eeacb03f1e72ba7021c4fe92416ea6 Mon Sep 17 00:00:00 2001 From: zero Date: Mon, 7 Jan 2008 05:32:27 +0000 Subject: [PATCH] =?UTF-8?q?ccl=20=EC=97=90=EB=94=94=ED=84=B0=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3476 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../cc_license/cc_license.class.php | 100 ++++++++++++++++++ .../editor/components/cc_license/ccl_logo.gif | Bin 0 -> 1611 bytes modules/editor/components/cc_license/icon.gif | Bin 0 -> 1193 bytes modules/editor/components/cc_license/info.xml | 8 ++ .../components/cc_license/lang/ko.lang.php | 29 +++++ .../components/cc_license/tpl/popup.html | 50 +++++++++ .../editor/components/cc_license/tpl/popup.js | 68 ++++++++++++ 7 files changed, 255 insertions(+) create mode 100755 modules/editor/components/cc_license/cc_license.class.php create mode 100644 modules/editor/components/cc_license/ccl_logo.gif create mode 100644 modules/editor/components/cc_license/icon.gif create mode 100755 modules/editor/components/cc_license/info.xml create mode 100644 modules/editor/components/cc_license/lang/ko.lang.php create mode 100755 modules/editor/components/cc_license/tpl/popup.html create mode 100755 modules/editor/components/cc_license/tpl/popup.js diff --git a/modules/editor/components/cc_license/cc_license.class.php b/modules/editor/components/cc_license/cc_license.class.php new file mode 100755 index 000000000..5a4286317 --- /dev/null +++ b/modules/editor/components/cc_license/cc_license.class.php @@ -0,0 +1,100 @@ + + * @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(' + Creative Commons License
', + $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('', $width); + $output = sprintf('%s
%s%s
', $style, $ccl_title, $text); + return $output; + } + } + +?> diff --git a/modules/editor/components/cc_license/ccl_logo.gif b/modules/editor/components/cc_license/ccl_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..6c9f5122085afd71eb31e012aeb2876c936dc7d6 GIT binary patch literal 1611 zcmV-R2DJG{Nk%w1VORhk0Oo%Hw79d$%*MvZ#k#$@#>v9U%*n#V!NbPC$jZgJy|%o; zy2Qu9j*pJP!obDH#DIZ-ue7d1L_;VjC&0tL^z`(quc_13(z3R(u(hxI`}+a|0;Q^? zqN1X?y0|hjGUDRmTwGkWy0gvA&CJfqk&%(NytaLPeM?MBV`F2_&(DU2hTPrU@9*!j zx3L@@9LmbdxVyGfQ&YUYyU@_ky1%%2d3n^-)Tyee($dm8Iy$tpv=R~$t*x!JwzKQ& z>(|%Uv9_?SvaGYWvewwu4Gj&)$H$zUoV>iev9z$i!n?h}y#D_F{r&x}v#tF6{Qv&{ z&d|-j!M?q}ywTIp)Yj9_(ayHHwaLrKzQDb!u&Vg@_|4DE&C<-(*VL}Ct-rs&zr?KL|F^ofl$Mjn%*L0Omp?#2v9YoI`u+R){7+C$iHe9(Qc$q7 zud}tX(9+MWuB(HDgQ%>h2?_~uadB2xRsaD2|Ns90006A9tN;K1A^8LW004ggEC2ui z09XJY000O7fPZ^~go7G|g@=fUeT|Nfkdcy;l#+vEdm4XZeH{ZbSPcda4hUBTBdMuZ z2m%fU4OmhD04*4|w-CBbLA^nKz`?@9#Kp$MUUiwBo>C1CS0h_hQx;TRT~roRRa*rD zuu(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;xGfBZjyikWvry&0h}cw+6M`tHIfSeZ$|2777)1R z$S`rZX<-70ZjqZa&`3i~3p}*xM*=+{%E58ofFlk$MY!6-0DRs+fpzY{BM&_RK;f!) zh;lKWKL80t&=Y$cD*&P$$mbA55>eEItHL1)LVz531kxH>aJz)09z>W@3l507gbb4Q zF@c9P+0=pvnKl-0A7`*Q6b9|)3-6sg6p@6F + + Creative Commons Licenses + + zero + CCL 라이센스를 출력합니다. + + diff --git a/modules/editor/components/cc_license/lang/ko.lang.php b/modules/editor/components/cc_license/lang/ko.lang.php new file mode 100644 index 000000000..c535a447e --- /dev/null +++ b/modules/editor/components/cc_license/lang/ko.lang.php @@ -0,0 +1,29 @@ + + * @brief 위지윅에디터(editor) 모듈 > CCL 출력 에디터 컴포넌트 + **/ + + $lang->ccl_default_title = '크리에이티브 커먼즈 코리아 저작자표시'; + $lang->ccl_default_message = '이 저작물은 %s%s%s%s에 따라 이용하실 수 있습니다'; + + $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 = '저작물의 변경 여부를 허용할 수 있습니다. (기본: 동일 조건 변경)'; +?> diff --git a/modules/editor/components/cc_license/tpl/popup.html b/modules/editor/components/cc_license/tpl/popup.html new file mode 100755 index 000000000..40b2396ab --- /dev/null +++ b/modules/editor/components/cc_license/tpl/popup.html @@ -0,0 +1,50 @@ + + + +
+

{$component_info->title} ver. {$component_info->version}

+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
{$lang->ccl_title} + +

{$lang->about_ccl_title}

+
{$lang->ccl_use_mark} + +

{$lang->about_ccl_use_mark}

+
{$lang->ccl_allow_commercial} + +

{$lang->about_ccl_allow_commercial}

+
{$lang->ccl_allow_modification} + +

{$lang->about_ccl_allow_modification}

+
+
+ + + +
diff --git a/modules/editor/components/cc_license/tpl/popup.js b/modules/editor/components/cc_license/tpl/popup.js new file mode 100755 index 000000000..7cb2cf1b2 --- /dev/null +++ b/modules/editor/components/cc_license/tpl/popup.js @@ -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 = '
ccl
'; + + 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);