日期:2008-08-17  浏览次数:20949 次

<script language=javascript>
//系统变量
var vFileName=""; //打开的文件名

var vObject=null; //打开的对象
var gFileName=""; //文件名
var gObject=null; //对象
var gOpened=false; //是否被打开
var gUserName=""; //系统用户
</script>


<script language="JScript" for=Weboffice event="OnDocumentOpened(vFileName,vObject)">
OnDocumentOpened(vFileName,vObject); //打开文件事件
</script>

<script language="JScript" for=Weboffice event="OnDocumentClosed()">
OnDocumentClosed(); //关闭文件事件
</script>

<script language=javascript>
//打开文档,根据用户权限(EditType),进行初始化设置
function OnDocumentOpened(vFileName,vObject)
{
var mProtect,mTools,mTrack,mPrint,mShow;
gFileName=vFileName; //取得全局文件名
gObject=vObject; //取得全局对象
//设置痕迹和保护状态
if (webform.Weboffice.EditType=="0"){
mProtect=true;
mTools=false;
mTrack=false;
mPrint=false;
mShow=true;
}else if(webform.Weboffice.EditType=="1"){
mProtect=false;
mTools=false;
mTrack=false;
mPrint=false;
mShow=false;
}else if(webform.Weboffice.EditType=="2"){
mProtect=false;
mTools=false;
mTrack=true;
mPrint=true;
mShow=true;
}else if(webform.Weboffice.EditType=="3"){
mProtect=false;
mTools=true;
mTrack=true;
mPrint=true;
mShow=true;
}else{
var mType="";
var mEdit=webform.Weboffice.EditType;
var mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
}
mEdit=mEdit.substring(mIdx+1,mEdit.length);

mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
if (mType=="1") mProtect=true;
if (mType=="0") mProtect=false;
}
mEdit=mEdit.substring(mIdx+1,mEdit.length);

var mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
if (mType=="1") mShow=true;
if (mType=="0") mShow=false;
}
mEdit=mEdit.substring(mIdx+1,mEdit.length);

var mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
if (mType=="1") mTrack=true;
if (mType=="0") mTrack=false;
}
mEdit=mEdit.substring(mIdx+1,mEdit.length);

var mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
if (mType=="1") mPrint=true;
if (mType=="0") mPrint=false;
}
mEdit=mEdit.substring(mIdx+1,mEdit.length);

var mIdx=mEdit.indexOf(",");
if (mIdx>0){
mType=mEdit.substring(0,mIdx);
if (mType=="1") mTools=true;
if (mType=="0") mTools=false;
}

}

if (webform.Weboffice.FileType==".doc"){
gObject.TrackRevisions=mTrack;
gObject.PrintRevisions=mPrint;
gObject.ShowRevisions=mShow;

gObject.CommandBars('Reviewing').Enabled =mTools;
gObject.CommandBars('Reviewing').Visible =mTools;

var mCount=gObject.CommandBars('Track Changes').Controls.Count;
for (var mIndex = 1; mIndex<= mCount; mIndex++){
var mCurID=gObject.CommandBar