git-svn-id: http://xe-core.googlecode.com/svn/trunk@1003 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-06 05:38:22 +00:00
parent 7bd24d6934
commit cf46548046
8 changed files with 0 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<component version="0.1">
<title xml:lang="ko">설문조사 컴포넌트</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<description xml:lang="ko">글 작성시에 설문조사를 첨부하실 수 있습니다. 설문조사 컴포넌트는 설문조사 모듈의 설정에 영향을 받습니다.</description>
</author>
</component>

View file

@ -0,0 +1,16 @@
<?php
/**
* @file /modules/editor/components/urllink/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 위지윅에디터(editor) 모듈 > 설문조사 컴포넌트의 언어팩
**/
$lang->poll_title = "제목";
$lang->poll_item = "항목";
$lang->poll_stop_date = "종료 일자";
$lang->poll_chk_count = "선택항목 수";
$lang->cmd_add_poll = "설문 추가";
$lang->cmd_del_poll = "설문 제거";
$lang->cmd_add_item = "항목 추가";
?>

View file

@ -0,0 +1,49 @@
<?php
/**
* @class poll
* @author zero (zero@nzeo.com)
* @brief 에디터에서 url링크하는 기능 제공.
**/
class poll extends EditorHandler {
// upload_target_srl 는 에디터에서 필수로 달고 다녀야 함....
var $upload_target_srl = 0;
var $component_path = '';
/**
* @brief upload_target_srl과 컴포넌트의 경로를 받음
**/
function poll($upload_target_srl, $component_path) {
$this->upload_target_srl = $upload_target_srl;
$this->component_path = $component_path;
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
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) {
$poll_srl = $xml_obj->attrs->poll_srl;
// poll model 객체 생성해서 html 얻어와서 return
$oPollModel = &getModel('poll');
return $oPollModel->getPollHtml($poll_srl);
}
}
?>

View file

@ -0,0 +1,9 @@
<filter name="insert_poll" module="poll" act="procInsert" confirm_msg_code="confirm_submit">
<form />
<parameter />
<response callback_func="completeInsertPoll">
<tag name="error" />
<tag name="message" />
<tag name="poll_srl" />
</response>
</filter>

View file

@ -0,0 +1,122 @@
@charset "utf-8";
.editor_window {
width:500px;
clear:both;
}
.editor_title {
font-size:10pt;
font-weight:bold;
clear:both;
height:20px;
background-color:#555555;
color:#EFEFEF;
vertical-align:middle;
padding-top:5px;
border-bottom:1px solid #000000;
text-align:center;
}
.poll_header {
border:1px solid #888888;
background-color:#EFEFEF;
margin:5px;
padding:5px;
font-weight:bold;
}
.poll_box {
border:1px solid #888888;
height:140px;
margin:5px;
padding:5px;
}
.title_box {
background-color:#EFEFEF;
border:1px solid #DDDDDD;
padding-top:4px;
height:22px;
clear:both;
}
.item_box {
height:22px;
clear:both;
padding-top:3px;
margin-bottom:3px;
border-bottom:1px solid #DDDDDD;
}
.header {
float:left;
width:60px;
clear:left;
text-align:left;
font-weight:bold;
font-size:9pt;
padding:2px 0px 0px 20px;
height:20px;
}
.sub_header {
float:left;
width:60px;
clear:left;
text-align:left;
font-size:9pt;
padding:2px 0px 0px 20px;
height:20px;
}
.body {
float:left;
text-align:left;
font-size:9pt;
height:20px;
}
.sub_button_area {
padding:3px 20px 3px 0px;
clear:both;
height:25px;
}
.sub_button_area div {
float:left;
padding-right:10px;
margin-right:10px;
height:20px;
}
.editor_input {
width:335px;
border:1px solid #AAAAAA;
font-size:9pt;
height:13px;
}
.editor_small_input {
width:50px;
border:1px solid #AAAAAA;
font-size:9pt;
height:13px;
}
.editor_button_area {
border-top:1px solid #AAAAAA;
text-align:center;
background-color:#EEEEEE;
padding:10px 0px 2px 0px;
clear:both;
height:25px;
}
.editor_button {
background-color:#FFFFFF;
border:1px solid #AAAAAA;
height:17px;
font-size:9pt;
}

View file

