<html>
<head>
<META http-equiv=Content-Language content=zh-cn>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<link href="../CSS/Base.css" rel="stylesheet" type="text/css"/>
<link href="../CSS/Common.css" rel="stylesheet" type="text/css"/>
<link href="../CSS/SurveyList.css" rel="stylesheet" type="text/css"/>
<LINK href="../CSS/Window.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="../JS/Common.js.php"></script>
<script type="text/javascript" src="../JS/Window.js.php"></script>
<style>
  td { padding:2px 5px 2px 5px;}
 </style>
<script type="text/javascript" src="../JS/Browser.js.php"></script>
<script type="text/javascript" src="../JS/Jquery.min.js.php"></script>
<script type="text/javascript" src="../JS/Jquery.notification.js.php"></script>
<link type="text/css" rel="stylesheet" href="../CSS/Notification.css" />
<script>
function refreshParent() {
   //self.location.replace(self.location.href);
   self.location.href = '{defineURL}';
}
function checkall(form) 
{
	if( form.all.checked)
	{
		if( form.defineID.length == null )
		{
			if( !form.defineID.disabled) form.defineID.checked = true;
		}
		else
		{
			for(var i = 0;i <= form.defineID.length-1; i++) 
			{
				var e = form.defineID[i];
				if( ! e.disabled )	e.checked = true;
			}
		}
	}
	else
	{
		if( form.defineID.length == null )
		{
			if( !form.defineID.disabled) form.defineID.checked = false;
		}
		else
		{
			for(var i = 0;i <= form.defineID.length-1; i++) 
			{
				var e = form.defineID[i];
				if( ! e.disabled )	e.checked = false;
			}
		}
    }
}
function getRadioCheckBoxValue(objField)
{
	if( objField.length == null )
	{
		if(objField.checked) return objField.value;
	}
	else
	{
		var theSelectedValue = '';
		for( i=0;i<objField.length;i++){
			if (objField[i].checked)  theSelectedValue += objField[i].value + ',';
		}
		return theSelectedValue.substr(0,theSelectedValue.length-1);
	}
}

function copycode(obj) {
        
    var theSwfObject = obj.getElementsByTagName("object");
    for (var i=theSwfObject.length; i>=0; i--)
    {
		if( theSwfObject[i] != null )
		{
			theSwfObject[i].removeNode(true);
		}
	}
	var rng = document.body.createTextRange();
    rng.moveToElementText(obj);
    rng.scrollIntoView();
    rng.select();
    rng.execCommand("Copy");
    rng.collapse(false);
	$.notification("复制分析结果到剪贴板成功");
}
function ajax_Submit(url,postStr) {
	var ajax=false; 
	try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
	if (!ajax && typeof XMLHttpRequest!='undefined') ajax = new XMLHttpRequest(); 

	ajax.open("POST", url, true); 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	ajax.send(postStr);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4)
		{
			if(ajax.status == 200)
			{
				var theRtnText = ajax.responseText;
				document.getElementById("dataAnalysisMapTable").style.display = '';
				document.getElementById("dataAnalysisCopyAction").style.display = '';
				document.getElementById("dataAnalysisMap").innerHTML = theRtnText;
				adjustMenuWarpSize();
				parent.document.getElementById("the_content_iframe").contentWindow.document.body.style.overflowX='auto';
			}
			else
			{
				$.notification('网络传输问题');
			}
		}	
	} 
}

function DataAnalysisSubmit()
{
	//得到defineID的值
	var objField = document.form.defineID;
	var theDefineIDValue = '';
	if( typeof objField != 'undefined' )
	{
		if( objField.length == null )
		{
			if (objField.checked)  theDefineIDValue += objField.value + ',';
		}
		else
		{		
			for( k=0;k<objField.length;k++){
				if (objField[k].checked)  theDefineIDValue += objField[k].value + ',';
			}
		}
		theDefineIDValue = theDefineIDValue.substr(0,theDefineIDValue.length-1);
	}
	var surveyID = document.getElementById('surveyID').value;
	var ParamString = "Action=DataAnalysisSubmit";
	ParamString += "&defineID="+theDefineIDValue;
	ParamString += "&surveyID="+surveyID;
	ParamString += "&dataSource=" + getRadioCheckBoxValue(document.form.dataSource);
	document.getElementById("dataAnalysisMapTable").style.display = '';
	document.getElementById("dataAnalysisMap").innerHTML = "<div id=\"preloading\" style=\"background-color:#f0f0f0;width:160px;overflow:hidden;white-space:nowrap;color:black;font-weight:bold;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;-khtml-border-bottom-right-radius:5px;border-bottom-right-radius:5px;\">&nbsp;<img src=\"..\/Images\/wait.gif\" width=\"16px\" height=\"16px\">&nbsp;正在加载数据分析&nbsp;<\/div>";
	ajax_Submit('DefineReport.php',ParamString);
}
</script>
<body oncontextmenu="return false" style="background-color:#244d8f;" onload="javascript:AjaxShowDataSource({surveyID},1);">

