📄 documentlist.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.*,java.sql.*,java.text.SimpleDateFormat,java.text.DateFormat,java.util.Date,DBstep.iDBManager2000.*" %>
<%!
DBstep.iDBManager2000 DbaObj=new DBstep.iDBManager2000();
//列出所有模版
public String GetTemplateList(String ObjType, String FileType)
{
String mTemplateList,mstr="";
mTemplateList = "<select name=" + ObjType + " >";
mTemplateList = mTemplateList + "<option value=''>--------不用模版--------</option>";
String Sql = "select RecordID,Descript from Template_File where FileType='" + FileType + "'"; //打开数据库
try {
if (DbaObj.OpenConnection()) {
try {
ResultSet result = DbaObj.ExecuteQuery(Sql);
mstr="selected";
while (result.next()) {
mTemplateList = mTemplateList + "<option value='" + result.getString("RecordID") + "'"+mstr+">" + result.getString("Descript") + "</option>";
}
result.close();
}
catch (SQLException sqlex) {
System.out.println(sqlex.toString());
}
}
else {
System.out.println("GetTemplateList: OpenDatabase Error");
}
}
finally {
DbaObj.CloseConnection();
}
mTemplateList = mTemplateList + "</select>";
return (mTemplateList);
}
/**
* 功能或作用:格式化日期时间
* @param DateValue 输入日期或时间
* @param DateType 格式化 EEEE是星期, yyyy是年, MM是月, dd是日, HH是小时, mm是分钟, ss是秒
* @return 输出字符串
*/
public String FormatDate(String DateValue,String DateType)
{
String Result;
SimpleDateFormat formatter = new SimpleDateFormat(DateType);
try{
Date mDateTime = formatter.parse(DateValue);
Result = formatter.format(mDateTime);
}catch(Exception ex){
Result = ex.getMessage();
}
if (Result.equalsIgnoreCase("1900-01-01")){
Result = "";
}
return Result;
}
%>
<html>
<head>
<title>WebEditor实例</title>
<link rel='stylesheet' type='text/css' href='test.css'>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffffff">
<div align="center"><font size=4 color=ff0000>办公自动化网络文档处理示例[WebEditor嵌入版]</font></div>
<hr size=1>
<OBJECT id="WebOffice" width="100%" height="24" classid="clsid:33739A7E-2004-4D1C-88D5-D50B18F7C347" codebase="WebEditor.ocx#version=4,4,0,0" >
<param name="BorderStyle" value="1">
<param name="Menubar" value="1">
<param name="Toolbars" value="1">
</OBJECT>
<OBJECT id="WebHandWrite" width="100%" height="10" classid="clsid:4F5880F1-39BB-415E-BC85-3AD756D438AB" codebase="DlkjSignature.ocx#version=2,0,0,0">
<param name="UserColor" value="#0f0f00">
<param name="PenWidth" value="3">
<param name="ZOrder" value="4">
</OBJECT>
<hr size=1>
<br>
<table border=0 cellspacing='0' cellpadding='0' width=100% align=center class=TBStyle>
<tr>
<td colspan=6 class="TDTitleStyle">
<input type=button name="BookMark" value="标签管理" onclick="javascript:location.href='BookMark/BookMarkList.jsp'">
<input type=button name="Template" value="模板管理" onclick="javascript:location.href='Template/TemplateList.jsp'">
<input type=button name="Template" value="签章管理" onclick="javascript:location.href='Signature/SignatureList.jsp'">
</td>
</tr>
<tr>
<td colspan=2 class="TDTitleStyle" nowrap>
请选择模版:<%=GetTemplateList("doc",".doc")%>
<input type=button value="新建Word 文档" onclick="javascript:location.href='DocumentEdit.jsp?FileType=.doc&UserName='+username.value+'&Template='+doc.value;">
<br>
请选择模版:<%=GetTemplateList("xls",".xls")%>
<input type=button value="新建Excel文档" onclick="javascript:location.href='DocumentEdit.jsp?FileType=.xls&UserName='+username.value+'&Template='+xls.value;">
</td>
<td colspan=4 class="TDTitleStyle">由于不同用户保留痕迹将使用不同的颜色,所以在修改文档时请更改身份<input type=text name=username size=8 value="演示人"></td>
</tr>
<tr>
<td nowrap align=center class="TDTitleStyle" height="25">编号</td>
<td nowrap align=center class="TDTitleStyle">主题</td>
<td nowrap align=center class="TDTitleStyle">作者</td>
<td nowrap align=center class="TDTitleStyle">类型</td>
<td nowrap align=center class="TDTitleStyle">日期</td>
<td nowrap align=center class="TDTitleStyle">操作</td>
</tr>
<%
try {
if (DbaObj.OpenConnection()) {
try {
ResultSet result = DbaObj.ExecuteQuery("select Status,RecordID,HtmlPath,DocumentID,Subject,Author,FileType,FileDate from Document order by DocumentID desc");
while (result.next()) {
String RecordID = result.getString("RecordID");
String HTMLPath = result.getString("HtmlPath");
if (HTMLPath == null)
HTMLPath = "";
%>
<tr>
<td class="TDStyle"><%=result.getString("DocumentID")%> </td>
<td class="TDStyle"><%=result.getString("Subject")%> </td>
<td class="TDStyle"><%=result.getString("Author")%> </td>
<td class="TDStyle"><%=result.getString("FileType")%> </td>
<td class="TDStyle"><%=FormatDate(result.getString("FileDate"),"yyyy-MM-dd")%> </td>
<td class="TDStyle" nowrap>
<input type=button onclick="javascript:location.href='DocumentEdit.jsp?RecordID=<%=RecordID%>&EditType=0&UserName='+username.value;" value="阅读">
<input type=button onclick="javascript:location.href='DocumentEdit.jsp?RecordID=<%=RecordID%>&EditType=1&UserName='+username.value;" value="修改[无痕迹]">
<input type=button onclick="javascript:location.href='DocumentEdit.jsp?RecordID=<%=RecordID%>&EditType=2&UserName='+username.value;" value="修改[有痕迹]">
<input type=button onclick="javascript:location.href='DocumentEdit.jsp?RecordID=<%=RecordID%>&EditType=3&UserName='+username.value;" value="审核">
<input type=button <% if (HTMLPath.equalsIgnoreCase("")) out.write("disabled"); %> onclick="javascript:window.open('<%=HTMLPath%>');" value="HTML">
</td>
</tr>
<%
}
result.close();
}
catch (SQLException sqlex) {
System.out.println(sqlex.toString());
}
}
else {
out.println("OpenDatabase Error");
}
}
finally {
DbaObj.CloseConnection();
}
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -