<%@ page language="java" errorPage="/WEB-INF/common/exception.jsp" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> <%@ include file="/WEB-INF/common/taglibs.jsp"%> <html> <head> <title>系统管理 > 用户管理 > 修改</title> </head> <body> <script type="text/javascript" language="javascript"> $(document).ready(function (){ <c:forEach var="r" items="${list3}"> $("input[name=user.roles][value='${r.id}']").attr("checked","checked"); </c:forEach> <c:forEach var="g" items="${list4}"> $("input[name=user.groups][value='${g.id}']").attr("checked","checked"); </c:forEach> var utype = "${user.userType}"; if(utype=="ADMINISTRATOR"){ $("tr[name='prname']").attr("style","display:none"); $("select[name='user.depart.id']").removeAttr("dataType"); } }); function onVail(myfrom){ var org=Validator.Validate(myfrom,3); var ob=document.getElementsByName('user.roles'); if(org){ var reName = $("#realName").val().replace(/\s/g,"");//这里是去掉空字符 if(reName ==''){ $("#realtip").css("color","red"); $("#realtip").text("*请输入用户姓名"); return false; }else{ $("#realtip").text(""); } if (ob != null && ob.length > 0){ var ids=''; for(var i=0; i<ob.length; i++){ if(ob[i].checked==true){ ids += ob[i].value + ','; } } } if(ids == ''){ $("#tips").css("color","red"); $("#tips").text("*请选择"); return false; } var filePath = document.getElementById("replyfileupload").value; var extension=new String (filePath.substring(filePath.lastIndexOf(".")+1,filePath.length));//文件扩展名 if (filePath!="" ){ if(extension == "jpg" || extension=="jpeg" || extension=="gif" || extension=="bmp" || extension=="png" ){ }else{ alert('只能上传后缀名为:.jpg,.jpeg,.gif,.bmp,.png 的图片!'); return false; } } return true; }else{ return false; } } function queryProflist(value){ //根据 所属系 去查找对应的专业 if(value == ''){ $('#thid').html(''); $('#tdid').html(''); } var usertype2 = document.getElementById("userTypeID2"); var usertype = document.getElementById("userTypeID"); var tagg = document.getElementById("tagg").value; url = "<c:url value='/manage/user/findSubInforms.jhtml?user.depart.id="+value+"'/>"; $.post(url,null,function(data){ var d = eval("("+data+")"); var thid = document.getElementById('thid'); var tdid = document.getElementById('tdid'); var addHtmlth=''; var addHtmltd=''; if(d.rlist!='' && usertype != null && usertype.value!="DEPARTADMIN"){ //系统管理员登录并且选的用户类型为教师 需要选专业 addHtmlth = "专业:"; thid.innerHTML=addHtmlth; addHtmltd = "<select name='user.profession.id' style='width:180px'>"; $.each(d.rlist,function(index,value){ addHtmltd = addHtmltd + "<option value='"+value.id+"' title='"+value.name+"'>"+value.name+"</option>"; }); addHtmltd = addHtmltd +"</select>"; tdid.innerHTML=addHtmltd; }else if(d.rlist!='' && usertype2 != null && usertype2.value!="DEPARTADMIN"){ //超级管理员登录并且选的用户类型为教师 需要选专业 addHtmlth = "专业:"; thid.innerHTML=addHtmlth; addHtmltd = "<select name='user.profession.id' style='width:180px'>"; $.each(d.rlist,function(index,value){ addHtmltd = addHtmltd + "<option value='"+value.id+"' title='"+value.name+"'>"+value.name+"</option>"; }); addHtmltd = addHtmltd +"</select>"; tdid.innerHTML=addHtmltd; }else if(d.rlist!='' && tagg !='' && tagg =="departAdmin"){ //系管理员登录 用户类型为教师 需要选专业 addHtmlth = "专业:"; thid.innerHTML=addHtmlth; addHtmltd = "<select name='user.profession.id' style='width:180px'>"; $.each(d.rlist,function(index,value){ addHtmltd = addHtmltd + "<option value='"+value.id+"' title='"+value.name+"'>"+value.name+"</option>"; }); addHtmltd = addHtmltd +"</select>"; tdid.innerHTML=addHtmltd; }else{ $('#thid').html(''); $('#tdid').html(''); } },"text"); } function changeDepart(value){ if(value=="DEPARTADMIN"){ //系管理员不需要选专业 $('#thid').html(''); $('#tdid').html(''); $("tr[name='prname']").removeAttr("style"); $("select[name='user.depart.id']").attr("dataType","Require"); }else if(value=="ADMINISTRATOR"){ //系统管理员不需要选 所属系 和 专业 $("tr[name='prname']").attr("style","display:none"); $("select[name='user.depart.id']").removeAttr("dataType"); }else{ //教师 则把所选系相对应的专业查出来 $("tr[name='prname']").removeAttr("style"); $("select[name='user.depart.id']").attr("dataType","Require"); var prval = document.getElementById("prID").value; if(prval == ''){ $('#thid').html(''); $('#tdid').html(''); } url = "<c:url value='/manage/user/findSubInforms.jhtml?user.depart.id="+prval+"'/>"; $.post(url,null,function(data){ var d = eval("("+data+")"); var thid = document.getElementById('thid'); var tdid = document.getElementById('tdid'); var addHtmlth=''; var addHtmltd=''; if(d.rlist!=''){ addHtmlth = "专业:"; thid.innerHTML=addHtmlth; addHtmltd = "<select name='user.profession.id' style='width:180px'>"; $.each(d.rlist,function(index,value){ addHtmltd = addHtmltd + "<option value='"+value.id+"' title='"+value.name+"'>"+value.name+"</option>"; }); addHtmltd = addHtmltd +"</select>"; tdid.innerHTML=addHtmltd; }else{ $('#thid').html(''); $('#tdid').html(''); } },"text"); } } </script> <div class="ifrm-cont"> <div class="title01 clear"> <h2 class="title01-cont floatL">修改用户</h2> </div> <form action="<c:url value='/manage/user/saveOrUpdate.jhtml'/>" enctype="multipart/form-data" method="post" onsubmit="return onVail(this);"> <table width="100%" class="tableCont mT10"> <tr> <input type="hidden" name="user.id" value="${user.id }"/> <input type="hidden" name="user.enabled" value="${user.enabled }"/> <th><span style="color:red;">*</span>登 录名:</th> <td><input id="name" name="user.name" type="text" class="input" value="${user.name }" maxlength="20" size="32" disabled="disabled"/> </td> <th><span style="color:red;">*</span>用户姓名:</th> <td><input id="realName" name="user.realName" type="text" class="input" value="${user.realName }" maxlength="20" size="32" dataType="Require" msg="请输入真实姓名"/><span id="realtip"></span> </td> </tr> <tr> <th><span style="color:red;">*</span>联系手机:</th> <td><input id="telephone" name="user.telephone" type="text" class="input" size="32" value="${user.telephone }" dataType="Mobile" size="30" msg="请输入正确的手机号码"/> </td> <th>性别:</th> <td><input name="user.sex" type="radio" value="true" <c:if test="${empty user.sex || user.sex }">checked</c:if>/> 男 <input name="user.sex" type="radio" value="false" <c:if test="${!user.sex }">checked</c:if>/> 女 </td> </tr> <input type="hidden" id="tagg" value="${tag }" /> <tr> <th><span style="color:red;">*</span>用户类型:</th> <td ><c:if test="${users.userType=='SUPERADMIN'}"> <!--超级管理员可以创建多种用户类型--> <select id="userTypeID2" name="user.userType" onchange="changeDepart(this.value);" dataType="Require" msg="请选择"> <option value="">请选择</option> <option value="ADMINISTRATOR" <c:if test="${user.userType=='ADMINISTRATOR' }">selected</c:if>>系统管理员</option> <option value="DEPARTADMIN" <c:if test="${user.userType=='DEPARTADMIN' }">selected</c:if>>系管理员</option> <option value="TEACHER" <c:if test="${user.userType=='TEACHER' }">selected</c:if>>教师</option> </select> <div style="margin-top: 3px;color: red;">注:系统管理员在统计中可查看所有的信息</div> </c:if> <c:if test="${users.userType=='ADMINISTRATOR'}"> <!--系统管理员可以创建多种用户类型--> <select id="userTypeID" name="user.userType" onchange="changeDepart(this.value);" dataType="Require" msg="请选择"> <option value="">请选择</option> <c:if test="${user.userType=='ADMINISTRATOR' }"> <option value="ADMINISTRATOR" <c:if test="${user.userType=='ADMINISTRATOR' }">selected</c:if>>系统管理员</option> </c:if> <option value="DEPARTADMIN" <c:if test="${user.userType=='DEPARTADMIN' }">selected</c:if>>系管理员</option> <option value="TEACHER" <c:if test="${user.userType=='TEACHER' }">selected</c:if>>教师</option> </select> </c:if> <c:if test="${users.userType=='DEPARTADMIN'}"> <!--系管理员只能创建教师用户类型--> <select name="user.userType" dataType="Require" msg="请选择"> <option value="">请选择</option> <option value="TEACHER" <c:if test="${user.userType=='TEACHER' }">selected</c:if>>教师</option> </select> </c:if> </td> <th><span style="color:red;">*</span>所属角色:</th> <td > <c:forEach var="role" items="${list}" varStatus="i"> <c:if test="${i.index!=0 && i.index % 4 ==0}"> <br/> </c:if> <input type="checkbox" name="user.roles" value="${role.id }" <c:if test="${role.id==60220}">readonly="readonly" onclick="return false;"</c:if> /> ${role.name } </c:forEach> <span id="tips"></span> </td> </tr> <tr name="prname" > <th><span style="color:red;">*</span>所属系:</th> <td><select id="prID" name="user.depart.id" onchange="queryProflist(this.value);" dataType="Require" msg="请选择系"> <option value="">请选择</option> <c:forEach var="pf" items="${list5}"> <option value="${pf.id }" <c:if test="${user.depart.id==pf.id }">selected</c:if> title="${pf.name }">${pf.name }</option> </c:forEach> </select> </td> <th id="thid"><c:if test="${!empty departProflist}">专业:</c:if> </th> <td id="tdid"><c:if test="${!empty departProflist}"> <select name="user.profession.id" id='tyID2' style="width:180px"> <c:forEach var="pf" items="${departProflist}"> <option value="${pf.id }" <c:if test="${pf.id==user.profession.id }">selected</c:if> title="${pf.name }">${pf.name }</option> </c:forEach> </select> </c:if> </td> </tr> <tr> <th>图片上传:</th> <td colspan="3"><input type="hidden" id = "fujian" value="${user.photoName}" /> <c:if test="${user.photoName !=''}"><a href='<c:url value='/manage/user/download.jhtml?user.id=${user.id} '/>' title="点击下载图片">${user.photoName }</a><br /></c:if> <input type="file" class="input" name="upload" id="replyfileupload" class="input" size="50" /><br /> <div style="margin-top: 5px;color: red;">注:只允许上传后缀名为:.jpg,.jpeg,.gif,.bmp,.png 的图片。</div> <c:if test="${user.photoName !=null && user.photoName !=''}"><div style="margin-top: 5px;color: red;"> ( 若重新上传图片,则当前图片将会被覆盖。)</div></c:if> </td> </tr> <tr> <th>个人简介:</th> <td colspan="3"> <textarea name="user.remark" cols="80" rows="8">${user.remark }</textarea> </td> </tr> <tr> <th>主要成绩:</th> <td colspan="3"> <textarea name="user.achievement" cols="80" rows="8">${user.achievement }</textarea> </td> </tr> </table> <div class="mT10"><span class="btn04 mL10"> <input type="submit" name="button" value="确认" /></span> <span class="btn04 mL10"> <input type="button" name="button" value="返回" onclick="window.history.back(-1);"/></span> </div> </form> </div> </body> </html>