%@page contentType="text/html;charset=UTF-8" %>
<%@page import="java.util.*"%>
<%@page import="java.io.File"%>
<%@page import="jcms.sys.SysInfo"%>
<%@page import="jcms.blf.module.voting.Jcms_Voting_KindBLF" %>
<%@page import="com.hanweb.common.util.Convert" %>
<%@page import="jcms.blf.module.voting.Jcms_Voting_AnswerBLF"%>
<%@page import="jcms.util.AccessUtil"%>
<%@page import="jcms.entity.module.Jcms_Voting_KindEntity"%>
<%@page import="jcms.extramodule.comment.VotingFun" %>
<%@ include file="./config.jsp" %>
<%
if(!AccessUtil.checkAccess(request)){ //阻止跨站点请求伪造
out.print(Convert.getAlterScript("location.href='../../';"));
return;
}
/* CSRF防御 */
String crumb = UUID.randomUUID().toString();
session.setAttribute("crumb", crumb);
int tempWebId = Convert.getParameterInt(request,"webid",0);
if(tempWebId > 0)
strWebID = ""+tempWebId;
String strPath = VotingFun.getPath(application.getRealPath(""), strAppID,strWebID);
// 得到调查类别的ID
int kindid = Convert.getParameterInt(request, "classid", 0);
// 问题ID
int queId = Convert.getParameterInt(request, "queid", 0);
int nScope = 0;
// 是否带答案显示 1=显示;0=不显示
int isAnswer = Convert.getParameterInt(request, "answer", 0);
//调用方式:是嵌入在单元中显示 yes;通过URL直接调用 no
String strInlay = Convert.getParameter(request,"inlay","yes",true,true);
boolean blModal = true;
if(isAnswer == 1)
blModal = false;
String strUnitPath = "";
if(kindid > 0)
strUnitPath = strPath + "config" + File.separator + "init"+kindid+".xml";
else
strUnitPath = strPath + "config" + File.separator + "init.xml";
String strConfigPath = strPath + "config" + File.separator + "config.xml";
String strwebtype = xmlFile.getContent( "webtype", strConfigPath );
strwebtype = Convert.getValue(strwebtype);
String strWebServerName = xmlFile.getContent( "web_in_servername", strConfigPath );
strWebServerName = Convert.getValue(strWebServerName);
Jcms_Voting_KindBLF vBLF = new Jcms_Voting_KindBLF(strAppID, strWebID);
Jcms_Voting_KindEntity vkEn = vBLF.getEntity(kindid);
if(vkEn == null)
return;
int b_showresult = vkEn.getB_showresult();
// 0 a.vc_question, 1 a.i_type, 2 b.vc_name, 3 a.i_id, 4 a.b_feedback,
// 5 b.i_timescope, 6 b.vc_sparefield, 7 a.i_sparefield1, 8 b.i_type, 9 b.c_endtime
String[][] strData = vBLF.getUnitData(kindid,-1);
if( strData == null || strData.length == 0 ){
SysInfo sys = new SysInfo();
out.println(sys.getAlert(request,"查询记录为空,请检查问题是否已创建!"));
return;
}
if( Convert.getValue(strData[0][8]).equals("1") )
{
nScope = VotingFun.getScope( Convert.getValue(strData[0][9]));
}
//系统路径
String strSysPath = "/";
if(strwebtype.equals("1")){
strSysPath = request.getContextPath() + "/jcms_files/jcms"+strAppID+"/web"+strWebID+"/site/";
}
if(strwebtype.equals("2")){
strSysPath = "/";
}
String strForTr = "";
String strHead = "";
String strEnd = "";
String strContent = "";
String strAnswer = "";
String strHidden = "";
String strTextHight = "";
String strTextWidth = "";
String strCols = "";
String strScript = "";
String strDepiction = "";
String strRandomCode = "";//随机码的html代码
StringBuffer scriptBuf = new StringBuffer();
int nColumns = 1;
String strDisplay = nScope==1?"none":"";
String strDisplayView = b_showresult==1?"":"none";
strHidden += "";
strHidden += "";
StringBuffer sbContent = new StringBuffer( 256 );
Vector v_label = new Vector(5);
v_label.add( "");
v_label.add( "" );
v_label.add( "");
v_label.add( "" );
v_label.add( "");
Vector v_label_value = new Vector(5);
strScript = xmlFile.getContent( "scriptcode",strUnitPath );
strTextHight = xmlFile.getContent( "texthight", strUnitPath );
strTextWidth = xmlFile.getContent( "textwidth", strUnitPath );
String strqyHeight = xmlFile.getContent( "qyheight", strUnitPath );
String strqyWidth = xmlFile.getContent( "qywidth", strUnitPath );
strScript = strScript.replaceAll("",""+kindid);
strScript = strScript.replaceAll("",""+queId);
strCols = xmlFile.getContent("column", strUnitPath);
strCols = Convert.getValue(strCols);
int nCols = Convert.getStringValueInt(strCols,1);
int nStart = strScript.indexOf( "" );
int nEnd = strScript.indexOf( "" );
String strBgColor = "";
int nRadom = (int)Math.ceil(Math.random()*100);
if( nStart != -1 && nEnd != -1 && nEnd > nStart )
{
strHead = strScript.substring(0,nStart );
strForTr = strScript.substring( nStart+10,nEnd );
strEnd = strScript.substring( nEnd+11 );
sbContent.append( "
" );
strScript = strHead + sbContent.toString() + strEnd;
v_label_value.add( strData[0][2] );
v_label_value.add("");
v_label_value.add("");
v_label_value.add("");
v_label_value.add(strRandomCode);
}
else{
v_label_value.add(Convert.getValue(strData[0][2]));
v_label_value.add(Convert.getValue(strData[0][0]));
v_label_value.add( "answer" );
v_label_value.add( "1");
v_label_value.add("");
}
String temp="";
int height = Convert.getParameterInt(request,"height",0);
int width = Convert.getParameterInt(request,"width",0);
if (height > 0){
temp = "height='"+strqyHeight+"'";
} else {
if(Convert.getStringValueInt(strqyHeight)>0){
temp = "height='"+strqyHeight+"'";
}
}
if (width > 0){
temp += " width='"+strqyWidth+"'";
} else {
if(Convert.getStringValueInt(strqyWidth)>0){
temp += " width='"+strqyWidth+"'";
}
}
for( int j=0;j","");
strScript = Convert.replaceString( strScript,"\n","");
strScript = Convert.replaceString( strScript,"",strDisplay);
strScript = Convert.replaceString( strScript,"",strDisplayView);
strScript = Convert.replaceString( strScript,"",strDepiction);
String funScript = "";
funScript = ""
+"";
if(scriptBuf != null)
scriptBuf.delete(0, scriptBuf.length());
String str = funScript+ "";
String strModal = "";
if( blModal )
{
strModal = VotingFun.getModal(strWebID, strAppID, application.getRealPath(""), strwebtype, strWebServerName);
String strFrom1 = "";
int nPos1 = strModal.indexOf( strFrom1 );
int nPos2 = strModal.indexOf( strFrom2, nPos1 );
if( nPos1!=-1 && nPos2!=-1 && nPos2>nPos1 )
str = strModal.substring(0,nPos1) + str + strModal.substring( nPos2+strFrom2.length() );
out.println( str );
out.println( "");
}
else
{
str = Convert.replaceString( str,"\"","\\\\\"");
if(strInlay.equals("yes")){ // 嵌入到单元
out.println( "document.write(\""+ str +"\");" );
out.println( "document.write(\"\");");
}else{ // 未设置模板,也未嵌入到单元
out.println("");
out.println(str);
out.println( "");
}
}
%> |