?? resposition.jsp.svn-base
字號:
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.nsi.components.util.LoginuserUtil" %>
<%@ page import="com.nsi.components.department.RsPosInfo" %>
<%@ page import="com.nsi.components.util.DeptInfoUtil" %>
<%@ page import="com.nsi.components.department.DeptDtl" %>
<%@ page import="com.nsi.components.department.DeptRole" %>
<%@ page import="com.nsi.components.department.RsPosDetail" %>
<%@ page import="com.nsi.components.util.info.RsDropInfo" %>
<%@ page import="com.nsi.components.web.util.RsPosWebUtil" %>
<%@ page import="com.nsi.util.ValHelper" %>
<%
String deptid = RsPosWebUtil.getInstance().getDeptid(request);
int addedrows = RsPosWebUtil.getInstance().getAddnum(request);
int rownum = 0;
if ( addedrows > 0 )
{
rownum += addedrows;
}
List<RsPosDetail> detaillist = RsPosWebUtil.getInstance().getDetaillist(request);
List<DeptRole> deptrolelist = DeptInfoUtil.getInstance().getDeptrolelist();
String searchtype = RsPosWebUtil.getInstance().getSearchtype(request);
%>
<html>
<head>
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="pragma" content="no-cache">
<%
if ( LoginuserUtil.getInstance().isNotLogined(request) )
{
%><meta http-equiv="refresh" content="0; url=/entrance.jsp"><%
}
%>
<title>Achievo-RMS Resources Posotion</title>
<link href="../theme/master.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
var valid = 0;
function savecheck( theform, action )
{
if ( checkvalid( theform )&&confirmupdate( theform ) )
{
submitform( theform, action );
return true;
}
else
{
return false;
}
}
function confirmupdate( theform )
{
for ( var i = 0; i < theform.length; i++ )
{
if ( theform.elements[i].type == "checkbox" && theform.elements[i].checked == true )
{
return confirm('Do you want to delete the resource from this department?');
}
}
return true;
}
function checkvalid( theform )
{
if ( valid == 1 )
{
valid = 0;
return false;
}
else
{
if ( ! validrespos(theform) )
{
return false;
}
else
{
return true;
}
}
}
function submitform( theform, action )
{
theform.action.value = action;
theform.submit();
}
function cancelform( theform )
{
theform.action.value = "";
theform.urlmapping.value = "/resources/resposmenu" ;
theform.submit() ;
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="rp_form" method="post" action="/rms/mainservlet">
<h1>Resources Position</h1>
<input type="hidden" name="urlmapping" value="/resources/resposition">
<input type="hidden" name="action" value="displayResPos">
<table width="837" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" class="txtLabel">Department</td>
<td width="200" class="cell">
<select class="cell" name="deptid" size="1">
<%
List<DeptDtl> deptlist = DeptInfoUtil.getInstance().getDeptlist();
int size = deptlist.size();
for( int i = 0; i < size; i++ )
{
DeptDtl dtl = deptlist.get( i ) ;
String dropdeptid = dtl.getDeptid();
if ( deptid.equals( dropdeptid ) )
{
%><option class="cell" selected value="<%=deptid%>"><%=dtl.getDeptname()%></option><%
}
else
{
%><option class="cell" value="<%=dropdeptid%>"><%=dtl.getDeptname()%></option><%
}
}
%>
</select>
</td>
<td width="537" class="cell">
<input type="button" class="cell" name="rpdisplay" value="Display & Modify" onclick="javascript:submitform(this.form, 'displayResPos');">
</td>
</tr>
<tr>
<td width="200" class="txtLabel">Resource Status</td>
<%
if ( searchtype.equals( "A" ) )
{
%>
<td width="400" class="cell">
<input type="radio" class="cell" name="searchtype" value="A" checked> Active
<input type="radio" class="cell" name="searchtype" value="I" > Inactive
<input type="radio" class="cell" name="searchtype" value="S"> All
</td>
<%
}
else if ( searchtype.equals( "I" ) )
{
%>
<td width="400" class="cell">
<input type="radio" class="cell" name="searchtype" value="A" > Active
<input type="radio" class="cell" name="searchtype" value="I" checked> Inactive
<input type="radio" class="cell" name="searchtype" value="S"> All
</td>
<%
}
else
{
%>
<td width="400" class="cell">
<input type="radio" class="cell" name="searchtype" value="A" > Active
<input type="radio" class="cell" name="searchtype" value="I" > Inactive
<input type="radio" class="cell" name="searchtype" value="S" checked> All
</td>
<%
}
%>
<td width="100"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
<%
if( ValHelper.getInstance().isNotNullAndEmpty(deptid) )
{
%>
<tr>
<td>
<table border="1" cellpadding="0" cellspacing="0">
<%
if ( detaillist.isEmpty() )
{
%>
<tr>
<td colspan="3" class="txtHighlight">There is no resource assigned to this department currently.</td>
</tr>
<%
}
else
{
%>
<tr>
<td width="250" class="cellHeader">Resource Name</td>
<td width="150" class="cellHeader">Department Role</td>
<td width="150" class="cellHeader">Deleting ?</td>
<td width="150" class="cellHeader">Resource Status</td>
</tr>
<%
RsPosDetail rspDetail = new RsPosDetail();
int detailsize = detaillist.size();
rownum += detailsize;
Map<String,String> resourcemap = RsPosWebUtil.getInstance().getResourcemap(request);
for ( int i = 0; i < detailsize; i++ )
{
RsPosDetail detail = detaillist.get( i );
String rsposid = detail.getRsposid();
String resourceid = detail.getResourceid();
String resourcename = resourcemap.get( resourceid );
String deptroleid = detail.getDeptroleid();
String active = detail.getActive();
%>
<tr>
<td class="cell">
<input type="hidden" name="rspid<%= i %>" value="<%=rsposid%>">
<input type="hidden" name="rsid<%= i %>" value="<%= resourceid %>"> <%=resourcename%>
</td>
<td class="cellCenter">
<select class="cell" name="deptroleid<%= i %>" size = 1>
<%
int rolesize = deptrolelist.size();
for( int j=0;j<rolesize;j++)
{
DeptRole deptrole = deptrolelist.get(j);
if( deptroleid.equalsIgnoreCase( deptrole.getDeptroleid() ) )
{
%><option class="cell" selected value="<%=deptroleid%>"><%=deptrole.getDeptrole()%></option><%
}
else
{
%><option class="cell" value="<%=deptrole.getDeptroleid()%>"><%=deptrole.getDeptrole()%></option><%
}
}
%>
</select>
</td>
<td class="cellCenter">
<input class="cell" type="checkbox" name="deleting<%= i %>" disabled>
</td>
<td class="cellCenter">
<%= active.equals("T")?"Active":"Inactive"%>
</td>
</tr>
<%
}
}
if ( addedrows > 0 )
{
if ( detaillist.size() <= 0 )
{
%>
<tr>
<td width="250" class="cellHeader">Resource Name</td>
<td width="150" class="cellHeader">Department Role</td>
<td width="150" class="cellHeader">Deleting ?</td>
<td width="150" class="cellHeader">Resource Status</td>
</tr>
<%
}
for ( int i = detaillist.size(); i < ( detaillist.size() + addedrows ); i++ )
{
%>
<tr>
<td class="cell">
<input type="hidden" class="cell" name="rspid<%= i %>" value="">
<select class="cell" name="rsid<%= i %>" size = 1>
<option class="cell" value="">- - - - -</option>
<%
List<RsDropInfo> droplist = RsPosWebUtil.getInstance().getActiveResourceList(request);
int dropsize = droplist.size();
for( int j = 0; j < dropsize; j++ )
{
RsDropInfo dropinfo = droplist.get( j );
%><option class="cell" value="<%=dropinfo.getResourceid()%>"><%=dropinfo.getName()%></option><%
}
%>
</select>
</td>
<td class="cellCenter">
<select class="cell" name="deptroleid<%= i %>" size = 1>
<%
int rolesize = deptrolelist.size();
for( int j=0;j<rolesize;j++)
{
DeptRole deptrole = deptrolelist.get(j);
%><option class="cell" value="<%=deptrole.getDeptroleid()%>"><%=deptrole.getDeptrole()%></option><%
}
%>
</select>
</td>
<td class="cellCenter">
<input type="hidden" class="cell" name="deleting<%= i %>">
</td>
<td class="cellCenter"> </td>
</tr>
<%
}
}
%>
</table>
</td>
</tr>
<tr>
<td> <input type="hidden" class="cell" name="rownum" value="<%= rownum %>"></td>
</tr>
<%
if ( !detaillist.isEmpty() )
{
%>
<tr>
<td class="cell">
<input type="button" class="cell" value="Update" onclick="javascript:savecheck(this.form, 'updateResPos');">
<input type="reset" class="cell" value="Reset">
<input type="button" class="cell" value="Cancel" onclick="javascript:submitform(this.form, 'displayResPos');">
</td>
</tr>
<%
}else{
String action=(String)request.getParameter("action");
if(action.equals("addResPos")){
%>
<tr>
<td class="cell">
<input type="button" class="cell" value="Update" onclick="javascript:savecheck(this.form, 'updateResPos');">
<input type="reset" class="cell" value="Reset">
<input type="button" class="cell" value="Cancel" onclick="javascript:submitform(this.form, 'displayResPos');">
</td>
</tr>
<%
}}
%>
<tr>
<td> </td>
</tr>
<tr>
<td>
<hr width="750" size="1" noshade>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" align="left">
<tr>
<td width="250" class="txtLabel">Add Resources to Department</td>
<td width="150" class="txtHighlight">Number of Lines:</td>
<td width="80" class="cell">
<select class="cell" name="addlines" size="1">
<option class="cell" selected value="1">1</option>
<option class="cell" value="2">2</option>
<option class="cell" value="3">3</option>
</select>
</td>
<td width="357" class="cell"><input type="button" name="addact" value="Add" onclick="javascript:savecheck(this.form, 'addResPos' )"></td>
</tr>
</table>
</td>
</tr>
<%
}
%>
</table>
</form>
<%
out.print("\n<script language=\"javascript\">\n");
out.print("<!--\n");
out.print(" function validrespos(theform) \n");
out.print(" {\n");
if ( ( detaillist.size() + addedrows ) > 0 )
{
out.print(" if ( theform.rsid0.value == \"\"\n");
if ( addedrows > 0 )
{
for ( int i = detaillist.size(); i < ( detaillist.size() + addedrows ); i++ )
{
for ( int j = 0; j < detaillist.size(); j++ )
{
out.print(" || theform.rsid" + i + ".options[theform.rsid" + i + ".selectedIndex].value == theform.rsid" + j + ".value\n");
}
}
for ( int i = detaillist.size(); i < ( detaillist.size() + addedrows ); i++ )
{
for ( int j = ( i + 1 ); j < ( detaillist.size() + addedrows ); j++ )
{
out.print(" || theform.rsid" + i + ".options[theform.rsid" + i + ".selectedIndex].value == theform.rsid" + j + ".options[theform.rsid" + j + ".selectedIndex].value\n");
}
}
}
out.print(" ) {\n");
out.print(" alert(\"Duplicate Department/Resource. \");\n");
out.print(" return false;\n");
out.print(" }\n");
}
out.print(" return true;\n");
out.print(" }\n\n");
out.print("// -->\n");
out.print("</script>\n");
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -