roleuser.jsp
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:5k
源码类别:
Jsp/Servlet
开发平台:
Java
- <%@ page language="java" pageEncoding="GBK"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
- <link href="<%=request.getContextPath()%>/Css_file/oa.css" rel="stylesheet" type="text/css" />
- <body onload="init();">
- <form id="form1" name="form1" method="post" action="">
- <table width="100%" border="0" class="myTable">
- <tr>
- <td>
- <select id="left" name="left" onDblClick="move(form1.left,form1.right);" multiple size="10">
- <logic:equal name="type" value="user" scope="request">
- <logic:iterate id="list" name="list" scope="request">
- <option value="${list.uno}">${list.utruename}</option>
- </logic:iterate>
- </logic:equal>
- <logic:equal name="type" value="role" scope="request">
- <logic:iterate id="list" name="list" scope="request">
- <option value="${list.rid}">${list.rname}</option>
- </logic:iterate>
- </logic:equal>
- <logic:equal name="type" value="transrole" scope="request">
- <logic:iterate id="list" name="list" scope="request">
- <option value="${list.rid}">${list.rname}</option>
- </logic:iterate>
- </logic:equal>
- </select>
- </td>
- <td>
- <input class="tableHead" type="button" name="a" value="左移一个" onClick="move(form1.right,form1.left)"><br>
- <input class="tableHead" type="button" name="c" value="右移一个" onClick="move(form1.left,form1.right)"><br>
- <input class="tableHead" type="button" name="b" value="全部左移" onClick="moveAll(form1.right,form1.left)"><br>
- <input class="tableHead" type="button" name="d" value="全部右移" onClick="moveAll(form1.left,form1.right)">
- </td>
- <td>
- <select id="right" name="right" onDblClick="move(form1.right,form1.left)" multiple size="10">
- </select>
- </td>
- </tr>
- <tr>
- <td align="center" colspan="3">
- <input type="button" name="ok" value="确定" onClick="returnOpener();">
- <input type="button" name="canel" value="取消" onClick="window.close();">
- </td>
- </tr>
- </table>
- </from>
- </body>
- <script>
- function init()
- {
- var select_right = document.getElementById("right");
- var name = opener.document.all("${requestScope.type}${requestScope.id}").value.split(",");
- var id = opener.document.all("${requestScope.type}id${requestScope.id}").value.split(",");
- if (name != null && name != "")
- {
- for(var i=0; i<name.length; i++)
- {
- select_right.options[i] = new Option(name[i], id[i]);
- }
- clearleftValue();
- }
- }
- function clearleftValue(){
- var select_left = document.getElementById("left");
- var select_right = document.getElementById("right");
- if(select_right.length>0){
- for(var i=0;i<select_right.length;i++){
- for(var j=0;j<select_left.length;j++){
- if(select_left.options[j].value==select_right.options[i].value){
- select_left.remove(j);
- //i--;
- break;
- }
- }
- }
- }
- }
- function move(from,to){
- for(var i = 0;i<from.options.length;i++){
- if(from.options[i].selected == true){
- to.options[to.options.length] = new Option(from.options[i].text,from.options[i].value);
- from.options[i] = null;
- i--;
- }
- }
- }
- function moveAll(from,to){
- for(var i = 0;i<from.options.length;i++){
- to.options[to.options.length] = new Option(from.options[i].text,from.options[i].value);
- from.options[i] = null;
- i--;
- }
- }
- function returnOpener(){
- var id = parseInt("${requestScope.id}", 10);
- var tValue = opener.document.all("${requestScope.type}${requestScope.id}");
- var rValue = opener.document.all("${requestScope.type}id${requestScope.id}");
- var vv = ""
- var vr = ""
- tValue.value = "";
- rValue.value = "";
- var select_right = document.getElementById("right");
- for (var i=0;i<select_right.length;i++){
- if (vv == "" && vr == ""){
- vv = select_right[i].text;
- vr = select_right[i].value;
- }
- else{
- vv = vv + ","+select_right[i].text;
- vr = vr + ","+select_right[i].value;
- }
- }
- tValue.value = vv;
- rValue.value = vr;
- window.close();
- }
- </script>