<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Issue_Reply.aspx.cs" Inherits="TotCms.Web.Office.Document.Issue_Reply" ValidateRequest="false" %>
<!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" />
    <link href="../../swfupload/swfupload.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-ui-1.8.10/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
    <link href="../../js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
      $(function () {
        $("#dialog:ui-dialog").dialog("destroy");
        $("#dialog-win").dialog({
          autoOpen: false,
          height: 350,
          width: 450,
          modal: true,
          buttons: {
            "关闭窗口": function () {
              $(this).dialog("close");
            }
          },
          close: function () {

          }
        });

        $("#selclass").click(function () {
          $("#dialog-win").dialog("open");
        });

        $("#rplist tr").hover(
         function () {
           $(this).removeClass("lines");
           $(this).addClass("lines2");    //鼠标经过添加hover样式 
         },
         function () {
           $(this).removeClass("lines2");
           $(this).addClass("lines");    //鼠标经过添加hover样式 
         }
        );
       });

       function CloseFrame() {
         $("#dialog-win").dialog("close");
       }
       function ReturnValue(v, t) {
         $('#tbStaffs').val(t);
         $('#tbStaffId').val(v);
         CloseFrame();
       }
    </script>
    <script src="../../ckeditor/ckeditor.js" type="text/javascript"></script>
    <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() {
    var oEditor = CKEDITOR.instances.Content;
    var runsts = checkGet(document.forms[0].rbRunSatus);
    var tbStaffId = document.forms[0].tbStaffId.value;
    if (tbStaffId == '') {
      alert('请选择下一步执行人员');
      return false;
    }
    var tbStaffs = document.forms[0].tbStaffs.value;
    //alert(runsts);
    try {
      var webObj = document.getElementById("WebOffice1");
      var returnValue;
      webObj.HttpInit(); 		//初始化Http引擎
      // 添加相应的Post元素
      webObj.HttpAddPostString("id", "<%=GetId() %>");
      webObj.HttpAddPostString("runsts", escape(runsts));
      webObj.HttpAddPostString("staffid", tbStaffId);
      webObj.HttpAddPostString("staffname", escape(tbStaffs));
      webObj.HttpAddPostString("tbContent", escape(oEditor.getData()));
      webObj.HttpAddPostCurrFile("DocContent", ""); 	// 上传文件
      returnValue = webObj.HttpPost("<%=GetUrl() %>/Issue_Reply_Save.aspx"); // 判断上传是否成功
      //document.write(returnValue);
      if ("succeed" == returnValue) {
        return_onclick('<%=GetUrl() %>/Reply.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);
    }
  }
  function ShowStep() {    
    $("#rplist").show();
  }
  function HideStep() {
    $("#rplist").hide();
  }
</script>
    <style type="text/css">
      .style1
      {
        width: 100%;
      }
    </style>
    
</head>
<body>
    <form id="form1" runat="server">
    <div id="dialog-win" title="选择员工">
	    <iframe src="../Staff/Staff_Select.aspx" width="370" height="350" frameborder="0" scrolling="auto"></iframe>	
    </div>
    <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 class="suphead">
        <td>流程步骤 <span id="step_showhide"><a href="javascript:ShowStep()">显示</a> <a href="javascript:HideStep()">隐藏</a></span></td>
    </tr>
    <tr>
      <td align="center">
        <table class="style1" id="rplist">
          <tr>            
            <td height="26">
              <b>步骤</b></td>
            <td>
              <b>名称</b></td>
            <td>
              <b>执行人</b></td>
            <td><b>类型</b></td>
            <td><b>结果</b></td>
            <td><b>状态</b></td>
            <td>
              <b>执行日期</b></td>
          </tr>
          <asp:Literal ID="rpSteps" runat="server"></asp:Literal>
          
        </table>
        <script type="text/javascript">
          $('#rplist').hide();
        </script>
      </td>
    </tr>
    
    <tr class="suphead">
        <td>公文处理</td>
    </tr>

    <tr>
      <td>
        <table class="style1">
          <tr>
            <td>
              处理意见：</td>
            <td>
              <asp:RadioButtonList ID="rbRunSatus" runat="server" 
                RepeatDirection="Horizontal" RepeatLayout="Flow">
                <asp:ListItem Value="2" Selected="True">同意</asp:ListItem>
                <asp:ListItem Value="3">否定</asp:ListItem>
              </asp:RadioButtonList>
            </td>
          </tr>
          <%
          if (this.actiontype == 3)
          {
          %>
          <tr>
            <td>
                指定下一步执行人：</td>
            <td>
                <input name="tbStaffs" type="text" id="tbStaffs" class="input_middle" />
                <input name="tbStaffId" type="text" id="tbStaffId" class="hidden" />
                <input id="selclass" name="selclass" type="button" value="请选择" class="selclass" />
            </td>
          </tr>
          <%}else{%>
           <input name="tbStaffs" type="text" id="tbStaffs" value="" class="hidden" />
           <input name="tbStaffId" type="text" id="tbStaffId" value="0" class="hidden" />
           <%}%>
          <tr>
            <td>
              结果：</td>
            <td>
            <textarea name="Content" id="Content" class="hidden"></textarea>
          <script type="text/javascript">
		      //<![CDATA[
            // Replace the <textarea id="Content"> with an CKEditor instance.            

            var editor = CKEDITOR.replace('Content',
			      {
			        toolbar:
					    [
						    ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'],
						    ['UIColor']
					    ],
			        filebrowserBrowseUrl: '../../ckfinder/ckfinder.html', //启用浏览功能
			        filebrowserImageBrowseUrl: '../../ckfinder/ckfinder.html?Type=Images',
			        filebrowserFlashBrowseUrl: '../../ckfinder/ckfinder.html?Type=Flash',
			        filebrowserUploadUrl: '../../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
			        filebrowserImageUploadUrl: '../../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
			        filebrowserFlashUploadUrl: '../../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
			      }
            );
		      //]]>
		      </script>
            </td>
          </tr>
          <tr>
            <td>
              &nbsp;</td>
            <td>
              <asp:Literal ID="liBtn" runat="server"></asp:Literal>
        <input id="Button2" type="reset" value="返回" 
          onclick="javascript:history.back();" /></td>
          </tr>
  </table>
    </form>
</body>
</html>
