
<%
/************************************************************@@
  * Program Name	: popup_copy_form.jsp
  * Description		: /집계자/내문서함/등록함/복사양식 첨부
  * Author				: 강원중
  * Create Date		: 2004-11-05
  * History				:
@@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder" import="javax.jdo.PersistenceManager"
	import="javax.jdo.Transaction" import="kr.co.kihyun.lang.MString"
	import="kr.co.kihyun.lang.MLong"
	import="kr.co.kihyun.text.html.TagFilter"
	import="kr.co.kihyun.lang.StringConverter"
	import="kr.co.kihyun.moumi.Moumi"
	import="kr.co.kihyun.beans.entity.util.*"%>

<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	/********** get Parameter *************/
	Long reuseDocID = MLong.parseLong(request.getParameter("reuseDocID"), null);

	/*********** doc value *****************/
	String repDocForm = "";
	if(reuseDocID != null){
		TotDoc totDoc = null;
		totDoc = reuseDocID == null ? null : pm.getObjectById(TotDoc.class, reuseDocID);
		repDocForm = totDoc.getForm();
		repDocForm = TagFilter.convertSingle(repDocForm);
		repDocForm = StringConverter.toOneLine(repDocForm);
	}

%>

<%@page import="kr.co.kihyun.beans.entity.TotDoc"%><html>
<head>
<title><%=Moumi.getTitle()%></title>
<link rel="stylesheet" href="/totsys/common/css/text.css"
	type="text/css">
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
	type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script language=javascript>
			function copyForm(){
				//opener.docForm.copyForm.value = EditCtrl.document.body.innerHTML;
				//td 안닫힌 태그 닫기
				var temp=$('<div>'+EditCtrl.document.body.innerHTML+'</div>');
				temp.find('td').each(function(i,o){
					try{
						if(o.outerHTML.toLowerCase().indexOf('</td>')==-1){
							o.outerHTML+='</td>';
						}
					}catch(e){}
				});
		        opener.dform.copyForm.value = temp.html();
				opener.focus();
				window.close();
			}

			<%if(reuseDocID != null){%>
			function initForm(){

				EditCtrl.document.body.innerHTML = '<%= repDocForm %>';
			}
			<%}%>
		</script>
</head>

<body style='' bgcolor="#FFFFFF" text="#000000" leftmargin="0"
	topmargin="0" marginwidth="0" marginheight="0">
