2023-08-04

This commit is contained in:
2023-08-04 17:06:50 +08:00
parent 70a51ab125
commit 78e8037f08
81 changed files with 8897 additions and 2763 deletions
@@ -4,11 +4,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<title>
Spire.Office
</title>
<style>
@@ -49,9 +49,9 @@
var lang = "zh";
var fileType = "";
var token = null;
var appid = "40a7173618064b5d32cbd941de2d75de";
var appkey = "7rtntDrw5aqYYwsJ3qsIDSis2ZbJuXeO";
var appid ='<%=Appid%>';
var appkey ='<%=Appkey%>';
//console.log(Appid + "---" + appkey);
var innerAlert = function (message) {
if (console && console.log)
console.log(message);
@@ -102,7 +102,7 @@
xhr.open(method, url, true);
if (method === "POST")
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("token", "<%=UserId%>");
xhr.setRequestHeader("token", "<%=this.CurrUser.PersonId%>");
xhr.send(queryString);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
@@ -127,26 +127,23 @@
fileName = fileName.split('=')[1];
var host = location.hostname;
ajax({
url: 'https://sggl.sedin.com.cn/sgglapi/api/FileUpload/DownloadDocument',
type: 'post',
url: '<%=CallBackUrl%>',
type: 'post',
data: {
'UrlStr': url,
'PCUrl': '<%=PCUrl%>',
},
dataType: 'json',
async: false,
success: function (json) {
console.log(json)
if (json.code == 1 || json.code == '1') {
alert('保存成功');
} else {
this.error(json);
this.error(json, '保存失败');
}
},
error: function (json) {
alert(json.message);
error: function (json, msg) {
alert(+msg);
}
});
}
@@ -161,8 +158,9 @@
type = "mobile";
}
};
/*var urlString = "https://cloud.e-iceblue.cn/demo/sample.docx";*/
var urlString = "<%=BLL.Funs.SGGLUrl%>"+"<%=PCUrl%>";
// var urlString = "https://cloud.e-iceblue.cn/demo/sample.docx";
var urlString = "<%=BLL.Funs.SGGLUrl%>" + "<%=PCUrl%>";
var arrfn = urlString.split(".");
var strp = arrfn[arrfn.length - 1];
var documentTypeValue = null;
@@ -217,59 +215,59 @@
whiteLabel:true,
user: {
primary: '',
name: '<%=UserName%>',
canSave: true,
customization: {
public: {
common: {
whiteLabel: true,
defaultZoom: 1,
openReviewChanges: false,
permGroups: ['everyone'], //限制编辑分组
viewVersion: false,
header: {
hideTitle: false,
defaultView: 'full'
}
},
word: null, //doc定制
powerpoint: null, //ppt定制
excel: null //xls定制
name: '<%=this.CurrUser.PersonName%>',
canSave: true,
customization: {
public: {
common: {
whiteLabel: true,
defaultZoom: 1,
openReviewChanges: false,
permGroups: ['everyone'], //限制编辑分组
viewVersion: false,
header: {
hideTitle: false,
defaultView: 'full'
}
},
"private": {
"token": null,
"appid": null,
"appkey": null
}
}
},
editorAttrs: { //编辑器配置
editorWidth: '100%',
editorHeight: '100%',
editorMode: 'edit',
editorType: 'document', //编辑器类型,可不配置,程序根据文件类型获取,结果为 document,presentation,spreadsheet
platform: 'windows', //编辑器平台类型,可选windows mobile embedded
viewLanguage: 'zh', //平台界面展示语言可选en/zh
canChat: true, //是否可聊天
canComment: true, //是否可批注
canReview: true,
canDownload: true,
canForcesave: true,
embedded: {
saveUrl: '',
embedUrl: '',
shareUrl: ''
word: null, //doc定制
powerpoint: null, //ppt定制
excel: null //xls定制
},
events: {
'onReady': onReady,
'onDocumentStateChange': onDocumentStateChange,
'onError': onError,
'onRequestEditRights': onRequestEditRights,
'onOutdatedVersion': onOutdatedVersion,
'onSave': callbackfn
"private": {
"token": null,
"appid": null,
"appkey": null
}
}
},
editorAttrs: { //编辑器配置
editorWidth: '100%',
editorHeight: '100%',
editorMode: 'edit',
editorType: 'document', //编辑器类型,可不配置,程序根据文件类型获取,结果为 document,presentation,spreadsheet
platform: 'windows', //编辑器平台类型,可选windows mobile embedded
viewLanguage: 'zh', //平台界面展示语言可选en/zh
canChat: true, //是否可聊天
canComment: true, //是否可批注
canReview: true,
canDownload: true,
canForcesave: true,
embedded: {
saveUrl: '',
embedUrl: '',
shareUrl: ''
},
events: {
'onReady': onReady,
'onDocumentStateChange': onDocumentStateChange,
'onError': onError,
'onRequestEditRights': onRequestEditRights,
'onOutdatedVersion': onOutdatedVersion,
'onSave': callbackfn
}
}
},
appid,
appkey
);
@@ -1,38 +1,70 @@
using BLL;
using RestSharp;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.AttachFile
{
public partial class OnlineEditing : System.Web.UI.Page
public partial class OnlineEditing : PageBase
{
#region
public string UserId
public string Appid
{
get
{
return (string)ViewState["UserId"];
}
set
{
ViewState["UserId"] = value;
var sysSet = (from x in Funs.DB.Sys_Const where x.ConstText == "OnlineEditAppid" select x).ToList().FirstOrDefault();
if (sysSet != null)
{
return sysSet.ConstValue;
}
else
{
return "";
}
}
}
public string UserName
public string Appkey
{
get
{
return (string)ViewState["UserName"];
var sysSet = (from x in Funs.DB.Sys_Const where x.ConstText == "OnlineEditAppkey" select x).ToList().FirstOrDefault();
if (sysSet != null)
{
return sysSet.ConstValue;
}
else
{
return "";
}
}
}
public string CallBackUrl
{
get
{
var sysSet = (from x in Funs.DB.Sys_Const where x.ConstText == "OnlineEditCallBackurl" select x).ToList().FirstOrDefault();
if (sysSet != null)
{
return sysSet.ConstValue;
}
else
{
return "";
}
}
}
public string ReadOnly
{
get
{
return (string)ViewState["ReadOnly"];
}
set
{
ViewState["UserName"] = value;
ViewState["ReadOnly"] = value;
}
}
public string PCUrl
@@ -45,17 +77,6 @@ namespace FineUIPro.Web.AttachFile
{
ViewState["PCUrl"] = value;
}
}
public string CanSave
{
get
{
return (string)ViewState["CanSave"];
}
set
{
ViewState["CanSave"] = value;
}
}
#endregion
@@ -63,13 +84,12 @@ namespace FineUIPro.Web.AttachFile
{
if (!IsPostBack)
{
UserId = Request.Params["UserId"];
// UserId = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0";
CanSave = Request.Params["CanSave"];
PCUrl = Request.Params["PCUrl"];
// PCUrl = "https://sggl.sedin.com.cn/FileUpLoad/K350-ZBJH-001.doc";
UserName=BLL.Person_PersonsService.GetPersonsNameById(UserId);
CanSave = "true";
/*UserId = Request.Params["UserId"];
AttachFileId = Request.Params["AttachFileId"];
ReadOnly = Request.Params["ReadOnly"];*/
PCUrl = Request.Params["fileUrl"];
}
}
}
@@ -1,5 +1,6 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.SessionState;
@@ -41,6 +42,8 @@ namespace FineUIPro.Web.AttachFile
ResponseError(context);
return;
}
// 定义允许上传的文件类型列表
List<string> allowExtensions = BLL.DropListService.allowExtensions;
HttpPostedFile postedFile = context.Request.Files[0];
// 文件名完整路径
@@ -51,6 +54,15 @@ namespace FineUIPro.Web.AttachFile
string shortFileName = GetFileName(fileName);
string fileType = GetFileType(fileName);
if (!allowExtensions.Contains("." + fileType))
{
// 出错了
context.Response.StatusCode = 415;
context.Response.Write("不支持的文件类型");
// ResponseError(context);
return;
}
int fileSize = postedFile.ContentLength;
JObject fileObj = new JObject();
@@ -29,7 +29,9 @@
<f:Toolbar runat="server" ID="toolBar" Hidden="true" ToolbarAlign="Right">
<Items>
<f:Button ID="btnImageMagnify" runat="server" IconFont="Inbox" Text="扫描"
ToolTip="扫描文件" OnClick="btnImageMagnify_Click"></f:Button>
ToolTip="扫描文件" OnClick="btnImageMagnify_Click"></f:Button>
<f:Button ID="btnOnlineEdit" runat="server" IconFont="Edit" ToolTip="文档编辑" OnClick="btnOnlineEdit_OnClick" Hidden="True"></f:Button>
<f:ToolbarFill runat="server">
</f:ToolbarFill>
<f:Button ID="btnSelectFiles" Text="上传" ToolTip="选择文件上传" IconFont="Upload" runat="server" EnablePostBack="false">
@@ -725,5 +725,58 @@ namespace FineUIPro.Web.AttachFile
{
}
protected void btnOnlineEdit_OnClick(object sender, EventArgs e)
{
JArray source = GetSourceData();
for (int i = 0, count = source.Count; i < count; i++)
{
JObject item = source[i] as JObject;
if (item.Value<string>("id") == Grid1.SelectedRowID)
{
try
{
string savedName = item.Value<string>("savedName");
string folder = item.Value<string>("folder");
string xnUrl = AttachPath + "\\" + savedName;
if (!string.IsNullOrEmpty(folder))
{
xnUrl = folder + savedName;
}
string url = Funs.RootPath + xnUrl;
if (savedName.Contains("FileUpLoad"))
{
url = Funs.RootPath + savedName.Replace('/', '\\');
}
FileInfo info = new FileInfo(url);
if (!info.Exists || string.IsNullOrEmpty(savedName))
{
url = Funs.RootPath + "Images//Null.jpg";
info = new FileInfo(url);
}
var FiletExtension = Path.GetExtension(savedName);
bool isSupportType = FiletExtension.Equals(".docx");
if (isSupportType)
{
url = url.Replace(Funs.RootPath, "");
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/OnlineEditing.aspx?fileUrl={0}", url, "编辑 -")));
}
else
{
ShowNotify("不支持在线编辑", MessageBoxIcon.Warning);
}
}
catch (Exception)
{
}
}
}
}
}
}
+25 -14
View File
@@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.AttachFile {
public partial class webuploader {
namespace FineUIPro.Web.AttachFile
{
public partial class webuploader
{
/// <summary>
/// form1 控件。
/// </summary>
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Grid1 控件。
/// </summary>
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// toolBar 控件。
/// </summary>
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar toolBar;
/// <summary>
/// btnImageMagnify 控件。
/// </summary>
@@ -56,7 +58,16 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImageMagnify;
/// <summary>
/// btnOnlineEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOnlineEdit;
/// <summary>
/// btnSelectFiles 控件。
/// </summary>
@@ -65,7 +76,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSelectFiles;
/// <summary>
/// btnDelete 控件。
/// </summary>
@@ -74,7 +85,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDelete;
/// <summary>
/// ToolbarSeparator2 控件。
/// </summary>
@@ -83,7 +94,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator2;
/// <summary>
/// btnSave 控件。
/// </summary>
@@ -92,7 +103,7 @@ namespace FineUIPro.Web.AttachFile {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// Window1 控件。
/// </summary>