<div style="line-height:10px">&nbsp;</div>
<div id="menu">
  <span style="float:left;padding-left:26px;"><div class="navmenu">数据报告中心 &raquo; 自定义报告</div></span>
  <span style="float:right">
  <ul><li><a href="../System/ShowMain.php">我的问卷</a></li>
      <li><a href="../Analytics/DataOverview.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">标准报告</a>
      <li class="current"><a href="../Analytics/DefineReport.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">自定义报告</a></li>
      <li><a href="../Analytics/DataList.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">回复数据</a></li>
      <li><a href="../Analytics/EventAward.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">调查奖励</a></li>
      <li><a href="../Analytics/PanelArea.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">样本来源</a></li>
      <li><a href="../Analytics/TaskResult.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">计划任务</a></li>
      <li><a href="../Analytics/SurveyIndexResult.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">指标分析</a></li>
	  </ul></span>
</div>
<div class="wrap q_clear" id=wrap>
<div>
<form name="form" id="form" method="post" action="">
<div class=content>
<div class=q_clear id=mysurvey><h1>[<font color=red>{surveyTitle}</font>] 自由组装数据分析报告</h1>
<p class=surveynum>[ <span class=red>{recNum}</span> 组定义 ]</p>&nbsp;
<input class=inputsubmit name="createNew" type="button" id="createNew" value="新增定义" onclick="javascript:showPopWin('{newDefineURL}', 800, 460, refreshParent, null,'新增数据分析报告组装定义')"><br/></div>
<div id=myname><span class=red>*</span> 以频数频率分析、交叉数据分析与均值分析为原件，可自由组装所需要的数据分析报告</div>
<a name="top" href="javascript:void(0);"></a>

 <div class="datalist">  
 <script src="../JS/AjaxDataSource.js.php"></script>
 <script>
 function refreshDataSource(){
	AjaxShowDataSource({surveyID},1);
 }
 </script>
<div id="dataSourceTable"><div id="dataloading" style="background-color:#f0f0f0;width:160px;overflow:hidden;white-space:nowrap;color:black;font-weight:bold;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;-khtml-border-bottom-right-radius:5px;border-bottom-right-radius:5px;">&nbsp;<img src="../Images/wait.gif" width="16px" height="16px">&nbsp;正在加载数据源...&nbsp;</div></div>

  <table class=datatable id="datatable" style="border-bottom:0px" cellspacing=0 cellpadding=0>
   <tr class=coltitle>
	  <td width=3% noWrap>&nbsp;</td>
	  <td width=3% noWrap><b>序号</b></td>
      <td width=89%>&nbsp;<B>报告类型</B></td>
      <td width=8% noWrap align=center><b>操 作</b> </td>
   </tr>
   <!-- BEGIN LIST -->
   <tr height=25 onmouseover="this.style.backgroundColor='#deefff'" onmouseout="this.style.backgroundColor='#ffffff'">
      <td align=center valign=center><input name="defineID[]" type="checkbox" id="defineID" value="{defineID}" {deleteDisabled}></td>
	  <td noWrap><b>{orderNum}</b></td>
      <td valign=top>{reportName}</td>
      <td noWrap align=center valign=center>&nbsp;<A href="{deleteURL}" onclick="return window.confirm('您真的想删除该条数据分析报告组装定义吗？本操作不可恢复！')" style="display:{haveDelete}">删除</A>
	  </td>
   </tr>
   <tr>
     <td bgcolor="#f5fafe" colspan=2>&nbsp;</td>
     <td colspan=2 align=left bgcolor="#f5fafe" height=25>{defineList}</td>
   </tr>
   <!-- END LIST -->
</table>
<table width=100% style="border:0px;margin:0px;padding:0px;">
    <tr>
	  <td width=3% style="border:0px;margin:0px;padding:0px;" align=center><input name="all" type="checkbox" id="all" value="all" onclick="checkall(this.form)" style="background-color:#ffffff"></td>
	  <td style="border:0px;margin:0px;padding:0px;">
	  <span style="float:left"><input name="DeleteDefineSubmit" class=inputsubmit type="submit" id="DeleteDefineSubmit" value="删除定义" onclick="return window.confirm('您真的想删除当前选中的数据分析报告组装定义吗？本操作不可恢复！')"> <input class=inputsubmit name="submit" type="button" id="submit" value="开始分析" onclick="javascript:DataAnalysisSubmit();"></span>
	  <span style="float:right">&nbsp;<a name="footer" href="#top"><img src="../Images/top.gif" align="middle" alt="TOP"></a></span>	
	</td></tr>
</table>

</div>

<table id="dataAnalysisCopyAction" width=100% style="LINE-HEIGHT: 150%;border-collapse:collapse;display:none;margin-top:10px;" cellSpacing=0 cellPadding=0 borderColor=#b5cfd9 border=0>
  <tr><td align=right bgcolor="#eeeeee" style="border:1px #b5cfd9 solid;border-bottom:0px;height:30px;"><a href="javascript:void(0)" onclick="copycode(document.getElementById('dataAnalysisMap'));"><font color="#444444">复制分析结果到剪贴板</font></a><img src="../Images/list_menu_arrow.gif" border=0>&nbsp;&nbsp;</td></tr></table>

<table id="dataAnalysisMapTable" style="LINE-HEIGHT: 150%;border-collapse:collapse;display:none;" cellSpacing=0 cellPadding=0 width="100%" borderColor=#b5cfd9 border=1>
   <tr><td id="dataAnalysisMapInner" align=left style="padding-top:5px;padding-bottom:5px"><div id="dataAnalysisMap" style="padding:15px"></div></td></tr>
 </table>

</div></div></div>
<input name="surveyID" type="hidden" id="surveyID" value="{surveyID}"> 
</form>
</body></html>
