05. 관리자의 견적서폼 추가/수정 부분 구현하기

조회 수 821 추천 수 0 2010.06.10 21:59:07
sol *.13.13.164
제목 작성자 날짜
05. 관리자의 견적서폼 추가/수정 부분 구현하기 (current) sol 2010.06.10 21:59:07
복원
<div class="eArea xe_content xe_dr_txt"><p>관리자 견적서폼 등록 화면 구현입니다. 구현할 화면은 아래와 같습니다. formView Class에 info/module.xml 에 작성한 dispFormAdminInsert()과 템플릿을 작성하고 입력항목의 유효성 체크 등을 위한 fliter와 callback 함수를 작성합니다. 그리고 실제 등록하는 부분으로 procFormAdminInsert()를 작성합니다.<br></p></div><div class="eArea xe_content xe_dr_img"><p>
<img src="./files/attach/images/18093223/427/245/018/admin_form_add_1.png" class="" alt="">
</p></div><div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1251015396797">템플릿 tpl/form_insert.html</a></li><li class="toc3"><a href="#h1251015414907">Fliter tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</a></li><li class="toc3"><a href="#h1251015475291">Controller Class form.admin.controller.php 작성 </a></li><li class="toc3"><a href="#h1251015497357">견적서폼 추가 Action formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015396797">템플릿 tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma;">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225);">procFilter</span></b><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">(this, </span></span><b><span style="background-color: rgb(225, 225, 225);">insert_form</span></b><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015414907">Fliter tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold;">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px;">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold;">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma;"> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px;">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015475291">Controller Class form.admin.controller.php 작성 </h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015497357">견적서폼 추가 Action formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>module controller의 insertModule()/updateModule()로 모듈을 등록/수정합니다. 또 formAdminController 자신의 객체 $this의 add()로 반환할 변수인 page, module_srl을 등록하여 filter에 선언한 callback 함수의 argument로 받습니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor'+
'+
',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>page</b>',Context::get('page'));</span></span><br><span style="background-color: rgb(225, 225, 225);"><span style="background-color: rgb(225, 225, 225);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>module_srl</b>',$output-&gt;get('module_srl'));</span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.24 11:55:11
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1251015396797">템플릿 tpl/form_insert.html</a></li><li class="toc3"><a href="#h1251015414907">Fliter tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</a></li><li class="toc3"><a href="#h1251015475291">Controller Class form.admin.controller.php 작성 </a></li><li class="toc3"><a href="#h1251015497357">견적서폼 추가 Action formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015396797">템플릿 tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015414907">Fliter tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015475291">Controller Class form.admin.controller.php 작성 </h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251015497357">견적서폼 추가 Action formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>module controller의 insertModule()/updateModule()로 모듈을 등록/수정합니다. 또 formAdminController 자신의 객체 $this의 add()로 반환할 변수인 page, module_srl을 등록하여 filter에 선언한 callback 함수의 argument로 받습니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>page</b>',Context::get('page'));</span></span><br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>module_srl</b>',$output-&gt;get('module_srl'));</span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.23 17:18:29
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250890916934">tpl/form_insert.html</a></li><li class="toc3"><a href="#h1250890545201">tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('+
'+
'layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890916934">tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890545201">tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'+
'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>module controller의 insertModule()/updateModule()로 모듈을 등록/수정합니다. 또 formAdminController 자신의 객체 $this의 add()로 반환할 변수인 page, module_srl을 등록하여 filter에 선언한 callback 함수의 argument로 받습니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>page</b>',Context::get('page'));</span></span><br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('<b>module_srl</b>',$output-&gt;get('module_srl'));</span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.23 17:15:28
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250890916934">tpl/form_insert.html</a></li><li class="toc3"><a href="#h1250890545201">tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('+
'+
'layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890916934">tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890545201">tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'+
'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>module controller의 insertModule()/updateModule()로 모듈을 등록/수정합니다. 또 formAdminController 자신의 객체 $this의 add()로 반환할 변수를 등록합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.23 17:11:08
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250890916934">tpl/form_insert.html</a></li><li class="toc3"><a href="#h1250890545201">tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('+
'+
'layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890916934">tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890545201">tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013330032">"insert_form" fliter의 javascript callback 함수 completeInsertForm()</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'+
'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>module controller의 insertModule()/updateModule()로 모듈을 등록/수정합니다. 또 formAdminController 자신의 객체 $this의 add()로 반환할 변수를 등록합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.23 16:44:52
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250890916934">tpl/form_insert.html</a></li><li class="toc3"><a href="#h1250890545201">tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1251013177317">"insert_form" fliter의 callback 함수</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function <b>dispFormAdminInsert</b>(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br><b>$skin_list</b> = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('skin_list',$skin_list);</span></span><br><br>$oLayoutMode = &amp;getModel('layout');<br><b>$layout_list</b> = $oLayoutMode-&gt;getLayoutList();<br><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">Context::set('layout_list', $layout_list);</span></span><br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890916934">tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html의 form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 <b>procFilter()</b>를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890545201">tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="<b>mid</b>" required="true" maxlength="40" filter="<b>alpha_number</b>" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="<b>completeInsertForm</b>"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1251013177317">"insert_form" fliter의 callback 함수</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>/* 폼&nbsp;모듈 생성 후 */</div><div>function <b>completeInsertForm</b>(ret_obj) {</div><div>&nbsp;&nbsp; &nbsp;var error = ret_obj['error'];</div><div>&nbsp;&nbsp; &nbsp;var message = ret_obj['message'];</div><div>&nbsp;&nbsp; &nbsp;var page = ret_obj['page'];</div><div>&nbsp;&nbsp; &nbsp;var module_srl = ret_obj['module_srl'];</div><div><br></div><div>&nbsp;&nbsp; &nbsp;alert(message);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;var url = current_url.setQuery('act','dispFormAdminExtraVars');</div><div>&nbsp;&nbsp; &nbsp;if(module_srl) url = url.setQuery('module_srl',module_srl);</div><div>&nbsp;&nbsp; &nbsp;if(page) url.setQuery('page',page);</div><div>&nbsp;&nbsp; &nbsp;location.href = url;</div><div>}</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class <b>formAdminController </b>extends <b>form </b>{<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.23 16:40:41
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250890916934">tpl/form_insert.html</a></li><li class="toc3"><a href="#h1250890545201">tpl/fliter/insert_form.xml</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 견적서 폼을 추가하면 module 컨트롤러에서 모듈을 추가 합니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function dispFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br>$skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>Context::set('skin_list',$skin_list);<br><br>$oLayoutMode = &amp;getModel('layout');<br>$layout_list = $oLayoutMode-&gt;getLayoutList();<br>Context::set('layout_list', $layout_list);<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890916934">tpl/form_insert.html</h3></div><div class="eArea xe_content xe_dr_txt"><p></p><div>견적서폼 설정 내용을 전달할 html form 입니다.&nbsp;<span class="Apple-style-span" style="line-height: 19px; font-family: Tahoma; ">XE에서는 form을 전송할 때 직접 post/get으로 submit 하지 않고 procFilter()를 통해 Ajax로 call 한 뒤 response를 받아 작성한 "<b>tpl/filter/insert_form.xml</b>" 의 callback을 통해 실행됩니다.</span></div><div><br></div><div>&lt;form action="./" method="post" <span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">onsubmit="return </span></span><b><span style="background-color: rgb(225, 225, 225); ">procFilter</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">(this, </span></span><b><span style="background-color: rgb(225, 225, 225); ">insert_form</span></b><span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">)"</span></span>&gt;</div><div>&lt;input type="hidden" name="page" value="{$page}" /&gt;</div><div>&lt;input type="hidden" name="module_srl" value="{$module_info-&gt;module_srl}" /&gt;</div><div>...</div><div>&lt;/form&gt;</div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250890545201">tpl/fliter/insert_form.xml</h3></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼 등록을 위한 fliter입니다. &nbsp;action을&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">form <span class="Apple-style-span" style="font-weight: normal;">모듈의</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Gulim; font-weight: normal; line-height: 18px; ">&nbsp;<span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; font-weight: bold; ">procFormAdminInsert</span><span class="Apple-style-span" style="line-height: 19px; color: rgb(51, 51, 51); font-family: Tahoma; "> 를 지정하였고 등록전 javascript confirm()으로 "confirm_submit" 의 언어코드를 사용하였습니다.<br></span></span></span></p><p><font class="Apple-style-span" color="#333333" face="Tahoma"><span class="Apple-style-span" style="line-height: 19px; ">mid는 필수 최대 40자 영문자시작 숫자조합의 조건을 설정하였습니다.<br>&lt;input type="text" name="mid" value="{$module_info-&gt;mid}" class="inputTypeText w200" /&gt;<br></span></font></p></div><div class="eArea xe_content xe_dr_txt"><p></p><div>&lt;filter name="<b>insert_form</b>" module="<b>form</b>" act="<b>procFormAdminInsert</b>" confirm_msg_code="confirm_submit"&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;form&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="background-color: rgb(225, 225, 225); "><span style="background-color: rgb(225, 225, 225); ">&lt;node target="mid" required="true" maxlength="40" filter="alpha_number" /&gt;</span></span></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;node target="browser_title" required="true" maxlength="250" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/form&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;response callback_func="completeInsertForm"&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="error" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="message" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="act" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="page" /&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;tag name="module_srl" /&gt;</div><div>&nbsp;&nbsp; &nbsp;&lt;/response&gt;</div><div>&lt;/filter&gt;</div><div><br></div><p></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class formAdminController extends form {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('+
'+
'module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('+
'page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl'+
',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.22 06:42:02
복원
<div class="eArea xe_content xe_dr_index"><ul class="toc"><li class="toc3"><a href="#h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</a></li><li class="toc3"><a href="#h1250840766341">form.admin.controller.php</a></li><li class="toc3"><a href="#h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</a></li></ul></div><div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다. 실제 DB의 xe_modules table 등에 등록을 하여 mid및 module_srl을 생성합니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840884734">견적서폼 추가 화면 formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function dispFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br>$skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>Context::set('skin_list',$skin_list);<br><br>$oLayoutMode = &amp;getModel('layout');<br>$layout_list = $oLayoutMode-&gt;getLayoutList();<br>Context::set('layout_list', $layout_list);<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class formAdminController extends form {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840906359">견적서폼 추가 formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.21 16:49:32
복원
<div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840454574">formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function dispFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br>$skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>Context::set('skin_list',$skin_list);<br><br>$oLayoutMode = &amp;getModel('layout');<br>$layout_list = $oLayoutMode-&gt;getLayoutList();<br>Context::set('layout_list', $layout_list);<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840766341">form.admin.controller.php</h3></div><div class="eArea xe_content xe_dr_txt"><p>module.xml에서 정의한 controller 부분 중 'procFormAdmin~'으로 시작하는 관리자 controller action과 생성자
init를 form class를 상속받는 formAdminController class에 member method로 작성합니다.</p></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp; class formAdminController extends form {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 초기화<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서 폼(mid) 등록<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840803760">formAdminController::procFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function procFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // request 값을 모두 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args = Context::getRequestVars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $args-&gt;module = 'form';<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module controller를 받음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // module_srl의 값에 따라 insert/update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$args-&gt;module_srl) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;insertModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_registed';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output = $oModuleController-&gt;updateModule($args);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $msg_code = 'success_updated';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 오류가 있으면 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!$output-&gt;toBool()) return $output;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $output은 Object객체로 리턴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $oModuleController-&gt;insertModule() 또는 $oModuleController-&gt;updateModule() 에서 리턴시 설정한 module_srl를 가져옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $module_srl = $output-&gt;get('module_srl');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 에디터의 높이 조정 및 자동 저장을 하지 않음<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oEditorModel = &amp;getModel('editor');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController = &amp;getController('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config = $oEditorModel-&gt;getEditorConfig($module_srl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;editor_height = 300;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $editor_config-&gt;enable_autosave = 'N';<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleController-&gt;insertModulePartConfig('editor',$module_srl,$editor_config);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // $this객체에 add()로 변수를 등록하여 호출하여 XMLRPC로 리턴시 값을 추가함<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('page',Context::get('page'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;add('module_srl',$output-&gt;get('module_srl'));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setMessage($msg_code);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br></p></div>
sol 2009.08.21 16:46:37
복원
<div class="eArea xe_content xe_dr_txt"><p>견적서폼을 등록하는 관리자 화면입니다. 게시판으로 보면 게시판을 생성하는 부분입니다.<br></p></div><div class="eArea xe_content xe_dr_hx"><h3 id="h1250840454574">formAdminView::dispFormAdminInsert()</h3></div><div class="eArea xe_content xe_dr_txt"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @brief 견적서(mid) 추가/수정 폼<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function dispFormAdminInsert(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 스킨 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oModuleModel = &amp;getModel('module');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('skin_list',$skin_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 레이아웃 목록을 구해옴<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayoutMode = &amp;getModel('layout');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $layout_list = $oLayoutMode-&gt;getLayoutList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context::set('layout_list', $layout_list);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 템플릿 파일 지정<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setTemplateFile('form_insert');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></p></div><div class="eArea xe_content xe_dr_txt"><p>mid를 생성시 레이아웃 및 스킨을 설정 합니다. 견적서 모듈에서도 스킨 및 레이아웃 지정을 위해<br>form/skins/의 스킨 목록과 XE_ROOT/layouts/ 레이아웃 목록을 가져와 템플릿에 전달합니다.<br><br>$oModuleModel = &amp;getModel('module');<br>$skin_list = $oModuleModel-&gt;getSkins($this-&gt;module_path);<br>Context::set('skin_list',$skin_list);<br><br>$oLayoutMode = &amp;getModel('layout');<br>$layout_list = $oLayoutMode-&gt;getLayoutList();<br>Context::set('layout_list', $layout_list);<br></p></div>
sol 2009.08.21 16:43:25