📄 question.php
字号:
break;
}
if ( $message )
{
$message = "".$phpQlang['Status'].": ".$message;
}
$types = array(
array(
"radio",
$phpQlang['radio']
),
array(
"checkbox",
$phpQlang['checkbox']
),
array(
"textfield",
$phpQlang['textfield']
),
array(
"textarea",
$phpQlang['textarea']
),
array(
"select",
$phpQlang['select']
)
);
$choosearray = array(
array(
$phpQlang['AnyNumber'],
"a"
),
array(
$phpQlang['Exactly'],
"e"
),
array(
$phpQlang['AtLeast'],
"l"
),
array(
$phpQlang['AtMost'],
"m"
)
);
$advancearray = array(
array(
$phpQlang['Basic'],
"n"
),
array(
$phpQlang['Advanced'],
"y"
)
);
$required = array(
array(
"y",
$phpQlang['Yes']
),
array(
"n",
$phpQlang['No']
)
);
$tsurveyname = "";
if ( $cs )
{
$mqsurvey = mysql_query( "select Name from phpQSurvey where SID = \"".protectmysql( $cs )."\"" );
if ( $masurvey = mysql_fetch_array( $mqsurvey ) )
{
$tsurveyname = 65 < strlen( $masurvey['Name'] ) ? substr( $masurvey['Name'], 0, 65 )."..." : $masurvey['Name'];
}
else
{
header( "Location: survey.php" );
exit( );
}
}
else
{
header( "Location: survey.php" );
exit( );
}
$mqquestion = mysql_query( "select * from phpQQuestion where SID = \"".protectmysql( $cs )."\" order by SortOrder" );
$count = 0;
while ( $maquestion = mysql_fetch_array( $mqquestion ) )
{
$questionlist[] = $maquestion;
if ( $cq == $maquestion['QID'] )
{
$cquestion = $maquestion;
$largestid = $maquestion['LargestAID'];
}
++$count;
}
$tcount = $count + 1;
$iQAsked = $oQAsked ? $qObject->getproperty( "questionAsked", "html" ) : protecthtml( $cquestion['Question'] );
$iQType = $oQType ? $qObject->getproperty( "questionType", "html" ) : protecthtml( $cquestion['Type'] ) ? protecthtml( $cquestion['Type'] ) : "radio";
$iARequired = $oARequired ? $qObject->getproperty( "answerRequired", "html" ) : protecthtml( $cquestion['Required'] );
$iSSize = $oSSize ? $qObject->getproperty( "selectSize", "html" ) : protecthtml( $cquestion['Mult'] ) ? protecthtml( $cquestion['Mult'] ) : 3;
$iQInstructions = $oQInstructions ? $qObject->getproperty( "qInstructions", "html" ) : protecthtml( $cquestion['Instructions'] );
$iQStyle = $oQStyle ? protecthtml( $oQStyle ) : protecthtml( $cquestion['QuestionStyle'] );
$iDAnswer = $oDAnswer ? $qObject->getproperty( "defaultAnswer", "html" ) : protecthtml( $cquestion['DefaultAnswer'] );
$iAChoices = $oAChoices ? $qObject->getproperty( "answerChoices", "html" ) : protecthtml( $cquestion['Answer'] );
$iCNumber = $oCNumber ? $qObject->getproperty( "columnNumber", "html" ) : protecthtml( $cquestion['ColNumb'] ) ? protecthtml( $cquestion['ColNumb'] ) : 1;
if ( $oAControl && $oACount )
{
$iAControl = $qObject->getproperty( "answerControl", "html" );
$iACount = $qObject->getproperty( "answerCount", "html" );
}
else
{
list( $iAControl, $iACount ) = split( ":", $cquestion['Choose'] );
}
$iAIStyle = $oAIStyle ? protecthtml( $oAIStyle ) : protecthtml( $cquestion['AnswerInputStyle'] );
$iAStyle = $oAStyle ? protecthtml( $oAStyle ) : protecthtml( $cquestion['AnswerTextStyle'] );
$iIStyle = $oIStyle ? protecthtml( $oIStyle ) : protecthtml( $cquestion['AnswerStyle'] );
$iIAttributes = $oIAttributes ? $qObject->getproperty( "inputAttributes", "html" ) : protecthtml( $cquestion['Attributes'] );
$iSDisplay = $oSDisplay ? $qObject->getproperty( "summaryDisplay", "html" ) : protecthtml( $cquestion['Summary'] ) ? protecthtml( $cquestion['Summary'] ) : "n";
$listalt = $phpQlang['ListofQuestions'];
$cslabel = $phpQlang['CurrentSurvey'];
$qlabel = $phpQlang['Questions'];
$previewalt = $phpQlang['Preview'];
$helpalt = $phpQlang['?'];
$staralt = $phpQlang['*'];
$contents = "\r\n<TABLE CELLPADDING=2 width=100% CELLSPACING=1 BORDER=0>\r\n<FORM NAME=questionlist ACTION=\"question.php\" METHOD=POST>\r\n<TR class=\"TableLine2\">\r\n\t<TD width=\"20%\">{$cslabel}:</TD>\r\n\t<TD width=\"50%\">\r\n\t<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>\r\n\t\t<TD><A HREF=\"survey.php?cs={$cs}\" CLASS=link>{$tsurveyname}</A>\r\n\t\t<A HREF=\"../fillsurvey.php?sid={$cs}&action=preview\" TARGET=_blank>预览</A></TD>\r\n\t\t</TR></TABLE>\r\n\t</TD>\r\n\t<TD width=25%></TD>\r\n</TR>\r\n<TR class=\"TableLine1\">\r\n\t<TD VALIGN=top>{$qlabel}:</TD>\r\n\t<TD><SELECT NAME=choosequestion CLASS=huge SIZE=10 style=\" width:470px\">\r\n";
if ( 0 < sizeof( $questionlist ) )
{
$i = 0;
for ( ; $i < sizeof( $questionlist ); ++$i )
{
$listedq = 60 < strlen( $questionlist[$i]['Question'] ) ? protecthtml( substr( $questionlist[$i]['Question'], 0, 60 )."..." ) : protecthtml( $questionlist[$i]['Question'] );
if ( $questionlist[$i]['Type'] != "pagebreak" )
{
$selected = $questionlist[$i]['QID'] == $cq ? "SELECTED" : "";
$contents .= "<OPTION {$selected} VALUE=".$questionlist[$i]['QID'].">".$listedq;
}
else
{
$contents .= "<OPTION VALUE=\"pagebreak\">".$listedq;
}
}
}
else
{
$contents .= "<OPTION VALUE=\"-1\">".$phpQlang['NoQuestions'];
}
$upalt = $phpQlang['AltUp'];
$downalt = $phpQlang['AltDown'];
$addmodifyalt = $phpQlang['AddModifyAQuestion'];
$requiredtext = $phpQlang['RequiredField'];
$editbutton = $phpQlang['Edit'];
$deletebutton = $phpQlang['Delete'];
$pagebutton = $phpQlang['AddPageBreak'];
$sobutton = $phpQlang['SaveOrder'];
$previewbutton = $phpQlang['Preview'];
$interface = $phpQlang['Interface'];
$contents .= "\r\n\t\t</SELECT></TD>\r\n\t<TD VALIGN=middle width=\"50%\">\r\n\t<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>\r\n\t<TR><TD><A HREF=\"javascript:MoveUp()\"><IMG SRC=\"images/buttonup.gif\" WIDTH=30 HEIGHT=30 BORDER=0 ALT=\"{$upalt}\"></A></TD></TR>\r\n\t<TR><TD><A HREF=\"javascript:MoveDown()\"><IMG SRC=\"images/buttondown.gif\" WIDTH=30 HEIGHT=30 BORDER=0 ALT=\"{$downalt}\"></A></TD></TR>\r\n\t</TABLE>\r\n\t</TD>\r\n</TR>\r\n<TR class=\"TableLine2\">\r\n\t<TD WIDTH=135 ></TD>\r\n\t<TD COLSPAN=2><INPUT TYPE=button ONCLICK=\"ChangeQuestion()\" VALUE=\"{$editbutton}\" class=\"SmallButton\">\r\n\t\t<INPUT TYPE=button ONCLICK=\"DeleteQuestion()\" VALUE=\"{$deletebutton}\" class=\"SmallButton\">\r\n\t\t<INPUT TYPE=button ONCLICK=\"PreviewQuestion({$cs})\" VALUE=\"{$previewbutton}\" class=\"SmallButton\"></TD>\r\n</TR>\r\n<INPUT TYPE=hidden NAME=action VALUE=\"\">\r\n<INPUT TYPE=hidden NAME=deleteid VALUE=\"\">\r\n<INPUT TYPE=hidden NAME=sortorder VALUE=\"\">\r\n<INPUT TYPE=hidden NAME=cs VALUE=\"{$cs}\">\r\n<INPUT TYPE=hidden NAME=qid VALUE=\"{$cq}\">\r\n</FORM>\r\n</TABLE>\r\n\r\n<BR>\r\n<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>\r\n<TR><TD BACKGROUND=\"images/border.gif\"><IMG SRC=\"images/invdot.gif\" WIDTH=100 HEIGHT=1 ALT=\"\"></TD></TR>\r\n</TABLE>\r\n<BR>\r\n\r\n<TABLE CELLPADDING=3 width=\"100%\" CELLSPACING=1 BORDER=0 ID=AddLoc>\r\n<FORM NAME=addquestion ACTION=\"question.php\" METHOD=POST>\r\n<TR>\r\n<TD COLSPAN=4>\r\n<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>\r\n<TR>\r\n<TD>新建或者编辑调查项\r\n<SELECT NAME=localadvance ONCHANGE=\"ChangeInterface()\" style=\"display:none \">\r\n<OPTION SELECTED VALUE=\"n\">Basic<OPTION VALUE=\"y\">Advanced\r\n\t\t\t</SELECT>\r\n</TD>\r\n<TD><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD></TD><TD> </TD></TR></TABLE></TD>\r\n<TD>\r\n";
$qlabel = $iQType == "htmlcontent" ? $phpQlang['ContentName'] : $phpQlang['Question'];
$qhelp = $iQType == "htmlcontent" ? "q_contentname" : "q_question";
$qhelplabel = $iQType == "htmlcontent" ? "ContentName" : "Question";
$tlabel = $phpQlang['Type'];
$contents .= "\r\n</TD>\r\n\t</TR>\r\n\t</TABLE>\r\n\t</TD>\r\n</TR>\r\n<TR>\r\n\t<TD width=\"20%\" class=\"TableLine2\">{$qlabel}:</TD>\r\n\t<TD width=\"1\" class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><INPUT TYPE=text NAME=questionasked CLASS=huge VALUE=\"{$iQAsked}\" size=\"65\"></TD>\r\n\t<TD width=\"30%\" class=\"TableLine1\"> <IMG SRC=\"{$imgurl}/star.gif\" WIDTH=11 HEIGHT=11 ALT=\"{$staralt}\"></TD>\r\n</TR>\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$tlabel}:</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><SELECT NAME=type CLASS=large ONCHANGE=\"TypeCheck()\">\r\n";
$i = 0;
for ( ; $i < sizeof( $types ); ++$i )
{
$selected = $iQType == $types[$i][0] ? "SELECTED" : "";
$contents .= "<OPTION {$selected} VALUE=\"".$types[$i][0]."\">".$types[$i][1];
}
$contents .= "\r\n\t\t</SELECT></TD>\r\n\t<TD class=\"TableLine1\"> <IMG SRC=\"{$imgurl}/star.gif\" WIDTH=11 HEIGHT=11 ALT=\"{$staralt}\"></TD>\r\n</TR>\r\n";
if ( $iQType != "htmlcontent" )
{
$rlabel = $phpQlang['Required'];
$contents .= "\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$rlabel}{$helpalt}</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><SELECT NAME=required>\r\n";
$j = 0;
for ( ; $j < sizeof( $required ); ++$j )
{
$selected = $required[$j][0] == $iARequired ? " SELECTED" : "";
$contents .= "<OPTION{$selected} VALUE=\"".$required[$j][0]."\">".$required[$j][1];
}
$contents .= "\r\n\t\t</SELECT></TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n</TR>\r\n";
}
if ( $iQType == "selectmult" )
{
$sslabel = $phpQlang['SelectSize'];
$contents .= "\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$sslabel}:</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><INPUT TYPE=text NAME=mult CLASS=medium VALUE=\"{$iSSize}\"></TD>\r\n\t<TD class=\"TableLine1\"><IMG SRC=\"{$imgurl}/star.gif\" WIDTH=11 HEIGHT=11 ALT=\"{$staralt}\"></TD>\r\n</TR>\r\n";
}
if ( $advance || $iQType == "htmlcontent" )
{
$itlabel = $iQType == "htmlcontent" ? $phpQlang['HTMLContent'] : $phpQlang['QuestionInstructions'];
$ithelp = $iQType == "htmlcontent" ? "q_htmlcontent" : "q_instructions";
$ithelplabel = $iQType == "htmlcontent" ? "HTMLContent" : "QuestionInstructions";
$itrequired = $iQType == "htmlcontent" ? "<IMG SRC=\"{$imgurl}/star.gif\" WIDTH=11 HEIGHT=11 ALT=\"{$staralt}\">" : "";
$contents .= "\r\n<TR>\r\n\t<TD VALIGN=top class=\"TableLine2\">{$itlabel}:</TD>\r\n\t<TD VALIGN=top class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><TEXTAREA NAME=instructions CLASS=huge cols=\"65\">{$iQInstructions}</TEXTAREA></TD>\r\n\t<TD VALIGN=top class=\"TableLine1\">{$itrequired}</TD>\r\n</TR>\r\n";
}
if ( $advance && $iQType != "htmlcontent" )
{
$qtslabel = $phpQlang['QuestionTextStyle'];
$contents .= "\r\n";
}
if ( $iQType == "radio" || $iQType == "checkbox" || $iQType == "select" || $iQType == "selectmult" )
{
$aclabel = $phpQlang['AnswerChoices'];
$contents .= "\r\n<TR>\r\n\t<TD VALIGN=top class=\"TableLine2\">{$aclabel}:</TD>\r\n\t<INPUT TYPE=hidden NAME=answer VALUE=\"{$iAChoices}\">\r\n <TD VALIGN=top class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><SELECT NAME=answeroptions CLASS=huge SIZE=10 ONCHANGE=\"ChangeChoice()\" style=\"width:470px\"></SELECT></TD>\r\n\t<TD class=\"TableLine1\">\r\n\t\t<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\r\n\t\t<TR><TD ALIGN=center><IMG SRC=\"{$imgurl}/star.gif\" WIDTH=11 HEIGHT=11 ALT=\"{$staralt}\"></TD></TR>\r\n\t\t<TR ><TD HEIGHT=110 VALIGN=middle>\r\n\t\t\t<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>\r\n\t\t\t<TR><TD><A HREF=\"javascript:MoveUpW()\"><IMG SRC=\"images/buttonup.gif\" BORDER=0 ALT=\"{$upalt}\"></A></TD></TR>\r\n\t\t\t<TR><TD><A HREF=\"javascript:MoveDownW()\"><IMG SRC=\"images/buttondown.gif\" BORDER=0 ALT=\"{$downalt}\"></A></TD></TR>\r\n\t\t\t</TABLE></TD></TR>\r\n\t\t</TABLE>\r\n\t</TD>\r\n</TR>\r\n<TR>\r\n\t<TD class=\"TableLine2\">选择项</TD>\r\n\t<td class=\"TableLine1\"></td>\r\n\t<TD class=\"TableLine1\" colspan=2>\r\n\t\t<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>\r\n\t\t<TR>\r\n";
$typeclass = $iQType == "select" || $iQType == "selectmult" ? 2 : 1;
$acprompt = $phpQlang['AnswerChoicePrompt'];
$contents .= "\t\t\t<TD><INPUT TYPE=text NAME=newanswer CLASS=wizard{$typeclass} ONFOCUS=\"ClearFieldW(0)\" VALUE=\"{$acprompt}\" size=\"55\">\r\n\t\t\t";
$slabel = $phpQlang['AnswerChoiceSelectable'];
$slabel2 = $phpQlang['AnswerChoiceSelected'];
if ( $iQType == "select" || $iQType == "selectmult" )
{
$contents .= "\r\n\t\t\t\t<INPUT TYPE=checkbox NAME=selectable CHECKED ONCLICK=\"UpdateChoice(false)\">\r\n\t\t\t\t{$slabel}\r\n";
}
$addbutton = $phpQlang['AddAnswer'];
$addtbutton = $phpQlang['AddTextfield'];
$mbutton = "保存修改选项";
$dbutton = "删除选项";
$contents .= "\r\n\t\t\t\t<INPUT TYPE=checkbox NAME=dselect ONCLICK=\"UpdateChoice(true)\">\r\n\t\t\t\t{$slabel2}\r\n\t\t\t\r\n\t\t\t</TD>\r\n\t\t</TR>\r\n\t\t</TABLE>\r\n\t</TD>\r\n\t\r\n</TR>\r\n<TR class=\"TableLine1\">\r\n\t<TD COLSPAN=2 >\r\n\t<TD><NOBR><INPUT TYPE=button ONCLICK=\"AddAnswer(false)\" VALUE=\"{$addbutton}\" class=\"SmallButton\">\r\n\t\t<INPUT TYPE=button ONCLICK=\"ModifyW()\" VALUE=\"{$mbutton}\" class=\"SmallButton\">\r\n\t\t<INPUT TYPE=button ONCLICK=\"DeleteAnswer()\" VALUE=\"{$dbutton}\" class=\"SmallButton\">\r\n\t<INPUT TYPE=button ONCLICK=\"AddAnswer(true)\" VALUE=\"{$addtbutton}\" class=\"SmallButton\"></NOBR></TD>\r\n\t<TD></TD>\r\n</TR>\r\n";
}
else if ( $iQType != "htmlcontent" )
{
$dalabel = $phpQlang['DefaultAnswer'];
if ( $iQType == "textarea" )
{
$contents .= "\r\n<TR>\r\n\t<TD VALIGN=top class=\"TableLine2\">{$dalabel}:</TD>\r\n\t<TD VALIGN=top class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><TEXTAREA NAME=defaultanswer rows=\"10\" cols=\"55\">{$iDAnswer}</TEXTAREA></TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n</TR>\r\n";
}
else
{
$contents .= "\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$dalabel}:</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><INPUT TYPE=text NAME=defaultanswer CLASS=huge VALUE=\"{$iDAnswer}\"></TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n</TR>\r\n";
}
}
if ( $iQType == "checkbox" || $iQType == "selectmult" )
{
$noalabel = $phpQlang['NumberofAnswers'];
$contents .= "\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$noalabel}:</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><SELECT NAME=control>\r\n";
$j = 0;
for ( ; $j < sizeof( $choosearray ); ++$j )
{
$selected = $iAControl == $choosearray[$j][1] ? "SELECTED" : "";
$contents .= "<OPTION {$selected} VALUE=\"".$choosearray[$j][1]."\">".$choosearray[$j][0];
}
$contents .= "\r\n\t\t</SELECT>\r\n\t\t<INPUT TYPE=text NAME=answercount CLASS=small VALUE=\"{$iACount}\">\r\n\t\t</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n</TR>\r\n";
}
if ( ( $iQType == "radio" || $iQType == "checkbox" ) && $advance )
{
$noclabel = $phpQlang['NumberofColumns'];
$contents .= "\r\n<TR>\r\n\t<TD class=\"TableLine2\">{$noclabel}:</TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n\t<TD class=\"TableLine1\"><INPUT TYPE=text NAME=colnumb CLASS=medium VALUE=\"{$iCNumber}\"></TD>\r\n\t<TD class=\"TableLine1\"></TD>\r\n</TR>\r\n";
}
if ( $advance && $iQType != "htmlcontent" )
{
$aislabel = $phpQlang['AnswerInputStyle'];
$atslabel = $phpQlang['AnswerTextStyle'];
$tislabel = $phpQlang['TextInputStyle'];
$tialabel = $phpQlang['TextInputAttributes'];
$contents .= "\r\n\r\n";
}
$addbutton = "<INPUT TYPE=button ONCLICK=\"AddModifyQuestion(0)\" VALUE=\"保存新增内容\" class=\"SmallButton\">";
$modbutton = $cq ? "<INPUT TYPE=button ONCLICK=\"AddModifyQuestion(1)\" VALUE=\"保存修改内容\" class=\"SmallButton\">" : "";
$clearbutton = $phpQlang['ClearForm'];
$contents .= "\r\n<TR class=\"TableLine2\">\r\n\t<TD WIDTH=135 COLSPAN=2></TD>\r\n\t<TD COLSPAN=2>{$addbutton} {$modbutton}\r\n\t\t<INPUT TYPE=button ONCLICK=\"ClearForm({$cs})\" VALUE=\"{$clearbutton}\" class=\"SmallButton\"></TD>\r\n</TR>\r\n<INPUT TYPE=hidden NAME=action VALUE=\"\">\r\n<INPUT TYPE=hidden NAME=modifyid VALUE=\"{$cq}\">\r\n<INPUT TYPE=hidden NAME=cs VALUE=\"{$cs}\">\r\n<INPUT TYPE=hidden NAME=cq VALUE=\"{$cq}\">\r\n<INPUT TYPE=hidden NAME=next VALUE=\"{$tcount}\">\r\n<INPUT TYPE=hidden NAME=fsubmit VALUE=\"true\">\r\n</FORM>\r\n</TABLE>\r\n\r\n<BR>\r\n<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>\r\n<TR><TD BACKGROUND=\"images/border.gif\"><IMG SRC=\"images/invdot.gif\" WIDTH=100 HEIGHT=1 ALT=\"\"></TD></TR>\r\n</TABLE>\r\n";
createpage( "question", $phpQlang['AdminTitle']." :: ".$phpQlang['QuestionEditorTitle'], $contents, true, "jsquestion.php" );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -