欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SelectReaderBody.jsp JSPStrutsHTMLBeanJ#

程序员文章站 2022-07-12 11:01:51
...
<%@ page language="java" contentType="text/html;CHARSET=utf8"
import="org.apache.commons.beanutils.BasicDynaBean,
        cn.com.detech.struts.action.DEMessages,
cn.com.detech.deinfo.util.Constants"
%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<head>
<title>选择传阅对象</title>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  -->
<LINK href="../skin/skin<bean:write name="user" property="systemskin"/>/style.css" rel="stylesheet">
<script language="JavaScript" src="../script/oa_Popup.js"></SCRIPT>
<script language="JavaScript">
<!--
function lTrim(str){
    var rtnStr;
    rtnStr="";
    for (var i=0;i<str.length;i++){
if (str.charAt(i)!=" "){
rtnStr=str.substr(i);
break;
}
}
    return rtnStr;
}

function rTrim(str){
    var rtnStr;
rtnStr="";
for (var i=str.length-1;i>=0;i--){
if (str.charAt(i)!=" "){
rtnStr=str.substring(0,i+1);
break;
}
}
return rtnStr;
}

//去除左边和右边的空格
function lrtrim(str){
    return(lTrim(rTrim(str)));
}

function setReaderNameStr(){
    myform = document.SelectReaderForm;
var NameStr = "";
myform.readerNameStr.value = "";

for(i=0; i < myform.selectedIDStr.options.length; i++){
        NameStr = myform.selectedIDStr.item(i).text;

if(NameStr != ""){
if (i < myform.selectedIDStr.options.length - 1) {
myform.readerNameStr.value += NameStr+"#";
}
else {
myform.readerNameStr.value += NameStr;
}
}
}
}

function setReturnValue(){
    myform = document.SelectReaderForm;
    var NameStr ="";
myform.returnName.value = "";
    //var EMailStr = "";
    //var IDStr = "";
    for(i=0; i < myform.selectedIDStr.options.length; i++){
//NameStr = lrtrim(myform.selectedIDStr.item(i).text.substring(0, 6));
var index = myform.selectedIDStr.item(i).text.indexOf(" ");
if (index > 0)
NameStr = myform.selectedIDStr.item(i).text.substring(0, index);

        //IDStr = myform.selectedIDStr.item(i).value;
        //EMailStr = NameStr.substring(NameStr.indexOf(" <")+2,NameStr.indexOf(">"));
        //NameStr = NameStr.substring(0,NameStr.indexOf(" <"));

        if(NameStr != ""){
if (i < myform.selectedIDStr.options.length - 1) {
            myform.returnName.value += NameStr+", ";
}
else {
                myform.returnName.value += NameStr;
}
}
        //myform.returnEMail.value += EMailStr+",";
        //myform.returnID.value += IDStr+",";
    }
}

function setback(){
    myform = document.SelectReaderForm;
    setReturnValue();

window.opener.document.CirculationEditForm.reader.value = myform.returnName.value;
//    if(myform.returnObjName.value == "assignEmpName"){//分配他人
//        window.opener.document.todoDetailForm.assignEmpName.value = myform.returnName.value;
//        window.opener.document.todoDetailForm.assignEmpID.value = myform.returnID.value;
//    }else
//    if(myform.returnObjName.value == "engageEmpName"){//预约他人
//        window.opener.document.schDetailForm.engageEmpName.value = myform.returnName.value;
//        window.opener.document.schDetailForm.engageEmpID.value = myform.returnID.value;
//    }else
//    if(myform.returnObjName.value == "messageEmpName"){//留言他人
//        window.opener.document.schDetailForm.messageEmpName.value = myform.returnName.value;
//        window.opener.document.schDetailForm.messageEmpID.value = myform.returnID.value;
//    }else
//    if(myform.returnObjName.value == "mailto"){//邮件给他人
//        window.opener.document.schDetailForm.mailto.value = myform.returnEMail.value;
//    }else
//    if(myform.returnObjName.value == "mail_cc"){//邮件抄送他人
//        window.opener.document.schDetailForm.mail_cc.value = myform.returnEMail.value;
//    }else
//    if(myform.returnObjName.value == "mail_bcc"){//密件抄送他人
//        window.opener.document.schDetailForm.mail_bcc.value = myform.returnEMail.value;
//    }
//    window.close();
}

function checkDept() {
var temp = document.SelectReaderForm.selDeptID.value;
if (temp == null || temp == "9998" || temp == "")
return false;
return true;
}

function checkGroup() {
var temp = document.SelectReaderForm.selGroupID.value;
if (temp == null || temp == "9998" || temp == "")
return false;
return true;
}

function selectAll() {
myform = document.SelectReaderForm;
for(i = myform.selectableIDStr.options.length - 1; i >= 0; i --) {
        document.SelectReaderForm.selectableIDStr.options(i).selected = true;
}
}

function addReceiver() {
    myform = document.SelectReaderForm;
    for(i=0; i < myform.selectableIDStr.options.length; i++) {
        if (myform.selectableIDStr.options(i).selected == true) {
    j = myform.selectedIDStr.options.length - 1;
    for (; j >= 0; j--) {
if (myform.selectableIDStr.item(i).value == myform.selectedIDStr.item(j).value) {
    break;
}
    }
    if (j < 0) {
        newOpt = new Option(myform.selectableIDStr.item(i).text, myform.selectableIDStr.item(i).value);
                myform.selectedIDStr.add(newOpt);
    }
}
    }
}

function removeReceiver() {
    myform = document.SelectReaderForm;
    for (i = myform.selectedIDStr.options.length - 1; i >= 0; i--) {
        if (myform.selectedIDStr.options(i).selected == true) {
            myform.selectedIDStr.remove(i);
}
    }
}

function moveUpDn(direction) {
    myform = document.SelectReaderForm;
    index = myform.selectedIDStr.options.length;
    count = 0;
    for (i = myform.selectedIDStr.options.length - 1; i >= 0; i--) {
        if (myform.selectedIDStr.options(i).selected == true) {
        count++;
        index = i;
    }
    }
    if (count == 1) { // Select One only
        if (direction < 0 && index > 0) { // Up
        newOpt = new Option(myform.selectedIDStr.item(index).text, myform.selectedIDStr.item(index).value);
        newOpt.selected = true;
            myform.selectedIDStr.remove(index);
            myform.selectedIDStr.add(newOpt, index + direction);
        }
        if (direction > 0 && index < myform.selectedIDStr.options.length - 1) { // Down
        newOpt = new Option(myform.selectedIDStr.item(index).text, myform.selectedIDStr.item(index).value);
        newOpt.selected = true;
            myform.selectedIDStr.remove(index);
            myform.selectedIDStr.add(newOpt, index + direction);
        }
    }
}

function moveUp() {
myform = document.SelectReaderForm;
var j = 0;
    for (i = myform.selectedIDStr.options.length - 1; i >= 0; i--) {
        if (myform.selectedIDStr.options(i).selected == true) {
            myform.selectedIDStr.options(i).selected = false;
            j = i;
}
}
if ( myform.selectedIDStr.options.length > 0 ) {
if (j == 0)
myform.selectedIDStr.options(j).selected = true;
else
myform.selectedIDStr.options(j - 1).selected = true;
}
}

function moveDown() {
myform = document.SelectReaderForm;
var j = 0;
    for (i = 0; i < myform.selectedIDStr.options.length; i++) {
        if (myform.selectedIDStr.options(i).selected == true) {
            myform.selectedIDStr.options(i).selected = false;
            j = i;
}
}
if ( myform.selectedIDStr.options.length > 0 ) {
if (j == (myform.selectedIDStr.options.length - 1))
myform.selectedIDStr.options(j).selected = true;
else
myform.selectedIDStr.options(j + 1).selected = true;
}
}

function submitForm(act){
myform = document.SelectReaderForm;

    //if(act == "Save"){
        for (i = document.SelectReaderForm.selectedIDStr.options.length - 1; i >= 0; i--) {
            document.SelectReaderForm.selectedIDStr.options(i).selected = true;
    }
        for (i = document.SelectReaderForm.selectableIDStr.options.length - 1; i >= 0; i--) {
            document.SelectReaderForm.selectableIDStr.options(i).selected = false;
    }
    //}

myform.action.value = act;
myform.submit();
}
//-->
</script>
</head>

<html:form action="/SelectReader" name="SelectReaderForm" method="POST" type="cn.com.detech.deinfo.communion.web.SelectFormForm">
<html:hidden property="action"/>
<html:hidden property="returnName"/>
<html:hidden property="readerNameStr"/>

<body class="popbg" topmargin="0" leftmargin="0">
<% DEMessages DEMSG = (DEMessages)request.getAttribute(Constants.ERROR_BEAN);
if (DEMSG!=null) {
String[] strMsg = DEMSG.getStrErrMSG();
if (strMsg!=null && strMsg.length>=1) { %>
        <%-- <jsp:include page="../../../platform/jsp/DEMessages.jsp" flush="true" /> --%>
        <script language="javascript">
window.close();
</script>
<%
}
}
%>
<div align="center">
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="popbt">
  <tr>
    <td>&&<B>请从列表中选择姓名</B></td>
   
  </tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
  <tr>

      <td>
        
      <div align="center">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100%" >

  <TABLE width="100%" border="0" cellspacing="1">
            <TR>
              <TD width="100%"  colspan="4">
              <b>
              &部门科室:</b>
<html:select property="selDeptID" size="1" onchange="setReaderNameStr();submitForm('ChangeDept');" style="width:150">
        <logic:iterate id="did" name="SelectReaderForm" property="deptList">
                      <html:option value="<%=Integer.toString(((cn.com.detech.deinfo.users.BeanDepartment)did).getDeptID())%>"><%=((cn.com.detech.deinfo.users.BeanDepartment)did).getDepartmentName()
  %>
  </html:option>
                 </logic:iterate>
</html:select><b>
自定义群组:</b>
<html:select property="selGroupID" size="1" onchange="setReaderNameStr();submitForm('ChangeGroup');" style="width:150">
    <logic:iterate id="gid" name="SelectReaderForm" property="groupList">
                      <html:option value="<%=Integer.toString(((cn.com.detech.deinfo.users.BeanGroup)gid).getGroupID())%>"><%=((cn.com.detech.deinfo.users.BeanGroup)gid).getGroupName()
  %>
  </html:option>
                 </logic:iterate>
</html:select>(信息送给指定的传阅对象)
              </TD>
            </TR>
            <TR>
             
      <TD width="44%">
        <p align="center"><strong>人员一览</strong></TD>
              <TD width="8%" rowspan="3" >
                <p align="center">
                  <input type="button" value="→ 添加" name="B3" onClick="addReceiver();"><br>
                  <br>
                  <input type="button" value="← 删除" name="B3" onClick="removeReceiver(); return false;"><br>
                  <br>
                  <input type="button" value="○ 全选" name="B3" onClick="selectAll(); return false;"></p></TD>
             
      <TD width="50%"  colspan="2">
        <p align="center"><strong>传阅对象一览</strong></TD>
            </TR>
            <TR>
              <TD width="45%" valign="middle" >
                <table border="0" width="99%" cellspacing="0" cellpadding="0">
                  <tr >
                    <td width="30%"  align="left"  height="11">姓名</td>
                    <td width="40%"  align="left"  height="11">部门科室</td>
                    <td width="29%"  align="left"  height="11">职务</td>
                  </tr>
                </table></TD>
              <TD width="45%" > <table border="0" width="99%" cellspacing="0"  cellpadding="0">
                  <tr >
                    <td width="30%"  align="left"  height="11">姓名</td>
                    <td width="40%"  align="left"  height="11">部门科室</td>
                    <td width="29%"  align="left"  height="11">职务</td>
                  </tr>
                </table></TD>
              <TD width="2%"  rowspan="2">
                <p align="center"><input type="button" value="↑" name="B3" onclick="moveUpDn(-1);"><br>
                <br>
                <input type="button" value="↓" name="B3" onclick="moveUpDn(1);"><br>
                <br>
              </TD>
            </TR>
            <tr>
              <TD width="45%" >
  <html:select property="selectableIDStr" multiple="true" size="15" style="width:100%; font-family:Courier New; font-size:9pt" ondblclick="addReceiver(); return false;">
    <logic:iterate id="eid" name="SelectReaderForm" property="empList">
<%
     String userStr = "";
     String userName = ((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getUserName();
String deptName = ((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getDeptName();
String positionName = ((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getPositionName();

int ulength = 0;
ulength = 6 - userName.length();
if (ulength > 0) {
for(int i = 0; i < ulength; i ++) {
userName += " ";
}
}
else {
userName += " ";
}

ulength = 9 - deptName.length();
if (ulength > 0) {
for(int i = 0; i < ulength; i ++) {
deptName += " ";
}
}
else {
deptName += " ";
}

userStr = userName + deptName + positionName;
%>
      <html:option value='<%=Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getUserID()) + "#" + Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getDeptID()) + "#" + Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)eid).getPositionID())%>'><%=userStr%>
  </html:option>
                 </logic:iterate>
              </html:select>
  </TD>
              <TD width="45%" >
  <html:select property="selectedIDStr" multiple="true" size="15" style="width:100%; font-family:Courier New; font-size:9pt" ondblclick="removeReceiver(); return false;">
     <logic:iterate id="rid" name="SelectReaderForm" property="readerList">
<%
     String readerStr = "";
     String readerName = ((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getUserName();
String deptName = ((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getDeptName();
String positionName = ((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getPositionName();

int ulength = 0;
ulength = 6 - readerName.length();
if (ulength > 0) {
for(int i = 0; i < ulength; i ++) {
readerName += " ";
}
}
else {
readerName += " ";
}

ulength = 9 - deptName.length();
if (ulength > 0) {
for(int i = 0; i < ulength; i ++) {
deptName += " ";
}
}
else {
deptName += " ";
}

readerStr = readerName + deptName + positionName;
%>
                      <html:option value='<%=Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getUserID()) + "#" + Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getDeptID()) + "#" + Integer.toString(((cn.com.detech.deinfo.communion.model.ReaderBean)rid).getPositionID())%>'><%=readerStr%>
  </html:option>
                 </logic:iterate>
  </html:select>
  </TD>
            </tr>
          </TABLE>

</td>
        </tr>
      </table>
         </div>
      </TD>
      </TR>
      </TABLE>
  <HR>
<table width="90%" border="0" cellpadding="2" cellspacing="2">
  <tr>
    <td align="right"><input  type="button" value="&&确定&&" name="B39"  onClick="setReaderNameStr();setback();submitForm('Save');" class="button" onMouseOver="this.className='button_over';" onMouseOut="this.className='button';"> <input  type="button" value="&&取消&&" name="B40" onClick="window.close();" class="button" onMouseOver="this.className='button_over';" onMouseOut="this.className='button';">&</td>
  </tr>
</table>

</div>
</body>
</html:form>