<table width="950" height="570" border="0" cellspacing="0"
	cellpadding="0">
	<tr>
		<td width="29"><img
			src="/totsys/common/images/popupt_top_left.gif" width="29"
			height="19"></td>
		<td background="/totsys/common/images/popupt_top_center.gif"
			height="19">&nbsp;</td>
		<td width="30"><img
			src="/totsys/common/images/popupt_top_right.gif" width="30"
			height="19"></td>
	</tr>
	<tr>
		<td rowspan="2"
			background="/totsys/common/images/popupt_center_left.gif">&nbsp;</td>
		<td valign="top">
		<table valign="top" width="100%" height="100%" border="0"
			cellpadding="0" cellspacing="0">
			<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
			<tr>
				<td width="100%" style="padding-top: 15; padding-bottom: 15;">
				<table valign="top" cellSpacing="0" cellPadding="0" border="0"
					width="100%" height="200">
					<tr>
						<td>
						<table width="100%" border="0" cellpadding=0 cellspacing=0
							class=llist1>
							<form name="gocomp0" action="/Mail-bin/send_mail.frame"
								method=post><input type="hidden" name=What value=0>
							<input type="hidden" name=BODY> <input type="hidden"
								name=CMD value=''> <input type="hidden" name=MSGID
								value=''> <input type="hidden" name=TO> <input
								type="hidden" name=CC> <input type="hidden" name=BCC>
							<input type="hidden" name=SUBJECT> <input type="hidden"
								name=XSUBJECT value=''> <input type="hidden" name=PID
								value='11295'></form>
							<FORM name=Mail_Form target=_parent method=post
								action="/Mail-bin/start_mail/simplehtml"><input
								type="hidden" name=SENDACTION value=""> <input
								type="hidden" name=RESV_Y value=""> <input type="hidden"
								name=RESV_M value=""> <input type="hidden" name=RESV_D
								value=""> <input type="hidden" name=RESV_H value="">
							<input type="hidden" name=ISLINEANS value=""> <input
								type="hidden" name=PID value="11295"> <input
								type="hidden" name=MSGID value=> <input type="hidden"
								name=LINKURL value=""> <input type="hidden"
								name=LINKCOMMENT value=""> <input type="hidden"
								name=KEYWORD value=""> <input type="hidden" name=KEYTYPE
								value=""> <input type="hidden" name=FOLDER value="">
							<input type="hidden" name=mpage value=""> <input
								type="hidden" name=UseCompose value=""> <SCRIPT
								LANGUAGE='javascript' src='/totsys/common/js/editor.js'></SCRIPT>
							<tr class=bgw1>
								<td colspan=3><iframe id='i_fontcolor'
									style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
									scrolling=no frameborder=0 width=120 height=120></iframe> <iframe
									id='i_backcolor'
									style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
									scrolling=no frameborder=0 width=120 height=120></iframe> <iframe
									id='i_image'
									style='color: #000000; background-color: #efefef; border: 1px double #BFBFBF; cursor: default; position: absolute; visibility: hidden;'
									scrolling=no frameborder=0 width=325 height=85></iframe> <iframe
									id='i_link'
									style='color: #000000; background-color: #efefef; border: 1px double #BFBFBF; cursor: default; position: absolute; visibility: hidden;'
									scrolling=no frameborder=0 width=325 height=70></iframe> <iframe
									id='i_emoticon'
									style='background-color: #efefef; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
									scrolling=no frameborder=0 width=125 height=125></iframe> <br>
								<table cellpadding=0 cellspacing=0 border=0>
									<tr>
										<td><font color="FF6600"><b>&nbsp;&nbsp;[ 표
										넣기창 ] </b></font></td>
									</tr>
									<tr>
										<td height=10></td>
									</tr>
									<tr>
										<td>
										<div id='editctrl'
											style='display: show; width: 890; height: 400;'><iframe
											name='EditCtrl' width='100%' height='100%' scrolling='YES'
											onfocus='layeroff();' onblur='nowkong.SaveSelection();'></iframe></div>
										<input type="hidden" name=FORSAVE
											value="&lt;HEAD&gt;
																	&lt;STYLE&gt;
																	P {margin-top:2px;margin-bottom:2px;}
																	&lt;/STYLE&gt;
																	&lt;/HEAD&gt;
																	&lt;BODY oncontextmenu='return false;' style='background-color: ; background-image: url(); ' topmargin=11 leftmargin=11&gt;
																	&lt;/BODY&gt;">
										<input type="hidden" name=BODY value=""> <input
											type="hidden" name=BODYBG value=""> <input
											type="hidden" name=BODYBGC value=""></td>
									</tr>
								</table>
								</td>
							</tr>
							</FORM>
						</table>
						<br>
						<SCRIPT FOR=window EVENT=onbeforeunload LANGUAGE="JScript">
												document.Mail_Form.FORSAVE.value=EditCtrl.document.documentElement.innerHTML;
											</SCRIPT> <SCRIPT FOR=window EVENT=onload LANGUAGE="javascript">
											<%if(reuseDocID != null){%>
												initRepDocID();
											<%}else{%>
												init();
											<%}%>
											</SCRIPT>
						<table align="center" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td><a href="#" onclick="javascript:copyForm();"
									onMouseOut="MM_swapImgRestore()"
									onMouseOver="MM_swapImage('bt_enter1','','images/bt_enter.gif',1)"><img
									src="/totsys/common/images/bt_enter.gif" name="bt_enter1"
									border="0" id="bt_enter1"></a></td>
								<td>&nbsp;</td>
								<td><a href="#" onclick="javascript:window.close();"
									onMouseOut="MM_swapImgRestore()"
									onMouseOver="MM_swapImage('bt_cancel3','','images/bt_cancel3.gif',1)"><img
									src="/totsys/common/images/bt_cancel3.gif" name="bt_cancel3"
									border="0"></a></td>
							</tr>
						</table>
						</form>
						</td>
					</tr>
				</table>
				</td>
			</tr>
			<!-----  내용 들어갈 부분  끝 ---->
		</table>
		</td>
		<td rowspan="2"
			background="/totsys/common/images/popupt_center_right.gif">&nbsp;</td>
	</tr>
	<tr>
		<td height="1" align="center"></td>
	</tr>
	<tr>
		<td><img src="/totsys/common/images/popupt_bottom_left.gif"
			width="29" height="24"></td>
		<td background="/totsys/common/images/popupt_bottom_center.gif"
			height="24">&nbsp;</td>
		<td><img src="/totsys/common/images/popupt_bottom_right.gif"
			width="30" height="24"></td>
	</tr>
</table>
</body>
</html>
<%
}catch(Exception ex){
        //38.오류메세지를 통한 정보 노출(getMessage)_CWE-209 : Update by YOUNGJUN,CHO
	//out.println(ex);
	ex.printStackTrace();
	//out.println("<html><body style='overflow=auto' bgcolor='white'><h1>Can't contact servlet runner</h1><br><br>Message : "+ex.getMessage()+"</body></html>");
	//out.println("<META HTTP-EQUIV='refresh' CONTENT='0.1; URL=/error/exception.jsp'>");
        //================================================
}finally{
    if(tx.isActive())
        tx.rollback();
        pm.close();
}
%>
