knu project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

694 lines
23 KiB

<%
/************************************************************@@
* Program Name : report_regist.jsp
* Description : /보고자/내문서함/임시보고함/보고자료 변경
* Author : 기현테크
* Create Date : 2010-11-27
* History :
@@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8"
import="java.net.URLEncoder"
import="kr.co.kihyun.beans.user.HttpSSOLogin" import="java.net.*"
import="kr.co.kihyun.util.MUtil" import="kr.co.kihyun.lang.MString"
import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.lang.MInteger"
import="kr.co.kihyun.lang.MLong"
import="kr.co.kihyun.text.html.ServletUtil"
import="kr.co.kihyun.moumi.Moumi"
import="kr.co.kihyun.moumi.report.MReport"
import="kr.co.kihyun.moumi.report.stat.StaticMReport"
import="kr.co.kihyun.moumi.doc.table.MTable"
import="kr.co.kihyun.moumi.doc.table.item.MItem"
import="kr.co.kihyun.moumi.report.MReportData"
import="kr.co.kihyun.beans.totsys.report.ReportModifyManager"
import="kr.co.kihyun.beans.totsys.report.ReportView"
import="kr.co.kihyun.beans.totsys.report.ReportDataSet"
import="kr.co.kihyun.text.javascript.JavaScriptUtil"
import="javax.jdo.PersistenceManager"
import="javax.jdo.Transaction"
import="kr.co.kihyun.beans.entity.util.*"
import="kr.co.kihyun.beans.entity.*"%>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
/********** session내의 userId **********/
String usID = HttpSSOLogin.getLoginID(request);
String dtID = HttpSSOLogin.getDeptID(request);
String dpName = HttpSSOLogin.getDeptName(request);
String savePath = Moumi.getRepoPerRoot().getPath() + "/fileUpload";
/********* Parameter *********/
Long reportID = MLong.parseLong(request.getParameter("reportID"),null);
int rowCount = MInteger.parseInt(request.getParameter("rowCount"), 1);
int delRowNum = MInteger.parseInt(request.getParameter("delRowNum"), 1);
String modifyMode = clearXSS(request.getParameter("modifyMode"),"");
String copyForm = MString.checkNull( Encoder.toJava(request.getParameter("copyForm")) );
String tableRows = MString.checkNull( Encoder.toJava(request.getParameter("tableRows")) );
TotReport totReport = pm.getObjectById(TotReport.class, reportID);
if(tableRows.equals("") || tableRows==null){
String datas = JavaScriptUtil.toCRLF(totReport.getData());
int[] tableRowList = MReportData.getRowNumList(datas);
for(int r=0; r<tableRowList.length; r++){
if(r==0)
tableRows=Integer.toString(tableRowList[r]);
else
tableRows=tableRows+","+Integer.toString(tableRowList[r]);
}
}
/********* report *********/
ReportModifyManager reportModifyManager = new ReportModifyManager(request, totReport.getTotDoc(), dtID, usID, rowCount, tableRows);
int tableType = reportModifyManager.getTableType();
String tableTypes = reportModifyManager.getTableTypes();
rowCount = reportModifyManager.getRowCount();
String insertForm = reportModifyManager.getInsertForm();
String baseInsertForm = reportModifyManager.getInsertForm();
String putValScript = reportModifyManager.getPutValScript();
String changeAllScript = reportModifyManager.getChangeAllScript();
String inDataJavaScript = reportModifyManager.getInDataJavaScript();
if(tableTypes.indexOf("1")==-1){
tableType = MTable.STATIC;
}else{
tableType = MTable.DYNA;
}
String addJavaScript = "";
String hiddenData = "";
if(tableType == MTable.DYNA){
addJavaScript = reportModifyManager.getAddJavaScript();
hiddenData = reportModifyManager.getHiddenData();
}
reportModifyManager=null;
session.setAttribute("modifySuccTargetURI", "/totsys/repoper/mydocbox/tempbox/report_list.jsp?reportType=TEMP");
if(!copyForm.equals("")){
ReportDataSet reportDataSet = new ReportDataSet();
insertForm = reportDataSet.setForm(insertForm,copyForm);
if(reportDataSet.getChange()==0){%>
<script>alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.formError")%>')</script>
<%}else{
inDataJavaScript="";
}
}
String realFileName = "";
String viewFileName = "";
for (String fileName : totReport.getAttachments().keySet()) {
viewFileName += fileName + ";";
realFileName += fileName + ";";
}
/*********** append file name vlaues ***********/
String[] svrFilenameList = realFileName.split(";");
%>
<HTML>
<HEAD>
<TITLE><%=Moumi.getTitle()%></TITLE>
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script src='/totsys/common/js/checkNum.js'></script>
<script src="/totsys/common/js/util.js"></script>
<script src="/totsys/common/js/calendar.js"></script>
<script src="/totsys/common/js/drag.js"></script>
<script src="/totsys/common/js/popup.js"></script>
<script language="javascript">
num = <%= svrFilenameList.length %>;
usrFilenames = "<%= viewFileName %>";
svrFilenames = "<%= realFileName %>";
fileInfos = "";
userFilePath = "";
function checkFile(Filename, Filename2){
mkFileList(Filename, Filename2, 'add');
num++;
}
function mkFileList(Filename, Filename2, size, mode) {
var tmpSvrFilenames = "";
var tmpUsrFilenames = "";
var tmpFileInfos = "";
//var nList4 = "";
if (!mode){
mode = "add";
}
subFilename = Filename;
subFilename2 = cut_str( 1, Filename2, "/");
subinfo = size;
usrFilenameList = usrFilenames.split(";", num);
svrFilenameList = svrFilenames.split(";", num);
fileInfoList = fileInfos.split(";", num);
if (mode == "add") {
if (svrFilenames && usrFilenames) {
for (i=0; i<num; i++) {
tmpSvrFilenames += svrFilenameList[i] + ";";
tmpUsrFilenames += usrFilenameList[i] + ";";
tmpFileInfos += fileInfoList[i] + ";";
}
tmpSvrFilenames += subFilename;
tmpUsrFilenames += subFilename2;
tmpFileInfos += subinfo;
} else {
tmpSvrFilenames = subFilename;
tmpUsrFilenames = subFilename2;
tmpFileInfos = subinfo;
}
} else {
for (i=0; i<num; i++) {
if (subFilename == svrFilenameList[i])
continue;
else {
tmpSvrFilenames += svrFilenameList[i] + ";";
tmpUsrFilenames += usrFilenameList[i] + ";";
tmpFileInfos += fileInfoList[i] + ";";
}
}
}
usrFilenames = tmpUsrFilenames;
svrFilenames = tmpSvrFilenames;
fileInfos = tmpFileInfos;
}
function cut_str( state, value, separator ) {
if (!separator){
separator = ".";
}
if ( state == 0 ){
return value.substring(0, value.lastIndexOf(separator));
}
if ( state == 1 ){
return value.substring(value.lastIndexOf(separator)+1, value.length );
}
}
function delFrm() {
var list = document.subUpload.delFrm.fileList;
var a = list.options[list.selectedIndex].value;
var no = -1;
usrFilenameList = usrFilenames.split(";", num);
svrFilenameList = svrFilenames.split(";", num);
for(i=0; i<num; i++) {
if (a == svrFilenameList[i]) {
no = i;
mkFileList(svrFilenameList[i], usrFilenameList[i], 0,"delete");
}
}
if (no != -1) {
if (num > 0){
num--;
}
document.subUpload.delFrm.submit();
}
}
<%= putValScript %>
function changeAll(){
<%= changeAllScript %>
}
function insertData(){
<%= inDataJavaScript.toString() %>
}
/********** userfile list와 serverfile list를 배열로 저장 **********/
function viewFrm(num) {
name = "fileUp"+num;
eval(name + ".style.visibility = \"visible\";" );
eval(name + ".style.display = \"block\";" );
//dform.upFile.focus();
}
function viewNote(){
var width = 600;
var height = 450;
var leftpos = (screen.width - width) / 2;
var toppos = (screen.height - height) / 2;
window.open("/totsys/common/web/note/popup_note.jsp?docID=<%=totReport.getTotDoc().getId()%>","","width="+width+", height="+height+", toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left= "+ leftpos +" ,top= "+ toppos);
}
function deptCheck(){
if( <%=tableType%> == 1 ){
var tmp = document.modifyForm.rowCount.value;
if( parseInt(tmp) < 1 ) {
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.addRow")%>');
document.modifyForm.delRowNum.value = '';
modifyForm.delRowNum.focus();
return false;
}
}
var url = '/totsys/common/web/dept_check/popup_reportsend.jsp?deptID=<%= dtID %>';
var target = 'deptCheck';
var width = 385;
//var height = 221;
var height = 271;
var align = 'center';
var valign = 'middle';
var scroll = 'no';
var resize = 'no';
<%if (changeAllScript.length() > 0) {%>
changeAll();
<%}%>
changeAll();
document.dform.usrFilenames.value = usrFilenames;
document.dform.svrFilenames.value = svrFilenames;
//dform.submit();
var farwindow = null;
farwindow = getOpener(url, target, width, height, align, valign, scroll, resize);
farwindow.focus();
}
function totApply(){
totApplyForm.submit();
}
function ShowCopy(){
window.open('./popup_copy_form.jsp','makecopy','width=950,height=595,scrollbars=no,resizable=no');
}
<%if(tableType == MTable.DYNA){%>
//동적 표에서만 사용
function insertData(){
<%= inDataJavaScript %>
}
function lineAdd(){
<%= addJavaScript %>
modifyForm.rowCount.value='<%= (rowCount+2) %>';
modifyForm.modifyMode.value='addRow';
modifyForm.submit();
}
function lineAddNum(){
var tmp = document.modifyForm.addRowNum.value;
var tr = document.modifyForm.tableRows.value;
var st = document.modifyForm.tables.value;
if(tmp == ''){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.addLine")%>');
modifyForm.addRowNum.focus();
return;
}else if(isNaN(tmp)){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.inputNumber")%>');
document.modifyForm.addRowNum.value = '';
modifyForm.delRowNum.focus();
return;
}else if(1 > parseInt(tmp)){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.oneMore")%>');
document.modifyForm.addRowNum.value = '';
modifyForm.delRowNum.focus();
return;
}
var trlist = tr.split(",");
trlist[parseInt(st)-1] = parseInt(tmp)+parseInt(trlist[parseInt(st)-1]);
for(i=0; i<trlist.length; i++){
if(i==0) tr=trlist[i];
else tr=tr+","+trlist[i];
}
var num = parseInt(tmp)+parseInt('<%= (rowCount) %>');
<%= addJavaScript %>
modifyForm.rowCount.value=num;
modifyForm.modifyMode.value='addRow';
modifyForm.tableRows.value=tr;
modifyForm.submit();
}
function lineDel(){
var tmp = document.modifyForm.delRowNum.value;
var tr = document.modifyForm.tableRows.value;
var st = document.modifyForm.tables.value;
var trlist = tr.split(",");
if(tmp == ''){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.deleteLine")%>');
modifyForm.delRowNum.focus();
return;
}else if(isNaN(tmp)){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.inputNumber")%>');
document.modifyForm.delRowNum.value = '';
modifyForm.delRowNum.focus();
return;
}else if(1 > parseInt(tmp)){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.oneMore")%>');
document.modifyForm.delRowNum.value = '';
modifyForm.delRowNum.focus();
return;
}else if(parseInt(tmp) > parseInt(trlist[parseInt(st)-1])){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.lessLine")%>');
document.modifyForm.delRowNum.value = '';
modifyForm.delRowNum.focus();
return;
}
trlist[parseInt(st)-1] = parseInt(trlist[parseInt(st)-1])-1;
for(i=0; i<trlist.length; i++){
if(i==0) tr=trlist[i];
else tr=tr+","+trlist[i];
}
<%= addJavaScript %>
modifyForm.rowCount.value='<%= (rowCount-1) %>';
modifyForm.modifyMode.value='delRow';
modifyForm.tableRows.value=tr;
modifyForm.submit();
}
function checkReport(){
if(1 > dform.rowCount.value){
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.notSubmitDoc")%>');
return;
}
openPopup('./popup_dept_check.jsp?deptID=<%= dtID %>&deptName=<%= dpName %>', '350', '290', 'no');
}
</script>
<%}%>
</HEAD>
<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0"
MARGINWIDTH="0" MARGINHEIGHT="0" onload="insertData();">
<table width="100%" height="70" border="0" cellpadding="0"
cellspacing="0">
<jsp:include page="/totsys/common/inc/repoper/top/top.jsp" flush="true" />
<tr>
<td nowrap width="0"></td>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="537"><a
href="/totsys/repoper/mydocbox/returnbox/report_list.jsp"><img
src="/totsys/common/images/bt_doc_list.gif" border="0"></a></td>
<td align="right">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<!--1픽셀 띄우기-->
<tr>
<td height="1"></td>
</tr>
<!--파란색 밑줄-->
<tr>
<td bgcolor="6891cb" height="2"></td>
</tr>
<tr>
<!---- 내용---->
<td height="31" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!---- 문서내용 시작 ---->
<tr>
<td height="50" colspan="4" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"
style="padding-top: 25; padding-bottom: 25; padding-left: 25; padding-right: 25;">
<!---- 행추가, 행삭제 시작 ---->
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<!---- 행추가, 행삭제 시작 ---->
<%if(tableType == MTable.DYNA){%>
<tr>
<td>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<form name="modifyForm" method="post"
action="./report_modify.jsp"><input type="hidden"
name="comment" value="<%= totReport.getNote() %>">
<input type="hidden" name="reportID"
value="<%= reportID %>"> <input type="hidden"
name="rowCount" value="<%= rowCount %>"> <input
type="hidden" name="inForm"
value='<%= URLEncoder.encode(baseInsertForm, "UTF-8") %>'>
<input type="hidden" name="tableType"
value="<%= tableType %>"> <input type="hidden"
name="modifyMode" value="addRow"> <input
type="hidden" name="tableRows" value="<%= tableRows%>">
<%= hiddenData %>
<tr>
<td width="62" align="right"
background="/totsys/common/images/bt_line_addbg.jpg">
<input name="addRowNum" type="text" size="3"
maxlength="2" class="inputtxt"></td>
<td width="47"><img onclick="lineAddNum();"
style="cursor: hand;"
src="/totsys/common/images/bt_line_add.jpg" width="47"
height="22" border="0"></td>
<td width="5">&nbsp;</td>
<td width="62" align="right"
background="/totsys/common/images/bt_line_delbg.jpg">
<input name="delRowNum" type="text" size="3"
maxlength="2" class="inputtxt"></td>
</form>
<td width="47"><img onclick="lineDel();"
style="cursor: hand;"
src="/totsys/common/images/bt_line_del.jpg" width="47"
height="22" border="0"></td>
<td width="*">&nbsp;</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td nowrap height="20"></td>
</tr>
<%}%>
<!---- 행추가, 행삭제 끝---->
<tr>
<td>
<form name="dform" method="post"
action="/servlet/kr.co.kihyun.beans.totsys.report.HttpReportModifyer"
enctype="multipart/form-data"><input type="hidden"
name="reportID" value="<%= reportID %>"> <input
type="hidden" name="rowCount" value="<%= rowCount %>">
<input type="hidden" name="inForm"
value='<%= URLEncoder.encode(baseInsertForm, "UTF-8") %>'>
<input type="hidden" name="tableType"
value="<%= tableType %>"> <input type="hidden"
name="repDocID" value="repDocID"> <input
type="hidden" name="tableTypes" value="<%= tableTypes %>">
<input type="hidden" name="tableRows"
value="<%= tableRows%>"> <input type="hidden"
name="name" value=""> <input type="hidden"
name="tel" value=""> <INPUT type="hidden"
name="usrFilenames"> <INPUT type="hidden"
name="svrFilenames"> <!-------------------------------------------- 보고 폼 시작 -------------------------------------------->
<% out.println(insertForm); %> <!-------------------------------------------- 보고 폼 끝 -------------------------------------------->
</td>
</tr>
<tr>
<td align="center">
<%if (changeAllScript.length() > 0) {%> <img
style="cursor: hand;"
onClick='changeAll();changeAll();changeAll();changeAll();'
src="/totsys/common/images/bt_cal.gif" border="0">
<%}%>
</td>
</tr>
<tr>
<td height="15"></td>
</tr>
<!--세미타이틀-->
<tr>
<td colspan="4">
<table border="0" width="100%" cellpadding="0"
cellspacing="0">
<tr>
<td style="width: 14"><img
src="/totsys/common/images/ico_1.gif"></td>
<td class="kecttep_title" style="padding-left: 5"
align="left" width="100%">[<%= Moumi.getMessageBundle().getString("moumi.message.tot_report.opinionFile") %>]</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><textarea name="comment"
style="width: 100%; height: 60;"><%= totReport.getNote() %></textarea>
</td>
</tr>
<tr>
<td><!-- 파일 첨부 시작 -->
<div id='fileUp1'>
<table width="100%" border="0" cellpadding="0"
cellspacing="0">
<!---- 첨부파일 찾아보기 ---->
<!---- 파일 찾아보기 ---->
<tr>
<td colspan="2"><input type=file
style="width: 100%" name="upFile" class="inputtxt">
<input type=hidden name="upFile"></td>
</tr>
<!---- 기존파일 / 첨부파일 삭제 ---->
<tr>
<%
for (String fileName : totReport.getAttachments().keySet()) {
%>
<td class="body"><font color="#FF6600"><b>+</b>File
#1&nbsp;&nbsp;</font><a class="a"
href="/servlet/kr.co.kihyun.text.html.HttpViewer?saveAs=<%= URLEncoder.encode(fileName, "UTF-8") %>&fileName=<%= fileName %>&reportID=<%= totReport.getId() %>"
target="new"><%= fileName %></a>&nbsp;&nbsp;&nbsp;<input
type=checkbox name=dropfile value=1><%= Moumi.getMessageBundle().getString("moumi.message.tot_doc.file") %>
<%=Moumi.getMessageBundle().getString("moumi.message.tot_report.delete")%>
<input type="hidden" name=delFile></td>
<%}%>
</tr>
</table>
</div>
<!-- 파일 첨부 끝 --></td>
</form>
<!-- dform end -->
</tr>
<tr>
<td height="37" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="#" onClick='ShowCopy();'><img
src="/totsys/common/images/bt_copyin.gif" border="0"></a></td>
<td width="3"></td>
<td><a href="#" onClick="return deptCheck();"><img
src="/totsys/common/images/bt_reportsend.gif"
border="0"></a></td>
<td width="3"></td>
</tr>
<form name="totApplyForm" method="post"
action="./tot_report_modify.jsp"><input
type="hidden" name="reportID" value="<%= reportID %>">
<input type="hidden" name="rowCount"
value="<%= rowCount %>"> <input type="hidden"
name="delRowNum" value="<%= delRowNum %>"> <input
type="hidden" name="modifyMode"
value="<%= modifyMode %>"></form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<!---- 문서내용 끝---->
</tr>
<!--파란색 밑줄-->
<tr>
<td bgcolor="6891cb" height="2" colspan="4"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!--1픽셀 띄우기-->
<tr>
<td height="1"></td>
</tr>
<!---- bottom bar 버튼 시작 ---->
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><a href="./report_list.jsp"><img
src="/totsys/common/images/bt_rep_list.gif" border="0"></a></td>
<td align="right">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="#" onclick="viewNote();"><img
src="/totsys/common/images/bt_proposal.gif" border="0"></a></td>
<td width="5">&nbsp;</td>
<td><a href="#" onclick="viewFrm(1);"><img
src="/totsys/common/images/bt_fileadd.gif" border="0"></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!---- bottom bar 버튼 끝 ---->
</table>
</td>
<td nowrap width="10"></td>
</tr>
<!--1픽셀 띄우기-->
<tr>
<td height="30"></td>
</tr>
</table>
</BODY>
<div id="SetWin" style="position: absolute; visibility: hidden; width: 100px; height: 100px; background: silver; border: 1px solid #333333; line-height: 1.4em; padding: 3px 3px"></div>
</HTML>
<%
}catch(Exception ex){ex.printStackTrace();
out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/servlet/kr.co.kihyun.beans.user.HttpSSOLogin?mode=logout';"));
}finally{
if(tx.isActive())
tx.rollback();
pm.close();
}
%>