FormmodeLogList.jsp 6.19 KB
<%@page import="weaver.systeminfo.label.LabelComInfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.formmode.log.FormmodeLog"%>
<%@page import="com.weaver.formmodel.util.DateHelper"%>
<%@page import="java.text.DecimalFormat"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="SubComanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<%@ taglib uri="/browserTag" prefix="brow"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%!
/**
 * 获取目录下所有文件(按时间排序)
 * 
 * @param path
 * @return
 */
public List<File> getFileSort(String path) {
    List<File> list = getFiles(path, new ArrayList<File>());
    if (list != null && list.size() > 0) {
        Collections.sort(list, new Comparator<File>() {
            public int compare(File file, File newFile) {
                if (file.lastModified() < newFile.lastModified()) {
                    return 1;
                } else if (file.lastModified() == newFile.lastModified()) {
                    return 0;
                } else {
                    return -1;
                }
            }
        });
    }
    return list;
}

/**
 * 
 * 获取目录下所有文件
 * 
 * @param realpath
 * @param files
 * @return
 */
public List<File> getFiles(String realpath, List<File> files) {
    File realFile = new File(realpath);
    if (realFile.isDirectory()) {
        File[] subfiles = realFile.listFiles();
        for (File file : subfiles) {
            if (!file.isDirectory()) {
            	if(file.getName().endsWith(".log")){
	                files.add(file);
            	}
            }
        }
    }
    return files;
}
%>

<%
if (!HrmUserVarify.checkUserRight("ModeSetting:All", user)) {
	response.sendRedirect("/notice/noright.jsp");
	return;
}
int modelId = Util.getIntValue(request.getParameter("modelId"), 0);
String titlename = SystemEnv.getHtmlLabelNames("129637",user.getLanguage()) ;//建模引擎设置
int formEngineSetid = Util.getIntValue(request.getParameter("formEngineSetid"),0);
String isEnFormModeReply = "";
RecordSet.executeSql("select * from formEngineSet where isdelete=0");
if(RecordSet.next()){
	formEngineSetid = RecordSet.getInt("id");
	isEnFormModeReply = RecordSet.getString("isEnFormModeReply");
}
String rootPath = GCONST.getRootPath()+"log"+File.separator+"formmode"+File.separator;
List<File> fileList = getFileSort(rootPath);
%>
<html>
	<head>
		<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
		<script language=javascript src="/js/checkbox/jquery.tzCheckbox_wev8.js"></script>
		<script language=javascript src="/js/ecology8/hrm/HrmSearchInit_wev8.js"></script>
		<script language=javascript src="/js/ecology8/hrm/e8Common_wev8.js"></script>
		<script type="text/javascript">
			$(function(){
	 			$("#e8_tablogo").css({"background-image":"url(/js/tabs/images/nav/mnav2_wev8.png)"});
	 		});
		</script>
	</head>
	<body>
		<jsp:include page="/systeminfo/commonTabHead.jsp">
		   <jsp:param name="mouldID" value="<%=modelId%>"/>
		   <jsp:param name="navName" value="<%=titlename%>"/>
		</jsp:include>
		<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
		<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
		<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
		<form style="margin-top: 0px" id="frmMain" name=frmMain method=post action="/formmode/setup/formEngineSetOperation.jsp">
			<input type="hidden" id="formEngineSetid" name="formEngineSetid" value="<%=formEngineSetid%>"/>
			<table id="topTitle" cellpadding="0" cellspacing="0">
				<tr>
					<td></td>
					<td class="rightSearchSpan" style="text-align:right;">
						<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span>
					</td>
				</tr>
			</table>
			<table id="logListTable">
				<colgroup>
					<col style="width: 50%; ">
					<col style="width: 25%; ">
					<col style="width: 25%; ">
				</colgroup>
				<tr>
    				<th><%=SystemEnv.getHtmlLabelName(84276,user.getLanguage())%></th>
    				<th><%=SystemEnv.getHtmlLabelName(723,user.getLanguage())%></th>
    				<th><%=SystemEnv.getHtmlLabelName(2036,user.getLanguage())%></th>
    			</tr>
					<%
					DecimalFormat df=new DecimalFormat("#.##");
					for (int i = 0; i < fileList.size(); i++) {
						File tempFile = fileList.get(i);
						long t = tempFile.lastModified();
						Date d = new Date(t);
						String date = DateHelper.convertDateIntoYYYYMMDDStr(d);
						
						long size = tempFile.length();
						String sizeStr="";
				        if(size>(1024*1024))
				        	sizeStr=df.format(size/(1024.0*1024.0))+"M";
				        else if(size>1024)
				        	sizeStr=df.format(size/(1024.0))+"K";
				        else
				        	sizeStr=size+"B";
					%>
						<tr>
							<td style="padding-left: 30px;"><a href="/weaver/weaver.formmode.servelt.DownloadFile?filename=/log/formmode/<%=tempFile.getName() %>"><%=tempFile.getName()%></a></td>
							<td align="center"><%=date%></td>
							<td align="center"><%=sizeStr%></td>
						</tr>
					<%}%>
				</table>
		 </form>
	</body>
<script type="text/javascript">
function onSubmit(){
	frmMain.submit();
}
function formCheckAll() {
	if($G("isEnFormModeReply").checked) {
		jQuery("#isEnFormModeReply").val(1);
	}else{
		jQuery("#isEnFormModeReply").val(0);
	}
}

function openLogList(){
    	$("#rightMenu").css("visibility","hidden");
    	var h = $(window).height();
    	var w = $(window).width();
    	alert("==h=="+h+"===w==="+w);
    	var dialog = new window.top.Dialog();
			dialog.currentWindow = window;
			dialog.Width = w*0.8 ;
			dialog.Height = h*0.8;
			dialog.URL = "/formmode/setup/CustomTypeBrowser.jsp";
			dialog.callbackfun = function (paramobj, id1) {
				
			} ;
			dialog.Title = "<%=SystemEnv.getHtmlLabelName(129637,user.getLanguage())%>";//提示信息
			dialog.Drag = true;
			dialog.show();
    }
</script>
<style>

#logListTable{
	width:100%;
	border-collapse: collapse;
  	border: 1px solid #aaa;
}
#logListTable th{
  padding: 5px 15px 5px 6px;
  background-color: #d5d5d5;
  border: 1px solid #aaa;
}

#logListTable td {
  vertical-align: text-top;
  padding: 6px 15px 6px 6px;
  background-color: #efefef;
  border: 1px solid #aaa;
}
</style>
</HTML>