Current File : //home/obabain/anms_obaba_in/MenuCreation.jsp |
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page language="java" import="javax.sql.*"%>
<%@ include file="Connection.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form method="post">
<%@include file="master.jsp" %>
<div class="content">
<div class="row">
<div class="col-md-9">
<div class="panel panel-success">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Menu Creation</h3>
</div>
<table class="table" style="width:50%;background-color:white;">
<tr>
<td>
Menu Name</td>
<td>
<input type="text" name="mname" class="form-control">
</td>
</tr>
<tr>
<td>
Menu Parent</td>
<td>
<select name="mparent" class="form-control">
<option value="0">--Select--</option>
<%
Statement stmt=con.createStatement();
ResultSet r=stmt.executeQuery("select * from ip_menu_creation where menu_parent_id=0 ");
while(r.next())
{
%>
<option value="<%=r.getString("id") %>"><%=r.getString("menu_name") %></option>
<%} %>
</select>
</td>
</tr>
<tr>
<td>
Status</td>
<td>
<select name="status" class="form-control"><option value="0">Active</option>
<option value="1">Inactive</option>
</select>
</td>
</tr>
<tr>
<td>
Redirection</td>
<td>
<input type="text" name="redirect" class="form-control">
</td>
</tr>
<tr>
<td>
Sort Order</td>
<td>
<input type="text" name="sorder" class="form-control">
</td>
</tr>
<tr>
<td>
<input type="submit" name="save" class="btn btn-success">
</td>
</tr>
</table>
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-9" style="background-color:white;padding-top:10px; margin:0px 0px 0px 25px; width:73%;">
<div class="col-md-12">
<input class="form-control" type="text" placeholder="Filters users..." name="filter">
</div>
<table class="table">
<thead>
<tr>
<th></th>
<th>Menu Name</th>
<th>Menu Parent</th>
<th>SortOrder</th>
<th>Redirection</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<%
ResultSet rsm=null;
Statement stm=con.createStatement();
String filt=request.getParameter("filter");
if(filt==null)
{
rsm=stm.executeQuery("SELECT tb.*,(case when tb.status=0 then 'img/bullet_ball_glass_green.png' else 'img/orange.png' end)img FROM ip_menu_creation tb");
}
else
{
rsm=stm.executeQuery("select tb.*,(case when tb.status=0 then 'img/bullet_ball_glass_green.png' else 'img/orange.png' end)img from ip_menu_creation tb where menu_name like '"+filt+"%' ");
}
while(rsm.next())
{
%>
<tr>
<td><%=rsm.getString("id") %></td>
<td><%=rsm.getString("menu_name") %></td>
<td><%=rsm.getString("menu_parent_id") %></td>
<td><%=rsm.getString("sortorder") %></td>
<td><%=rsm.getString("redirection_page") %></td>
<td>
<img src="<%=rsm.getString("img") %>"></img>
</td>
<td><a href="editmenu.jsp?Id=<%=rsm.getString("id") %>"><span class="glyphicon glyphicon-pencil"></span></a></td>
</tr>
<%} %>
</tbody>
</table>
</div>
<%
try{
String mname=request.getParameter("mname");
String parent=request.getParameter("mparent");
String status=request.getParameter("status");
String redir=request.getParameter("redirect");
String order=request.getParameter("sorder");
if(mname.length()!=0 || mname!=null)
{
int i=stmt.executeUpdate("insert into ip_menu_creation values(0,'"+mname+"',"+parent+",'"+redir+"',"+status+","+order+",1)");
response.sendRedirect("MenuCreation.jsp");
}
}
catch(Exception el){}
%>
</div>
</div>
<%@include file="footer.jsp" %>
</form>
</body>
</html>