11
This commit is contained in:
@@ -0,0 +1,408 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditOffice.aspx.cs" Inherits="FineUIPro.Web.Common.FileManage.EditOffice" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta content="IE=7" http-equiv="X-UA-Compatible" />
|
||||
<title>文档编辑</title>
|
||||
<link href="../../Styles/Style.css" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="ntko.js"></script>
|
||||
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
$("#mblx").ready(
|
||||
function () {
|
||||
var mb = document.getElementById("drpBigType")
|
||||
for (i = 0; i < mb.options.length; i++) {
|
||||
if (mb.options[i].value == "<%=drpBigType %>") {
|
||||
mb.selectedindex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mb.selectedindex != undefined) {
|
||||
mb.value = mb.options[mb.selectedindex].value;
|
||||
}
|
||||
|
||||
bao("<%=drpBigType %>")
|
||||
|
||||
var sy = document.getElementById("drpSmallType");
|
||||
for (j = 0; j < sy.options.length; j++) {
|
||||
if (sy.options[j].value == "<%=drpSmallType %>") {
|
||||
sy.selectedindex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sy.selectedindex != undefined) {
|
||||
sy.value = sy.options[sy.selectedindex].value;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function bao(s) {
|
||||
var drpSmallType = document.getElementById('drpSmallType');
|
||||
drpSmallType.length = 0;
|
||||
if (s == "HSSE_ActionPlanTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "系统内项目";
|
||||
option1.value = "系统内项目";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "系统外项目";
|
||||
option2.value = "系统外项目";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "海外项目";
|
||||
option3.value = "海外项目";
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
}
|
||||
else if (s == "HSSE_MeetingTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "周例会";
|
||||
option1.value = "周例会";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "月例会";
|
||||
option2.value = "月例会";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "专题会议";
|
||||
option3.value = "专题会议";
|
||||
var option4 = document.createElement("option");
|
||||
option4.text = "HSE委员会会议";
|
||||
option4.value = "HSE委员会会议";
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
drpSmallType.options.add(option4);
|
||||
}
|
||||
else if (s == "HSSE_EmergencyTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "火灾";
|
||||
option1.value = "火灾";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "地震";
|
||||
option2.value = "地震";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "台风";
|
||||
option3.value = "台风";
|
||||
var option4 = document.createElement("option");
|
||||
option4.text = "高空坠落及重物打击";
|
||||
option4.value = "高空坠落及重物打击";
|
||||
var option5 = document.createElement("option");
|
||||
option5.text = "坍塌";
|
||||
option5.value = "坍塌";
|
||||
|
||||
var option6 = document.createElement("option");
|
||||
option6.text = "交通事故";
|
||||
option6.value = "交通事故";
|
||||
var option7 = document.createElement("option");
|
||||
option7.text = "传染病";
|
||||
option7.value = "传染病";
|
||||
var option8 = document.createElement("option");
|
||||
option8.text = "突发疾病";
|
||||
option8.value = "突发疾病";
|
||||
var option9 = document.createElement("option");
|
||||
option9.text = "放射源丢失或泄漏";
|
||||
option9.value = "放射源丢失或泄漏";
|
||||
var option10 = document.createElement("option");
|
||||
option10.text = "有毒有害气体泄漏";
|
||||
option10.value = "有毒有害气体泄漏";
|
||||
var option11 = document.createElement("option");
|
||||
option11.text = "限定空间作业";
|
||||
option11.value = "限定空间作业";
|
||||
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
drpSmallType.options.add(option4);
|
||||
drpSmallType.options.add(option5);
|
||||
|
||||
drpSmallType.options.add(option6);
|
||||
drpSmallType.options.add(option7);
|
||||
drpSmallType.options.add(option8);
|
||||
drpSmallType.options.add(option9);
|
||||
drpSmallType.options.add(option10);
|
||||
drpSmallType.options.add(option11);
|
||||
}
|
||||
else if (s == "HSSE_LicenseManagerTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "送停电作业许可证";
|
||||
option1.value = "送停电作业许可证";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "专区作业许可证";
|
||||
option2.value = "专区作业许可证";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "压力试验作业许可证";
|
||||
option3.value = "压力试验作业许可证";
|
||||
var option4 = document.createElement("option");
|
||||
option4.text = "盲板作业许可证";
|
||||
option4.value = "盲板作业许可证";
|
||||
var option5 = document.createElement("option");
|
||||
option5.text = "夜间作业许可证";
|
||||
option5.value = "夜间作业许可证";
|
||||
var option6 = document.createElement("option");
|
||||
option6.text = "格栅作业许可证";
|
||||
option6.value = "格栅作业许可证";
|
||||
var option7 = document.createElement("option");
|
||||
option7.text = "吊篮作业许可证";
|
||||
option7.value = "吊篮作业许可证";
|
||||
var option8 = document.createElement("option");
|
||||
option8.text = "起重作业安全许可证";
|
||||
option8.value = "起重作业安全许可证";
|
||||
var option9 = document.createElement("option");
|
||||
option9.text = "受限空间作业安全许可证";
|
||||
option9.value = "受限空间作业安全许可证";
|
||||
var option10 = document.createElement("option");
|
||||
option10.text = "用火作业安全许可证";
|
||||
option10.value = "用火作业安全许可证";
|
||||
var option11 = document.createElement("option");
|
||||
option11.text = "破土作业安全许可证";
|
||||
option11.value = "破土作业安全许可证";
|
||||
var option12 = document.createElement("option");
|
||||
option12.text = "临时用电安全许可证";
|
||||
option12.value = "临时用电安全许可证";
|
||||
var option13 = document.createElement("option");
|
||||
option13.text = "现场脚手架安全许可证";
|
||||
option13.value = "现场脚手架安全许可证";
|
||||
var option14 = document.createElement("option");
|
||||
option14.text = "射线作业安全许可证";
|
||||
option14.value = "射线作业安全许可证";
|
||||
var option15 = document.createElement("option");
|
||||
option15.text = "高处作业安全许可证";
|
||||
option15.value = "高处作业安全许可证";
|
||||
var option16 = document.createElement("option");
|
||||
option16.text = "安全作业许可证";
|
||||
option16.value = "安全作业许可证";
|
||||
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
drpSmallType.options.add(option4);
|
||||
drpSmallType.options.add(option5);
|
||||
drpSmallType.options.add(option6);
|
||||
drpSmallType.options.add(option7);
|
||||
drpSmallType.options.add(option8);
|
||||
drpSmallType.options.add(option9);
|
||||
drpSmallType.options.add(option10);
|
||||
drpSmallType.options.add(option11);
|
||||
drpSmallType.options.add(option12);
|
||||
drpSmallType.options.add(option13);
|
||||
drpSmallType.options.add(option14);
|
||||
drpSmallType.options.add(option15);
|
||||
drpSmallType.options.add(option16);
|
||||
|
||||
}
|
||||
if (s == "CQMS_MeetingTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "施工质量周例会";
|
||||
option1.value = "施工质量周例会";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "施工质量月例会";
|
||||
option2.value = "施工质量月例会";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "施工质量专题会议";
|
||||
option3.value = "施工质量专题会议";
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
}
|
||||
|
||||
if (s == "CQMS_ConstructSolutionTemplate") {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "土建";
|
||||
option1.value = "土建";
|
||||
var option2 = document.createElement("option");
|
||||
option2.text = "钢结构";
|
||||
option2.value = "钢结构";
|
||||
var option3 = document.createElement("option");
|
||||
option3.text = "静设备";
|
||||
option3.value = "静设备";
|
||||
|
||||
var option4 = document.createElement("option");
|
||||
option4.text = "动设备";
|
||||
option4.value = "动设备";
|
||||
var option5 = document.createElement("option");
|
||||
option5.text = "工业炉";
|
||||
option5.value = "工业炉";
|
||||
var option6 = document.createElement("option");
|
||||
option6.text = "配管";
|
||||
option6.value = "配管";
|
||||
var option7 = document.createElement("option");
|
||||
option7.text = "暖通";
|
||||
option7.value = "暖通";
|
||||
var option8 = document.createElement("option");
|
||||
option8.text = "电气";
|
||||
option8.value = "电气";
|
||||
var option9 = document.createElement("option");
|
||||
option9.text = "仪表";
|
||||
option9.value = "仪表";
|
||||
var option10 = document.createElement("option");
|
||||
option10.text = "焊接及无损检测";
|
||||
option10.value = "焊接及无损检测";
|
||||
var option11 = document.createElement("option");
|
||||
option11.text = "其它";
|
||||
option11.value = "其它";
|
||||
drpSmallType.options.add(option1);
|
||||
drpSmallType.options.add(option2);
|
||||
drpSmallType.options.add(option3);
|
||||
drpSmallType.options.add(option4);
|
||||
drpSmallType.options.add(option5);
|
||||
drpSmallType.options.add(option6);
|
||||
drpSmallType.options.add(option7);
|
||||
drpSmallType.options.add(option8);
|
||||
drpSmallType.options.add(option9);
|
||||
drpSmallType.options.add(option10);
|
||||
drpSmallType.options.add(option11);
|
||||
}
|
||||
else {
|
||||
var option1 = document.createElement("option");
|
||||
option1.text = "无";
|
||||
option1.value = "";
|
||||
drpSmallType.options.add(option1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload='javascript:TANGER_OCX_OpenDoc1("<% = readURL %>","<%=newofficetype %>");'>
|
||||
<form id="form1" action="Save.aspx" enctype="multipart/form-data">
|
||||
<div id="editmain">
|
||||
|
||||
<div id="editmain_middle" class="editmain_middle">
|
||||
<div id="editmain_right" class="editmain_right">
|
||||
<div id="formtop">
|
||||
<table width="100%" cellpadding="1" cellspacing="1" class="table">
|
||||
<tr>
|
||||
<td align="left" colspan="8" style="height: 40px">
|
||||
<%if (strOper != "read")
|
||||
{%>
|
||||
<input type="button" class="button" value="提交关闭" onclick="saveFileToUrl()" />
|
||||
<input type="button" class="button" value="打开本地文件" onclick="WebOpenLocal()" />
|
||||
<input type="button" class="button" value="存为本地文件" onclick="WebSaveLocal()" />
|
||||
<%}%>
|
||||
<input type="button" class="button" value="返回关闭" onclick="javascript:window.close();"
|
||||
style="width: 80" />
|
||||
<input type="button" class="button" value="页面设置" onclick="WebPageSetup()" />
|
||||
<input type="button" class="button" value="打印文档" onclick="TANGER_OCX_PrintDoc(false)" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left">
|
||||
<td>
|
||||
文件编号:<input id="txtFileId" style="width: 50px" name="txtFileId" type="hidden"
|
||||
value="<%=txtFileId %>" />
|
||||
</td>
|
||||
<td>
|
||||
<input id="txtFileCode" name="txtFileCode" style="width: 120px" type="text" value="<%=txtFileCode %>" />
|
||||
</td>
|
||||
<td>
|
||||
文件名称:
|
||||
</td>
|
||||
<td>
|
||||
<input id="txtFileName" name="txtFileName" style="width: 200px" type="text" value="<%=txtFileName %>"
|
||||
style="width: 98%" />
|
||||
</td>
|
||||
<td>
|
||||
文件类型:
|
||||
</td>
|
||||
<td>
|
||||
<select id="drpBigType" name="drpBigType" style="width: 150px; height: 22px;"
|
||||
onchange="bao(this.options[this.options.selectedIndex].value)">
|
||||
<option value="HSSE_ManagerRuleTemplate">HSE管理规定</option>
|
||||
<option value="HSSE_ActionPlanTemplate">HSE实施计划</option>
|
||||
<option value="HSSE_MeetingTemplate">HSE会议</option>
|
||||
<option value="HSSE_EmergencyTemplate">HSE应急预案</option>
|
||||
<option value="HSSE_EmergencyDrillTemplate">HSE应急响应</option>
|
||||
<option value="HSSE_NoticeTemplate">HSE通知通告</option>
|
||||
<option value="HSSE_ManagerWeekTemplate">HSE管理周报</option>
|
||||
<option value="HSSE_ManagerMonthTemplate">HSE管理月报</option>
|
||||
<option value="HSSE_ManagerTotalTemplate">HSE工作总结</option>
|
||||
<option value="HSSE_ManagerPerformanceTemplate">HSE顾客评价</option>
|
||||
<option value="HSSE_LicenseManagerTemplate">HSE作业许可证</option>
|
||||
<option value="HSSE_SecurityLicenseTemplate">HSE新开项目安全许可证</option>
|
||||
<option value="HSSE_CheckMonthTemplate">HSE月检查表</option>
|
||||
<option value="HSSE_CheckMonthTotalTemplate">HSE月总结</option>
|
||||
<option value="HSSE_AccidentTemplate">HSE事故报告</option>
|
||||
<option value="HSSE_Log">HSE管理日志</option>
|
||||
<option value="CQMS_ManagerRuleTemplate">施工质量管理规定</option>
|
||||
<option value="CQMS_ConstructSolutionTemplate">质量施工方案</option>
|
||||
<option value="CQMS_DrawingAuditTemplate">施工质量设计交底会议纪要</option>
|
||||
<option value="CQMS_NoFourLetoffTemplate">施工质量四不放过</option>
|
||||
<option value="CQMS_NonconformityNoticeTemplate">施工质量不合格品通知单</option>
|
||||
<option value="CQMS_NonconformityReviewTemplate">施工质量不合格品评审和处置</option>
|
||||
<option value="CQMS_MeetingTemplate">施工质量会议</option>
|
||||
<option value="CQMS_NoticeTemplate">施工质量管理通知</option>
|
||||
<option value="CQMS_RectifyNoticeTemplate">施工质量问题整改通知单</option>
|
||||
<option value="CQMS_RepriseApplyTemplate">施工质量工程复工报告</option>
|
||||
<option value="CQMS_PauseNoticeTemplate">施工质量工程暂停令</option>
|
||||
<option value="CQMS_Log">施工日志</option>
|
||||
<option value="GJSX_Concert">沟通协调报告</option>
|
||||
<option value="GJSX_RoleReplace">角色替代委托</option>
|
||||
<option value="EmptyWordTemplate">空模板</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
适用范围:
|
||||
</td>
|
||||
<td>
|
||||
<select id="drpSmallType" name="drpSmallType" style="width: 260px">
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="officecontrol">
|
||||
<!--引用NTKO OFFICE文档控件-->
|
||||
<script language="javascript" type="text/javascript" src="../../OfficeControl/ntkoofficecontrol.js" ></script>
|
||||
<!--控件事件代码开始-->
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
|
||||
alert(cmd);
|
||||
CancelLastCommand=true;
|
||||
</script>
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
|
||||
setFileOpenedOrClosed(false);
|
||||
</script>
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
|
||||
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
|
||||
TANGER_OCX_OBJ.ActiveDocument.Saved = true;
|
||||
if(2==TANGER_OCX_OBJ.DocType)
|
||||
{
|
||||
try{
|
||||
TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
|
||||
}catch(e)
|
||||
{
|
||||
alert("错误:" + err.number + ":" + err.description);
|
||||
}
|
||||
}
|
||||
setFileOpenedOrClosed(true);//设置文档状态值
|
||||
controlStyle();//插入控件样式自定义菜单
|
||||
SetReviewMode(true);//设置文档在痕迹模式下编辑
|
||||
setShowRevisions(true); //设置是否显示痕迹
|
||||
objside2();
|
||||
</script>
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
|
||||
alert("BeforeOriginalMenuCommand事件被触发");
|
||||
</script>
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
|
||||
if (TANGER_OCX_str == 3)
|
||||
{
|
||||
alert("不能提交!");
|
||||
CancelLastCommand = true;
|
||||
}
|
||||
</script>
|
||||
<script language="JScript" for="TANGER_OCX" event="OnCustomMenuCmd2(menuPos,submenuPos,subsubmenuPos,menuCaption,menuID)">
|
||||
//alert("第" + menuPos +","+ submenuPos +","+ subsubmenuPos +"个菜单项,menuID="+menuID+",菜单标题为\""+menuCaption+"\"的命令被执行.");
|
||||
if("全网页查看"==menuCaption)objside();
|
||||
if("恢复原大小"==menuCaption)objside2();
|
||||
</script>
|
||||
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(result,code);">
|
||||
result=trim(result);
|
||||
alert(result);
|
||||
if(result=="succeed")
|
||||
{window.close();}
|
||||
</script>
|
||||
<!--控件事件代码结束-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManage
|
||||
{
|
||||
public partial class EditOffice : System.Web.UI.Page
|
||||
{
|
||||
public string url, newofficetype, readURL, strOper;
|
||||
public string txtFileId, txtFileCode, txtFileName, drpBigType, drpSmallType;//定义表单数据
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
url = Request.QueryString["url"];
|
||||
newofficetype = Request.QueryString["newofficetype"];
|
||||
drpBigType = Request.QueryString["drpBigType"];
|
||||
drpSmallType = Request.QueryString["drpSmallType"];
|
||||
strOper = Request.QueryString["oper"];
|
||||
|
||||
if (url != null && url != "")
|
||||
{
|
||||
readURL = "Read.aspx?docid=" + url;
|
||||
//SqlDataReader dr = BLL.SQLHelper.RunSql("select * from Common_FileManage where FileId=" + url);
|
||||
try
|
||||
{
|
||||
var q = from x in BLL.Funs.DB.Common_FileManage where x.FileId.ToString() == url select x;
|
||||
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
txtFileId = q.First().FileId.ToString();
|
||||
txtFileCode = q.First().FileCode;
|
||||
txtFileName = q.First().FileName.ToString();
|
||||
drpBigType = q.First().BigType.ToString();
|
||||
drpSmallType = q.First().SmallType.ToString();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManage {
|
||||
|
||||
|
||||
public partial class EditOffice {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileManageList.aspx.cs" Inherits="FineUIPro.Web.common.FileManage.FileManageList" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head id="Head1" runat="server">
|
||||
<title>模板信息</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="ntko.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="FileId" AllowCellEditing="true" EnableColumnLines="true"
|
||||
ClicksToEdit="2" DataIDField="FileId" AllowSorting="true" SortField="FileCode,BigType"
|
||||
SortDirection="ASC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="12" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" AllowFilters="true"
|
||||
OnFilterChange="Grid1_FilterChange">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
|
||||
<Items>
|
||||
<f:DropDownList runat="server" ID="DrpTemplateType">
|
||||
<f:ListItem Selected="true" Text="-请选择-" Value="0" />
|
||||
<f:ListItem Text="Word模板" Value="1" />
|
||||
<f:ListItem Text="Excel模板" Value="2" />
|
||||
<f:ListItem Text="PowerPoint模板" Value="3" />
|
||||
</f:DropDownList>
|
||||
<f:Button ID="btnNew" Text="新增" Icon="Add" runat="server"
|
||||
OnClick="btnNew_Click" >
|
||||
|
||||
</f:Button>
|
||||
<f:Button ID="btnEdit" Text="编辑" Icon="Pencil" runat="server" OnClick="btnEdit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDelete" Text="删除" Icon="Delete" ConfirmText="确定删除当前数据?" OnClick="btnDelete_Click"
|
||||
runat="server">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField Width="50px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
|
||||
<f:RenderField Width="120px" ColumnID="FileCode" DataField="FileCode"
|
||||
SortField="FileCode" FieldType="String" HeaderText="文件编号" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="240px" ColumnID="FileName" DataField="FileName" EnableFilter="true"
|
||||
SortField="FileName" FieldType="String" HeaderText="文件名称" HeaderTextAlign="Center" TextAlign="Left">
|
||||
<Filter EnableMultiFilter="true" ShowMatcher="true">
|
||||
<Operator>
|
||||
<f:DropDownList ID="DropDownList2" runat="server">
|
||||
<f:ListItem Text="等于" Value="equal" />
|
||||
<f:ListItem Text="包含" Value="contain" Selected="true" />
|
||||
</f:DropDownList>
|
||||
</Operator>
|
||||
</Filter>
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="180px" ColumnID="FileType" DataField="FileType" EnableFilter="true"
|
||||
SortField="FileType" FieldType="String" HeaderText="模板类型" HeaderTextAlign="Center" TextAlign="Left">
|
||||
<Filter EnableMultiFilter="true" ShowMatcher="true">
|
||||
<Operator>
|
||||
<f:DropDownList ID="DropDowsnList1" runat="server">
|
||||
<f:ListItem Text="等于" Value="equal" />
|
||||
<f:ListItem Text="包含" Value="contain" Selected="true" />
|
||||
</f:DropDownList>
|
||||
</Operator>
|
||||
</Filter>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="SmallType" DataField="SmallType"
|
||||
SortField="SmallType" FieldType="String" HeaderText="适用范围" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
|
||||
<f:TemplateField Width="100px" HeaderText="文件大小" HeaderTextAlign="Center" TextAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label2" runat="server" Text='<%# ConvertSize(Eval("FileSize")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
|
||||
<f:RenderField Width="100px" ColumnID="FileCreate" DataField="FileCreate"
|
||||
SortField="FileCreate" FieldType="String" HeaderText="创建人" HeaderTextAlign="Center" TextAlign="Left">
|
||||
</f:RenderField>
|
||||
|
||||
<f:WindowField ColumnID="myWindowField" Width="50px" WindowID="Window1" HeaderText="查看"
|
||||
Icon="Pencil" ToolTip="查看" DataTextFormatString="{0}" DataIFrameUrlFields="FileId,FileName"
|
||||
DataIFrameUrlFormatString="EditOffice.aspx?url={0}&oper=read&officetype=1" DataWindowTitleFormatString="查看 - {1}"
|
||||
HeaderTextAlign="Center" TextAlign="Center"/>
|
||||
|
||||
<f:LinkButtonField Width="50px" HeaderText="删除" ConfirmText="删除选中行?" ConfirmTarget="Top"
|
||||
CommandName="Delete" Icon="Delete" HeaderTextAlign="Center" TextAlign="Center"/>
|
||||
</Columns>
|
||||
<PageItems>
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
|
||||
</f:ToolbarSeparator>
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
|
||||
</f:ToolbarText>
|
||||
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
|
||||
<f:ListItem Text="10" Value="10" />
|
||||
<f:ListItem Text="15" Value="15" />
|
||||
<f:ListItem Text="20" Value="20" />
|
||||
<f:ListItem Text="25" Value="25" />
|
||||
</f:DropDownList>
|
||||
</PageItems>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="编辑模板" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="1024px" Height="768px">
|
||||
</f:Window>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,277 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.common.FileManage
|
||||
{
|
||||
public partial class FileManageList : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 表头过滤
|
||||
FilterDataRowItem = FilterDataRowItemImplement;
|
||||
if (!IsPostBack)
|
||||
{
|
||||
btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!");
|
||||
btnDelete.ConfirmText = String.Format("你确定要删除选中的 <b><script>{0}</script></b> 行数据吗?", Grid1.GetSelectedCountReference());
|
||||
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = "select f.FileId,f.FileCode,f.FileName,f.FileSize,f.BigType,f.SmallType,f.FileDate,t.FileType,u.UserName as FileCreate " +
|
||||
@" from dbo.Common_FileManage f" +
|
||||
@" left join dbo.Common_FileManageType t on t.FileCode=f.BigType" +
|
||||
@" left join Sys_User u on u.UserId=f.FileCreate" +
|
||||
@" order by t.SortIndex,f.BigType";
|
||||
|
||||
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, null);
|
||||
|
||||
// 2.获取当前分页数据
|
||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
|
||||
#region 过滤表头
|
||||
/// <summary>
|
||||
/// 过滤表头
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据表头信息过滤列表数据
|
||||
/// </summary>
|
||||
/// <param name="sourceObj"></param>
|
||||
/// <param name="fillteredOperator"></param>
|
||||
/// <param name="fillteredObj"></param>
|
||||
/// <param name="column"></param>
|
||||
/// <returns></returns>
|
||||
private bool FilterDataRowItemImplement(object sourceObj, string fillteredOperator, object fillteredObj, string column)
|
||||
{
|
||||
bool valid = false;
|
||||
if (column == "FileName")
|
||||
{
|
||||
string sourceValue = sourceObj.ToString();
|
||||
string fillteredValue = fillteredObj.ToString();
|
||||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (column == "FileType")
|
||||
{
|
||||
string sourceValue = sourceObj.ToString();
|
||||
string fillteredValue = fillteredObj.ToString();
|
||||
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 删除数据
|
||||
/// <summary>
|
||||
/// 批量删除数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.Common_FileManageService.DeleteFileTById(Convert.ToInt32(rowID));
|
||||
}
|
||||
BindGrid();
|
||||
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除模板!");
|
||||
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
|
||||
if (e.CommandName == "Delete")
|
||||
{
|
||||
BLL.Common_FileManageService.DeleteFileTById(Convert.ToInt32(rowID));
|
||||
BindGrid();
|
||||
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除模板!");
|
||||
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 分页
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
//Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页显示条数下拉框
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||||
{
|
||||
//Grid1.SortDirection = e.SortDirection;
|
||||
//Grid1.SortField = e.SortField;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择行事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSelectRows_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInParent("请至少选择一条记录!");
|
||||
return;
|
||||
}
|
||||
string fileId = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EditOffice.aspx?ispop=1&oper=edit&url=" + fileId,"EditOffice")));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
btnEdit_Click(null, null);
|
||||
}
|
||||
|
||||
|
||||
protected string ConvertSize(object size)
|
||||
{
|
||||
string strSize = string.Empty;
|
||||
if (size != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
double temsize = (Convert.ToDouble(size)) / 1000;
|
||||
if (temsize > 0)
|
||||
{
|
||||
if (temsize > 1000)
|
||||
{
|
||||
temsize = temsize / 1000;
|
||||
strSize = temsize.ToString() + "M";
|
||||
}
|
||||
else
|
||||
{
|
||||
strSize = temsize.ToString() + "K";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strSize = temsize.ToString() + "bytes";
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return strSize;
|
||||
}
|
||||
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.DrpTemplateType.SelectedValue != "0")
|
||||
{
|
||||
string type = this.DrpTemplateType.SelectedValue.Trim();
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EditOffice.aspx?ispop=1&newofficetype=" + type, "EditOffice")));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.common.FileManage {
|
||||
|
||||
|
||||
public partial class FileManageList {
|
||||
|
||||
/// <summary>
|
||||
/// Head1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// DrpTemplateType 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList DrpTemplateType;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnEdit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnEdit;
|
||||
|
||||
/// <summary>
|
||||
/// btnDelete 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDelete;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// DropDownList2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList DropDownList2;
|
||||
|
||||
/// <summary>
|
||||
/// DropDowsnList1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList DropDowsnList1;
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileManageList1.aspx.cs" Inherits="FineUIPro.Web.Common.FileManage.FileManageList1" %>
|
||||
|
||||
<%@ Register Src="../../Controls/GridNavgator.ascx" TagName="GridNavgator" TagPrefix="uc1" %>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head id="Head1" runat="server">
|
||||
<title></title>
|
||||
<link href="../../Styles/Style.css" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="ntko.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function CreateNew(newofficetype, url) {
|
||||
var iWidth = 1280;
|
||||
var iHeight = 720;
|
||||
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
|
||||
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
|
||||
window.open("EditOffice.aspx?ispop=1&newofficetype=" + newofficetype + "&url=" + url, "EditOffice", "width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft + ",scrollbars=yes,resizable=yes");
|
||||
}
|
||||
|
||||
function ShowOffice(url,oper) {
|
||||
var iWidth = 1180;
|
||||
var iHeight = 720;
|
||||
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
|
||||
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
|
||||
window.open("EditOffice.aspx?ispop=1&oper=" + oper + "&url=" + url, "EditOffice", "width=" + iWidth + ",height=" + iHeight + ",top=" + iTop + ",left=" + iLeft + ",scrollbars=yes,resizable=yes");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<table id="Table1" runat="server" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 100%; background: url('../../Images/bg-1.gif')">
|
||||
<table id="tabbtn" runat="server" width="100%" style="background: url('../../Images/bg-1.gif')"
|
||||
cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="left" valign="middle" style="width: 35%; font-size: 11pt; font-weight: bold">
|
||||
<asp:Image ImageUrl="~/Images/lv-1.gif" ImageAlign="AbsMiddle" ID="image15" runat="server" />
|
||||
模板信息
|
||||
</td>
|
||||
<td align="right" valign="middle" style="width: 65%; height: 30px;">
|
||||
<asp:DropDownList runat="server" ID="DrpTemplateType" Height="24px" Width="120px">
|
||||
<asp:ListItem Selected="True" Value="0">--请选择--</asp:ListItem>
|
||||
<asp:ListItem Value="1">Word模板</asp:ListItem>
|
||||
<asp:ListItem Value="2">Excel模板</asp:ListItem>
|
||||
<asp:ListItem Value="3">PowerPoint模板</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/Images/addbutton.gif" onclick="btnAdd_Click"
|
||||
/>
|
||||
<asp:ImageButton ID="imgbtnSearch" runat="server" ImageUrl="~/Images/Search.gif"
|
||||
OnClick="imgbtnSearch_Click" Style="height: 20px" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div runat="server" id="divSearch" visible="false">
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td align="right" style="height: 32px; width:15%">
|
||||
|
||||
<asp:Label ID="Label1" runat="server" Text="文件名称"></asp:Label>
|
||||
</td>
|
||||
<td align="left" style="height: 32px; width:20%" >
|
||||
<asp:TextBox ID="txtFileName" runat="server" Width="90%"></asp:TextBox>
|
||||
</td>
|
||||
|
||||
<td align="right" style="height: 32px; width:15%">
|
||||
|
||||
<asp:Label ID="Label2" runat="server" Text="模板类型"></asp:Label>
|
||||
</td>
|
||||
<td align="left" style="height: 32px; width:20%">
|
||||
<asp:DropDownList ID="drpFileSort" runat="server" Height="22px" Width="80%">
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
<td align="left" style="height: 32px">
|
||||
<asp:ImageButton ID="btnSearch" runat="server" ImageUrl="~/Images/confirm.gif" OnClick="btnSearch_Click" />
|
||||
<asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/Images/cancel.gif" OnClick="imgbtnCancel_Click" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:GridView ID="gvFileT" runat="server" AllowPaging="True" AllowSorting="True"
|
||||
AutoGenerateColumns="False" HorizontalAlign="Justify" PageSize="12" Width="100%"
|
||||
OnDataBound="gvFileT_DataBound" OnRowCommand="gvFileT_RowCommand" DataSourceID="ObjectDataSource1">
|
||||
<AlternatingRowStyle CssClass="GridBgColr" />
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="序号" HeaderStyle-Width="5%" ItemStyle-HorizontalAlign="Center"
|
||||
ItemStyle-Height="20px">
|
||||
<ItemTemplate>
|
||||
<%# gvFileT.PageIndex * gvFileT.PageSize + Container.DataItemIndex + 1%>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="5%"></HeaderStyle>
|
||||
<ItemStyle HorizontalAlign="Center" Height="20px"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="FileCode" HeaderText="文件编号">
|
||||
<HeaderStyle Width="10%" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="文件名称" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="click" CssClass="ItemLink"
|
||||
Text='<%# Bind("FileName") %>' CommandArgument='<%# Bind("FileId") %>' ToolTip="编辑"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="28%" />
|
||||
<ItemStyle HorizontalAlign="Left"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="BigType" HeaderText="模板类型">
|
||||
<HeaderStyle Width="15%" />
|
||||
</asp:BoundField>
|
||||
<asp:BoundField DataField="SmallType" HeaderText="适用范围">
|
||||
<HeaderStyle Width="10%" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="文件大小">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label4" runat="server" Text='<%# ConvertSize(Eval("FileSize")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<ItemStyle Width="10%" />
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="FileCreate" HeaderText="创建人">
|
||||
<HeaderStyle Width="10%" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="查看" HeaderStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtnFind" runat="server" Text="查看" CssClass="ItemLink" CommandArgument='<%# Bind("FileId") %>'
|
||||
CommandName="find" ToolTip="查看模板内容"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="5%"></HeaderStyle>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="删除">
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/DeleteBtn.gif"
|
||||
CommandArgument='<%# Bind("FileId") %>' CommandName="Del" OnClientClick="return confirm("确定要删除此模板吗?")"
|
||||
ToolTip="删除" />
|
||||
</ItemTemplate>
|
||||
<HeaderStyle Width="5%" />
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<HeaderStyle CssClass="GridBgColr" />
|
||||
<PagerStyle HorizontalAlign="Left" />
|
||||
<RowStyle CssClass="GridRow" />
|
||||
<PagerTemplate>
|
||||
<uc1:GridNavgator runat="server" ID="GridNavgator1" />
|
||||
</PagerTemplate>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListData"
|
||||
TypeName="BLL.Common_FileManageService" EnablePaging="True" OnSelecting="ObjectDataSource1_Selecting"
|
||||
SelectCountMethod="GetListCount">
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="bigType" />
|
||||
<asp:Parameter Name="fileName" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<asp:ValidationSummary ID="ValidationSummary1" Style="z-index: 101; left: 8px; position: absolute;
|
||||
top: 8px" runat="server" HeaderText="请注意!" ShowMessageBox="True" ShowSummary="False"
|
||||
ValidationGroup="Save" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManage
|
||||
{
|
||||
public partial class FileManageList1 : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.Funs.PleaseSelect(this.drpFileSort);
|
||||
this.drpFileSort.Items.AddRange(BLL.Common_FileManageService.FileSortList());
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSearch_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
this.gvFileT.PageIndex = 0;
|
||||
this.gvFileT.DataBind();
|
||||
}
|
||||
|
||||
protected void imgbtnCancel_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
this.divSearch.Visible = false;
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
if (this.DrpTemplateType.SelectedValue != "0")
|
||||
{
|
||||
string type = this.DrpTemplateType.SelectedValue.Trim();
|
||||
ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>CreateNew('" + type + "','');</script>");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
|
||||
{
|
||||
e.InputParameters["bigType"] = this.drpFileSort.SelectedValue.Trim();
|
||||
e.InputParameters["fileName"] = this.txtFileName.Text.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定GridView
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void gvFileT_DataBound(object sender, EventArgs e)
|
||||
{
|
||||
//if (this.gvFileT.BottomPagerRow == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//((Web.Controls.GridNavgator)this.gvFileT.BottomPagerRow.FindControl("GridNavgator1")).GridView = this.gvFileT;
|
||||
}
|
||||
|
||||
protected void gvFileT_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||
{
|
||||
string pid = e.CommandArgument.ToString();
|
||||
if (e.CommandName == "click")
|
||||
{
|
||||
ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>ShowOffice('" + pid + "','edit');</script>");
|
||||
}
|
||||
if (e.CommandName == "find")
|
||||
{
|
||||
ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script type='text/javascript'>ShowOffice('" + pid + "','read');</script>");
|
||||
}
|
||||
if (e.CommandName == "Del")
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId,this.CurrUser.UserId, Const.FileManageListMenuId,Const.BtnDelete))
|
||||
{
|
||||
BLL.Common_FileManageService.DeleteFileTById(Convert.ToInt32(pid));
|
||||
this.gvFileT.DataBind();
|
||||
BLL.Sys_LogService.AddLog(Const.System_1,this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除模板!");
|
||||
}
|
||||
else
|
||||
{
|
||||
ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('您没有这个权限,请与管理员联系!')", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e)
|
||||
{
|
||||
this.divSearch.Visible = true;
|
||||
this.gvFileT.PageIndex = 0;
|
||||
this.gvFileT.DataBind();
|
||||
}
|
||||
protected string ConvertSize(object size)
|
||||
{
|
||||
string strSize = string.Empty;
|
||||
if (size != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
double temsize = (Convert.ToDouble(size)) / 1000;
|
||||
if (temsize > 0)
|
||||
{
|
||||
if (temsize > 1000)
|
||||
{
|
||||
temsize = temsize / 1000;
|
||||
strSize = temsize.ToString() + "M";
|
||||
}
|
||||
else
|
||||
{
|
||||
strSize = temsize.ToString() + "K";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strSize = temsize.ToString() + "bytes";
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return strSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManage {
|
||||
|
||||
|
||||
public partial class FileManageList1 {
|
||||
|
||||
/// <summary>
|
||||
/// Head1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// Table1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTable Table1;
|
||||
|
||||
/// <summary>
|
||||
/// tabbtn 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTable tabbtn;
|
||||
|
||||
/// <summary>
|
||||
/// image15 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Image image15;
|
||||
|
||||
/// <summary>
|
||||
/// DrpTemplateType 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DrpTemplateType;
|
||||
|
||||
/// <summary>
|
||||
/// btnAdd 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ImageButton btnAdd;
|
||||
|
||||
/// <summary>
|
||||
/// imgbtnSearch 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ImageButton imgbtnSearch;
|
||||
|
||||
/// <summary>
|
||||
/// divSearch 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divSearch;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// txtFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtFileName;
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
/// <summary>
|
||||
/// drpFileSort 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList drpFileSort;
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ImageButton btnSearch;
|
||||
|
||||
/// <summary>
|
||||
/// btnCancel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ImageButton btnCancel;
|
||||
|
||||
/// <summary>
|
||||
/// gvFileT 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView gvFileT;
|
||||
|
||||
/// <summary>
|
||||
/// ObjectDataSource1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ObjectDataSource1;
|
||||
|
||||
/// <summary>
|
||||
/// ValidationSummary1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Read.aspx.cs" Inherits="FineUIPro.Web.Common.FileManager.Read" %>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManager
|
||||
{
|
||||
public partial class Read : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
doGetDocData();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从数据库或者磁盘中读取文件并发送给客户端
|
||||
/// </summary>
|
||||
public void doGetDocData()
|
||||
{
|
||||
SqlDataReader objReader = null;
|
||||
SqlConnection conn = new SqlConnection(BLL.Funs.ConnString);
|
||||
if (conn.State == ConnectionState.Closed) conn.Open();
|
||||
|
||||
try
|
||||
{
|
||||
string docid = Request.QueryString["docid"];
|
||||
|
||||
if (!string.IsNullOrEmpty(docid))
|
||||
{
|
||||
string strcmd = "select FileName,FileContent from Common_FileManage where FileId=" + docid;
|
||||
|
||||
SqlCommand command = new SqlCommand(strcmd, conn);
|
||||
command.CommandType = CommandType.Text;
|
||||
objReader = command.ExecuteReader();
|
||||
|
||||
if (objReader.Read())
|
||||
{
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + objReader["FileName"].ToString());
|
||||
Response.AppendHeader("Contenttype", "application/msword");
|
||||
//读取数据
|
||||
byte[] buffer = new Byte[10240];
|
||||
long datalen = objReader.GetBytes(1, 0, null, 0, 0);//["filedata"]
|
||||
//Response.Write("datalen=" + datalen.ToString());
|
||||
//*
|
||||
long curPos = 0;
|
||||
long readsize = 0;
|
||||
readsize = objReader.GetBytes(1, curPos, buffer, 0, 10240);
|
||||
while (readsize == 10240)
|
||||
{
|
||||
curPos += readsize;
|
||||
Response.BinaryWrite(buffer);
|
||||
Response.Flush();
|
||||
readsize = objReader.GetBytes(1, curPos, buffer, 0, 10240);
|
||||
}
|
||||
byte[] rBuf = new Byte[readsize];
|
||||
objReader.GetBytes(1, curPos, rBuf, 0, (int)readsize);
|
||||
Response.BinaryWrite(rBuf);
|
||||
Response.Flush();
|
||||
|
||||
//*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (objReader != null) objReader.Close();
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManager {
|
||||
|
||||
|
||||
public partial class Read {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Save.aspx.cs" Inherits="FineUIPro.Web.Common.FileManager.Save" %>
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManager
|
||||
{
|
||||
|
||||
public partial class Save : System.Web.UI.Page
|
||||
{
|
||||
public string url, newofficetype,filetype, readURL;
|
||||
public string txtFileId, txtFileCode, txtFileName, drpBigType, drpSmallType;//定义表单数据
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtFileId = Request.Form["txtFileId"];//获取文件ID
|
||||
txtFileCode = Request.Form["txtFileCode"];//获取已有文件的名称
|
||||
txtFileName = Request.Form["txtFileName"];//获取文件的标题
|
||||
drpBigType = Request.Form["drpBigType"];//获取文件另存为格式类型
|
||||
filetype = Request.Form["filetype"];//获取当前文件的文件格式
|
||||
drpSmallType = Request.Form["drpSmallType"];
|
||||
saveoffice();
|
||||
}
|
||||
|
||||
//提交文档为office
|
||||
public void saveoffice()
|
||||
{
|
||||
System.Web.HttpFileCollection uploadFiles = Request.Files;
|
||||
System.Web.HttpPostedFile theFile;
|
||||
|
||||
bool isNewRecord = false;
|
||||
if ((txtFileId.Length == 0) || (txtFileId.Trim().Length == 0))
|
||||
{
|
||||
isNewRecord = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isNewRecord = false;
|
||||
}
|
||||
|
||||
if (uploadFiles.Count == 0)
|
||||
{
|
||||
Response.Write("没有文件上传!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SqlConnection conn = new SqlConnection(BLL.Funs.ConnString);
|
||||
if (conn.State == ConnectionState.Closed) conn.Open();
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < uploadFiles.Count; i++)
|
||||
{
|
||||
theFile = uploadFiles[i];
|
||||
int flieLength = theFile.ContentLength;
|
||||
Stream fs = theFile.InputStream;
|
||||
byte[] bytes = new byte[fs.Length];
|
||||
fs.Read(bytes, 0, flieLength);
|
||||
|
||||
if (uploadFiles.GetKey(i).ToUpper() == "EDITFILE")//上传文档控件中的文档
|
||||
{
|
||||
string strcmd = "";
|
||||
if (isNewRecord) // add new record to database
|
||||
{
|
||||
strcmd = "INSERT INTO Common_FileManage (FileCode,FileName,FileSize,FileType,BigType,SmallType,FileCreate,FileDate,FileContent) " +
|
||||
"Values(@FileCode, @FileName, @FileSize,@FileType,@BigType,@SmallType,@FileCreate,@FileDate,@FileContent) select SCOPE_IDENTITY() ";
|
||||
}
|
||||
else
|
||||
{
|
||||
strcmd = "Update Common_FileManage Set FileCode=@FileCode,FileName=@FileName,FileSize=@FileSize,FileType=@FileType,BigType=@BigType,SmallType=@SmallType," +
|
||||
"FileCreate=@FileCreate,FileDate=@FileDate,FileContent=@FileContent WHERE FileId=" + txtFileId;
|
||||
}
|
||||
|
||||
SqlCommand objCommand = new SqlCommand(strcmd, conn);
|
||||
objCommand.Parameters.Add("@FileCode", System.Data.SqlDbType.NVarChar).Value = txtFileCode;
|
||||
objCommand.Parameters.Add("@FileName", System.Data.SqlDbType.NVarChar).Value = txtFileName;//
|
||||
objCommand.Parameters.Add("@FileSize", System.Data.SqlDbType.NVarChar).Value = theFile.ContentLength;
|
||||
objCommand.Parameters.Add("@FileType", System.Data.SqlDbType.NVarChar).Value = filetype;
|
||||
objCommand.Parameters.Add("@BigType", System.Data.SqlDbType.NVarChar).Value = drpBigType;
|
||||
objCommand.Parameters.Add("@SmallType", System.Data.SqlDbType.VarChar).Value = drpSmallType;
|
||||
objCommand.Parameters.Add("@FileDate", System.Data.SqlDbType.DateTime).Value = DateTime.Now;
|
||||
objCommand.Parameters.Add("@FileCreate", System.Data.SqlDbType.NVarChar).Value = ((Model.Sys_User)Session["CurrUser"]).UserId;
|
||||
objCommand.Parameters.Add("@FileContent", System.Data.SqlDbType.Image).Value = bytes;
|
||||
if (isNewRecord) { txtFileId = objCommand.ExecuteScalar().ToString(); }
|
||||
else { objCommand.ExecuteNonQuery(); }
|
||||
Response.Write("ID:" + txtFileId + "</br>");
|
||||
Response.Write("Files: " + txtFileName + "<br>");
|
||||
Response.Write("Size: " + theFile.ContentLength.ToString() + " bytes<br>");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Common.FileManager {
|
||||
|
||||
|
||||
public partial class Save {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,767 @@
|
||||
//以下是程序引用页面的定义
|
||||
var editMScode = "EditOffice.aspx"; //编辑MS OFFICE文档页面程序
|
||||
var editWPScode = "editwps.aspx"; //编辑WPS文档页面程序
|
||||
var savecode = "Save.aspx"; //提交文档程序程序
|
||||
var readcode = "Read.aspx"; //读取后台二进制数据程序
|
||||
var delcode = "delete.aspx"; //执行数据删除后台程序
|
||||
|
||||
|
||||
//以下变量为JS公共变量
|
||||
var TANGER_OCX_bDocOpen = false;
|
||||
var TANGER_OCX_filename; //文件名称
|
||||
var filetype; //文件类型
|
||||
var savetype; //文件提交类型
|
||||
var TANGER_OCX_actionURL; //For auto generate form fiields
|
||||
var TANGER_OCX_OBJ; //控件对象
|
||||
var TANGER_OCX_Username = "匿名用户"; //User Name
|
||||
var TANGER_OCX_key = ""; //设置加载印章的key
|
||||
var IsFileOpened; //控件是否打开文档
|
||||
var svisble = true; //印章显示状态
|
||||
var url = ""; //初始化URL值
|
||||
var newwin, newdoc;
|
||||
|
||||
//创建新的文档
|
||||
function CreatNew(newofficetype) {
|
||||
//根据传递文档类型参数新建文档
|
||||
switch (newofficetype) {
|
||||
case "1":
|
||||
openoffice(url, newofficetype)
|
||||
break
|
||||
case "2":
|
||||
openoffice(url, newofficetype)
|
||||
break
|
||||
case "3":
|
||||
openoffice(url, newofficetype)
|
||||
break
|
||||
case "4":
|
||||
openoffice(url, newofficetype)
|
||||
break
|
||||
case "5":
|
||||
openoffice(url, newofficetype)
|
||||
break
|
||||
default:
|
||||
openoffice(url, "1")
|
||||
break;
|
||||
}
|
||||
}
|
||||
function openoffice(url, newofficetype) {
|
||||
window.open(editMScode + "?newofficetype=" + newofficetype + "&url=" + url, "editoffice", "top=0,left=0,scrollbars=yes,resizable=yes");
|
||||
}
|
||||
//当前表单不可编辑,当整个表单只读时调用
|
||||
function FormDisabled(bool) {
|
||||
var formid = document.forms.item(0)
|
||||
var elelength = formid.length;
|
||||
for (var i = 0; i < elelength; i++)
|
||||
{ formid.elements[i].disabled = bool; }
|
||||
//下面是控件标题栏,状态栏,工具栏,菜单栏不显示
|
||||
TANGER_OCX_OBJ.TitleBar = !bool;
|
||||
TANGER_OCX_OBJ.Statusbar = !bool;
|
||||
TANGER_OCX_OBJ.ToolBars = !bool;
|
||||
TANGER_OCX_OBJ.Menubar = !bool;
|
||||
document.getElementById("editmain_left").style.display = "none";
|
||||
document.getElementById("editmain_right").style.width = "95%";
|
||||
}
|
||||
//示例程序帮助文档
|
||||
function NtkoHelp() {
|
||||
window.open("help.htm", "help");
|
||||
}
|
||||
//编辑文档
|
||||
function editoffice(url, newofficetype) {
|
||||
TANGER_OCX_OBJ = document.getElementById("TANGER_OCX"); //;初始化控件对象
|
||||
//根据文档URL和newofficetype编辑文档,如果有url是编辑已有文档,如果为空根据newofficetype新建文档
|
||||
if ((typeof (url) != "undefined") && (url != "")) {
|
||||
var filename = document.all("filename").value;
|
||||
// alert(filename);
|
||||
try { TANGER_OCX_OBJ.BeginOpenFromURL("uploadOfficeFile/" + filename); } catch (err) { };
|
||||
}
|
||||
else {
|
||||
switch (newofficetype) {
|
||||
//新建文档
|
||||
case "1":
|
||||
TANGER_OCX_OBJ.CreateNew("word.document"); //word文档
|
||||
break
|
||||
case "2":
|
||||
TANGER_OCX_OBJ.CreateNew("excel.sheet"); //excel电子表格
|
||||
break
|
||||
case "3":
|
||||
TANGER_OCX_OBJ.CreateNew("PowerPoint.Show"); //微软幻灯片
|
||||
break
|
||||
case "4":
|
||||
TANGER_OCX_OBJ.CreateNew("WPS.Document"); //金山文档
|
||||
break
|
||||
case "5":
|
||||
TANGER_OCX_OBJ.CreateNew("ET.WorkBook"); //金山电子表格
|
||||
break
|
||||
default:
|
||||
alert("文档编辑出错!")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
function intializePage() {
|
||||
TANGER_OCX_OBJ = document.all("TANGER_OCX");
|
||||
}
|
||||
//文档编辑页面关闭事件
|
||||
function onPageClose() {
|
||||
if (IsFileOpened) {
|
||||
if (!TANGER_OCX_OBJ.ActiveDocument.Saved) {
|
||||
if (confirm("文档修改过,还没有提交,是否需要提交?")) {
|
||||
saveFileToUrl();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function TANGER_OCX_OpenDoc(fileUrl) {
|
||||
if (fileUrl != null || fileUrl != "") {
|
||||
TANGER_OCX_OBJ.BeginOpenFromURL(fileUrl);
|
||||
}
|
||||
else {
|
||||
alert("dd");
|
||||
TANGER_OCX_OBJ.BegingOpenFromURL("templateFile/newWordTemplate.doc")
|
||||
}
|
||||
}
|
||||
|
||||
function TANGER_OCX_OpenDoc1(URL, newofficetype) {
|
||||
TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
|
||||
if ((typeof (URL) != "undefined") && (URL != "")) {
|
||||
try { TANGER_OCX_OBJ.BeginOpenFromURL(URL); } catch (err) { };
|
||||
}
|
||||
else {
|
||||
try {
|
||||
switch (newofficetype) {
|
||||
//新建文档
|
||||
case "1":
|
||||
TANGER_OCX_OBJ.CreateNew("word.document"); //word文档
|
||||
break
|
||||
case "2":
|
||||
TANGER_OCX_OBJ.CreateNew("excel.sheet"); //excel电子表格
|
||||
break
|
||||
case "3":
|
||||
TANGER_OCX_OBJ.CreateNew("PowerPoint.Show"); //微软幻灯片
|
||||
break
|
||||
case "4":
|
||||
TANGER_OCX_OBJ.CreateNew("WPS.Document"); //金山文档
|
||||
break
|
||||
case "5":
|
||||
TANGER_OCX_OBJ.CreateNew("ET.WorkBook"); //金山电子表格
|
||||
break
|
||||
default:
|
||||
alert("文档编辑出错!")
|
||||
break
|
||||
}
|
||||
} catch (err) { };
|
||||
}
|
||||
}
|
||||
//设置文件是打开还是关闭
|
||||
function setFileOpenedOrClosed(bool) {
|
||||
IsFileOpened = bool;
|
||||
fileType = TANGER_OCX_OBJ.DocType;
|
||||
}
|
||||
function trim(str) { //删除左右两端的空格
|
||||
return str.replace(/(^\s*)|(\s*$)/g, "");
|
||||
}
|
||||
function erropen(retHTML) {
|
||||
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
|
||||
newdoc = newwin.document;
|
||||
newdoc.open();
|
||||
newdoc.write("<html><head><title>返回的数据</title></head><body><center><hr>")
|
||||
newdoc.write(retHTML + "kdkd<hr>");
|
||||
newdoc.write("<input type=button VALUE='关闭窗口' onclick='window.close();'>");
|
||||
newdoc.write('</center></body></html>');
|
||||
newdoc.close();
|
||||
}
|
||||
//提交office文档
|
||||
function saveFileToUrl() {
|
||||
var fileName = trim(document.all("txtFileName").value);
|
||||
if (fileName.length == 0) { alert("请输入文件名称!"); document.all("txtFileName").focus(); return false; } //判断文件标题输入域
|
||||
var result, filedot;
|
||||
if (IsFileOpened) {
|
||||
switch (TANGER_OCX_OBJ.doctype) {
|
||||
case 1:
|
||||
fileType = "Word.Document";
|
||||
filedot = ".doc";
|
||||
break;
|
||||
case 2:
|
||||
fileType = "Excel.Sheet";
|
||||
filedot = ".xls";
|
||||
break;
|
||||
case 3:
|
||||
fileType = "PowerPoint.Show";
|
||||
filedot = ".ppt";
|
||||
break;
|
||||
case 4:
|
||||
fileType = "Visio.Drawing";
|
||||
filedot = ".vso"
|
||||
break;
|
||||
case 5:
|
||||
fileType = "MSProject.Project";
|
||||
filedot = ".pro";
|
||||
break;
|
||||
case 6:
|
||||
fileType = "WPS Doc";
|
||||
filedot = ".wps";
|
||||
break;
|
||||
case 7:
|
||||
fileType = "Kingsoft Sheet";
|
||||
filedot = ".et";
|
||||
break;
|
||||
default:
|
||||
fileType = "unkownfiletype";
|
||||
filedot = ".doc";
|
||||
}
|
||||
retHTML = TANGER_OCX_OBJ.saveToURL(savecode, //提交到的url地址
|
||||
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
|
||||
"savetype=1&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要提交的文件格式office,html,pdf。filetype参数提交文件类型
|
||||
fileName + filedot, //上传文件的名称,类似<input type=file 的value
|
||||
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
|
||||
);
|
||||
switch (TANGER_OCX_OBJ.StatusCode) {
|
||||
case 0:
|
||||
alert("文件提交成功");
|
||||
TANGER_OCX_OBJ.ActiveDocument.Saved = true;
|
||||
window.close();
|
||||
parent.location.reload();
|
||||
//window.opener.location.href = window.opener.location.href; //新框架这代码用不了(window.opener为空)
|
||||
// var indexa = retHTML.indexOf("ID:");
|
||||
// var indexb = retHTML.indexOf("</br>");
|
||||
// var locationhref = retHTML.substring(indexa + 3, indexb);
|
||||
// window.location.href = editMScode + "?&url=" + locationhref;
|
||||
break;
|
||||
case 1:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 2:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 3:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 4:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 5:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 6:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
case 100:
|
||||
erropen(retHTML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("不能执行提交,没有编辑文档!");
|
||||
}
|
||||
}
|
||||
//提交office文档1
|
||||
function saveFileToUrl1() {
|
||||
var fileName = "test.doc";
|
||||
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
|
||||
var result,
|
||||
retHTML = TANGER_OCX_OBJ.saveToURL(savecode, //提交到的url地址
|
||||
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
|
||||
"savetype=1&fileType=doc", //与控件一起提交的参数,savetype参数为要提交的文件格式office,html,pdf。filetype参数提交文件类型
|
||||
fileName, //上传文件的名称,类似<input type=file 的value
|
||||
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
|
||||
);
|
||||
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
|
||||
newdoc = newwin.document;
|
||||
newdoc.open();
|
||||
newdoc.write("<center><hr>" + retHTML + "<hr><input type=button VALUE='关闭窗口' onclick='window.close();if(window.opener){window.opener.location.reload()};'></center>");
|
||||
newdoc.close();
|
||||
window.opener.focus();
|
||||
}
|
||||
//提交文档为html文件到服务器
|
||||
function saveFileAsHtmlToUrl() {
|
||||
var fileName = trim(document.all("filetitle").value);
|
||||
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
|
||||
var result, filedot;
|
||||
if (IsFileOpened) {
|
||||
switch (TANGER_OCX_OBJ.doctype) {
|
||||
case 1:
|
||||
fileType = "Word.Document";
|
||||
filedot = ".doc";
|
||||
break;
|
||||
case 2:
|
||||
fileType = "Excel.Sheet";
|
||||
filedot = ".xls";
|
||||
break;
|
||||
case 3:
|
||||
fileType = "PowerPoint.Show";
|
||||
filedot = ".ppt";
|
||||
break;
|
||||
case 4:
|
||||
fileType = "Visio.Drawing";
|
||||
filedot = ".vso"
|
||||
break;
|
||||
case 5:
|
||||
fileType = "MSProject.Project";
|
||||
filedot = ".pro";
|
||||
break;
|
||||
case 6:
|
||||
fileType = "WPS Doc";
|
||||
filedot = ".wps";
|
||||
break;
|
||||
case 7:
|
||||
fileType = "Kingsoft Sheet";
|
||||
filedot = ".et";
|
||||
break;
|
||||
default:
|
||||
fileType = "unkownfiletype";
|
||||
filedot = ".doc";
|
||||
}
|
||||
retHTML = TANGER_OCX_OBJ.PublishAsHTMLToURL(savecode, //提交到的url地址
|
||||
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
|
||||
"savetype=2&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要提交的文件格式office,html,pdf。filetype参数提交文件类型
|
||||
fileName, //上传文件的名称,类似<input type=file 的value
|
||||
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
|
||||
);
|
||||
newwin = window.open("", "_blank", "left=200,top=200,width=400,height=300,status=0,toolbar=0,menubar=0,location=0,scrollbars=1,resizable=1", false);
|
||||
newdoc = newwin.document;
|
||||
newdoc.open();
|
||||
newdoc.write("<center><hr>" + retHTML + "<hr><input type=button VALUE='关闭窗口' onclick='window.close();if(window.opener){window.opener.location.reload()};'></center>");
|
||||
newdoc.close();
|
||||
window.opener.focus();
|
||||
}
|
||||
else {
|
||||
alert("不能执行提交,没有编辑文档!");
|
||||
}
|
||||
}
|
||||
//保护文档为pdf格式
|
||||
function saveFileAsPdfToUrl() {
|
||||
var fileName = trim(document.all("filetitle").value);
|
||||
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; } //判断文件标题输入域
|
||||
var result, filedot;
|
||||
if (IsFileOpened && TANGER_OCX_OBJ.IsPDFCreatorInstalled()) {
|
||||
switch (TANGER_OCX_OBJ.doctype) {
|
||||
case 1:
|
||||
fileType = "Word.Document";
|
||||
filedot = ".doc";
|
||||
break;
|
||||
case 2:
|
||||
fileType = "Excel.Sheet";
|
||||
filedot = ".xls";
|
||||
break;
|
||||
case 3:
|
||||
fileType = "PowerPoint.Show";
|
||||
filedot = ".ppt";
|
||||
break;
|
||||
case 4:
|
||||
fileType = "Visio.Drawing";
|
||||
filedot = ".vso"
|
||||
break;
|
||||
case 5:
|
||||
fileType = "MSProject.Project";
|
||||
filedot = ".pro";
|
||||
break;
|
||||
case 6:
|
||||
fileType = "WPS Doc";
|
||||
filedot = ".wps";
|
||||
break;
|
||||
case 7:
|
||||
fileType = "Kingsoft Sheet";
|
||||
filedot = ".et";
|
||||
break;
|
||||
default:
|
||||
fileType = "unkownfiletype";
|
||||
filedot = ".doc";
|
||||
}
|
||||
TANGER_OCX_OBJ.PublishAsPDFToURL(savecode, //提交到的url地址
|
||||
"EDITFILE", //文件域的id,类似<input type=file id=upLoadFile 中的id
|
||||
"savetype=3&fileType=" + fileType, //与控件一起提交的参数,savetype参数为要提交的文件格式office,html,pdf。filetype参数提交文件类型
|
||||
fileName + filedot, //上传文件的名称,类似<input type=file 的value
|
||||
0, //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
|
||||
null, //sheetname,提交excel的哪个表格
|
||||
true, //IsShowUI,是否显示提交界面
|
||||
false, // IsShowMsg,是否显示提交成功信息
|
||||
false, // IsUseSecurity,是否使用安全特性
|
||||
null, // OwnerPass,安全密码.可直接传值
|
||||
false, //IsPermitPrint,是否允许打印
|
||||
true //IsPermitCopy,是否允许拷贝
|
||||
);
|
||||
}
|
||||
else {
|
||||
alert("不能执行提交,没有编辑文档或者没有安装PDF虚拟打印机!");
|
||||
}
|
||||
}
|
||||
|
||||
function testFunction() {
|
||||
alert(IsFileOpened);
|
||||
}
|
||||
function addServerSecSign() {
|
||||
var signUrl = document.all("secSignFileUrl").options[document.all("secSignFileUrl").selectedIndex].value;
|
||||
if (IsFileOpened) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
|
||||
try {
|
||||
alert("正式版本用户请插入EKEY!\r\n\r\n此为电子印章系统演示功能,请购买正式版本!");
|
||||
TANGER_OCX_OBJ.AddSecSignFromURL("ntko", signUrl);
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
else
|
||||
{ alert("不能在该类型文档中使用安全签名印章."); }
|
||||
}
|
||||
}
|
||||
function addLocalSecSign() {
|
||||
if (IsFileOpened) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
|
||||
try
|
||||
{ TANGER_OCX_OBJ.AddSecSignFromLocal("ntko", ""); }
|
||||
catch (error) { }
|
||||
}
|
||||
else
|
||||
{ alert("不能在该类型文档中使用安全签名印章."); }
|
||||
}
|
||||
}
|
||||
function addEkeySecSign() {
|
||||
if (IsFileOpened) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
|
||||
try
|
||||
{ TANGER_OCX_OBJ.AddSecSignFromEkey("ntko"); }
|
||||
catch (error) { }
|
||||
}
|
||||
else
|
||||
{ alert("不能在该类型文档中使用安全签名印章."); }
|
||||
}
|
||||
}
|
||||
function addHandSecSign() {
|
||||
if (IsFileOpened) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
|
||||
try
|
||||
{ TANGER_OCX_OBJ.AddSecHandSign("ntko"); }
|
||||
catch (error) { }
|
||||
}
|
||||
else
|
||||
{ alert("不能在该类型文档中使用安全签名印章."); }
|
||||
}
|
||||
}
|
||||
|
||||
function addServerSign(signUrl) {
|
||||
if (IsFileOpened) {
|
||||
try {
|
||||
TANGER_OCX_OBJ.AddSignFromURL("ntko", //印章的用户名
|
||||
signUrl, //印章所在服务器相对url
|
||||
100, //左边距
|
||||
100, //上边距 根据Relative的设定选择不同参照对象
|
||||
"ntko", //调用DoCheckSign函数签名印章信息,用来验证印章的字符串
|
||||
3, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
|
||||
100, //缩放印章,默认100%
|
||||
1); //0印章位于文字下方,1位于上方
|
||||
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
}
|
||||
|
||||
function addLocalSign() {
|
||||
if (IsFileOpened) {
|
||||
try {
|
||||
TANGER_OCX_OBJ.AddSignFromLocal("ntko", //印章的用户名
|
||||
"", //缺省文件名
|
||||
true, //是否提示选择
|
||||
100, //左边距
|
||||
100, //上边距 根据Relative的设定选择不同参照对象
|
||||
"ntko", //调用DoCheckSign函数签名印章信息,用来验证印章的字符串
|
||||
3, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
|
||||
100, //缩放印章,默认100%
|
||||
1); //0印章位于文字下方,1位于上方
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
}
|
||||
function addPicFromUrl(picURL) {
|
||||
if (IsFileOpened) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1 || TANGER_OCX_OBJ.doctype == 2) {
|
||||
try {
|
||||
TANGER_OCX_OBJ.AddPicFromURL(picURL, //图片的url地址可以时相对或者绝对地址
|
||||
false, //是否浮动,此参数设置为false时,top和left无效
|
||||
100, //left 左边距
|
||||
100, //top 上边距 根据Relative的设定选择不同参照对象
|
||||
1, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
|
||||
100, //缩放印章,默认100%
|
||||
1); //0印章位于文字下方,1位于上方
|
||||
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
else
|
||||
{ alert("不能在该类型文档中使用安全签名印章."); }
|
||||
}
|
||||
}
|
||||
function addPicFromLocal() {
|
||||
if (IsFileOpened) {
|
||||
try {
|
||||
TANGER_OCX_OBJ.AddPicFromLocal("", //印章的用户名
|
||||
true, //缺省文件名
|
||||
false, //是否提示选择
|
||||
100, //左边距
|
||||
100, //上边距 根据Relative的设定选择不同参照对象
|
||||
1, //Relative,取值1-4。设置左边距和上边距相对以下对象所在的位置 1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落
|
||||
100, //缩放印章,默认100%
|
||||
1); //0印章位于文字下方,1位于上方
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
}
|
||||
|
||||
function TANGER_OCX_AddDocHeader(strHeader) {
|
||||
if (!IsFileOpened)
|
||||
{ return; }
|
||||
var i, cNum = 30;
|
||||
var lineStr = "";
|
||||
try {
|
||||
for (i = 0; i < cNum; i++) lineStr += "_"; //生成下划线
|
||||
with (TANGER_OCX_OBJ.ActiveDocument.Application) {
|
||||
Selection.HomeKey(6, 0); // go home
|
||||
Selection.TypeText(strHeader);
|
||||
Selection.TypeParagraph(); //换行
|
||||
Selection.TypeText(lineStr); //插入下划线
|
||||
// Selection.InsertSymbol(95,"",true); //插入下划线
|
||||
Selection.TypeText("★");
|
||||
Selection.TypeText(lineStr); //插入下划线
|
||||
Selection.TypeParagraph();
|
||||
//Selection.MoveUp(5, 2, 1); //上移两行,且按住Shift键,相当于选择两行
|
||||
Selection.HomeKey(6, 1); //选择到文件头部所有文本
|
||||
Selection.ParagraphFormat.Alignment = 1; //居中对齐
|
||||
with (Selection.Font) {
|
||||
NameFarEast = "宋体";
|
||||
Name = "宋体";
|
||||
Size = 12;
|
||||
Bold = false;
|
||||
Italic = false;
|
||||
Underline = 0;
|
||||
UnderlineColor = 0;
|
||||
StrikeThrough = false;
|
||||
DoubleStrikeThrough = false;
|
||||
Outline = false;
|
||||
Emboss = false;
|
||||
Shadow = false;
|
||||
Hidden = false;
|
||||
SmallCaps = false;
|
||||
AllCaps = false;
|
||||
Color = 255;
|
||||
Engrave = false;
|
||||
Superscript = false;
|
||||
Subscript = false;
|
||||
Spacing = 0;
|
||||
Scaling = 100;
|
||||
Position = 0;
|
||||
Kerning = 0;
|
||||
Animation = 0;
|
||||
DisableCharacterSpaceGrid = false;
|
||||
EmphasisMark = 0;
|
||||
}
|
||||
Selection.MoveDown(5, 3, 0); //下移3行
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
alert("错误:" + err.number + ":" + err.description);
|
||||
}
|
||||
finally {
|
||||
}
|
||||
}
|
||||
|
||||
function insertRedHeadFromUrl(headFileURL) {
|
||||
if (TANGER_OCX_OBJ.doctype != 1)//TANGER_OCX_OBJ.doctype=1为word文档
|
||||
{ return; }
|
||||
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.HomeKey(6, 0); //光标移动到文档开头
|
||||
TANGER_OCX_OBJ.addtemplatefromurl(headFileURL); //在光标位置插入红头文档
|
||||
}
|
||||
function insertRedButtomFromUrl(headFileURL) {
|
||||
if (TANGER_OCX_OBJ.doctype != 1)//TANGER_OCX_OBJ.doctype=1为word文档
|
||||
{ return; }
|
||||
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.EndKey(6, 0);
|
||||
TANGER_OCX_OBJ.ActiveDocument.Application.Selection.TypeParagraph();
|
||||
TANGER_OCX_OBJ.addtemplatefromurl(headFileURL); //在光标位置插入红头文档
|
||||
}
|
||||
function openTemplateFileFromUrl(templateUrl) {
|
||||
TANGER_OCX_OBJ.openFromUrl(templateUrl);
|
||||
}
|
||||
function doHandSign() {
|
||||
/*if(TANGER_OCX_OBJ.doctype==1||TANGER_OCX_OBJ.doctype==2)//此处设置只允许在word和excel中盖章.doctype=1是"word"文档,doctype=2是"excel"文档
|
||||
{*/
|
||||
TANGER_OCX_OBJ.DoHandSign2(
|
||||
"ntko", //手写签名用户名称
|
||||
"ntko", //signkey,DoCheckSign(检查印章函数)需要的验证密钥。
|
||||
0, //left
|
||||
0, //top
|
||||
1, //relative,设定签名位置的参照对象.0:表示按照屏幕位置插入,此时,Left,Top属性不起作用。1:光标位置;2:页边距;3:页面距离 4:默认设置栏,段落(为兼容以前版本默认方式)
|
||||
100);
|
||||
//}
|
||||
}
|
||||
|
||||
// 存为本地文件
|
||||
function WebSaveLocal() {
|
||||
TANGER_OCX_OBJ.ShowDialog(3);
|
||||
}
|
||||
|
||||
// 打开本地文件
|
||||
function WebOpenLocal() {
|
||||
TANGER_OCX_OBJ.ShowDialog(1);
|
||||
}
|
||||
|
||||
// 打印预览
|
||||
function PrintPreview() {
|
||||
TANGER_OCX_OBJ.PrintPreview();
|
||||
}
|
||||
|
||||
// 页面设置
|
||||
function WebPageSetup() {
|
||||
TANGER_OCX_OBJ.showDialog(5);
|
||||
}
|
||||
|
||||
//isBackground参数可以控制是前台打印还是后台打印。对于比较大的文档,如果确认必须等待用户打印完毕,可以调用TANGER_OCX_PrintDoc(false);函数来进行前台打印。
|
||||
function TANGER_OCX_PrintDoc(isBackground) {
|
||||
var oldOption;
|
||||
try {
|
||||
var objOptions = TANGER_OCX_OBJ.ActiveDocument.Application.Options;
|
||||
oldOption = objOptions.PrintBackground;
|
||||
objOptions.PrintBackground = isBackground;
|
||||
}
|
||||
catch (err) { };
|
||||
TANGER_OCX_OBJ.printout(true);
|
||||
try {
|
||||
var objOptions = TANGER_OCX_OBJ.ActiveDocument.Application.Options;
|
||||
objOptions.PrintBackground = oldOption;
|
||||
}
|
||||
catch (err) { };
|
||||
}
|
||||
|
||||
|
||||
function SetReviewMode(boolvalue) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1) {
|
||||
TANGER_OCX_OBJ.ActiveDocument.TrackRevisions = boolvalue; //设置是否保留痕迹
|
||||
}
|
||||
}
|
||||
|
||||
function setShowRevisions(boolevalue) {
|
||||
if (TANGER_OCX_OBJ.doctype == 1) {
|
||||
TANGER_OCX_OBJ.ActiveDocument.ShowRevisions = boolevalue; //设置是否显示痕迹
|
||||
}
|
||||
}
|
||||
//接受或者取消所有修订
|
||||
function TANGER_OCX_AllRevisions(bool) {
|
||||
if (bool) {
|
||||
TANGER_OCX_OBJ.ActiveDocument.AcceptAllRevisions(); //接受所有的痕迹修订
|
||||
}
|
||||
else {
|
||||
TANGER_OCX_OBJ.ActiveDocument.Application.WordBasic.RejectAllChangesInDoc(); //拒绝所有的痕迹修订
|
||||
}
|
||||
}
|
||||
function setFilePrint(boolvalue) {
|
||||
TANGER_OCX_OBJ.fileprint = boolvalue; //是否允许打印
|
||||
}
|
||||
function setFileNew(boolvalue) {
|
||||
TANGER_OCX_OBJ.FileNew = boolvalue; //是否允许新建
|
||||
}
|
||||
function setFileSaveAs(boolvalue) {
|
||||
TANGER_OCX_OBJ.FileSaveAs = boolvalue; //是否允许另存为
|
||||
}
|
||||
|
||||
function setIsNoCopy(boolvalue) {
|
||||
TANGER_OCX_OBJ.IsNoCopy = boolvalue; //是否禁止粘贴
|
||||
}
|
||||
function DoCheckSign() {
|
||||
if (IsFileOpened) {
|
||||
var ret = TANGER_OCX_OBJ.DoCheckSign
|
||||
(
|
||||
false, /*可选参数 IsSilent 缺省为FAlSE,表示弹出验证对话框,否则,只是返回验证结果到返回值*/
|
||||
"ntko"//使用盖章时的signkey,这里为"ntko"
|
||||
); //返回值,验证结果字符串
|
||||
//alert(ret);
|
||||
}
|
||||
}
|
||||
function setToolBar() {
|
||||
TANGER_OCX_OBJ.ToolBars = !TANGER_OCX_OBJ.ToolBars;
|
||||
}
|
||||
function setMenubar() {
|
||||
TANGER_OCX_OBJ.Menubar = !TANGER_OCX_OBJ.Menubar;
|
||||
}
|
||||
function setInsertMemu() {
|
||||
TANGER_OCX_OBJ.IsShowInsertMenu = !TANGER_OCX_OBJ.IsShowInsertMenu;
|
||||
}
|
||||
function setEditMenu() {
|
||||
TANGER_OCX_OBJ.IsShowEditMenu = !TANGER_OCX_OBJ.IsShowEditMenu;
|
||||
}
|
||||
function setToolMenu() {
|
||||
TANGER_OCX_OBJ.IsShowToolMenu = !TANGER_OCX_OBJ.IsShowToolMenu;
|
||||
}
|
||||
|
||||
//增加自定义菜单
|
||||
function initCustomMenus1() {
|
||||
var myobj = TANGER_OCX_OBJ;
|
||||
for (var menuPos = 0; menuPos < 1; menuPos++) {
|
||||
myobj.AddCustomMenu2(menuPos, "常用功能" + "(&" + menuPos + ")");
|
||||
for (var submenuPos = 0; submenuPos < 1; submenuPos++) {
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, -1, true, "打印设置", false);
|
||||
//增加子菜单项目
|
||||
for (var subsubmenuPos = 0; subsubmenuPos < 3; subsubmenuPos++) {
|
||||
if (0 == subsubmenuPos)//增加子菜单项目
|
||||
{
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
|
||||
"设置打印区域", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
|
||||
}
|
||||
if (1 == subsubmenuPos)//增加子菜单项目
|
||||
{
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
|
||||
"取消打印区域", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
|
||||
}
|
||||
if (2 == subsubmenuPos) {
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
|
||||
"手写批注", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//控件控制
|
||||
function controlStyle() {
|
||||
var myobj = TANGER_OCX_OBJ;
|
||||
for (var menuPos = 0; menuPos < 1; menuPos++) {
|
||||
myobj.AddCustomMenu2(menuPos, "控件样式" + "(&" + menuPos + ")");
|
||||
for (var submenuPos = 0; submenuPos < 1; submenuPos++) {
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, -1, true, "改变大小", false);
|
||||
//增加子菜单项目
|
||||
for (var subsubmenuPos = 0; subsubmenuPos < 2; subsubmenuPos++) {
|
||||
if (0 == subsubmenuPos)//增加子菜单项目
|
||||
{
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
|
||||
"全网页查看", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
|
||||
}
|
||||
if (1 == subsubmenuPos)//增加子菜单项目
|
||||
{
|
||||
myobj.AddCustomMenuItem2(menuPos, submenuPos, subsubmenuPos, false,
|
||||
"恢复原大小", false, menuPos * 100 + submenuPos * 20 + subsubmenuPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//改变控件大小为当前网页可见区域
|
||||
function objside() {
|
||||
document.all.officecontrol.style.position = "absolute";
|
||||
document.all.officecontrol.style.left = "0px";
|
||||
document.all.officecontrol.style.top = "0px";
|
||||
document.all.officecontrol.style.width = document.body.clientWidth; //网页可见区域宽
|
||||
document.all.officecontrol.style.height = document.body.clientHeight; //网页可见区域高
|
||||
}
|
||||
//恢复控件显示大小
|
||||
function objside2() {
|
||||
document.all.officecontrol.style.position = "relative";
|
||||
document.all.officecontrol.style.left = "0px";
|
||||
document.all.officecontrol.style.top = "0px";
|
||||
document.all.officecontrol.style.width = "100%";
|
||||
document.all.officecontrol.style.height = "980px";
|
||||
}
|
||||
//显示或隐藏文档控件对象
|
||||
function ObjectDisplay(boolvalue) {
|
||||
var obj = document.getElementById("objside");
|
||||
if (!boolvalue) {
|
||||
obj.style.display = "none";
|
||||
}
|
||||
else {
|
||||
obj.style.display = "block";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user