6.10 weboffice新版改造,版本20220624

This commit is contained in:
jl-zhoujl2
2022-06-10 10:18:25 +08:00
parent e92f573281
commit 4605e48fca
20 changed files with 168 additions and 1188 deletions

10881
public/officecontrol/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
var ntko;//控件对象
//初始化去打开文档
function init(readonly, DocfileCode) {
ntko = document.getElementById("TANGER_OCX");
ntko.Menubar = false;//隐藏窗体左上侧文件菜单
ntko.TitleBar = false;//隐藏窗体左上图标
$.ajax({
url: "/api/doc/v1.0/files/queryReturn",
type: "POST",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify([DocfileCode]),
success: function (result) {
if (window.navigator.platform == "Win32") {
ntko.AddDocTypePlugin(".pdf", "PDF.NtkoDocument", "4.0.1.0", "officecontrol/ntkooledocall.cab", 51, true);
}
if (window.navigator.platform == "Win64") {
ntko.AddDocTypePlugin(".pdf", "PDF.NtkoDocument", "4.0.1.0", "officecontrol/ntkooledocallx64.cab", 51, true);//PDF支持
}
if (result.success) {
if (result.data.length > 0) {
$.ajax({
url: "/api/doc/api/data-service-document-center/outer/v1.0/files/getSecretKey?fileId=" + result.data[0].fileId,//获取密钥
type: "GET",
contentType: "application/json;charset=UTF-8",
success: function (response) {
ntko.BeginOpenFromURL("/api/doc/api/data-service-document-center/outer/v1.0/files/getDownload?fileId=" + result.data[0].fileId + "&documentSecretKey=" + response.data);
}
})
} else {
ntko.OpenFromURL("ntkocreatnew.docx");
}
} else {
alert(JSON.stringify(result));
}
/*展示保存按钮*/
if (readonly == "false") {
$("#saveBTN").show();
}
ntko.Menubar = true;//展示窗体左上侧文件菜单
ntko.IsUseOfficeConvertDocToPDF = true;
ntko.CustomToolBar = false;
ntko.FileSave = false;
},
error: function () {
alert("请求文档中心失败,请您关闭当前编辑器,重新打开。")
}
});
}
//通用上传
function ntkoUpload(type, objectId, fileName) {
if (objectId !== null && objectId !== void 0 && objectId !== "") {
var path = "/api/doc/v1.0/files/upload";
var fileUploadName = "multipartFiles";
var params = "appCode=ebtp-cloud-frontend&objectId=" + objectId;
var msg
$.ajax({
url: "/api/doc/v1.0/files/queryReturn",
type: "POST",
async: false,
contentType: "application/json;charset=UTF-8",
data: JSON.stringify([objectId]),
success: function (result) {
if (result.success) {
if (result.data.length > 0) {
for (let i = 0; i < result.data.length; i++) {
const ele = result.data[i];
$.ajax({
url: "/api/doc/v1.0/files/disk" + "?fileId=" + ele.fileId,
type: "POST",
dataType: "json",
})
}
}
if (type == "Doc") {
msg = ntko.SaveToURL(path, fileUploadName, params, fileName, "");
} else if (type == "HTML") {
msg = ntko.PublishAsHTMLToURL(path, fileUploadName, params, fileName, "");
} else if (type == "PDF") {
msg = ntko.PublishAsPDFToURL(path, fileUploadName, params, fileName, "");
}
}
}
})
return msg;
}
}
//修改文件名
function ntkoUpdateFile(objectId, fileName) {
if (objectId !== null && objectId !== void 0 && objectId !== "") {
var msg;
$.ajax({
url: "/api/doc/v1.0/files/queryReturn",
type: "POST",
async: false,
contentType: "application/json;charset=UTF-8",
data: JSON.stringify([objectId]),
success: function (result) {
if (result.success) {
if (result.data.length > 0) {
$.ajax({
url: "/api/doc/v1.0/files/update",
type: "POST",
async: false,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify([{ fileId: result.data[result.data.length - 1].fileId, originalName: fileName }]),
success: function (response) {
msg = response.success;
}
})
}
}
}
})
return msg;
}
}

View File

