<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.*,com.csc.library.session.*"%>
<jsp:useBean id="task" class="com.csc.library.system.Task" scope="session" />
<jsp:useBean id="task1" class="com.csc.library.system.Task" scope="session" />
<jsp:useBean id="task2" class="com.csc.library.system.Task" scope="session" />
<%
	task.setChannel(request, response);
	UIManager screen = (UIManager) task.process("SingleEntry", "WB_USER_SCORE");
	
	DbInquiry score=new InitialInquiry(screen.getUProfile()).getDbInquiry();
	score.initMyTable("wb_user_score","topic_id='"+request.getParameter("topic_id")+"' and user_id='"+request.getParameter("user_id")+"'", "");
	score.setColumn("*");
	score.refresh();	
	String name="";
	String group="";
	String topicName="";
	String code="0";
	if(score.next()){
		 code=score.getString("score_code");	 
		 screen.getRecord().set("score_code",code);
		 screen.getRecord().set("score",score.getString("score"));
	}else{
		screen.getRecord().set("score_code",code);
	}	
	
	if(request.getParameter("topic_id")!=null){
		screen.getRecord().set("topic_id",request.getParameter("topic_id"));
		screen.getRecord().set("user_id",request.getParameter("user_id"));
	}

%>

<% 

	DbInquiry topicTitle=new InitialInquiry(screen.getUProfile()).getDbInquiry();
	topicTitle.initMyTable("wb_topic","topic_id='"+request.getParameter("topic_id")+"'", "");
	topicTitle.setColumn("*");
	topicTitle.refresh();	
	
	if(topicTitle.next()){
		topicName=topicTitle.getString("title");
	}
%>
<%

	DbInquiry userName=new InitialInquiry(screen.getUProfile()).getDbInquiry();
	userName.initMyTable("wb_user","user_id='"+request.getParameter("user_id")+"'", "");
	userName.setColumn("*");
	userName.refresh();
	
	if(userName.next()){
		name=userName.getString("user_name");
		group=userName.getCurrentDbRecord().getSystemCode("user_group");
	}

	

%>
<script language="JavaScript" src="../../JS/SCREEN.js"></script>
<script type='text/javascript' src='../../JS/ICONSMENU.js'></script>
<script language="JavaScript" src="../../JS/VIEWCALENDAR.js"></script>
<script language="JavaScript">setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script language="javascript">getTitleName();</script>
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script>

function GoSave(){
confirmSave();

}
function GoUpdate(){
update();

}

</script>

<form name="cscform" method="post" action="stat_score.jsp">


<!----------BEGIN CSC INITIAL ZONE ------------------------>

<%=screen.InitialVariable()%>

<!----------END CSC INITIAL ZONE -------------------------->

<input  type="hidden" name="__cmd"  value=""> 

<input type="hidden" name="__screen" value="stat_score"> 
<input type="hidden" name="score_code" value="<%=request.getParameter("score_code") %>">

<input  type="hidden" name="__help" value=""> 
<input type="hidden" name="__fixCon" value="">
<input type="hidden" name="acc" value="<%=request.getParameter("acc") %>">
<input type="hidden" name="__companyid" value="<%=screen.getUProfile().get("companyid")%>"> 
<input type="hidden" name="__notNull" value="<%=screen.getRequire()%>">
<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>">
<input type="hidden" name="__score_code" value="<%=screen.getDataLabel("score_code") %>">
<input type="hidden" name="__topic_id" value="<%=screen.getDataLabel("topic_id") %>">
<input type="hidden" name="__user_id" value="<%=screen.getDataLabel("user_id") %>">

<input type="hidden" name="topic_id" value="<%=request.getParameter("topic_id") %>">
<input type="hidden" name="user_id" value="<%=request.getParameter("user_id") %>">

<input type="hidden" name="__calendar" value="">
<script language="javascript">getInputFormatDate();</script>
<script language="JavaScript" src="../../JS/HOTKEY.js"></script>


<title>myHR Forums-Administrator</title>
<style type="text/css">
<!--
body {
	background-color: #E9EAEC;
	margin-left: 0px;
	margin-top: 0px;
	background-repeat: repeat-y;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style8 {font-weight: bold}
-->
</style>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#4F5D6F">
  <tr>
    <td width="100%" class="maintitle"><div align="left">ให้คะแนน</div></td>
  </tr>
  <tr>
    <td class="subtitle">&nbsp;</td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" class="td04" >
      <tr>
        <td class="td02"><strong>หัวข้อ :</strong> <a href="../topicdetail.jsp?__fixCon=topic_id='<%=request.getParameter("topic_id") %>'" target="_blank"><%=topicName %></a></td>
      </tr>
      <tr >
        <td class="td02"><p><strong>ผู้ใช้งาน :</strong> <%=name%> ,<span class="style8"> <%=group %></span></p></td>
      </tr>
     
      <tr >
        <td class="td02"><strong>ให้คะแนน :</strong> 
          <%=screen.getInput("score") %> 
          คะแนน</td>
      </tr>
      <tr>
        <td class="td07"><div align="right">
        
        <%if(code.equals("0")){ %>
        	<a href="javascript:GoSave()">
        <%}else{ %>
        	<a href="javascript:GoUpdate()">
        <%} %>
        
        <img src="images/save.gif" border="0" width="60" height="22" /></a>
        
        
        </div></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
<br />
<!----------BEGIN CSC ENDING ZONE ------------------------>

<%=screen.endJSP()%>

<!----------END CSC ENDING ZONE -------------------------->
</form>