@ -0,0 +1,70 @@
<!--%import("popup.js")-->
<!--%import("popup.css")-->
<!--%import("filter/insert_poll.xml")-->
<!--%import("../lang")-->
<form action="./" method="post" id="fo_component" onSubmit="procFilter(this, insert_poll); return false;">
<input type="hidden" name="component" value="{$component_info->component_name}" />
<input type="hidden" name="method" value="insertPoll" />
<input type="hidden" name="poll_srl" value="" />
<div class="editor_window">
<div class="editor_title">{$component_info->title} ver. {$component_info->version} <a href="#" onclick="popopen('./?module=editor&amp;act=dispEditorComponentInfo&amp;component_name={$component_info->component_name}','ComponentInfo');return false;"><img src="../../../tpl/images/about_component.gif" title="{$lang->about_component}" alt="{$lang->about_component}" class="about_component_icon" border="0" /></a></div>
<div class="poll_header">
{$lang->poll_stop_date} :
<select name="stop_year">
<!--@for($i=date("Y");$i<date("Y")+10;$i++)-->
<option value="{$i}">{$i}</option>
<!--@end-->
</select>
<select name="stop_month">
<!--@for($i=1;$i<=12;$i++)-->
<option value="{$i}" <!--@if($i==date("m"))-->selected="true"<!--@end-->>{$i}</option>
<!--@end-->
</select>
<select name="stop_day">
<!--@for($i=1;$i<=31;$i++)-->
<option value="{$i}" <!--@if($i==date("d"))-->selected="true"<!--@end-->>{$i}</option>
<!--@end-->
</select>
<input type="button" class="editor_button" value="{$lang->cmd_add_poll}" onclick="doPollAdd(); return false;" />
</div>
<div id="poll_source" class="poll_box" style="display:none">
<div class="title_box">
<div class="header">{$lang->poll_title}</div>
<div class="body"><input type="text" name="title_tidx" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->poll_item} 1</div>
<div class="body"><input type="text" name="item_tidx_1" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->poll_item} 2</div>
<div class="body"><input type="text" name="item_tidx_2" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->poll_item} 3</div>
<div class="body"><input type="text" name="item_tidx_3" class="editor_input" /></div>
</div>
<div class="sub_button_area">
<div><input type="button" value="{$lang->cmd_add_item}" class="editor_button" onclick="doPollAddItem(this); return false;" /></div>
<div>
- {$lang->poll_chk_count} : <input type="text" name="checkcount_tidx" value="1" class="editor_small_input" />
</div>
<div><input type="button" value="{$lang->cmd_del_poll}" class="editor_button" onclick="doPollDelete(this); return false;" /></div>
</div>
</div>
<div class="editor_button_area">
<input type="submit" class="editor_button" value="{$lang->cmd_submit}" />
<input type="button" class="editor_button" value="{$lang->cmd_close}" onclick="window.close(); return false;" />
</div>
</div>
</form>

View file

@ -0,0 +1,122 @@
/**
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 block이 있는지 체크하여
* 있으면 가져와서 원하는 곳에 삽입
**/
var poll_index = 1;
function setPoll() {
var obj = xCreateElement("div");
var source = xGetElementById("poll_source");
var html = xInnerHtml(source);
html = html.replace(/tidx/g, poll_index);
xInnerHtml(obj, html);
obj.id = "poll_"+poll_index;
obj.className = "poll_box";
obj.style.display = "block";
source.parentNode.insertBefore(obj, source);
}
/**
* 부모창의 위지윅에디터에 데이터를 삽입
**/
function completeInsertPoll(ret_obj) {
if(typeof(opener)=="undefined") return null;
var poll_srl = ret_obj["poll_srl"];
if(!poll_srl) return null;
var text = "<img src=\"./common/tpl/images/blank.gif\" poll_srl=\""+poll_srl+"\" editor_component=\"poll\" class=\"editor_component_output\" style=\"width:400px;height:300px;\" />";
alert(ret_obj['message']);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);
opener.focus();
window.close();
return null;
}
xAddEventListener(window, "load", setPoll);
/**
* 설문 추가
**/
function doPollAdd() {
var obj = xCreateElement("div");
var source = xGetElementById("poll_source");
if(poll_index+1>3) return null;
poll_index++;
var html = xInnerHtml(source);
html = html.replace(/tidx/g, poll_index);
xInnerHtml(obj, html);
obj.id = "poll_"+poll_index;
obj.className = "poll_box";
obj.style.display = "block";
source.parentNode.insertBefore(obj, source);
setFixedPopupSize();
return null;
}
/**
* 항목 삭제
**/
function doPollDelete(obj) {
var pobj = obj.parentNode.parentNode.parentNode;
var tmp_arr = pobj.id.split('_');
var index = tmp_arr[1];
if(index==1) return;
pobj.parentNode.removeChild(pobj);
var obj_list = xGetElementsByClassName('poll_box');
for(var i=0;i<obj_list.length;i++) {
var nobj = obj_list[i];
if(nobj.id == 'poll_source') continue;
var tmp_arr = nobj.id.split('_');
var index = tmp_arr[1];
nobj.id = 'poll_'+(i+1);
}
poll_index = i-1;
setFixedPopupSize();
}
/**
* 항목 추가
**/
function doPollAddItem(obj) {
var pobj = obj.parentNode.parentNode;
var source = xPrevSib(pobj);
var new_obj = xCreateElement("div");
var html = xInnerHtml(source);
var idx_match = html.match(/ ([0-9]+)</i);
if(!idx_match) return null;
var idx = parseInt(idx_match[1],10);
html = html.replace( / ([0-9]+)</, ' '+(idx+1)+'<');
html = html.replace( /value=("){0,1}([^"^\s]*)"{0,1}/, 'value=""');
html = html.replace( /item_([0-9]+)_([0-9]+)/, 'item_$1_'+(idx+1));
xInnerHtml(new_obj, html);
new_obj.className = source.className;
pobj.parentNode.insertBefore(new_obj, pobj);
var box_obj = pobj.parentNode;
var box_height = xHeight(box_obj);
xHeight(box_obj, box_height+29);
setFixedPopupSize();
return null;
}