@ -1,23 +0,0 @@
var ntko;//控件对象
//初始化去打开文档
function init(cmd){
ntko = document.getElementById("TANGER_OCX");
if(window.navigator.platform=="Win64"){
//alert("平台版文档控件请使用32位浏览器如IE");
//TANGER_OCX_OBJ.AddDocTypePlugin(".tif","tif.NtkoDocument","4.0.1.0","officecontrol/ntkooledocallx64.cab",51,true);
ntko.AddDocTypePlugin(".pdf","PDF.NtkoDocument","4.0.2.0","officecontrol/ntkooledocallx64.cab",51,true);
}else{
ntko.AddDocTypePlugin(".pdf","PDF.NtkoDocument","4.0.2.0","officecontrol/ntkooledocall.cab",51,true);//版增加对于PDF文件的支持
//TANGER_OCX_OBJ.AddDocTypePlugin(".tif","tif.NtkoDocument","4.0.1.0","officecontrol/ntkooledocallx64.cab",51,true);
}
if (cmd == 1)
{
ntko.OpenFromURL("ntkocreatnew.docx");
}
else
{
ntko.OpenFromURL("aboutus.docx");
}
}

View File

@ -0,0 +1,14 @@
var ntko;//控件对象
//初始化去打开文档
function init(path) {
ntko = document.getElementById("TANGER_OCX");
ntko.OpenFromURL(path);
ntko.SetReadOnly(true);//只读
ntko.TitleBar = false;//不显示标题栏
ntko.CustomToolBar = false;//不显示自定义工具栏
ntko.FileSave = false;//禁用文档本身的保存功能
}

View File

@ -1,7 +1,7 @@
/**
* version: 2.5.1
* version: 3.6.2
*
* 2020.09.07版本 跟随 联通系统集成有限公司20201229 产品发送
* 2022.04.01版本 跟随 联通数字科技有限公司20220523 产品发送
*/
"use strict";
var varNtkoGUID = Math.random().toString(36);
@ -11,6 +11,8 @@ var timer;
var ntkoSendDataToChildStrUrl;
var ntkoSendDataToChildSData;
var ntkowin;
var ntkoextensionmainifest;
var strURL1;
var userAgent = navigator.userAgent,
rMsie = /(msie\s|trident.*rv:)([\w.]+)/,
rFirefox = /(firefox)\/([\w.]+)/,
@ -56,38 +58,38 @@ var userAgent = navigator.userAgent,
browser = browserMatch.browser;
version = browserMatch.version;
}
var mimeTypes = navigator.mimeTypes;
var mimeTypes = navigator.mimeTypes;
var bChromeExtensionInstalled = false;
version=parseInt(version);
if( "chrome" === browserMatch.browser && version>=45)
{
var img;
img = new Image();
img.src = "chrome-extension://lppkeogbkjlmmbjenbogdndlgmpiddda/icons/ntko.png";
img.onload = function() {
bChromeExtensionInstalled = true;
}
img.onerror = function() {
bChromeExtensionInstalled = false;
}
}
if("edg"===browserMatch.browser){
var img;
img = new Image();
img.src = "chrome-extension://miogdolpaknhgnfoghcmnooafkiafkcc/icons/ntko.png";
img.onload = function() {
bChromeExtensionInstalled = true;
}
img.onerror = function() {
bChromeExtensionInstalled = false;
}
}
if( "chrome" === browserMatch.browser && version>="45")
{
var img;
img = new Image();
img.src = "chrome-extension://lppkeogbkjlmmbjenbogdndlgmpiddda/icons/ntko.png";
img.onload = function() {
bChromeExtensionInstalled = true;
};
img.onerror = function() {
bChromeExtensionInstalled = false;
};
}
if("edg"===browserMatch.browser){
var img;
img = new Image();
img.src = "chrome-extension://miogdolpaknhgnfoghcmnooafkiafkcc/icons/ntko.png";
img.onload = function() {
bChromeExtensionInstalled = true;
};
img.onload = function() {
bChromeExtensionInstalled = true;
};
}
var ntkoBrowser = {
ntkoSendDataToChild:function( strURL, data)
{
console.log(strURL);
if ( typeof data === 'undefined' ){
return;
}
@ -103,8 +105,8 @@ ntkoSendDataToChild:function( strURL, data)
if(ntkobr){
window.postMessage({ type: "FROM_NTKO_PAGE", text: jsonValue }, "*");
}else{
ntkoWinOpen.ntkoGetParentData(data);
}
ntkoWinOpen.ntkoGetParentData(data);
}
},
ExtensionInstalled:function()
{
@ -130,27 +132,34 @@ ExtensionInstalled:function()
{
if( "firefox" === browserMatch.browser )
{
if(( typeof ntkoextensionmainifest != 'undefined' ) && ( ( null != ntkoextensionmainifest ) && ( "" != ntkoextensionmainifest ))){
return true;
}else{
var bInstalled = false;
if( "undefined" === typeof FirefoxInstalled )
return ( bInstalled );
else
return( window.FirefoxInstalled());
}
}
else if( "chrome" === browserMatch.browser )
{
if(localStorage["ntkoweb"]==="ntkoExtensionInstalled"){
bChromeExtensionInstalled=true;
localStorage.clear();
}
{
if(( typeof ntkoextensionmainifest != 'undefined' ) && ( ( null != ntkoextensionmainifest ) && ( "" != ntkoextensionmainifest ))){
return true;
}else{
return (bChromeExtensionInstalled);
} else if("edg" === browserMatch.browser){
if(localStorage["ntkoweb"]==="ntkoExtensionInstalled"){
bChromeExtensionInstalled=true;
localStorage.clear();
}
return( bChromeExtensionInstalled );
}
}
}
} else if("edg" === browserMatch.browser){
if(( typeof ntkoextensionmainifest != 'undefined' ) && ( ( null != ntkoextensionmainifest ) && ( "" != ntkoextensionmainifest ))){
return true;
}else{
return( bChromeExtensionInstalled );
}
}
}
},
ntkoClose:function( strURL )
@ -168,18 +177,16 @@ ntkoClose:function( strURL )
ntkoWinOpen.close();
}
},
openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserProductKey, ntkoBrowserNoExpireKey, ntkoBrowserOptions,varUrlData,ntkowidth,ntkoheight )
{
if(varUrlData!=null&&varUrlData!=""){
ntkoSendDataToChildSData=varUrlData;
}
openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserProductKey, ntkoBrowserNoExpireKey, ntkoBrowserOptions,varUrlData,ntkowidth,ntkoheight,cookiesDomainPath )
{
var ntkowinscr= ntkoBrowser.NtkoWidthAndHeightWinScr(ntkowidth,ntkoheight);
if(!ntkowinscr){
alert("设置窗口大小格式不正确");
return;
}
}
var strURL=ntkoBrowser.NtkoStrURL(strURL);
strURL1=strURL;
var ntkoSessionURL="";
var jsonValue = '{"OpenWindow":1,"URL":"';
jsonValue += strURL;
@ -187,6 +194,8 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
jsonValue += varNtkoGUID;
jsonValue += '","URLMD5":"';
jsonValue +=b64_md5(strURL);
jsonValue += '","ntkobrowserMatch":"';
jsonValue +=browserMatch.browser;
jsonValue += '","IsShowOnExtendMonitor":"';
jsonValue += IsShowOnExtendMonitor;
jsonValue += '"';
@ -225,7 +234,6 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
}
var LocalStorge = window.localStorage;
if( typeof LocalStorge != 'undefined' && ( 0 != LocalStorge.length ) )
{
@ -241,7 +249,12 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
jsonValue += JSON.stringify(varLocalDataList);;
jsonValue += '';
}
if(varUrlData!=null&&varUrlData!=""){
ntkoSendDataToChildSData=varUrlData;
LocalStorge['ntkoSendDataToChildSData']=varUrlData;
}
var SessionStorge = window.sessionStorage;
if( typeof SessionStorge != 'undefined' && ( 0 != SessionStorge.length ) )
{
@ -271,12 +284,16 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
jsonValue += ntkoheight;
jsonValue += '';
}
if( typeof cookiesDomainPath != 'undefined' && ( ( null != cookiesDomainPath ) && ( "" != cookiesDomainPath ) ) )
{
jsonValue += ',"CookiesDomainPath":';
jsonValue += cookiesDomainPath;
jsonValue += '';
}
jsonValue += '}';
var ntkobr=ntkoBrowser.NtkoBrower();
if(ntkobr){
window.postMessage({type: "FROM_NTKO_PAGE", text: jsonValue}, "*");
window.postMessage({type: "FROM_NTKO_PAGE", text: jsonValue}, "*");
}else{
ntkowin=b64_md5(strURL);
if(ntkowidth==null||ntkowidth=="" ||ntkowidth=="undefined"){
@ -307,7 +324,7 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
if(userAgent.indexOf("Windows NT 5.1") > -1){
return false;
}
if(version>="50"){
if(version>=50){
return true;
}else{
return false;
@ -317,7 +334,7 @@ openWindow:function( strURL,IsShowOnExtendMonitor,ProductCaption, ntkoBrowserPro
if(userAgent.indexOf("Windows NT 5.1") > -1){
return false;
}
if(version>="45"){
if(version>=45){
return true;
}else{
return false;
@ -398,13 +415,23 @@ NtkoWidthAndHeightWinScr:function(ntkowidth,ntkoheight){
}
}
}
},
},
thisNTKOGUID:varNtkoGUID,/**20220609 zhoujianlong 新版插件更新*/
NtkoExtensionVersion:function(){
if(browser=="firefox"){
var ntkojsontext = JSON.parse(window.NtkoFireFoxVersion());
var ntkofireforversion=ntkojsontext['ntkoversion'];
return ntkofireforversion;
}else{
return ntkoextensionmainifest;
}
}
};
if(browser!="IE")
{
window.addEventListener("message", function(event)
{
{
if ( event.source != window )
return;
if (event.data.type && (event.data.type == "FROM_NTKO_CONTEXT_PAGE"))
@ -439,10 +466,18 @@ if(browser!="IE")
"varFunctionAgrvs[4],varFunctionAgrvs[5],varFunctionAgrvs[6],varFunctionAgrvs[7],varFunctionAgrvs[8]);" );
}
}
}else if("NtkoError" === jsonData["functionName"]){
//启动扩展报错信息
alert(jsonData["NtkoReason"])
}
}
}
}
}
if(event.data.type && (event.data.type == "FROM_NTKO_MANIFEST")){
var ntkojsontext = JSON.parse( event.data.text );
ntkoextensionmainifest=ntkojsontext['ntkoversion'];
}
}, false);
}
function ieattachEventntko(data,varFunctionAgrvs)
@ -456,13 +491,7 @@ function ieattachEventntko(data,varFunctionAgrvs)
}
}
}
function ntkoSendDataToChildtext(ntkoDataSendUrl)
{
if(ntkoSendDataToChildSData!=null&&ntkoSendDataToChildSData!="")
{
ntkoBrowser.ntkoSendDataToChild(ntkoDataSendUrl,ntkoSendDataToChildSData);
}
}
/*___md5___*/
var hexcase = 0;
@ -652,3 +681,17 @@ function binl2b64(binarray)
}
return str;
}
/*接收 子页面数据*/
/**20220609 zhoujianlong 新版插件更新*/
function NTKO_DOC_PostMessage(param){
window.postMessage({type: 'FROM_RETURN_DOC',text: param}, "*")
}
function NTKO_PDF_PostMessage(param){
window.postMessage({type: 'FROM_RETURN_PDF',text: param}, "*")
}
function NTKO_HTML_PostMessage(param){
window.postMessage({type: 'FROM_RETURN_HTML',text: param}, "*")
}
function ntkoCloseEvent(){
window.postMessage({type: 'FROM_NTKO_CLOSE',text: varNtkoGUID}, "*")
}

View File

@ -1,29 +1,28 @@
/*------------------------------------------------------*/
/* 修改控件的配置信息 */
/* version:2.5.1 */
/* 2020.09.07版本 跟随 联通系统集成有限公司20201229 产品发送 */
/* */
/* version:3.6.2 */
/* 2022.04.01版本 跟随 联通数字科技有限公司20220523 产品发送 */
/*------------------------------------------------------*/
//64位控件的calssid
var classidx64="A64E3073-2016-4baf-A89D-FFE1FAA10EF1";
//32位控件的classid
var classid="A64E3073-2016-4baf-A89D-FFE1FAA10ED1";
//32位控件包的路径
var codebase="officecontrol/ofctnewclsid.cab#version=6,0,1,0";
var codebase="officecontrol/ofctnewclsid.cab#version=6.0.2.0";
//64位控件包的路径
var codebase64="officecontrol/ofctnewclsidx64.cab#version=6,0,1,0";
var codebase64="officecontrol/ofctnewclsidx64.cab#version=6.0.2.0";
//设置高度
var height="800px";
//设置宽度
var width="100%";
//买断授权密钥如果不是买断可以不用写
var MakerCaption="联通系统集成有限公司";
var MakerCaption="联通数字科技有限公司";
//买断授权密钥如果不是买断可以不用写
var MakerKey="D130003CD231496EBD17D6DAC22DEFC6BD8F4E17";
var MakerKey="C1AB790358ECC36C0F26DB985E43769912D15699";
//密钥
var ProductCaption="联通系统集成有限公司某某测试用户";
var ProductCaption="联通数字科技有限公司";
//密钥
var ProductKey="F6C911699ECD29CC0D2E47822CF1775B3A80C13F";
var ProductKey="46839E48E0B10E99B17E82F35A3E5371F2C07BC0";
//解除时间密钥
var NoExpireKey="";
@ -49,10 +48,9 @@ function ntkosaveasotherurl(type,code,html){
function ntkoondocumentopened(type,code){
//alert("Ondocumentopened成功回调");
if(cmd==5){
if(datavalue==1){
ntko.ShowTipMessage("注意","已经接收到父页面传过来的值,请注意文档中内容的变化");
ntkoDataToChild(datatext);
}
var datext=localStorage.getItem('ntkoSendDataToChildSData')
ntkoDataToChild(datext);
}
}
@ -118,7 +116,7 @@ if (browser=="IE"){
document.write('<param name="NoExpireKey" value="'+NoExpireKey+'"> ');
document.write('<param name="IsUseUTF8URL" value="-1"> ');
document.write('<param name="IsUseUTF8Data" value="-1"> ');
document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');
// document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');/**20220609 zhoujianlong 新版插件更新*/
document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN> ');
document.write('</object>');
}
@ -135,7 +133,7 @@ if (browser=="IE"){
document.write('<param name="NoExpireKey" value="'+NoExpireKey+'"> ');
document.write('<param name="IsUseUTF8URL" value="-1"> ');
document.write('<param name="IsUseUTF8Data" value="-1"> ');
document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');
// document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');/**20220609 zhoujianlong 新版插件更新*/
document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN> ');
document.write('</object>');
}
@ -165,7 +163,7 @@ else if (browser=="firefox"){
document.write('_ProductCaption="'+ProductCaption+'" ');
document.write('_NoExpireKey="'+NoExpireKey+'" ');
document.write('_ProductKey="'+ProductKey+'" ');
document.write('codebase="'+codebase+'" width="'+width+'" height="'+height+'" type="application/ntko-plug" ');
document.write('codebase="'+codebase+'" width="'+width+'" height="'+height+'" type="application/ntko-plug" >');
document.write('<SPAN STYLE="color:red">尚未安装NTKO Web Chrome跨浏览器插件</SPAN> ');
document.write('</object>');
}else if (Sys.opera){
@ -173,12 +171,12 @@ else if (browser=="firefox"){
}else if (Sys.safari){
alert("sorry,ntko web印章暂时不支持safari!");
}
window.onunload =function(){
var ntkojb= ntkoBrowser.NtkoJudgingBrowsers();
if(ntkojb){
window.opener.ntkoCloseEvent();
}
}
// window.onunload =function(){/**20220609 zhoujianlong 新版插件更新*/
// var ntkojb= ntkoBrowser.NtkoJudgingBrowsers();
// if(ntkojb){
// window.opener.ntkoCloseEvent();
// }
// }
//ie,谷歌,火狐传值
var ntkoBrowser={
@ -186,6 +184,7 @@ var ntkoBrowser={
var ntkojb= ntkoBrowser.NtkoJudgingBrowsers();
if(ntkojb){
window.opener.ieattachEventntko(data1,text1);
}else{
window.external.SetReturnValueToParentPage(data1,text1);
}
@ -197,12 +196,5 @@ var ntkoBrowser={
}catch(err){
return false;
}
},
}
//触发父页面传值的功能
var NtkoUrlTest = window.location.href;
if(NtkoUrlTest!=null&&NtkoUrlTest!=""){
var ntkoarry=new Array();
ntkoarry.push(NtkoUrlTest);
ntkoBrowser.ntkoSetReturnValueToParentPage("ntkoSendDataToChildtext",ntkoarry);
}
}