diff options
Diffstat (limited to 'macros/latex/contrib/acrotex/exerquiz.dtx')
-rw-r--r-- | macros/latex/contrib/acrotex/exerquiz.dtx | 167 |
1 files changed, 133 insertions, 34 deletions
diff --git a/macros/latex/contrib/acrotex/exerquiz.dtx b/macros/latex/contrib/acrotex/exerquiz.dtx index d75879e090..a5c4c18451 100644 --- a/macros/latex/contrib/acrotex/exerquiz.dtx +++ b/macros/latex/contrib/acrotex/exerquiz.dtx @@ -22,7 +22,7 @@ %<randomize>\ProvidesFile{aebrandom.def} %<sumrytbls>\ProvidesFile{aebsumrytbls.def} %<template>\ProvidesFile{template.def} -%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2020/03/14 v8.5.10 % +%<package|driver|aebjs|eqexam|randomize|sumrytbls|template> [2020/11/11 v8.5.11 % %<package> Exerquiz: Exercises and Quizzes for LaTeX/PDF package (dps)] %<driver> Exerquiz documentation driver file (dps)] %<aebjs> Exerquiz document level JavaScript (dps)] @@ -4670,7 +4670,7 @@ % \end{macrocode} % (2013/12/20) Pass \cs{bqlabelISO} through \cs{pdfstringdef}. % \begin{macrocode} - \def\fieldJSStr@CMD{\fieldJSStr*[noquotes]\bqlabelISO}% + \def\fieldJSStr@CMD{\flJSStr*[noquotes]\bqlabelISO}% \expandafter\fieldJSStr@CMD\expandafter{\bqlabelISO}% \ifx\@quiztype\@empty\gdef\@@quiztype{#1}\else \xdef\@@quiztype{\@quiztype}\fi @@ -8709,32 +8709,61 @@ if (!isQuizInitialized("@currQuiz")) { \ifx\txtAltList\@empty\xdef\txtAltList{["#2",#1]}\else \xdef\txtAltList{\jsTempArgs,["#2",#1]}\fi\@@argReadPC} \def\@@argReadPC{\advance\eqtmpcnta\m@ne - \ifnum\eqtmpcnta=\z@ - \def\eq@next{\endgroup - \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% - \if\grpquestions\eq@Zero - \ifwithinMCFI - \xdef\s@veCorrAnsFCFI{[\txtAltList]}\else - \eq@recordCorrAns{[\txtAltList]}\fi - \else - \eq@recordGrpAnsArray{[\txtAltList]}% - \fi - \eq@@RespBoxTxtPC - }% - \else - \def\eq@next{\@argReadPC}% - \fi\eq@next + \ifnum\eqtmpcnta=\z@ + \def\eq@next{\endgroup + \xdef\rbTxtAlt{\rbTxtAlt,\txtAltList}% + \if\grpquestions\eq@Zero + \ifwithinMCFI + \xdef\s@veCorrAnsFCFI{[\txtAltList]}\else + \eq@recordCorrAns{[\txtAltList]}\fi + \else + \eq@recordGrpAnsArray{[\txtAltList]}% + \fi + \eq@@RespBoxTxtPC + }% + \else + \def\eq@next{\@argReadPC}% + \fi\eq@next } -\def\eq@@RespBoxTxtPC{% - \ifeq@proofing\makebox[0pt][l]{\space\txt@correctAnswer}\fi - \eq@TextField +\def\eq@@RespBoxTxtPC{\ifeq@proofing + \makebox[0pt][l]{\space\txt@correctAnswer}\fi + \eq@TextField % \end{macrocode} % Closing of the \cs{hbox} begun above. % \begin{macrocode} - \egroup + \egroup } % \end{macrocode} % \end{macro} +% \begin{macro}{\SpellCheck}\hskip-\marginparsep\texttt{[\ameta{options}]} +% This command is designed to be used with text fill-in questions; the action of this button +% allows the user to correct spelling, but it does record the number of initially misspelled words. +% The placement of this field is after the text field (\cs{RespBoxTxt} or \cs{RespBoxTxtPC}) so +% it can pick up on the field name. The root name of this field is \texttt{spl}. Two helper commands +% are defined: \DescribeMacro{\splChkCA}\cmd{\splChkCA} and \DescribeMacro{\splChkTU}\cmd{\splChkTU}. +% \changes{v8.5.11}{2020/11/11}{Added \string\cs{SpellCheck}} +% \begin{macrocode} +\def\afterSplChkActn#1{\def\@fterSplChkActn{\r #1}} +\let\@fterSplChkActn\@empty +\newcommand{\splChkCA}{Check} +\newcommand{\splChkTU}{Check spelling} +\newcommand\SpellCheck[1][]{% + \pushButton[\CA{\splChkCA}\TU{\splChkTU}\S{S} + #1\A{\JS{% + \ifx\grpquestions\eq@One + var targetFldName=% + "grpobj.\curr@quiz.\thequestionno.\thegrpquestionno"; + \else + \ifx\annot@subtype\annot@subtype@rbe + var targetFldName="essay.\curr@quiz.\thequestionno"; + \else + var targetFldName="obj.\curr@quiz.\thequestionno"; + \fi + \fi\r + var splErrors=checkTheSpelling(targetFldName);\@fterSplChkActn + }}]{spl.\curr@quiz.\thequestionno}{}{11bp}} +% \end{macrocode} +% \end{macro} %\subsection{Essay Fill-In} % \begin{macro}{\RespBoxEssay} % Here is a simple text field with a multi-line attribute for entering @@ -8747,7 +8776,7 @@ if (!isQuizInitialized("@currQuiz")) { % \string\RespBoxEssay[\ameta{opts}]*\darg{\ameta{wd}}\darg{\ameta{ht}} % \end{quote} % The second argument declares the problem has a \env{solution} file; we define the target -% of the solution twh ways: an explicite \ameta{dest} string, or an star (\texttt*), where +% of the solution twh ways: an explicit \ameta{dest} string, or an star (\texttt*), where % the destination is automatically named. If you use \ameta{dest}, you must have % a frist optional, even if its only \texttt{[]}, to correctly parse this construction. % \changes{v8.3}{2019/08/13}{\string\env{solution} environment now defined for @@ -8775,7 +8804,9 @@ if (!isQuizInitialized("@currQuiz")) { } } % \RespBoxEssay[opt][dest]|*{wd}{ht} -\newcommand\RespBoxEssay[1][]{\def\rbe@rgi{#1}\RespBoxEssay@i} +\def\annot@subtype@rbe{rbe} +\newcommand\RespBoxEssay[1][]{\edef\annot@subtype{\annot@subtype@rbe}% + \def\rbe@rgi{#1}\RespBoxEssay@i} \def\RespBoxEssay@i{\@ifnextchar[%] {\RespBoxEssay@ii} {\@ifstar{\RespBoxEssay@ii[\curr@quiz.\thequestionno]}}% @@ -10354,7 +10385,6 @@ var pi = Math.PI; var replaceExclaim = \replaceexclaim; var negPointsAllowed = \negpointsallowed; var negPointsMarkupAllowed = \negpointsmarkupallowed; -%var aQuizControl = new Array(); var aQuizControl = new Object; var RightWrong=new Array(); var ProbValue = new Array(); @@ -11745,6 +11775,38 @@ function eqFilter(filterMethod) { return this.toString(); } } +% \end{macrocode} +% JavaScript support of spell checking command |\SpellCheck| +% \changes{v8.5.11}{2020/11/11}{JavaScript support of spell checking command \string\cs{SpellCheck}}. +% Returns the number of misspelled words, but allows user to to correct. +% \begin{macrocode} +function checkTheSpelling(targetFieldName) { + var spellChkCnt=0; +% var thisName=event.target.name; +% \end{macrocode} +% The root name of the \cs{SpellCheck} field is \texttt{spl}. Here we replace +% the root name with \texttt{obj} to get the field name of the previous \cs{RespBoxTxt(PC)} +% field. For the \texttt{spell.checkWord()} method, \app{PDF-XChange Editor} returns \texttt{undefined}. +% This (spell checking) is a AR/AA feature only. +% \begin{macrocode} +% var fName = "obj"+thisName.substring(3); +% var f=this.getField(fName); +% if (f==null) fName="grpobj"+thisName.substring(3); + var f=this.getField(targetFieldName); + var value=f.value; + var valueStrip = value.replace(/\s+/g,""); + if ( valueStrip != "" ) { + aBrk=value.split(/\s+/); + for (var i=0; i<aBrk.length; i++){ + var word=aBrk[i]; + var aRetnSC=spell.checkWord(word); + if (aRetnSC!=null) spellChkCnt++; + } + var corrdStr=spell.checkText(value); + f.value=corrdStr; + } + return spellChkCnt; +} \end{newsegment} % \end{macrocode} % \subsection{Multiple Choice Questions} @@ -11836,12 +11898,12 @@ function InitializeQuiz(qtfield,mark) { ProcessIt = false; aQuizControl[qtfield] = 1; this.resetForm(["ScoreField." + qtfield,"mc."+qtfield, - "obj."+qtfield,"mck."+qtfield,"Ans."+qtfield, - "PointsField."+qtfield,"PercentField."+qtfield, - "essay."+qtfield,"GradeField."+qtfield, - "grpobj."+qtfield,"qMark."+qtfield, qtfield+"SanityCheck", - qtfield+"SanityCheckPts",qtfield+"SanityCheckOOPts", - "rbmarkup."+qtfield]); + "obj."+qtfield,"mck."+qtfield,"Ans."+qtfield, + "PointsField."+qtfield,"PercentField."+qtfield, + "essay."+qtfield,"GradeField."+qtfield, + "grpobj."+qtfield,"qMark."+qtfield, qtfield+"SanityCheck", + qtfield+"SanityCheckPts",qtfield+"SanityCheckOOPts", + "rbmarkup."+qtfield]); ProcessIt = true; var f = this.getField("qMark."+qtfield); if ( f != null ) f.display = display.hidden; @@ -12439,6 +12501,12 @@ quizno,qtfield,pts,ppts) { var retn = [ [ scoreThisProblem, passKey ], letterResponses ] ; return retn; } +% \end{macrocode} +% \leavevmode\IndexJS{LimitSelection}\hskip-\marginparsep\texttt{(\ameta{n},\ameta{fname},\ameta{index}} +% This function supports the \cs{limitSelectionTo\darg{\ameta{n}}} command. The function determines +% whether the user has chosen more than \ameta{n} in a MS choice field. The widget that activated this +% function is \texttt{\ameta{fname}.\ameta{index}}. +% \begin{macrocode} function LimitSelection(n,fname,k) { var f = this.getField(fname); var g = f.getArray(); @@ -12941,6 +13009,9 @@ function qRadioButtonMCFI(key,qname,n) { R\texorpdfstring{\'}{\string\351}ponses} \renewcommand\eq@local@RC{Correctes} \renewcommand\eq@local@AC{SVP !} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pour cette question, + vous \u00EAtes autoris\'{e} \`{a} faire au plus " + + n + " s\'{e}lections."} %</eqfr> % \end{macrocode} % \subsection{German} @@ -13060,7 +13131,7 @@ function qRadioButtonMCFI(key,qname,n) { + " sonst wird diese Antwort als falsch gewertet."} \dlJSStr*[noquotes]{\limSelWarningMsg}{"F\"{u}r diese Aufgabe k\"{o}nnen sie h\"{o}chstens " + n + " ausw\string\344hlen."} -\fieldJSStr*[noquotes]{\promptButtonMsg}{% +\flJSStr*[noquotes]{\promptButtonMsg}{% "M\"{o}chten Sie die richtige Antwort jetzt sehen?" + " Ihre derzeitige Antwort ist diejenige, die gewertet wird." + " Wenn Sie auf \\"Yes\\" klicken, k\"{o}nnen Sie ihre Antwort @@ -13131,6 +13202,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@AC{% V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}snill!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"For dette sp\string\370rsm\string\345let + har du lov til \string\345 gj\string\370re p\string\345 det meste " + + n + " valg."} %</eqno> % \end{macrocode} % \subsection{Dutch} @@ -13219,6 +13293,8 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Corrigeer} \renewcommand\eq@local@RC{Mijn Antwoorden!} \renewcommand\eq@local@AC{AUB!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Voor deze vraag mag je maximaal " + + n + " selecties maken."} %</eqnl> % \end{macrocode} % \subsection{Spanish} @@ -13304,6 +13380,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correctas} \renewcommand\eq@local@RC{Mis Respuestas!} \renewcommand\eq@local@AC{Por Favor!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Para esta pregunta, + se le permite hacer como m\'{a}ximo " + + n + " selecciones."} %</eqes> % \end{macrocode} % \subsection{Italian} @@ -13393,6 +13472,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correggere} \renewcommand\eq@local@RC{Le mie risposte!} \renewcommand\eq@local@AC{Per favore!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Per questa domanda, + \`{e} possibile effettuare al massimo " + + n + " selezioni."} %</eqit> % \end{macrocode} % \subsection{Russian} @@ -13483,12 +13565,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@sqslrtnlabel{\^{a}{\aa}ð\'{\i}\'{o}\`{o}\"{u}\~{n}\"{y}} % User access to shortquiz label \renewcommand\sqslrtnlabel{\eq@sqslrtnlabel} - \cyrCommand\eqsqslrtnlabel{\^{E} \^{o}\^{\i}ð\`{\i}\'{o}\"{e}% \`{e}ð\^{\i}\^{a}\^{e}{\aa} \c{c}\`{a}\"{a}\`{a}\'{\i}\`{e}\"{y}} \renewcommand\eq@sqslrtnlabel{\eqsqslrtnlabel} - - % Here is the default quiz label. % No formatting allowed % For Example: \renewcommand\eq@bqlabel{D\'ebut} (French) @@ -13693,6 +13772,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@AC{% V\texorpdfstring{\ae}{\string\346}r s\texorpdfstring{\r}{\string\345}god!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Til dette sp\string\370rgsm\string\345l, + er du lov til at g\string\370re h\string\370jst " + + n + " valg."} %</eqda> % \end{macrocode} % \subsection{Polish} @@ -13779,6 +13861,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@RC{Moje odpowiedzi!} \renewcommand\eq@local@AC{Prosze!} %\renewcommand\eq@local@AC{Prosz\k{e}!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Na to pytanie, + mo\u017Cesz dokona\u0107 co najwy\u017Cej " + + n + " wybor\string\363w."} %</eqpo> % \end{macrocode} % \subsection{Finnish} @@ -13840,6 +13925,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Oikein} \renewcommand\eq@local@RC{Omat vastaukset!} \renewcommand\eq@local@AC{Ole hyv\string\344!}} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"T\string\344h\string\344n + kysymykseen, voit tehd\string\344 enint\string\344\string\344n " + + n + " valintoja."} %</eqfin> % \end{macrocode} % \subsection{catalan} @@ -13925,6 +14013,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Correctes} \renewcommand\eq@local@RC{Les meves Respostes!} \renewcommand\eq@local@AC{Si us plau!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Per a aquesta pregunta, + se li permet fer com a m\`{a}xim " + + n + " seleccions."} %</eqcat> % \end{macrocode} % @@ -14050,6 +14141,9 @@ function qRadioButtonMCFI(key,qname,n) { + "Kliknete-li na \\"Yes\\", uvidite spravnou odpoved, ale svou stavajici odpoved na tuto otazku uz nebudete moct zmenit." } +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pro tuto ot\string\341zku + m\u016F\u017Eete prov\'{e}st maxim\'{a}ln\u011B " + + n + " v\u00FDb\u0115ry."} %</eqcz> % \end{macrocode} % \subsection{brazil} @@ -14141,6 +14235,9 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Corretas} \renewcommand\eq@local@RC{Minhas Respostas!} \renewcommand\eq@local@AC{Por Favor!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Pro tuto ot\string\341zku + m\u016F\u017Eete prov\'{e}st maxim\'{a}ln\u011B " + + n + " v\u00FDb\u0115ry."} %</eqbr> % \end{macrocode} % \subsection{turkish} @@ -14233,6 +14330,8 @@ function qRadioButtonMCFI(key,qname,n) { \renewcommand\eq@local@CA{Dogru} \renewcommand\eq@local@RC{Benim Cevaplar\protect\u0131m!} \renewcommand\eq@local@AC{L\protect\374tfen!} +\dlJSStr*[noquotes]{\limSelWarningMsg}{"Bu soru i\u00E7in, en fazla " + + n + " se\u00E7im yapmak i\u00E7in izin verilir."} %</eqtr> % \end{macrocode} % \Finale |