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

This commit is contained in:
zero 2007-04-06 03:48:39 +00:00
parent aeb1d32bf2
commit 7b5e44ea20
14 changed files with 368 additions and 25 deletions

View file

@ -9,13 +9,14 @@
**/
String.prototype.getQuery = function(key) {
var idx = this.indexOf('?');
if(idx == -1) return;
if(idx == -1) return null;
var query_string = this.substr(idx+1, this.length);
var args = {}
query_string.replace(/([^=]+)=([^&]*)(&|$)/g, function() { args[arguments[1]] = arguments[2]; });
var q = args[key];
if(typeof(q)=="undefined") q = "";
return q;
}

View file

@ -113,6 +113,7 @@ function drawTreeMenu(oXml, callback_func, resopnse_tags, null_func, param) {
if(manual_select_node_srl) manualSelectNode(menu_id, manual_select_node_srl);
}
return null;
}
// 페이지 랜더링 중에 메뉴의 html이 완성되었을때 window.onload event 후에 그리기 재시도를 하게 될 함수

View file

@ -20,7 +20,7 @@ else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){
xIE6=xUA.indexOf('msie 6')!=-1;
}
else if(document.layers){xNN4=true;}
xMac=xUA.indexOf('mac')!=-1;
var xMac=xUA.indexOf('mac')!=-1;
// (element, event(without 'on'), event listener(function name)[, caption])
function xAddEventListener(e,eT,eL,cap)
@ -313,7 +313,7 @@ function xHeight(e,h)
}
}
h-=(pt+pb+bt+bb);
if(isNaN(h)||h<0) return;
if(isNaN(h)||h<0) return null;
else e.style.height=h+'px';
}
h=e.offsetHeight;
@ -325,9 +325,10 @@ function xHeight(e,h)
return h;
}
function xHex(n, digits, prefix)
function xHex(sn, digits, prefix)
{
var p = '', n = Math.ceil(n);
var p = '';
var n = Math.ceil(sn);
if (prefix) p = prefix;
n = n.toString(16);
for (var i=0; i < digits - n.length; ++i) {
@ -449,18 +450,6 @@ function xParent(e, bNode)
return p;
}
function xParentChain(e,delim,bNode)
{
if (!(e=xGetElementById(e))) return;
var lim=100, s = "", d = delim || "\n";
while(e) {
s += xName(e) + ', ofsL:'+e.offsetLeft + ', ofsT:'+e.offsetTop + d;
e = xParent(e,bNode);
if (!lim--) break;
}
return s;
}
function xPreventDefault(e)
{
if (e && e.preventDefault) e.preventDefault()
@ -602,7 +591,7 @@ function xWidth(e,w)
}
}
w-=(pl+pr+bl+br);
if(isNaN(w)||w<0) return;
if(isNaN(w)||w<0) return null;
else e.style.width=w+'px';
}
w=e.offsetWidth;

View file

@ -38,10 +38,12 @@ function xml_response_filter(oXml, callback_func, response_tags, callback_func_a
var ret_obj = oXml.toZMsgObject(xmlDoc, response_tags);
if(ret_obj["error"]!=0) {
alert(ret_obj["message"]);
return;
return null;
}
callback_func(ret_obj, response_tags, callback_func_arg, fo_obj);
return null;
}
// xml handler

View file

@ -188,6 +188,8 @@ function XmlJsFilterExecuteFilter(filter, value) {
return !isNaN(value);
break;
}
return null;
}
function XmlJsFilterAlertMsg(target, msg_code, minlength, maxlength) {
@ -281,6 +283,8 @@ function XmlJsFilterProc(confirm_msg) {
return true;
}
exec_xml(this.module, this.act, params, this.user_func, response, params, this.fo_obj);
return null;
}
// form proc

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->survey_title = "제목";
$lang->survey_item = "항목";
$lang->survey_stop_date = "종료 일자";
$lang->survey_chk_count = "선택항목 수";
$lang->cmd_add_survey = "설문 추가";
$lang->cmd_del_survey = "설문 제거";
$lang->cmd_add_item = "항목 추가";
?>

View file

