This commit is contained in:
		
							parent
							
								
									77d232b24e
								
							
						
					
					
						commit
						72cd50ef22
					
				|  | @ -0,0 +1,298 @@ | |||
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OnlineEditingPrivate.aspx.cs" Inherits="FineUIPro.Web.AttachFile.OnlineEditingPrivate" %> | ||||
| 
 | ||||
| <!DOCTYPE html> | ||||
| 
 | ||||
| <html xmlns="http://www.w3.org/1999/xhtml"> | ||||
| 
 | ||||
| <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> | ||||
|         html { | ||||
|             height: 100%; | ||||
|             width: 100%; | ||||
|         } | ||||
| 
 | ||||
|         body { | ||||
|             background: #fff; | ||||
|             color: #333; | ||||
|             font-family: Arial, Tahoma, sans-serif; | ||||
|             font-size: 12px; | ||||
|             font-weight: normal; | ||||
|             height: 100%; | ||||
|             margin: 0; | ||||
|             overflow-y: hidden; | ||||
|             padding: 0; | ||||
|             text-decoration: none; | ||||
|         } | ||||
| 
 | ||||
|         form { | ||||
|             height: 100%; | ||||
|         } | ||||
| 
 | ||||
|         div { | ||||
|             margin: 0; | ||||
|             padding: 0; | ||||
|         } | ||||
|     </style> | ||||
| 
 | ||||
|     <script language="javascript" type="text/javascript" | ||||
|         src="http://47.104.102.122:8000/web/editors/spireapi/SpireCloudEditor.js"></script> | ||||
| 
 | ||||
|     <script type="text/javascript" language="javascript"> | ||||
|         var docEditor; | ||||
|         var fileName = ""; | ||||
|         var lang = "zh"; | ||||
|         var fileType = ""; | ||||
|         var token = null; | ||||
|         var appid = null; | ||||
|         var appkey = null; | ||||
|         //console.log(Appid + "---" + appkey); | ||||
|         var innerAlert = function (message) { | ||||
|             if (console && console.log) | ||||
|                 console.log(message); | ||||
|         }; | ||||
| 
 | ||||
|         var onReady = function () { | ||||
|             innerAlert("Document editor ready"); | ||||
| 
 | ||||
|         }; | ||||
| 
 | ||||
|         var onDocumentStateChange = function (event) { | ||||
|             var title = document.title.replace(/\*$/g, ""); | ||||
|             document.title = title + (event.data ? "*" : ""); | ||||
|         }; | ||||
| 
 | ||||
|         var onRequestEditRights = function () { | ||||
|             location.href = location.href.replace(RegExp("action=view\&?", "i"), ""); | ||||
|         }; | ||||
| 
 | ||||
|         var onError = function (event) { | ||||
|             if (event) | ||||
|                 innerAlert(event.data); | ||||
|         }; | ||||
| 
 | ||||
|         var onOutdatedVersion = function (event) { | ||||
|             location.reload(true); | ||||
|         }; | ||||
| 
 | ||||
