DocTempletFieldsPurviewManage.jsp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:8k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" %>
  2. <%@ page import="com.gforce.gfoa.*, com.gforce.currency.*, java.util.*" %>
  3. <jsp:include page="/CheckLogin.jsp" flush="true"/><%
  4. Session m_session = new Session(session);
  5. Request m_request = new Request(request);
  6. int iSysDirID = m_request.GetInt("SysDirID");
  7. String strTempletID = m_request.GetString("ID");
  8. %>
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
  12. <title>公文管理 -- GForce OA 2.0</title>
  13. <link href="/css/txt.jsp" rel="stylesheet" type="text/css">
  14. <script language="JavaScript" src="/js/changestyle.js"></script>
  15. <script language="JavaScript">
  16. //可写用户初始化数组
  17. var WA_Array = new Array();
  18. //只读用户初始化数组
  19. var RA_Array = new Array();
  20. var SelectedCheckBoxValue = new Array();
  21. var WA_UserIDs = "";
  22. var RA_UserIDs = "";
  23. var INTI_WA_Array = "";
  24. var INTI_RA_Array = "";
  25. <%
  26.    //返回当前公文的所有字段信息
  27.    Vector DTF_vt = DocTempletFieldsManager.getRecordBySearch("","","","","","","","","","","","1","","",strTempletID,"","","","","");
  28.    if (DTF_vt.size()>0)
  29.    {
  30.      for (int i=0;i<DTF_vt.size();i++)
  31.      {
  32.        //格式:“字段ID”,“用户IDs”
  33.        out.println("WA_Array[" + i + "]=new Array('" + ((Vector)DTF_vt.get(i)).get(0) + "','" + ((Vector)DTF_vt.get(i)).get(9).toString() + "','" + ((Vector)DTF_vt.get(i)).get(10).toString() + "');");
  34.        out.println("RA_Array[" + i + "]=new Array('" + ((Vector)DTF_vt.get(i)).get(0) + "','" + ((Vector)DTF_vt.get(i)).get(10).toString() + "');");
  35.      }
  36.    }
  37. %>
  38. var jsArray = new Array();
  39. <%
  40. Vector vt = UserManager.getUserTreeData();
  41. for(int j=0;j<vt.size();j++)
  42. {
  43.     out.println("jsArray[" +j + "] = new Array("" + ((Vector)vt.get(j)).get(0).toString() + "","" + ((Vector)vt.get(j)).get(1).toString() + "");");
  44. }
  45. %>
  46. //产生str1和str2的交集
  47. function intersection(str1,str2)
  48. {
  49.   var str3 = "";
  50.   ///alert("str1=" + str1 + ";str2=" + str2 + ";str3=" + str3);
  51.   if (str1.length<1||str2.length<1)
  52.   {
  53.     ///alert("str1或者str2为空!str1=" + str1 + ";str2=" + str2 + ";str3=" + str3);
  54.     return "";
  55.   }
  56.   else
  57.   {
  58.     var MyArray = new Array();
  59.     if(str1.indexOf(",")>=0)
  60.     {
  61.       ///alert("str1包含,!str1=" + str1 + ";str2=" + str2 + ";str3=" + str3);
  62.       MyArray = str1.split(",");
  63.       str2 = "," + str2 + ",";
  64.       for (var i=0;i<MyArray.length;i++)
  65.       {
  66.         if (MyArray[i].length>0 && str2.indexOf(","+ MyArray[i] +",")>=0)
  67.         {
  68.           str3 += ("," + MyArray[i]);
  69.         }
  70.       }
  71.       str3=str3.substr(1);
  72.     }
  73.     else if (("," + str2 + ",").indexOf(","+ str1 +",")>=0)
  74.     {
  75.       ///alert("str1不包含,!str1=" + str1 + ";str2=" + str2 + ";str3=" + str3);
  76.       str3 += str1;
  77.     }
  78.     else
  79.     {
  80.       str3="";
  81.     }
  82.   }
  83.   return str3;
  84. }
  85. function PickCheck()
  86. {
  87.   INTI_WA_Array = "";
  88.   INTI_RA_Array = "";
  89.   WA_UserIDs = "-1";
  90.   RA_UserIDs = "-1";
  91.   var j=0;
  92.   for(var i=0;i<document.DTFPManage.Purview.length;i++)
  93.   {
  94.     if (document.DTFPManage.Purview[i].checked==true)
  95.     {
  96.       for (var k=0;k<WA_Array.length;k++)
  97.       {
  98.         if(document.DTFPManage.Purview[i].value==WA_Array[k][0])
  99.         {
  100.           INTI_WA_Array = WA_Array[k][1];
  101.           if (WA_UserIDs=="-1")
  102.           {
  103.             WA_UserIDs = INTI_WA_Array;
  104.           }
  105.           else
  106.           {
  107.             WA_UserIDs = intersection(WA_UserIDs,INTI_WA_Array);
  108.           }
  109.           INTI_RA_Array = WA_Array[k][2];
  110.           if (RA_UserIDs=="-1")
  111.           {
  112.             RA_UserIDs = INTI_RA_Array;
  113.           }
  114.           else
  115.           {
  116.             RA_UserIDs = intersection(RA_UserIDs,INTI_RA_Array);
  117.           }
  118.         }
  119.       }
  120.       j=j+1;
  121.     }
  122.   }
  123.   if (document.DTFPManage.OpType.value == "Writeable")
  124.     return WA_UserIDs;
  125.   else if (document.DTFPManage.OpType.value == "Readable")
  126.     return RA_UserIDs;
  127. }
  128. function ChangeSelected()
  129. {
  130.   document.DTFPManage.UserIDs.value = PickCheck();
  131.   document.DTFPManage.Intersection.value = document.DTFPManage.UserIDs.value;
  132. }
  133. function changeUserID()
  134. {
  135.   var temp = "";
  136.   for(var i=0;i<jsArray.length;i++)
  137.   {
  138.     if(("," + document.DTFPManage.UserIDs.value + ",").indexOf("," + jsArray[i][0] + ",")>=0)
  139.     temp+="," + jsArray[i][1];
  140.   }
  141.   document.DTFPManage.UserNames.value = temp.substr(1,temp.length);
  142. }
  143. function ClearField()
  144. {
  145.   if (document.DTFPManage.UserIDs.value==-1)
  146.   {document.DTFPManage.UserIDs.value="";}
  147. }
  148. function checkFields()
  149. {
  150.   for(var i=0;i<document.DTFPManage.Purview.length;i++)
  151.   {
  152.     if (document.DTFPManage.Purview[i].checked==true)
  153.     {
  154.       return true;
  155.     }
  156.   }
  157.   alert("请先选择要操作的字段!");
  158.   return false;
  159. }
  160. </script>
  161. </head>
  162. <body bgcolor="<%=m_session.GetString("BackColor")%>" leftmargin="0" topmargin="0">
  163.   <table width="100%" height="100%" border="0" align="center" cellspacing="0">
  164.     <tr>
  165.         <td align="center" valign="top"><p>&nbsp;</p>
  166.           <form name="DTFPManage" action="DTFP_ManageAction.jsp?SysDirID=<%=iSysDirID%>" onSubmit="javascript:return checkFields();" method="post">
  167.            <table width="90%" border="0" align="center" cellspacing="0">
  168.             <tr>
  169.               <td align="center">
  170.                 <font color="#000000"><strong>公文模板字段权限管理</strong></font>
  171.               </td>
  172.             </tr>
  173.             <tr>
  174.               <td>
  175.                 &nbsp;
  176.               </td>
  177.             </tr>
  178.            </table>
  179.            <table align="center" width="90%" border="1" cellpadding="1" cellspacing="1">
  180.              <tr align="center" valign="middle" bgcolor="<%=m_session.GetString("TitleColor")%>">
  181.                <td align="center" width="14%">
  182.                  操作类型:&nbsp;
  183.                </td>
  184.                <td align="left" width="80%">
  185.                  &nbsp;<select name="OpType" onchange="ChangeSelected()">
  186.                    <option value="Writeable" selected="selected">可写权限</option>
  187.                    <option value="Readable">只读权限</option>
  188.                  </select>
  189.                </td>
  190.              </tr>
  191.              <tr>
  192.               <td colspan="2">&nbsp;</td>
  193.              </tr>
  194.              <tr>
  195.                <td align="center" width="14%">权限列表:&nbsp;</td>
  196.                <td align="left" width="70%"><%
  197.                  if (DTF_vt.size()>0)
  198.                  {
  199.                    for (int i=0;i<DTF_vt.size();i++)
  200.                    {
  201.                      out.println("<class><input name="Purview" type="checkbox" value="" + ((Vector)DTF_vt.get(i)).get(0) + "" onpropertychange="ChangeSelected()">" + ((Vector)DTF_vt.get(i)).get(1) + "</class>");
  202.                    }
  203.                  }
  204.                  else
  205.                  {
  206.                    out.println("该公文模板没有字段!");
  207.                    return;
  208.                  }
  209.                %>
  210.                &nbsp;</td>
  211.              </tr>
  212.              <tr>
  213.                <td align="center">请选择用户:&nbsp;
  214.                </td>
  215.                <td align="left">&nbsp;<textarea name="UserNames" cols="60" rows="4" readonly="true" onDblClick="GetUserIDAndNames(document.DTFPManage.UserIDs,this);"></textarea>
  216.                <a href="" onclick="GetUserIDAndNames(document.DTFPManage.UserIDs,document.DTFPManage.UserNames);return false;" title="选择用户"><img src="/images/couple.gif" border="0"></a>
  217.                  <input name="UserIDs" type="hidden" value="" onpropertychange="changeUserID()">
  218.                  <input name="TempletID" type="hidden" value="<%=strTempletID%>">
  219.                  <input name="Intersection" type="hidden" value="">
  220.                </td>
  221.              </tr>
  222.            </table>
  223.            <table>
  224.              <tr>
  225.                <td colspan="2">
  226.                  &nbsp;
  227.                </td>
  228.              </tr>
  229.            </table>
  230.            <table width="90%">
  231.              <tr>
  232.                <td align="right">
  233.                  <input type="submit" onclick="ClearField()" value="确 定" style="background-color: #FFFFFF; border: 1 solid #000000">&nbsp;&nbsp;&nbsp;&nbsp;
  234.                  <input type="reset" value="重 置" style="background-color: #FFFFFF; border: 1 solid #000000">&nbsp;&nbsp;&nbsp;&nbsp;
  235.                  <input type="button" value="返 回" onclick="window.location='DocumentTempletManage.jsp?SysDirID=155'" style="background-color: #FFFFFF; border: 1 solid #000000">&nbsp;
  236.                </td>
  237.              </tr>
  238.            </table>
  239.            </form>
  240.         </td>
  241.     </tr>
  242.   </table>
  243. </body>
  244. </html>