mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-16 01:39:58 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@548 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a4f427a228
commit
4a46e67a18
7 changed files with 218 additions and 226 deletions
|
|
@ -44,10 +44,6 @@
|
|||
|
||||
Context::set("tpl_path", $tpl_path);
|
||||
|
||||
// 이모티콘을 모두 가져옴
|
||||
$image_link_list = FileHandler::readDir($tpl_path.'/images');
|
||||
Context::set('image_link_list', $image_link_list);
|
||||
|
||||
require_once("./classes/template/TemplateHandler.class.php");
|
||||
$oTemplate = new TemplateHandler();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
|
|
|
|||
|
|
@ -44,10 +44,6 @@
|
|||
|
||||
Context::set("tpl_path", $tpl_path);
|
||||
|
||||
// 이모티콘을 모두 가져옴
|
||||
$multimedia_link_list = FileHandler::readDir($tpl_path.'/images');
|
||||
Context::set('multimedia_link_list', $multimedia_link_list);
|
||||
|
||||
require_once("./classes/template/TemplateHandler.class.php");
|
||||
$oTemplate = new TemplateHandler();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
|
|
|
|||
80
modules/editor/components/quotation/quotation.class.php
Normal file
80
modules/editor/components/quotation/quotation.class.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/**
|
||||
* @class quotation
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 에디터에서 인용문 기능 제공. 단순 팝업.
|
||||
**/
|
||||
|
||||
class quotation extends EditorHandler {
|
||||
|
||||
// upload_target_srl 는 에디터에서 필수로 달고 다녀야 함....
|
||||
var $upload_target_srl = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief upload_target_srl과 컴포넌트의 경로를 받음
|
||||
**/
|
||||
function quotation($upload_target_srl, $component_path) {
|
||||
$this->upload_target_srl = $upload_target_srl;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 에디터에서 처음 요청을 받을 경우 실행이 되는 부분이다.
|
||||
* execute의 경우 2가지 경우가 생긴다.
|
||||
* 직접 에디터 아래의 component area로 삽입할 html 코드를 만드는 것과 popup 윈도우를 띄우는 것인데
|
||||
* popup윈도우를 띄울 경우는 getPopupContent() 이라는 method가 실행이 되니 구현하여 놓아야 한다
|
||||
**/
|
||||
function execute() {
|
||||
|
||||
$url = sprintf('./?module=editor&act=dispPopup&target_srl=%s&component=quotation', $this->upload_target_srl);
|
||||
|
||||
$this->add('tpl', '');
|
||||
$this->add('open_window', 'Y');
|
||||
$this->add('popup_url', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window요청시 다시 call이 될 method. popup window에 출력할 내용을 추가하면 된다
|
||||
**/
|
||||
function getPopupContent() {
|
||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
||||
Context::set("tpl_path", $tpl_path);
|
||||
|
||||
require_once("./classes/template/TemplateHandler.class.php");
|
||||
$oTemplate = new TemplateHandler();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
|
||||
*
|
||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
$src = $xml_obj->attrs->src;
|
||||
$alt = $xml_obj->attrs->alt;
|
||||
$width = $xml_obj->attrs->width;
|
||||
$height = $xml_obj->attrs->height;
|
||||
$align = $xml_obj->attrs->align;
|
||||
$border = $xml_obj->attrs->border;
|
||||
|
||||
$src = str_replace(array('&','"'), array('&','&qout;'), $src);
|
||||
if(!$alt) $alt = $src;
|
||||
|
||||
$output = array();
|
||||
$output = array("src=\"".$src."\"");
|
||||
if($alt) $output[] = "alt=\"".$alt."\"";
|
||||
if($width) $output[] = "width=\"".$width."\"";
|
||||
if($height) $output[] = "height=\"".$height."\"";
|
||||
if($align) $output[] = "align=\"".$align."\"";
|
||||
if($border) $output[] = "border=\"".$border."\"";
|
||||
return "<img ".implode(" ", $output)." />";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>add Quotation</title>
|
||||
<link rel='stylesheet' href='../css/editor.css' type='text/css' />
|
||||
<script type='text/javascript' src='../../common/js/x.js'></script>
|
||||
<script type='text/javascript' src='../../common/js/common.js'></script>
|
||||
<script type='text/javascript' src='../js/editor.js'></script>
|
||||
<script type='text/javascript'>
|
||||
var color_list = new Array('000000','993300','333300','003300','003366','000080','333399','333333','800000','FF6600','808000','008000','008080','0000FF','666699','808080','FF0000','FF9900','99CC00','339966','33CCCC','3366FF','800080','969696','FF00FF','FFCC00','FFFF00','00FF00','00FFFF','00CCFF','993366','c0c0c0','FF99CC','FFCC99','FFFF99','CCFFCC','CCFFFF','99CCFF','CC99FF','FFFFFF');
|
||||
|
||||
function setText() {
|
||||
if(typeof(opener)=='undefined') return;
|
||||
var text = opener.editorGetSelectedHtml(opener.editorPrevSrl);
|
||||
var fo_obj = xGetElementById('fo');
|
||||
fo_obj.text.value = text;
|
||||
self.focus();
|
||||
}
|
||||
|
||||
function change_type(obj) {
|
||||
xGetElementById('quotation').style.display = 'none';
|
||||
xGetElementById('htmlcode').style.display = 'none';
|
||||
xGetElementById('phpcode').style.display = 'none';
|
||||
xGetElementById('fold').style.display = 'none';
|
||||
|
||||
var editor_obj = xGetElementById('editor');
|
||||
|
||||
var val = obj.value;
|
||||
xGetElementById(val).style.display = 'block';
|
||||
switch(val) {
|
||||
case 'quotation' :
|
||||
xHeight(editor_obj,240);
|
||||
break;
|
||||
case 'htmlcode' :
|
||||
xHeight(editor_obj,240);
|
||||
break;
|
||||
case 'phpcode' :
|
||||
xHeight(editor_obj,240);
|
||||
break;
|
||||
case 'fold' :
|
||||
xHeight(editor_obj,150);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function change_color(obj) {
|
||||
var code = obj.options[obj.selectedIndex].value;
|
||||
obj.style.backgroundColor = "#"+code;
|
||||
}
|
||||
|
||||
function write_color_list(field_name) {
|
||||
var idx = '';
|
||||
switch(field_name) {
|
||||
case 'bgcolor' :
|
||||
idx = color_list.length-1;
|
||||
break;
|
||||
case 'bordercolor' :
|
||||
idx = 35;
|
||||
break;
|
||||
}
|
||||
var html = "<select name='"+field_name+"' id='"+field_name+"' onChange='change_color(this);' style='width:40px;'>";
|
||||
for(var i=0;i<color_list.length;i++) {
|
||||
html += "<option value='"+color_list[i]+"' ";
|
||||
if(i == idx) html += " selected ";
|
||||
html += "style='background-color:#"+color_list[i]+"'></option>";
|
||||
}
|
||||
html += "</select>";
|
||||
document.write(html);
|
||||
}
|
||||
|
||||
function getSelectValue(obj) {
|
||||
return obj.options[obj.selectedIndex].value;
|
||||
}
|
||||
|
||||
function insertQuotation() {
|
||||
if(typeof(opener)=='undefined') return;
|
||||
|
||||
var fo_obj = xGetElementById('fo');
|
||||
|
||||
var bgcolor = getSelectValue(fo_obj.bgcolor);
|
||||
var bordercolor = getSelectValue(fo_obj.bordercolor);
|
||||
var bordertype = 'background-color:#'+bgcolor+';';
|
||||
switch(getSelectValue(fo_obj.bordertype)) {
|
||||
case 'solid' :
|
||||
bordertype += "border:1px solid #"+bordercolor+";";
|
||||
break;
|
||||
case 'dotted' :
|
||||
bordertype += "border:1px dotted #"+bordercolor+";";
|
||||
break;
|
||||
case 'none' :
|
||||
bordertype += "border:0px;";
|
||||
break;
|
||||
}
|
||||
|
||||
var bordercolor = getSelectValue(fo_obj.bordercolor);
|
||||
|
||||
var text = fo_obj.text.value;
|
||||
var html = '';
|
||||
|
||||
if(!text) return;
|
||||
|
||||
if(xGetElementById('type_fold').checked) {
|
||||
var opentext = fo_obj.opentext.value;
|
||||
if(!opentext) opentext = 'more...';
|
||||
var closetext = fo_obj.closetext.value;
|
||||
if(!closetext) closetext = 'close';
|
||||
|
||||
var link_type = fo_obj.link_type.options[fo_obj.link_type.selectedIndex].value;
|
||||
if(fo_obj.bold.checked) link_type = 'bold '+link_type;
|
||||
|
||||
var id = Math.round(Math.random()*1000000);
|
||||
|
||||
html = '<div id="_folder_open_'+id+'" class="folder_opener"><a href="#" onClick="svc_folder_open(\''+id+'\');return false;" class="'+link_type+'" style="text-decoration:none;">'+opentext+'</a></div>';
|
||||
html += '<div id="_folder_close_'+id+'" class="folder_closer"><a href="#" onClick="svc_folder_close(\''+id+'\');return false;" class="'+link_type+'" style="text-decoration:none;">'+closetext+'</a></div>';
|
||||
html += '<div id="_folder_'+id+'" class="folder_area" style="padding:10px; '+bordertype+'">'+text+'</div>';
|
||||
html = "<div>"+html+"</div>";
|
||||
} else {
|
||||
html = '<div style="padding:10px; '+bordertype+'">'+text+'</div>';
|
||||
}
|
||||
|
||||
opener.editorInsertQuotation(html);
|
||||
|
||||
opener.focus();
|
||||
self.close();
|
||||
}
|
||||
xAddEventListener(window, 'load', setText);
|
||||
xAddEventListener(window, 'load', setFixedPopupSize);
|
||||
</script>
|
||||
</head>
|
||||
<body class="editor_pop_body">
|
||||
<form action='./' method='post' id='fo' onSubmit="return false" style="display:inline">
|
||||
<div id='zone_Quotation' class="editor_window">
|
||||
<div class="quotation_box">
|
||||
<input type="radio" id="type_quotation" name="quotation_type" value="quotation" checked onClick="change_type(this)" /> quotation
|
||||
<input type="radio" id="type_fold" name="quotation_type" value="fold" onClick="change_type(this)" /> fold
|
||||
</div>
|
||||
|
||||
<div class="quotation_type">
|
||||
<table border="0" width="100%">
|
||||
<col width="100" />
|
||||
<col width="*" />
|
||||
<tr>
|
||||
<td class="editor_field">bg color</td>
|
||||
<td class="editor_area"><script type="text/javascript">write_color_list("bgcolor");</script></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="editor_field">border type</td>
|
||||
<td class="editor_area">
|
||||
<select name="bordertype">
|
||||
<option value="solid">solid</option>
|
||||
<option value="dotted">dotted</option>
|
||||
<option value="none">none</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="editor_field">border color</td>
|
||||
<td class="editor_area"><script type="text/javascript">write_color_list("bordercolor");</script></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="quotation_type" id="quotation">
|
||||
</div>
|
||||
|
||||
<div class="quotation_type" id="htmlcode" style="display:none"></div>
|
||||
|
||||
<div class="quotation_type" id="phpcode" style="display:none"></div>
|
||||
|
||||
<div class="quotation_type" id="fold" style="display:none">
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="0">
|
||||
<col width="100" />
|
||||
<col width="*" />
|
||||
<tr>
|
||||
<td class="editor_field">open text</td>
|
||||
<td><input type='text' name='opentext' class="editor_input" style="width:120px;" value='more...'/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="editor_field">close text</td>
|
||||
<td><input type='text' name='closetext' class="editor_input" style="width:120px;" value='close' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="editor_field">bold</td>
|
||||
<td><input type='checkbox' name='bold' value='Y' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="editor_field">type</td>
|
||||
<td class="editor_area">
|
||||
<select name='link_type'>
|
||||
<option value=''>default</option>
|
||||
<option value='editor_blue_text'>blue</option>
|
||||
<option value='editor_red_text'>red</option>
|
||||
<option value='editor_green_text'>green</option>
|
||||
<option value='editor_yellow_text'>yellow</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><textarea name="text" id='editor' class="editor_textarea" style="width:100%;height:240px;"><?=$_REQUEST['title']?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type='button' id='manual_url_submit' class="editor_submit" value='Insert' onClick='insertQuotation()' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
52
modules/editor/components/quotation/tpl/popup.css
Normal file
52
modules/editor/components/quotation/tpl/popup.css
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
.editor_window {
|
||||
width:400px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.header {
|
||||
float:left;
|
||||
width:100px;
|
||||
clear:left;
|
||||
text-align:left;
|
||||
font-weight:bold;
|
||||
margin:5px;
|
||||
font-size:9pt;
|
||||
font-size:9pt;
|
||||
}
|
||||
|
||||
.body {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:left;
|
||||
margin:5px;
|
||||
font-size:9pt;
|
||||
}
|
||||
|
||||
.body label {
|
||||
cursor:pointer;
|
||||
font-size:9pt;
|
||||
}
|
||||
|
||||
.multimedia_url {
|
||||
width:240px;
|
||||
border:1px solid #AAAAAA;
|
||||
}
|
||||
|
||||
.multimedia_size {
|
||||
width:60px;
|
||||
border:1px solid #AAAAAA;
|
||||
}
|
||||
|
||||
.editor_button_area {
|
||||
clear:both;
|
||||
text-align:center;
|
||||
height:25px;
|
||||
padding-top:3px;
|
||||
background-color:#EEEEEE;
|
||||
}
|
||||
|
||||
.editor_button {
|
||||
margin-top:4px;
|
||||
background-color:#FFFFFF;
|
||||
border:1px solid #AAAAAA;
|
||||
}
|
||||
27
modules/editor/components/quotation/tpl/popup.html
Normal file
27
modules/editor/components/quotation/tpl/popup.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!--%import("popup.js")-->
|
||||
<!--%import("popup.css")-->
|
||||
<!--%import("../lang")-->
|
||||
|
||||
<div class="editor_window">
|
||||
<form action="./" method="get" onSubmit="return false" id="fo">
|
||||
<div class="header">{$lang->multimedia_url}</div>
|
||||
<div class="body"><input type="text" class="multimedia_url" id="multimedia_url" value="" /></div>
|
||||
|
||||
<div class="header">{$lang->multimedia_caption}</div>
|
||||
<div class="body"><input type="text" class="multimedia_url" id="multimedia_caption" value="" /></div>
|
||||
|
||||
<div class="header">{$lang->multimedia_width}</div>
|
||||
<div class="body"><input type="text" class="multimedia_size" id="multimedia_width" value="640" />px</div>
|
||||
|
||||
<div class="header">{$lang->multimedia_height}</div>
|
||||
<div class="body"><input type="text" class="multimedia_size" id="multimedia_height" value="480" />px</div>
|
||||
|
||||
<div class="header">{$lang->multimedia_auto_start}</div>
|
||||
<div class="body"><input type="checkbox" id="multimedia_auto_start" value="Y" /></div>
|
||||
|
||||
<div class="editor_button_area">
|
||||
<input type="button" value="{$lang->cmd_insert}" class="editor_button" onclick="insertMultimedia()" />
|
||||
<input type="button" value="{$lang->cmd_close}" class="editor_button" onclick="window.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
59
modules/editor/components/quotation/tpl/popup.js
Normal file
59
modules/editor/components/quotation/tpl/popup.js
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 멀티미디어 컴포넌트 코드를 체크하여
|
||||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
function getMultimedia() {
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
||||
var node = opener.editorPrevNode;
|
||||
if(!node || node.nodeName != "DIV") return;
|
||||
|
||||
var url = node.getAttribute("src");
|
||||
var caption = xInnerHtml(node);
|
||||
var width = node.getAttribute("width");
|
||||
var height = node.getAttribute("height");
|
||||
var auto_start = node.getAttribute("auto_start");
|
||||
|
||||
xGetElementById("multimedia_url").value = url;
|
||||
xGetElementById("multimedia_caption").value = caption;
|
||||
xGetElementById("multimedia_width").value = width;
|
||||
xGetElementById("multimedia_height").value = height;
|
||||
if(auto_start=="true") xGetElementById("multimedia_auto_start").checked = true;
|
||||
|
||||
}
|
||||
|
||||
function insertMultimedia(obj) {
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
||||
var url = xGetElementById("multimedia_url").value;
|
||||
|
||||
var caption = xGetElementById("multimedia_caption").value;
|
||||
|
||||
var width = xGetElementById("multimedia_width").value;
|
||||
if(!width) width = 640;
|
||||
|
||||
var height = xGetElementById("multimedia_height").value;
|
||||
if(!height) height= 480;
|
||||
|
||||
var auto_start = "false";
|
||||
if(xGetElementById("multimedia_auto_start").checked) auto_start = "true";
|
||||
|
||||
if(!url) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var text = "<div editor_component=\"multimedia_link\" class=\"editor_multimedia\" src=\""+url+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\" auto_start=\""+auto_start+"\">"+caption+"</div>";
|
||||
|
||||
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", getMultimedia);
|
||||
Loading…
Add table
Add a link
Reference in a new issue