/*------------------------------------------------------*/
|
/* 修改控件的配置信息 */
|
/* version:1.7.3 */
|
/* number:002 */
|
/*------------------------------------------------------*/
|
//64位控件的calssid
|
var classidx64 = "A64E3073-2016-4baf-A89D-FFE1FAA10EE0";
|
//32位控件的classid
|
var classid = "A64E3073-2016-4baf-A89D-FFE1FAA10EC0";
|
//32位控件包的路径
|
var codebase = "officecontrol/OfficeControl.cab#version=6.0.1.0";
|
//64位控件包的路径
|
var codebase64 = "officecontrol/OfficeControlx64.cab#version=6,0,1,0";
|
//设置高度
|
var height = "100%";
|
//设置宽度
|
var width = "100%";
|
//买断授权密钥如果不是买断可以不用写
|
var MakerCaption = "";
|
//买断授权密钥如果不是买断可以不用写
|
var MakerKey = "";
|
//密钥
|
var ProductCaption = "中国核能电力股份有限公司";
|
//密钥
|
var ProductKey = "EF38BB6FB9DB37E213541BB2FE37C28BEB892CBD";
|
//解除时间密钥
|
var NoExpireKey = "";
|
document.write('<param name="Caption" value="中国核能电力股份有限公司〔专用〕"> ');
|
|
|
/*------------------------------------------------------*/
|
/* 以下内容 请勿修改,否则可能出错 */
|
/*------------------------------------------------------*/
|
|
var userAgent = navigator.userAgent,
|
rMsie = /(msie\s|trident.*rv:)([\w.]+)/,
|
rFirefox = /(firefox)\/([\w.]+)/,
|
rOpera = /(opera).+version\/([\w.]+)/,
|
rChrome = /(chrome)\/([\w.]+)/,
|
rSafari = /version\/([\w.]+).*(safari)/;
|
var browser;
|
var version;
|
var ua = userAgent.toLowerCase();
|
|
function uaMatch(ua) {
|
var match = rMsie.exec(ua);
|
if (match != null) {
|
return {browser: "IE", version: match[2] || "0"};
|
}
|
var match = rFirefox.exec(ua);
|
if (match != null) {
|
return {browser: match[1] || "", version: match[2] || "0"};
|
}
|
var match = rOpera.exec(ua);
|
if (match != null) {
|
return {browser: match[1] || "", version: match[2] || "0"};
|
}
|
var match = rChrome.exec(ua);
|
if (match != null) {
|
return {browser: match[1] || "", version: match[2] || "0"};
|
}
|
var match = rSafari.exec(ua);
|
if (match != null) {
|
return {browser: match[2] || "", version: match[1] || "0"};
|
}
|
if (match != null) {
|
return {browser: "", version: "0"};
|
}
|
}
|
|
var browserMatch = uaMatch(userAgent.toLowerCase());
|
if (browserMatch.browser) {
|
browser = browserMatch.browser;
|
version = browserMatch.version;
|
}
|
|
/*
|
谷歌浏览器事件接管
|
*/
|
|
/*function ntkosavetourl(type,code,html)
|
{
|
alert("SaveToURL成功回调");
|
}*/
|
|
function ntkopublishashtml(type, code, html) {
|
//alert("Onpublishashtmltourl成功回调");
|
}
|
|
function ntkopublishaspdf(type, code, html) {
|
//alert("Onpublishaspdftourl成功回调");
|
}
|
|
function ntkosaveasotherurl(type, code, html) {
|
//alert("SaveAsOtherformattourl成功回调");
|
}
|
|
function OnDocumentOpened(TANGER_OCX_str, TANGER_OCX_obj) {
|
console.log("文档类型", OFFICE_CONTROL_OBJ.doctype);
|
if (OFFICE_CONTROL_OBJ.doctype >= 1 && OFFICE_CONTROL_OBJ.doctype <= 3) {
|
OFFICE_CONTROL_OBJ.activeDocument.saved = true;//saved属性用来判断文档是否被修改过,文档打开的时候设置成true,当文档被修改,自动被设置为false,该属性由office提供.
|
//setMenubar();
|
initCustomMenus();
|
//获取文档控件中打开的文档的文档类型
|
switch (OFFICE_CONTROL_OBJ.doctype) {
|
case 1:
|
fileType = "Word.Document";
|
fileTypeSimple = "word";
|
break;
|
case 2:
|
fileType = "Excel.Sheet";
|
fileTypeSimple = "excel";
|
break;
|
case 3:
|
fileType = "PowerPoint.Show";
|
fileTypeSimple = "powerpoint";
|
break;
|
case 4:
|
fileType = "Visio.Drawing";
|
break;
|
case 5:
|
fileType = "MSProject.Project";
|
break;
|
case 6:
|
fileType = "WPS Doc";
|
fileTypeSimple = "wps";
|
break;
|
case 7:
|
fileType = "Kingsoft Sheet";
|
fileTypeSimple = "et";
|
break;
|
default :
|
fileType = "unkownfiletype";
|
fileTypeSimple = "unkownfiletype";
|
}
|
setFileOpenedOrClosed(true);
|
}
|
}
|
|
//设置显隐
|
function display(id) {
|
var traget = document.getElementById(id);
|
if (traget.style.display == "none") {
|
traget.style.display = "";
|
} else {
|
traget.style.display = "none";
|
}
|
}
|
|
function OnDocumentClosed() {
|
setFileOpenedOrClosed(false);
|
}
|
|
function OnFileCommand(TANGER_OCX_str, TANGER_OCX_obj) {
|
OFFICE_CONTROL_OBJ.WebFileName = unescape(fileName);
|
if (TANGER_OCX_str == 3) {
|
saveFileToUrl();
|
OFFICE_CONTROL_OBJ.CancelLastCommand = true;
|
} else if (TANGER_OCX_str == 4) {
|
/* console.dir(OFFICE_CONTROL_OBJ.ActiveDocument.Application);
|
var dg = OFFICE_CONTROL_OBJ.ActiveDocument.Application.FileDialog(3);
|
dg.InitialFileName = document.all("fileName").value;
|
dg.show(); */
|
//由于NTKO插件的限制,只有保存操作可以指定文件名,PDF另存为时无法设置文件名,因此用保存操作代替另存为操作。
|
OFFICE_CONTROL_OBJ.ShowDialog(2);
|
OFFICE_CONTROL_OBJ.CancelLastCommand = true;//取消默认操作
|
}
|
}
|
|
function OnCustomMenuCmd2(menuPos, submenuPos, subsubmenuPos, menuCaption, menuID) {
|
if (menuPos == 0) { //流程文档模板
|
openTemplateFileFromUrl(getTemplateUrl(submenuPos));
|
} else if (menuPos == 1) { //套红模板
|
insertRedHeadFromUrl("../downloadFile.do?id=" + getTaohongId(submenuPos));
|
}
|
}
|
|
function OnCustomButtonOnMenuCmd(btnPos, btnCaption, btnCmdid) {
|
if (btnPos == 2) {
|
syncBookmarkData();
|
}
|
}
|
|
|
/*function ntkoondocumentopened(type,code){
|
//alert("Ondocumentopened成功回调");
|
if(cmd==5){
|
if(datavalue==1){
|
ntko.ShowTipMessage("注意","已经接收到父页面传过来的值,请注意文档中内容的变化");
|
ntkoDataToChild(datatext);
|
}
|
}
|
}*/
|
|
function getBrowser(n) {
|
var ua = navigator.userAgent.toLowerCase(),
|
s,
|
name = '',
|
ver = 0;
|
//探测浏览器
|
(s = ua.match(/msie ([\d.]+)/)) ? _set("ie", _toFixedVersion(s[1])) :
|
(s = ua.match(/firefox\/([\d.]+)/)) ? _set("firefox", _toFixedVersion(s[1])) :
|
(s = ua.match(/chrome\/([\d.]+)/)) ? _set("chrome", _toFixedVersion(s[1])) :
|
(s = ua.match(/opera.([\d.]+)/)) ? _set("opera", _toFixedVersion(s[1])) :
|
(s = ua.match(/version\/([\d.]+).*safari/)) ? _set("safari", _toFixedVersion(s[1])) : 0;
|
|
function _toFixedVersion(ver, floatLength) {
|
ver = ('' + ver).replace(/_/g, '.');
|
floatLength = floatLength || 1;
|
ver = String(ver).split('.');
|
ver = ver[0] + '.' + (ver[1] || '0');
|
ver = Number(ver).toFixed(floatLength);
|
return ver;
|
}
|
|
function _set(bname, bver) {
|
name = bname;
|
ver = bver;
|
}
|
|
return (n == 'n' ? name : (n == 'v' ? ver : name + ver));
|
}
|
|
|
if (browser == "IE") {
|
if (window.navigator.platform == "Win32") {
|
document.write('<SPAN STYLE="font-size:36px;color:#ff0000">由于NTKO插件升级后只兼容360极速浏览器极速模式,请切换到极速模式或安装版本号不小于11.0.2031.0的360极速浏览器</SPAN><br><a href="/cnnpbpm/download/ntko/360cse_11.0.2031.0.exe">浏览器下载</a><br> ');
|
document.write('<SPAN STYLE="font-size:36px;color:red">由于NTKO插件升级兼容360极速浏览器极速模式,请安装新版NTKO Web Chrome跨浏览器插件</SPAN><br><a href="static/plugins/ntko-office/NtkoAllControlSetup.msi">新版插件下载</a><br> ');
|
document.write('<SPAN STYLE="font-size:36px;color:red">如使用中遇到其他问题,请联系600IT服务台</SPAN>');
|
document.write('</object>');
|
}
|
if (window.navigator.platform == "Win64") {
|
document.write('<SPAN STYLE="font-size:36px;color:red">由于NTKO插件升级后只兼容360极速浏览器极速模式,请切换到极速模式或安装版本号不小于11.0.2031.0的360极速浏览器</SPAN><br><a href="/cnnpbpm/download/ntko/360cse_11.0.2031.0.exe">浏览器下载</a><br> ');
|
document.write('<SPAN STYLE="font-size:36px;color:red">由于NTKO插件升级兼容360极速浏览器极速模式,请安装新版NTKO Web Chrome跨浏览器插件</SPAN><br><a href="static/plugins/ntko-office/NtkoAllControlSetup.msi">新版插件下载</a><br> ');
|
document.write('<SPAN STYLE="font-size:36px;color:red">如使用中遇到其他问题,请联系600IT服务台</SPAN>');
|
document.write('</object>');
|
}
|
} else if (browser == "firefox") {
|
document.write('<object id="TANGER_OCX" type="application/ntko-plug" codebase="' + codebase + '" width="' + width + '" height="' + height + '" ForOnSaveToURL="ntkosavetourl" ForOndocumentopened="ntkoondocumentopened"');
|
document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
|
document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
|
document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
|
document.write('_MakerCaption="' + MakerCaption + '" ');
|
document.write('_MakerKey="' + MakerKey + '" ');
|
document.write('_ProductCaption="' + ProductCaption + '" ');
|
document.write('_ProductKey="' + ProductKey + '" ');
|
document.write('_NoExpireKey="' + NoExpireKey + '" ');
|
document.write('clsid="{' + classid + '}" >');
|
document.write('<SPAN STYLE="color:#ff0000">尚未安装NTKO Web FireFox跨浏览器插件</SPAN> ');
|
document.write('</object> ');
|
} else if (browser == "chrome") {
|
document.write('<object id="TANGER_OCX" clsid="{' + classid + '}" ForOnSaveToURL="ntkosavetourl" ForOndocumentopened="OnDocumentOpened"');
|
document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
|
document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
|
document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
|
|
document.write('ForOnDocumentClosed="OnDocumentClosed"');
|
document.write('ForOnFileCommand="OnFileCommand"');
|
document.write('ForOnCustomMenuCmd2="OnCustomMenuCmd2"');
|
document.write('ForOnCustomButtonOnMenuCmd="OnCustomButtonOnMenuCmd"');
|
|
document.write('_IsUseUTF8URL="-1" ');
|
document.write('_IsUseUTF8Data="-1" ');
|
document.write('_Caption="中国核能电力股份有限公司" ');
|
document.write('_MakerCaption="' + MakerCaption + '" ');
|
document.write('_MakerKey="' + MakerKey + '" ');
|
document.write('_ProductCaption="' + ProductCaption + '" ');
|
document.write('_NoExpireKey="' + NoExpireKey + '" ');
|
document.write('_ProductKey="' + ProductKey + '" ');
|
document.write('codebase="' + codebase + '" width="' + width + '" height="' + height + '" type="application/ntko-plug" ');
|
|
var strStart = userAgent.indexOf('Chrome/') + 7;
|
var strEnd = userAgent.indexOf('Safari');
|
var version = userAgent.substring(strStart, strEnd);//内核69.0.3497.100 为(版本:11.0.2031.0)的360极速浏览器
|
console.log("版本号:" + version);
|
if (version.indexOf('69.0.3497.100') === -1) {
|
document.write('<SPAN STYLE="font-size:36px;color:red">由于NTKO插件升版后只兼容360极速浏览器极速模式,请切换到极速模式或安装版本号不小于11.0.2031.0的360极速浏览器</SPAN><br><a href="/cnnpbpm/download/ntko/360cse_11.0.2031.0.exe">浏览器下载</a><br> ');
|
}
|
document.write('<SPAN STYLE="font-size:36px;color:red">由于NTKO插件升版兼容360极速浏览器极速模式,请安装新版NTKO Web Chrome跨浏览器插件</SPAN><br><a href="static/plugins/ntko-office/NtkoAllControlSetup.msi">新版插件下载</a><br> ');
|
document.write('<SPAN STYLE="font-size:36px;color:red">如使用中遇到其他问题,请联系600IT服务台</SPAN>');
|
document.write('</object>');
|
} else if (Sys.opera) {
|
alert("sorry,ntko web印章暂时不支持opera!");
|
} else if (Sys.safari) {
|
alert("sorry,ntko web印章暂时不支持safari!");
|
}
|
|
window.onunload = function () {
|
var ntkojb = ntkoBrowser.NtkoJudgingBrowsers();
|
if (ntkojb) {
|
window.opener.ntkoCloseEvent();
|
}
|
}
|
|
window.onbeforeunload = function () {
|
//修复霞浦公办待阅打开时快时慢问题,去除无用方法 by gw
|
//if(cmd==4){
|
//ntkoSendDataToParentPage();
|
//}
|
}
|
|
//ie,谷歌,火狐传值
|
var ntkoBrowser = {
|
ntkoSetReturnValueToParentPage: function (data1, text1) {
|
|
var ntkojb = ntkoBrowser.NtkoJudgingBrowsers();
|
if (ntkojb) {
|
window.opener.ieattachEventntko(data1, text1);
|
} else {
|
window.external.SetReturnValueToParentPage(data1, text1);
|
}
|
},
|
NtkoBrower: function () {
|
if (browser == "IE") {
|
return false;
|
}
|
if (browser == "firefox") {
|
if (userAgent.indexOf("Windows NT 5.1") > -1) {
|
return false;
|
}
|
if (version >= "50") {
|
return true;
|
} else {
|
return false;
|
}
|
}
|
if (browser == "chrome") {
|
if (userAgent.indexOf("Windows NT 5.1") > -1) {
|
return false;
|
}
|
if (version >= "45") {
|
return true;
|
} else {
|
return false;
|
}
|
}
|
},
|
NtkoJudgingBrowsers: function () {
|
try {
|
var ntkobtop = window.opener.top.browser;
|
return true;
|
} catch (err) {
|
return false;
|
}
|
}
|
|
}
|