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

This commit is contained in:
zero 2007-04-06 04:27:45 +00:00
parent 940b55b176
commit 6a9de5caca
5 changed files with 84 additions and 13 deletions

View file

@ -13,4 +13,6 @@
$lang->cmd_add_survey = "설문 추가"; $lang->cmd_add_survey = "설문 추가";
$lang->cmd_del_survey = "설문 제거"; $lang->cmd_del_survey = "설문 제거";
$lang->cmd_add_item = "항목 추가"; $lang->cmd_add_item = "항목 추가";
$lang->cmd_null_item = "설문조사로 등록할 값이 없습니다.\n다시 설정해주세요";
?> ?>

View file

@ -19,6 +19,44 @@
$this->component_path = $component_path; $this->component_path = $component_path;
} }
/**
* @brief 팝업창에서 설문 작성 완료후 저장을 누를때
**/
function insertSurvey() {
Context::loadLang($this->component_path.'lang');
$stop_year = Context::get('stop_year');
$stop_month = Context::get('stop_month');
$stop_day = Context::get('stop_day');
$stop_date = sprintf('%04d%02d%02d235959', $stop_year, $stop_month, $stop_day);
$vars = Context::getRequestVars();
foreach($vars as $key => $val) {
if(strpos($key,'tidx')) continue;
if(!eregi("^(title|checkcount|item)_", $key)) continue;
if(!trim($val)) continue;
$tmp_arr = explode('_',$key);
$survey_index = $tmp_arr[1];
if($tmp_arr[0]=='title') $tmp_args[$survey_index]->title = $val;
else if($tmp_arr[0]=='checkcount') $tmp_args[$survey_index]->checkcount = $val;
else if($tmp_arr[0]=='item') $tmp_args[$survey_index]->item[] = $val;
}
foreach($tmp_args as $key => $val) {
if(!$val->checkcount) $val->checkcount = 1;
if($val->title && count($val->item)) $args[] = $val;
}
if(!count($args)) return new Object(-1, 'cmd_null_item');
$survey_srl = getNextSequence();
$this->add('survey_srl', $survey_srl);
}
/** /**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
**/ **/

View file

@ -0,0 +1,9 @@
<filter name="insert_survey" module="editor" act="procEditorCall" confirm_msg_code="confirm_submit">
<form />
<parameter />
<response callback_func="completeInsertSurvey">
<tag name="error" />
<tag name="message" />
<tag name="survey_srl" />
</response>
</filter>

View file

@ -1,7 +1,13 @@
<!--%import("popup.js")--> <!--%import("popup.js")-->
<!--%import("popup.css")--> <!--%import("popup.css")-->
<!--%import("filter/insert_survey.xml")-->
<!--%import("../lang")--> <!--%import("../lang")-->
<form action="./" method="get" id="fo_component" onSubmit="return false">
<form action="./" method="post" id="fo_component" onSubmit="procFilter(this, insert_survey); return false;">
<input type="hidden" name="component" value="{$component_info->component_name}" />
<input type="hidden" name="method" value="insertSurvey" />
<input type="hidden" name="survey_srl" value="" />
<div class="editor_window"> <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="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>
@ -22,41 +28,41 @@
<option value="{$i}" <!--@if($i==date("d"))-->selected="true"<!--@end-->>{$i}</option> <option value="{$i}" <!--@if($i==date("d"))-->selected="true"<!--@end-->>{$i}</option>
<!--@end--> <!--@end-->
</select> </select>
<input type="button" class="editor_button" value="{$lang->cmd_add_survey}" onclick="doSurveyAdd(); return false;" />
</div> </div>
<div id="survey_source" class="survey_box" style="display:none"> <div id="survey_source" class="survey_box" style="display:none">
<div class="title_box"> <div class="title_box">
<div class="header">{$lang->survey_title}</div> <div class="header">{$lang->survey_title}</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div> <div class="body"><input type="text" name="title_tidx" class="editor_input" /></div>
</div> </div>
<div class="item_box"> <div class="item_box">
<div class="sub_header">{$lang->survey_item} 1</div> <div class="sub_header">{$lang->survey_item} 1</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div> <div class="body"><input type="text" name="item_tidx_1" class="editor_input" /></div>
</div> </div>
<div class="item_box"> <div class="item_box">
<div class="sub_header">{$lang->survey_item} 2</div> <div class="sub_header">{$lang->survey_item} 2</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div> <div class="body"><input type="text" name="item_tidx_2" class="editor_input" /></div>
</div> </div>
<div class="item_box"> <div class="item_box">
<div class="sub_header">{$lang->survey_item} 3</div> <div class="sub_header">{$lang->survey_item} 3</div>
<div class="body"><input type="text" name="title" class="editor_input" /></div> <div class="body"><input type="text" name="item_tidx_3" class="editor_input" /></div>
</div> </div>
<div class="sub_button_area"> <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_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><input type="button" value="{$lang->cmd_add_item}" class="editor_button" onclick="doSurveyAddItem(this); return false;" /></div>
<div> <div>
- {$lang->survey_chk_count} : <input type="text" name="check_count" value="1" class="editor_small_input" /> - {$lang->survey_chk_count} : <input type="text" name="checkcount_tidx" value="1" class="editor_small_input" />
</div> </div>
</div> </div>
</div> </div>
<div class="editor_button_area"> <div class="editor_button_area">
<input type="button" class="editor_button" value="{$lang->cmd_add_survey}" onclick="doSurveyAdd(); return false;" /> <input type="submit" class="editor_button" value="{$lang->cmd_submit}" />
<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;" /> <input type="button" class="editor_button" value="{$lang->cmd_close}" onclick="window.close(); return false;" />
</div> </div>

View file

@ -6,7 +6,11 @@ var survey_index = 1;
function setSurvey() { function setSurvey() {
var obj = xCreateElement("div"); var obj = xCreateElement("div");
var source = xGetElementById("survey_source"); var source = xGetElementById("survey_source");
xInnerHtml(obj, xInnerHtml(source));
var html = xInnerHtml(source);
html = html.replace(/tidx/g, survey_index);
xInnerHtml(obj, html);
obj.id = "survey_"+survey_index; obj.id = "survey_"+survey_index;
obj.className = "survey_box"; obj.className = "survey_box";
obj.style.display = "block"; obj.style.display = "block";
@ -17,14 +21,21 @@ function setSurvey() {
/** /**
* 부모창의 위지윅에디터에 데이터를 삽입 * 부모창의 위지윅에디터에 데이터를 삽입
**/ **/
function insertSurvey() { function completeInsertSurvey(ret_obj) {
if(typeof(opener)=="undefined") return; if(typeof(opener)=="undefined") return null;
var survey_srl = ret_obj["survey_srl"];
if(!survey_srl) return null;
var text = "<img src=\"./common/tpl/images/blank.gif\" survey_srl=\""+survey_srl+"\" editor_component=\"poll\" class=\"editor_component_output\" style=\"width:100%;\" />";
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl) var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, link); opener.editorReplaceHTML(iframe_obj, text);
opener.focus(); opener.focus();
window.close(); window.close();
return null;
} }
xAddEventListener(window, "load", setSurvey); xAddEventListener(window, "load", setSurvey);
@ -37,7 +48,11 @@ function doSurveyAdd() {
var source = xGetElementById("survey_source"); var source = xGetElementById("survey_source");
if(survey_index+1>3) return null; if(survey_index+1>3) return null;
survey_index++; survey_index++;
xInnerHtml(obj, xInnerHtml(source));
var html = xInnerHtml(source);
html = html.replace(/tidx/g, survey_index);
xInnerHtml(obj, html);
obj.id = "survey_"+survey_index; obj.id = "survey_"+survey_index;
obj.className = "survey_box"; obj.className = "survey_box";
obj.style.display = "block"; obj.style.display = "block";
@ -88,6 +103,7 @@ function doSurveyAddItem(obj) {
var idx = parseInt(idx_match[1],10); var idx = parseInt(idx_match[1],10);
html = html.replace( / ([0-9]+)</, ' '+(idx+1)+'<'); html = html.replace( / ([0-9]+)</, ' '+(idx+1)+'<');
html = html.replace( /value=("){0,1}([^"^\s]*)"{0,1}/, 'value=""'); 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); xInnerHtml(new_obj, html);
new_obj.className = source.className; new_obj.className = source.className;