c-innovacion2/resoft/cms_for_bcb/process/board/edit.jsp

140 lines
5.7 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/include/include.jsp"%>
<%@include file="/include/head.jsp"%>
<%@include file="/cms_for_bcb/show_top.jsp"%>
<%
String nowPage = r_call(request.getParameter("nowPage"));
String c_no = r_call(request.getParameter("c_no"));
if(c_no.equals("")){
}else{
String sql1 = " select a.* ";
sql1 = sql1 + ", (select count(c_no) from tbl_board_to where c_board_no = a.c_no and c_group_type=0 and c_group_no = 0 ) as c1_no ";
sql1 = sql1 + ", (select count(c_no) from tbl_board_to where c_board_no = a.c_no and c_group_type=0 and c_group_no = 1 ) as c2_no ";
sql1 = sql1 + ", (select count(c_no) from tbl_board_to where c_board_no = a.c_no and c_group_type=0 and c_group_no = 2 ) as c3_no ";
sql1 = sql1 + ", (select count(c_no) from tbl_board_to where c_board_no = a.c_no and c_group_type=0 and c_group_no = 3 ) as c4_no ";
sql1 = sql1 + " from tbl_board a where a.c_no = " + c_no;
ResultSet rst = stmt.executeQuery(sql1);
if (rst.next()) {
if(rst.getString("c_member_no").equals(session.getAttribute("member_no") ) && !session.getAttribute("member_type").equals("0")){
%>
<script>
function go(){
if(document.bcb.c_title.value == ""){
alert("Insert Title.")
document.bcb.c_title.focus()
}else if(document.bcb.c_content.value == ""){
alert("Insert Content.")
document.bcb.c_content.focus()
}else{
document.bcb.method = "post"
document.bcb.target = "exec"
document.bcb.action = "edit_ok.jsp?<%=para_t%>"
document.bcb.submit()
}
}
function check_check(){
if(document.bcb.c_type_0.checked == true){
for(i = 0; i < document.bcb.c_team.length; i = i +1){
document.bcb.c_team[i].checked = true;
}
}else{
for(i = 0; i < document.bcb.c_team.length; i = i +1){
document.bcb.c_team[i].checked = false;
}
}
}
function check_check2(){
check_no = 0
for(i = 0; i < document.bcb.c_team.length; i = i +1){
if(document.bcb.c_team[i].checked == false){
check_no = 1
}
}
if(check_no == 0){
document.bcb.c_type_0.checked = true
}else{
document.bcb.c_type_0.checked = false
}
}
</script>
<form name="bcb" encType="multipart/form-data">
<input name="c_no" value="<%=c_no%>" type="hidden">
<div class="row">
<div class="col-lg-12 col-md-12" style=" padding:0px 15px;">
<div class="col-lg-12 col-md-12" style="border-bottom: 1px solid #ccc; padding:10px ">
<input name="c_title" value="<%=rst.getString("c_title")%>" style="width:100%;height:30px" placeholder="Insert Title.">
</div>
<div class="col-lg-12 col-md-12" style="border-bottom: 1px solid #ccc; padding:10px ">
<div class="col-lg-4 col-md-4" >
Name. <%=rst.getString("c_name")%></b>
</div>
</div>
<div class="col-lg-12 col-md-12" style="border-bottom: 1px solid #ccc; padding:10px ">
<div class="col-lg-3 col-md-6" >
<b>To.</b><br>
<input name="c_type_0" value="y" type="checkbox" <%if(rst.getInt("c1_no") > 0){%>checked<%}%> onclick="check_check()"> All Members of Teams<br />
<input name="c_type_1" value="y" type="checkbox" <%if(rst.getInt("c2_no") > 0){%>checked<%}%>> All Instructors <br />
<input name="c_type_2" value="y" type="checkbox" <%if(rst.getInt("c3_no") > 0){%>checked<%}%>> All Mentors <br />
<input name="c_type_3" value="y" type="checkbox" checked onclick="return false" > All Observers <br />
</div>
<div class="col-lg-9 col-md-6" >
&nbsp;<br>
<%String sql2 = " select a.c_no, c_team_name ";
sql2 = sql2 + ", (select count(c_no) from tbl_board_to where c_board_no = " + c_no +" and c_group_type= 1 and c_group_no = a.c_no ) as b_count";
sql2 = sql2 + " from tbl_team a where a.c_use = 0 and a.c_project_no = " + session.getAttribute("member_project_no") + " order by a.c_team_name asc";
ResultSet rst2 = stmt.executeQuery(sql2);
while (rst2.next()) {
%>
<nobr><input name="c_team" value="<%=rst2.getInt("c_no")%>" <%if(rst2.getInt("b_count") > 0 ){%>checked<%}%> type="checkbox" onclick="check_check2()"> Members in team [<%=rst2.getString("c_team_name")%>] &nbsp;&nbsp;</nobr>
<%}
rst2.close();
%>
</div>
</div>
<div class="col-lg-12 col-md-12" style="min-height:100px;border-bottom: 1px solid #ccc; padding:10px ">
<textarea name="c_content" style="width:100%;height:200px"><%=rst.getString("c_content")%></textarea>
</div>
<div class="col-lg-12 col-md-12" style="border-bottom: 1px solid #ccc; padding:10px ">
File. <%=rst.getString("c_file")%>
<input name="o_file_name" value="<%=rst.getString("c_file")%>" type="hidden">
<%if(!rst.getString("c_file").equals("")){%>
&nbsp;&nbsp;<input name="o_file" value="y" type="checkbox">del</b>
<%}%>
<br>
<input name="c_file" type="file" style="width:100%;height:30px" placeholder="Choose file.">
</div>
</div>
</div>
<div class="col-lg-12 col-md-12" style="text-align:center;padding-top:20px">
<%if(rst.getString("c_member_no").equals(session.getAttribute("member_no") ) && !session.getAttribute("member_type").equals("0")){%>
<a href="#none" onclick="go()" style="width: 80px; line-height: 26px; text-align: center;display: inline-block; background: #5e7cc4; border: 1px solid #555; border-radius: 5px; color: #ffffff;">Edit</a>
<%}%>
<a href="view.jsp?<%=para_t%>&c_no=<%=c_no%>" style="width: 80px; line-height: 26px; text-align: center;display: inline-block; background: #989898; border: 1px solid #555; border-radius: 5px; color: #ffffff;">View</a>
</div>
</form>
<%
}else{
%>
<script>
alert("You have no permission.")
location.href="/"
</script>
<%
}
}
rst.close();
}
%>
<%@include file="/cms_for_bcb/show_bottom.jsp"%>
<%@include file="/include/bottom.jsp"%>
<%@include file="/include/include_b.jsp"%>