<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
<%@ include file="common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="common/top.jsp"%>
<%-- <%@ include file="common/analysis.jsp"%> --%>
</head>
<body class="easyui-layout">
	<%@ include file="common/header.jsp"%>
	<%@ include file="menu.jsp"%>
	<div data-options="region:'center',title:'首页 - <a href=#>【学生报告】</a> - 历史比较'">
		<div class="easyui-layout" data-options="fit:true,border:false">
			<div data-options="region:'north',border:false" class="domain">
				<form class="form-inline" id="paraForm" name="paraForm" action="post" target="reportFrame">
						<input type="hidden" class="report-parameter" name="school_id" value="${school_id}"/>
						<input type="hidden" class="report-parameter" name="student_code" value="${student_code}"/>
						<input type="hidden" class="report-parameter" name="exam_id" value="${exam.id}"/>
						<%-- <%@ include file="common/report-button.jsp"%> --%>
				</form>
			</div>
			<div class="border" data-options="region:'center'">
				<iframe id="reportFrame" name="student/scoreHistory.cpt&op=view"
						width="100%" height="100%" frameBorder="0" scrolling="no"></iframe>
			</div>
		</div>
	</div>
<script type="text/javascript">
$(function(){
	var reportName = $('#reportFrame').attr('name');
	var parameter = '';
	$('.report-parameter').each(function(index, obj){
		var name = $(this).attr('name');
		var value = $(this).val();
		if(name!=undefined && name!=''){
			if(value==undefined || value.length==0){
				alert("请确认所有报表条件已选择！");
				parameter = '';
				return false;
			}else{
				parameter = parameter + "&" + name + "=" + value;
			}
		}
	});
	$('.report-parameter-optional').each(function(index, obj){
		var name = $(this).attr('name');
		var value = $(this).val();
		if(name!=undefined && name!=''){
			if(value!=undefined && value.length>0){
				parameter = parameter + "&" + name + "=" + value;
			}
		}
	});
	$('.warning').each(function(){
		$(this).show();
	});
	if(parameter.length>0){
		$('#reportButton').attr("disabled","disabled");
		var reportURL = cjkEncode("${properties['report.server']}/"+reportName+parameter);
		$('#reportFrame').attr('src',reportURL);
	}
	return false;
	$('.warning-close a').click(function(){
		$(this).parent().parent().hide();
	});
	$('#reportFrame').load(function(){
		$('#reportButton').removeAttr("disabled");
	})
})
function cjkEncode(text) {                                                                            
  if (text == null) {         
    return "";         
  }         
  var newText = "";         
  for (var i = 0; i < text.length; i++) {         
    var code = text.charCodeAt (i);          
    if (code >= 128 || code == 91 || code == 93) {  //91 is "[", 93 is "]".         
      newText += "[" + code.toString(16) + "]";         
    } else {         
      newText += text.charAt(i);         
    }         
  }         
  return newText;         
} 
</script>	
</body>
</html>
