<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String systemColor = System.getProperty("theme.color");
	String range = (String)request.getParameter("range");
	String color = (String)request.getParameter("color");
	String change = (String)request.getParameter("change");
	if(color == null || color.length() == 0) color= systemColor;
	
	if("all".equals(range)) {
		System.setProperty("theme.color", color);
	}
%>
 <c:set var="themeColor" value="<%= color %>" scope="session" />
<html>
	<head>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
		<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<META HTTP-EQUIV="Cache-control" CONTENT="no-cache">
		<title>Change Theme Color</title>		
		<link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/web_ui.css"/>"/>
	<link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/theme_${themeColor}.css"/>" />
	<script language="javascript" src="<c:url value="/js/jquery-1.12.1.min.js"/>"></script>
	<script language="javascript" src="<c:url value="/js/prefixfree.min.js"/>"></script> 	
<script language="JavaScript">
<% if( "change".equals(change) ) { %>
// window.opener.location.reload();
	alert("color changed !");
<% } %>
</script>
	</head>
	<body>
	<table width="100%" height="100%" >
	<tr>
	<td valign="middle" width="100%">
	<form name="form" action="<c:url value="/color.jsp"/>" method="get">
	<table width="200px" align="center" cellspacing="0" border="0" cellpadding="0">
		<tr>
			<td>Theme Color</td>
			<td align="center" valign="middle"  height="25px">
			  <select name="color">
			  	<option value="black" <%= "black".equals(color)?"selected":"" %> >black</option>
			  	<option value="blue" <%= "blue".equals(color)?"selected":"" %> >blue</option>
			  	<option value="green" <%= "green".equals(color)?"selected":"" %> >green</option>
			  	<option value="orange" <%= "orange".equals(color)?"selected":"" %> >orange</option>
			  	<option value="yellow" <%= "yellow".equals(color)?"selected":"" %> >yellow</option>
			  </select>			  
		  </td>
		  </tr>
		  <tr>
			<td>Range</td>
			<td align="center" valign="middle"  height="25px">
			  <select name="range">
			  	<option value="current" <%= "current".equals(range)?"selected":"" %> >current</option>
			  	<option value="all" <%= "all".equals(range)?"selected":"" %> >all</option>			  				  	
			  </select>			  
		  </td>
		  </tr>
		  <tr><td colspan="2" ><hr width="200"/></td>
		  </tr>
		  <tr>
		  <td colspan="2" align="center" height="25px">
		  	<input type="submit" name="change"  value="change">
		  </td>		  
		</tr>
	</table>
	</form>
	</td></tr></table>
	</body>
</html>