|         function ajax(options) { | ||||
|             options = options || {}; | ||||
|             var method = (options.type || "GET").toUpperCase(), | ||||
|                 url = options.url, | ||||
|                 queryString = null; | ||||
|             if (!url) | ||||
|                 return; | ||||
|             if (options.data) { | ||||
|                 queryString = []; | ||||
|                 for (var attr in options.data) { | ||||
|                     queryString.push(attr + "=" + options.data[attr]); | ||||
|                 } | ||||
|                 queryString = queryString.join("&"); | ||||
|             } | ||||
|             if (method === "GET" && queryString) { | ||||
|                 url += "?" + queryString; | ||||
|                 queryString = ""; | ||||
|             } | ||||
|             var xhr = new XMLHttpRequest(); | ||||
|             xhr.open(method, url, true); | ||||
|             if (method === "POST") | ||||
|                 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | ||||
|                 xhr.setRequestHeader("token", "<%=this.CurrUser.UserId%>"); | ||||
|             xhr.send(queryString); | ||||
|             xhr.onreadystatechange = function () { | ||||
|                 if (xhr.readyState === 4) { | ||||
|                     if (xhr.status === 200) { | ||||
|                         var data = xhr.responseText; | ||||
|                         if (options.dataType === "json") | ||||
|                             data = JSON.parse(data); | ||||
|                         options.success && options.success(data); | ||||
|                     } else { | ||||
|                         options.error && options.error(xhr.status); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         var callbackfn = function (result) { | ||||
|             console.log(result.data); | ||||
|             if (result && result.data) { | ||||
|                 var data = result.data, | ||||
|                     fileName = data[0], | ||||
|                     url = data[1]; | ||||
|                 if (fileName.indexOf('=') > -1) | ||||
|                     fileName = fileName.split('=')[1]; | ||||
|                 var host = location.hostname; | ||||
|                 ajax({ | ||||
|                     url: '<%=CallBackUrl%>', | ||||
|                     type: 'post', | ||||
|                     data: { | ||||
|                         'UrlStr': url, | ||||
|                         'PCUrl': '<%=PCUrl%>', | ||||
|                     }, | ||||
|                     dataType: 'json', | ||||
|                     async: false, | ||||
|                     success: function (json) { | ||||
|                         if (json.code == 1 || json.code == '1') { | ||||
|                             alert('保存成功'); | ||||
|                         } else { | ||||
|                             this.error(json, '保存失败'); | ||||
|                         } | ||||
|                     }, | ||||
|                     error: function (json, msg) { | ||||
|                         alert(+msg); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         }; | ||||
|         var connectEditor = function () { | ||||
|             var type = 'desktop'; | ||||
|             if (type == "desktop") { | ||||
|                 var app = navigator.appVersion; | ||||
|                 if (app.toLowerCase().indexOf('window') != -1) { | ||||
|                     type = "desktop"; | ||||
|                 } else { | ||||
|                     type = "mobile"; | ||||
|                 } | ||||
|             }; | ||||
|            // 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; | ||||
|             switch (strp) { | ||||
|                 case "xls": | ||||
|                 case "xlsx": | ||||
|                 case "xlsm": | ||||
|                 case "xlt": | ||||
|                 case "xltx": | ||||
|                 case "xltm": | ||||
|                 case "ods": | ||||
|                 case "fods": | ||||
|                 case "ots": | ||||
|                 case "csv": | ||||
|                     documentTypeValue = "spreadsheet"; | ||||
|                     break; | ||||
|                 case "pps": | ||||
|                 case "ppsx": | ||||
|                 case "ppsm": | ||||
|                 case "ppt": | ||||
|                 case "pptx": | ||||
|                 case "pptm": | ||||
|                 case "pot": | ||||
|                 case "potx": | ||||
|                 case "potm": | ||||
|                 case "odp": | ||||
|                 case "fodp": | ||||
|                 case "otp": | ||||
|                     documentTypeValue = "presentation"; | ||||
|                     break; | ||||
|                 default: | ||||
|                     documentTypeValue = "document"; | ||||
|                     break; | ||||
|             } | ||||
| 
 | ||||
|             docEditor = new SpireCloudEditor.OpenApi("iframeEditor", { | ||||
|                     fileAttrs: { | ||||
|                         fileInfo: { | ||||
|                             name: '', | ||||
|                             ext: '', | ||||
|                             primary: '', | ||||
|                             creator: '', | ||||
|                             createTime: new Date('20210505') | ||||
|                         }, | ||||
|                         sourceUrl: urlString, | ||||
|                         createUrl: '', | ||||
|                         callbackUrl: '', ////This item can be empty, but only if the 'onSave' callback function must be defined in events. If the callback function is undefined and this item is empty, Cloud Editor will not provide save function. | ||||
|                         verification: null, //用户文件系统下载文件时若需要验证类似token的数据可以写在这里 | ||||
|                         canEdit: true | ||||
|                     }, | ||||
|                     templates:"", | ||||
|                     whiteLabel:true, | ||||
|                     user: { | ||||
|                         primary: '', | ||||
|                         name: '<%=this.CurrUser.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定制 | ||||
|                             }, | ||||
|                             "private": { | ||||
|                                 "token": null, | ||||
|                                 "appid": null, | ||||
|                                 "appkey": null | ||||
|                             } | ||||
|                         } | ||||
|                     }, | ||||
|                     editorAttrs: { //编辑器配置 | ||||
|                         editorWidth: '100%', | ||||
|                         editorHeight: '100%', | ||||
|                         editorMode: '<%=editorMode%>', | ||||
|                         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 | ||||
|             ); | ||||
|         }; | ||||
|         if (window.addEventListener) { | ||||
|             window.addEventListener("load", connectEditor); | ||||
|         } else if (window.attachEvent) { | ||||
|             window.attachEvent("load", connectEditor); | ||||
|         } | ||||
|     </script> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
|     <form name="form1" method="post" action="./docEditor.aspx?fileID=demo+(2).docx&lang=zh" id="form1"> | ||||
|         <div> | ||||
|             <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" | ||||
|                 value="/wEPDwUKMTkyMjc5MTU4M2RkBQQQBsVcOHQbzTlwYapiES2Trc9Z/U4CC+r9rluZubc=" /> | ||||
|         </div> | ||||
|         <div> | ||||
|             <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C2EAC0DE" /> | ||||
|         </div> | ||||
|         <div id="iframeEditor"> | ||||
|         </div> | ||||
|     </form> | ||||
| </body> | ||||
| 
 | ||||
| </html> | ||||
| 
 | ||||
|  | @ -0,0 +1,79 @@ | |||
| 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.AttachFile | ||||
| { | ||||
|     public partial class OnlineEditingPrivate : PageBase | ||||
|     { | ||||
|         #region 定义参数 | ||||
|   | ||||
|         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["ReadOnly"] = value; | ||||
|             } | ||||
|         } | ||||
|         public string PCUrl | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 return (string)ViewState["PCUrl"]; | ||||
|             } | ||||
|             set | ||||
|             { | ||||
|                 ViewState["PCUrl"] = value; | ||||
|             } | ||||
|         } | ||||
|         public string editorMode | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 return (string)ViewState["editorMode"]; | ||||
|             } | ||||
|             set | ||||
|             { | ||||
|                 ViewState["editorMode"] = value; | ||||
|             } | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|         protected void Page_Load(object sender, EventArgs e) | ||||
|         { | ||||
|             if (!IsPostBack) | ||||
|             { | ||||
|                 /*UserId = Request.Params["UserId"]; | ||||
|                 AttachFileId = Request.Params["AttachFileId"]; | ||||
|                 ReadOnly = Request.Params["ReadOnly"];*/ | ||||
|                 PCUrl = Request.Params["fileUrl"]; | ||||
|                 editorMode = Request.Params["editorMode"]; | ||||
| 
 | ||||
| 
 | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,17 @@ | |||
| //------------------------------------------------------------------------------ | ||||
| // <自动生成> | ||||
| //     此代码由工具生成。 | ||||
| // | ||||
| //     对此文件的更改可能导致不正确的行为,如果 | ||||
| //     重新生成代码,则所做更改将丢失。 | ||||
| // </自动生成> | ||||
| //------------------------------------------------------------------------------ | ||||
| 
 | ||||
| namespace FineUIPro.Web.AttachFile | ||||
| { | ||||
| 
 | ||||
| 
 | ||||
|     public partial class OnlineEditingPrivate | ||||
|     { | ||||
|     } | ||||
| } | ||||
|  | @ -968,7 +968,17 @@ namespace FineUIPro.Web.AttachFile | |||
|                         if (isSupportType) | ||||
|                         { | ||||
|                             url = url.Replace(Funs.RootPath, ""); | ||||
|                             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/OnlineEditing.aspx?fileUrl={0}&&editorMode={1}", url, editorMode, "编辑  -"))); | ||||
|                             var sysSet4 = (from x in Funs.DB.Sys_Const where x.ConstText == "IsUseLoaclService" select x).ToList().FirstOrDefault(); | ||||
|                             if (sysSet4!=null&& sysSet4.ConstValue=="1") | ||||
|                             { | ||||
|                                 PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/OnlineEditingPrivate.aspx?fileUrl={0}&&editorMode={1}", url, editorMode, "编辑  -"))); | ||||
| 
 | ||||
|                             } | ||||
|                             else | ||||
|                             { | ||||
|                                 PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/OnlineEditing.aspx?fileUrl={0}&&editorMode={1}", url, editorMode, "编辑  -"))); | ||||
| 
 | ||||
|                             } | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|  |  | |||
|  | @ -208,6 +208,7 @@ | |||
|     <Content Include="AttachFile\lib\popcorn.subtitle.js" /> | ||||
|     <Content Include="AttachFile\Look.aspx" /> | ||||
|     <Content Include="AttachFile\OnlineEditing.aspx" /> | ||||
|     <Content Include="AttachFile\OnlineEditingPrivate.aspx" /> | ||||
|     <Content Include="AttachFile\player.aspx" /> | ||||
|     <Content Include="AttachFile\res\webuploader\Uploader.swf" /> | ||||
|     <Content Include="AttachFile\res\webuploader\webuploader.nolog.js" /> | ||||
|  | @ -6393,6 +6394,13 @@ | |||
|     <Compile Include="AttachFile\OnlineEditing.aspx.designer.cs"> | ||||
|       <DependentUpon>OnlineEditing.aspx</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Include="AttachFile\OnlineEditingPrivate.aspx.cs"> | ||||
|       <DependentUpon>OnlineEditingPrivate.aspx</DependentUpon> | ||||
|       <SubType>ASPXCodeBehind</SubType> | ||||
|     </Compile> | ||||
|     <Compile Include="AttachFile\OnlineEditingPrivate.aspx.designer.cs"> | ||||
|       <DependentUpon>OnlineEditingPrivate.aspx</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Include="AttachFile\player.aspx.cs"> | ||||
|       <DependentUpon>player.aspx</DependentUpon> | ||||
|       <SubType>ASPXCodeBehind</SubType> | ||||
|  |  | |||
|  | @ -376,6 +376,13 @@ | |||
|                                                 <f:TextBox ID="txtCallBackapiurl" runat="server" Label="文档保存回调地址" LabelWidth="230px"></f:TextBox> | ||||
|                                             </Items> | ||||
|                                         </f:FormRow> | ||||
|                                         <f:FormRow ColumnWidths="100%"> | ||||
|                                             <Items> | ||||
|                                                 <f:CheckBox ID="ckIsUseLoaclService" runat="server" Label="是否使用本地服务" LabelWidth="230px"> | ||||
|                                                 </f:CheckBox> | ||||
|                                             </Items> | ||||
|                                         </f:FormRow> | ||||
| 
 | ||||
|                                     </Rows> | ||||
|                                 </f:Form> | ||||
|                             </Items> | ||||
|  |  | |||
|  | @ -1048,6 +1048,18 @@ namespace FineUIPro.Web.SysManage | |||
|             { | ||||
|                 txtCallBackapiurl.Text = sysSet3.ConstValue; | ||||
|             } | ||||
|             var sysSet4 = (from x in db.Sys_Const where x.ConstText == "IsUseLoaclService" select x).ToList().FirstOrDefault(); | ||||
|             if (sysSet4 != null) | ||||
|             { | ||||
|                 if (sysSet4.ConstValue=="1") | ||||
|                 { | ||||
|                     ckIsUseLoaclService .Checked=true; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     ckIsUseLoaclService.Checked = false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         protected void OnlineMenuSetSave_OnClick(object sender, EventArgs e) | ||||
|         { | ||||
|  | @ -1115,6 +1127,36 @@ namespace FineUIPro.Web.SysManage | |||
|                 Funs.DB.Sys_Const.InsertOnSubmit(sysSet3); | ||||
|                 Funs.DB.SubmitChanges(); | ||||
|             } | ||||
|             Model.Sys_Const sysSet4 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "IsUseLoaclService"); | ||||
|             if (sysSet4 != null) | ||||
|             { | ||||
|                 if (ckIsUseLoaclService.Checked) | ||||
|                 { | ||||
|                     sysSet4.ConstValue ="1"; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     sysSet4.ConstValue = "0"; | ||||
|                 } | ||||
| 
 | ||||
|                 db.SubmitChanges(); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 sysSet4 = new Model.Sys_Const(); | ||||
|                 if (ckIsUseLoaclService.Checked) | ||||
|                 { | ||||
|                     sysSet4.ConstValue = "1"; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     sysSet4.ConstValue = "0"; | ||||
|                 } | ||||
|                 sysSet4.ConstText = "IsUseLoaclService"; | ||||
|                 sysSet4.ID = SQLHelper.GetNewID(); | ||||
|                 Funs.DB.Sys_Const.InsertOnSubmit(sysSet4); | ||||
|                 Funs.DB.SubmitChanges(); | ||||
|             } | ||||
|             ShowNotify("保存成功!", MessageBoxIcon.Success); | ||||
|         } | ||||
|         #endregion | ||||
|  |  | |||
|  | @ -869,6 +869,15 @@ namespace FineUIPro.Web.SysManage | |||
|         /// </remarks> | ||||
|         protected global::FineUIPro.TextBox txtCallBackapiurl; | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// ckIsUseLoaclService 控件。 | ||||
|         /// </summary> | ||||
|         /// <remarks> | ||||
|         /// 自动生成的字段。 | ||||
|         /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 | ||||
|         /// </remarks> | ||||
|         protected global::FineUIPro.CheckBox ckIsUseLoaclService; | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Toolbar5 控件。 | ||||
|         /// </summary> | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
|   <appSettings> | ||||
|     <!--连接字符串--> | ||||
|     <!--<add key="ConnectionString" value="Server=.;Database=SGGLDB_WH;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Connect Timeout=1200"/>--> | ||||
| 	  <add key="ConnectionString" value="Server=192.168.0.108;Database=SGGLDB_WH;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Connect Timeout=1200"/> | ||||
| 	  <add key="ConnectionString" value="Server=.;Database=SGGLDB_WH;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Connect Timeout=1200"/> | ||||
| 	  <!--系统名称--> | ||||
|     <add key="SystemName" value="智慧施工管理信息系统V1.0"/> | ||||
|     <add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/> | ||||
|  | @ -188,7 +188,7 @@ | |||
|       </dependentAssembly> | ||||
|       <dependentAssembly> | ||||
|         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> | ||||
|         <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/> | ||||
|         <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/> | ||||
|       </dependentAssembly> | ||||
|       <dependentAssembly> | ||||
|         <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue