104 lines
5.5 KiB
Plaintext
104 lines
5.5 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
|
|
<%@include file="/include/db/db_connect.jsp"%>
|
|
<%@include file="/include/function/function.jsp"%>
|
|
<%request.setCharacterEncoding("utf-8");%>
|
|
<%
|
|
|
|
String c_name = r_call(request.getParameter("c_name"));
|
|
String c_eng_name = r_call(request.getParameter("c_eng_name"));
|
|
String c_site_name = r_call(request.getParameter("c_site_name"));
|
|
String c_main_type = r_call(request.getParameter("c_main_type"));
|
|
String c_institute = r_call(request.getParameter("c_institute"));
|
|
String c_master = r_call(request.getParameter("c_master"));
|
|
String c_tel = r_call(request.getParameter("c_tel"));
|
|
String c_exp = r_call(request.getParameter("c_exp"));
|
|
|
|
String sql1=" SELECT c_no from tbl_field where c_eng_name = '" + c_eng_name + "' ";
|
|
ResultSet rst = stmt.executeQuery(sql1);
|
|
if(rst.next()) {
|
|
%>
|
|
<script>
|
|
alert("The same field name already exists.\nPlease change the field name..");
|
|
parent.document.bcb.c_eng_name.focus();
|
|
</script>
|
|
<%
|
|
|
|
}else{
|
|
String sql_ok = "";
|
|
sql_ok = "insert into tbl_field (c_relation, c_eng_name,c_name,c_site_name,c_institute,c_master,c_tel,c_exp,c_use,c_date,c_main_type) values(";
|
|
sql_ok = sql_ok + "0,'" + c_eng_name + "','" + c_name + "','" + c_site_name + "','" + c_institute + "','" + c_master + "','" + c_tel + "','" + c_exp + "',0,now(),"+ c_main_type +")";
|
|
stmt2.execute(sql_ok);
|
|
|
|
|
|
int max_c_no = 0;
|
|
String sql_ok2 = "select max(c_no) as max_c_no from tbl_field " ;
|
|
ResultSet rss = stmt.executeQuery(sql_ok2);
|
|
if(rss.next()){
|
|
max_c_no = rss.getInt("max_c_no");
|
|
}
|
|
rss.close();
|
|
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,0,1,1,1,0,'Program Apply','',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,0,2,1,1,0,'Education','',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,0,3,1,1,0,'BMC','',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,0,4,1,1,0,'Community','',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,0,5,1,1,0,'Board','',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
|
|
sql_ok2 = "select c_no,c_order from tbl_menu where c_home = " + max_c_no + " and c_maker = 1 order by c_order asc" ;
|
|
rss = stmt.executeQuery(sql_ok2);
|
|
while(rss.next()){
|
|
if(rss.getInt("c_order") == 1 ){
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",1,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Apply','apply',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",2,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Check Apply','apply_check',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
}
|
|
if(rss.getInt("c_order") == 2 ){
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",1,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Education','survey',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
}
|
|
if(rss.getInt("c_order") == 3 ){
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",1,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Connect','bmc',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
}
|
|
if(rss.getInt("c_order") == 4 ){
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",1,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Community','community',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
}
|
|
if(rss.getInt("c_order") == 5 ){
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",1,"+ max_c_no +","+ rss.getInt("c_no") +",2,'Notice','notice',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
sql_ok = "insert into tbl_menu (c_home,c_maker,c_up_no,c_order,c_relation,c_relation2,c_type,c_name,c_content,c_view,c_use,c_date,c_fix) values(";
|
|
sql_ok = sql_ok + max_c_no + ",1,"+ rss.getInt("c_no") +",2,"+ max_c_no +","+rss.getInt("c_no") +",2,'Data','board',0,0,now(),1)";
|
|
stmt.execute(sql_ok);
|
|
}
|
|
}
|
|
rss.close();
|
|
|
|
|
|
%>
|
|
<script>
|
|
alert("Insert OK");
|
|
parent.location.href="list.jsp"
|
|
</script>
|
|
<%
|
|
}
|
|
rst.close();
|
|
%>
|
|
<%@include file="/include/db/db_close.jsp"%> |