@ -0,0 +1,36 @@
<?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);
}
}
?>

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;
}
.survey_header {
border:1px solid #888888;
background-color:#EFEFEF;
margin:5px;
padding:5px;
font-weight:bold;
}
.survey_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,64 @@
<!--%import("popup.js")-->
<!--%import("popup.css")-->
<!--%import("../lang")-->
<form action="./" method="get" id="fo_component" onSubmit="return false">
<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="survey_header">
{$lang->survey_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>
</div>
<div id="survey_source" class="survey_box" style="display:none">
<div class="title_box">
<div class="header">{$lang->survey_title}</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->survey_item} 1</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->survey_item} 2</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div>
</div>
<div class="item_box">
<div class="sub_header">{$lang->survey_item} 3</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div>
</div>
<div class="sub_button_area">
<div><input type="button" value="{$lang->cmd_del_survey}" class="editor_button" onclick="doSurveyDelete(this); return false;" /></div>
<div><input type="button" value="{$lang->cmd_add_item}" class="editor_button" onclick="doSurveyAddItem(this); return false;" /></div>
<div>
- {$lang->survey_chk_count} : <input type="text" name="check_count" value="1" class="editor_small_input" />
</div>
</div>
</div>
<div class="editor_button_area">
<input type="button" class="editor_button" value="{$lang->cmd_add_survey}" onclick="doSurveyAdd(); return false;" />
<input type="button" class="editor_button" value="{$lang->cmd_insert}" onclick="insertSurvey(); return false;" />
<input type="button" class="editor_button" value="{$lang->cmd_close}" onclick="window.close(); return false;" />
</div>
</div>
</form>

View file

@ -0,0 +1,103 @@
/**
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 block이 있는지 체크하여
* 있으면 가져와서 원하는 곳에 삽입
**/
var survey_index = 1;
function setSurvey() {
var obj = xCreateElement("div");
var source = xGetElementById("survey_source");
xInnerHtml(obj, xInnerHtml(source));
obj.id = "survey_"+survey_index;
obj.className = "survey_box";
obj.style.display = "block";
source.parentNode.insertBefore(obj, source);
}
/**
* 부모창의 위지윅에디터에 데이터를 삽입
**/
function insertSurvey() {
if(typeof(opener)=="undefined") return;
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, link);
opener.focus();
window.close();
}
xAddEventListener(window, "load", setSurvey);
/**
* 설문 추가
**/
function doSurveyAdd() {
var obj = xCreateElement("div");
var source = xGetElementById("survey_source");
if(survey_index+1>3) return null;
survey_index++;
xInnerHtml(obj, xInnerHtml(source));
obj.id = "survey_"+survey_index;
obj.className = "survey_box";
obj.style.display = "block";
source.parentNode.insertBefore(obj, source);
setFixedPopupSize();
return null;
}
/**
* 항목 삭제
**/
function doSurveyDelete(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('survey_box');
for(var i=0;i<obj_list.length;i++) {
var nobj = obj_list[i];
if(nobj.id == 'survey_source') continue;
var tmp_arr = nobj.id.split('_');
var index = tmp_arr[1];
nobj.id = 'survey_'+(i+1);
}
survey_index = i-1;
setFixedPopupSize();
}
/**
* 항목 추가
**/
function doSurveyAddItem(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)+'<');
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;
}

View file

@ -157,17 +157,16 @@ function _editorAutoSave() {
function _editorAutoSaved(ret_obj) {
setTimeout(_editorAutoSave, 7000);
return null;
}
// 에디터의 전체 내용 return
function editorGetContent(upload_target_srl) {
var iframe_obj = editorGetIFrame(upload_target_srl);
if(!iframe_obj) return;
var html = '';
if(!iframe_obj) return null;
var html = null;
html = xInnerHtml(iframe_obj.contentWindow.document.body);
if(html) html = html.replace(/^<br>$/i,'');
if(!html) return "";
return html;
}

View file

@ -155,7 +155,6 @@ function editor_remove_file(upload_target_srl) {
var fo_obj = obj;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value;
var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?act=procFileDelete&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl;
// iframe에 url을 보내버림
@ -192,7 +191,6 @@ function editor_insert_file(upload_target_srl) {
var fo_obj = obj;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value;
var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?module=file&amp;act=procFileDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
openComponent("url_link", upload_target_srl, url);
}