<%@include file="include/header.jsp"%>
<%!
//-----------------------------------------------
void update(CommonBypassDao dao){
	if(demoFlag){
		errList.add("Not allowed on demo site.");
		return;
	}

	CommonBypassData data = new CommonBypassData();
	data.bypassFilter = paramBoolean("bypassFilter");
	data.domain = paramString("domain");

	if(dao.update(data)){
		succList.add("Data updated.");
	}
}
%>
<%
//-----------------------------------------------
// Set permission for this page.
permission.addAdmin();

//Check permission.
if(!checkPermission()){
	return;
}

// Create data access object.
CommonBypassDao dao = new CommonBypassDao();

// Action.
String actionFlag = paramString("actionFlag");
if(actionFlag.equals("update")){
	update(dao);
}

// Global.
CommonBypassData data = dao.selectOne();
%>
<%@include file="include/action_info.jsp"%>

<!-- view -->
<form action="<%= getPageName()%>" method="post">
<input type="hidden" name="actionFlag" value="update">

<fieldset>
	<legend>COMMON BYPASS</legend>
<table class="view">

	<tr>
		<td width="200" valign="top">
			Domain
			<i class="fa fa-question-circle south-east" title="Adding globally bypassed domains. You can add
				<br>your whitelisted domains en masse here."></i>
		</td>
		<td>
			<textarea name="domain" cols="80" rows="36"><%= data.domain%></textarea>
		</td>
	</tr>

	<tr>
		<td>Bypass Filtering</td>
		<td>
		<input type="checkbox" class="no-border" name="bypassFilter"
			<%if(data.bypassFilter){out.print("checked");}%>>
	</tr>

	<tr>
		<td></td>
		<td>
			<input type="button" value="SUBMIT" onclick="javascript:this.form.submit();">
			<input type="button" value="RESET" onclick="javascript:this.form.reset();">
		</td>
	</tr>

</table>
</fieldset>
</form>
<!-- /view -->

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