<%@ page contentType="text/html;charset=GBK" %>

<%
/**
 *	$RCSfile: editRewards.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:11 $
 */
%>

<%@ page import="java.util.*,
				 java.text.*,
                 java.sql.*,
				 com.jivesoftware.util.*,
                 com.jivesoftware.forum.*,
				 com.jivesoftware.forum.database.*,
				 com.jivesoftware.forum.util.*"
    errorPage="error.jsp"
%>

<%@ include file="global.jsp" %>

<%	// get parameters
	int maxPoints = ParamUtils.getIntParameter(request,"maxPoints",-1);
    boolean setProp = ParamUtils.getBooleanParameter(request,"setProp");

    RewardManager rewardManager = forumFactory.getRewardManager();

    boolean errors = false;
    String errorMessage = "";
    if (setProp) {
        if (maxPoints > -1) {
            rewardManager.setMaxPoints(maxPoints);
            response.sendRedirect("editRewards.jsp");
            return;
        }
        else {
            errors = true;
            errorMessage = "请输入一个大于0的合法数字。";
        }
    }
%>

<%@ include file="header.jsp" %>

<p>

<%  // Title of this page and breadcrumbs
    String title = "设定点数";
    String[][] breadcrumbs = {
        {"主页面", "main.jsp"},
        {title, "editRewards.jsp"}
    };
%>
<%@ include file="title.jsp" %>

<font size="-1">
设置每个主题可分配的最大点数。
</font>

<p>

<%  if (errors) { %>
    <font size="-1"><i><%= errorMessage %></i></font>
    <p>
<%  } %>

<form action="editRewards.jsp">
<input type="hidden" name="setProp" value="true">
<%  int numMaxPoints = rewardManager.getMaxPoints(); %>
<font size="-1">
<%  if (numMaxPoints == Integer.MAX_VALUE) { %>
(没有设置)
<%  } else { %>
(当前值为 <b><%= rewardManager.getMaxPoints() %></b>.)
<%  } %>
<ul>
    <input type="text" size="5" name="maxPoints"
<%  if (numMaxPoints == Integer.MAX_VALUE) { %>
    value="">
<%  } else { %>
    value="<%= rewardManager.getMaxPoints() %>">
<%  } %>

    <input type="submit" value="设置">
</uL>
</font>
</form>

<%@ include file="footer.jsp" %>