<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Issue_Redo.aspx.cs" Inherits="TotCms.Web.Office.Document.Issue_Redo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>公文批复</title>
    <link href="../style/global.css" rel="stylesheet" type="text/css" />    
    <script src="../ActiveX/docfun.js" type="text/javascript"></script>
    <!-- --------------------=== 调用Weboffice初始化方法 ===--------------------- -->
<script language="javascript" event="NotifyCtrlReady" for="WebOffice1">
/****************************************************
*
*	在装载完Weboffice(执行<object>...</object>)
*	控件后执行 "WebOffice1_NotifyCtrlReady"方法
*
****************************************************/
	WebOffice1_NotifyCtrlReady()
</script>

<script language="javascript" event="NotifyWordEvent(eventname)" for="WebOffice1">
<!--
 WebOffice1_NotifyWordEvent(eventname)
//-->
</script>

<script language="javascript">
  /****************************************************
  *
  *		控件初始化WebOffice方法
  *
  ****************************************************/
  function WebOffice1_NotifyCtrlReady() {
    document.all.WebOffice1.OptionFlag |= 128;
    // 新建文档
    document.all.WebOffice1.LoadOriginalFile("<%=GetUrl()%>/Doc/<%=GetId() %>.doc", "doc");

  }
  var flag = false;
  function menuOnClick(id) {
    var id = document.getElementById(id);
    var dis = id.style.display;
    if (dis != "none") {
      id.style.display = "none";

    } else {
      id.style.display = "block";
    }
  }
  /****************************************************
  *
  *		接收office事件处理方法
  *
  ****************************************************/
  var vNoCopy = 0;
  var vNoPrint = 0;
  var vNoSave = 0;
  var vClose = 0;
  function no_copy() {
    vNoCopy = 1;
  }
  function yes_copy() {
    vNoCopy = 0;
  }


  function no_print() {
    vNoPrint = 1;
  }
  function yes_print() {
    vNoPrint = 0;
  }


  function no_save() {
    vNoSave = 1;
  }
  function yes_save() {
    vNoSave = 0;
  }
  function EnableClose(flag) {
    vClose = flag;
  }
  function CloseWord() {

    document.all.WebOffice1.CloseDoc(0);
  }

  function WebOffice1_NotifyWordEvent(eventname) {
    if (eventname == "DocumentBeforeSave") {
      if (vNoSave) {
        document.all.WebOffice1.lContinue = 0;
        alert("此文档已经禁止保存");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "DocumentBeforePrint") {
      if (vNoPrint) {
        document.all.WebOffice1.lContinue = 0;
        alert("此文档已经禁止打印");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "WindowSelectionChange") {
      if (vNoCopy) {
        document.all.WebOffice1.lContinue = 0;
        //alert("此文档已经禁止复制");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "DocumentBeforeClose") {
      if (vClose == 0) {
        document.all.WebOffice1.lContinue = 0;
      } else {
        //alert("word");
        document.all.WebOffice1.lContinue = 1;
      }
    }
    //alert(eventname); 
  }

  function checkGet(formObj) {
    for (var i = 0; i < formObj.length; i++) {
      if (formObj[i].checked) {
        return formObj[i].value;
      }
    }
  }


  function SaveDoc() {
    try {
      var webObj = document.getElementById("WebOffice1");
      var returnValue;
      webObj.HttpInit(); 		//初始化Http引擎
      // 添加相应的Post元素
      webObj.HttpAddPostString("id", "<%=GetId() %>");
      webObj.HttpAddPostCurrFile("DocContent", ""); 	// 上传文件
      returnValue = webObj.HttpPost("<%=GetUrl() %>/Issue_Redo_Save.aspx"); // 判断上传是否成功
      //document.write(returnValue);
      if ("succeed" == returnValue) {
        return_onclick('<%=GetUrl() %>/Issue.aspx');
      } else if ("failed" == returnValue) {
        //alert("文件上传失败");   
      }
    }
    catch (e) {
      //document.write(e.Description);
      alert("异常\r\nError:" + e + "\r\nError Code:" + e.number + "\r\nError Des:" + e.description);
    }
  }
</script>
    <style type="text/css">
      .style1
      {
        width: 100%;
      }
    </style>
    
</head>
<body>
    <form id="form1" runat="server">
    <table style="width:100%;" border="0" cellpadding="0" cellspacing="1" 
      class="border">
      <tr class="suphead">
        <td>公文再次发起</td>
    </tr>    
    <tr>
      <td class="fields_text">
      <!-- -----------------------------== 装载weboffice控件 ==--------------------------------- -->
        <object id="WebOffice1" height="400" width='100%' style='LEFT: 0px; TOP: 0px'  classid='clsid:E77E049B-23FC-4DB8-B756-60529A35FAD5' codebase='../ActiveX/weboffice_v6.0.5.0.cab#Version=6,0,5,0'>
        <param name='_ExtentX' value='6350'><param name='_ExtentY' value='6350'>
        </object>
        <!-- --------------------------------== 结束装载控件 ==----------------------------------- --> 
      </td>
    </tr>    
    
          <tr>

            <td align="center">
              <input type="button" value="再次发起"  onclick="SaveDoc()" />

        <input id="Button2" type="reset" value="返回" 
          onclick="javascript:history.back();" /></td>
          </tr>
  </table>
    </form>
</body>
</html>
