From 952a23c5b7a41b3bfd8b9d8255a4bcadb379a2f7 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 23 Feb 2021 14:50:01 +0900 Subject: eq-save update --- texmf-dist/doc/latex/eq-save/README.md | 7 +- texmf-dist/doc/latex/eq-save/eqsave-man.pdf | Bin 250534 -> 294027 bytes texmf-dist/doc/latex/eq-save/eqsave-man.tex | 4 +- .../doc/latex/eq-save/examples/eqsave-noname.pdf | Bin 189713 -> 151583 bytes texmf-dist/source/latex/eq-save/eq-save.dtx | 79 ++++++++++----------- texmf-dist/tex/latex/eq-save/eq-save.sty | 40 ++++------- 6 files changed, 57 insertions(+), 73 deletions(-) (limited to 'texmf-dist') diff --git a/texmf-dist/doc/latex/eq-save/README.md b/texmf-dist/doc/latex/eq-save/README.md index 7605893a..b62034bb 100644 --- a/texmf-dist/doc/latex/eq-save/README.md +++ b/texmf-dist/doc/latex/eq-save/README.md @@ -1,6 +1,6 @@ The eq-save Package Author: D. P. Story -Dated: 2019-08-07 +Dated: 2021-02-17 In the past, Adobe Reader did not save form data; consequently, work done by the student is lost when the AeB document is closed. In the more recent @@ -17,10 +17,13 @@ Interactive document, such as those produced by AeB (including exerquiz) require Adobe Reader. Any such AeB document must be viewed in AR, outside a browser. +What's New (2021-02-17) Minor modification of restoreQuizData() to accomodate + the eq-pin2corr package. + What's New (2019-08-07) Minor reorganization of internal and public commands. What's New (2018-04-07) Bug fix, occassionally the data was not being -recorded correctly. + recorded correctly. Package works for dvips/Distiller, pdflatex, lualatex, and xelatex. diff --git a/texmf-dist/doc/latex/eq-save/eqsave-man.pdf b/texmf-dist/doc/latex/eq-save/eqsave-man.pdf index 183f77c7..583ba2a6 100644 Binary files a/texmf-dist/doc/latex/eq-save/eqsave-man.pdf and b/texmf-dist/doc/latex/eq-save/eqsave-man.pdf differ diff --git a/texmf-dist/doc/latex/eq-save/eqsave-man.tex b/texmf-dist/doc/latex/eq-save/eqsave-man.tex index 7aad833d..510258b8 100644 --- a/texmf-dist/doc/latex/eq-save/eqsave-man.tex +++ b/texmf-dist/doc/latex/eq-save/eqsave-man.tex @@ -43,7 +43,7 @@ email={dpstory@acrotex.net}, subject=Documentation for the eq-save package, talksite={\url{www.acrotex.net}}, - version={1.2.5, 2019/08/07}, + version={1.2, 2021/02/17}, Keywords={LaTeX, form field, hints, AcroTeX}, copyrightStatus=True, copyrightNotice={Copyright (C) \the\year, D. P. Story}, @@ -104,7 +104,6 @@ _path=_path.substring(0,pos)+"/"+manualfilename; \tableofcontents \selectColors{linkColor=webgreen} - \section{Introduction} In this documentation, the one reading an \AEB\footnote{{\AcroTeX} eDucation @@ -138,6 +137,7 @@ document. This `state data' is saved to a hidden text field. When the document is opened again, this hidden field is read, and the state of the document is minimally restored. + \section{Requirements and options of the package} The \pkg{eq-save} package, being a support package, requires \pkg{exerquiz}, diff --git a/texmf-dist/doc/latex/eq-save/examples/eqsave-noname.pdf b/texmf-dist/doc/latex/eq-save/examples/eqsave-noname.pdf index 06bdb163..327205d6 100644 Binary files a/texmf-dist/doc/latex/eq-save/examples/eqsave-noname.pdf and b/texmf-dist/doc/latex/eq-save/examples/eqsave-noname.pdf differ diff --git a/texmf-dist/source/latex/eq-save/eq-save.dtx b/texmf-dist/source/latex/eq-save/eq-save.dtx index dd2a1170..dbdf6b48 100644 --- a/texmf-dist/source/latex/eq-save/eq-save.dtx +++ b/texmf-dist/source/latex/eq-save/eq-save.dtx @@ -2,7 +2,7 @@ %<*copyright> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% eq-save package, %% -%% Copyright (C) 2017-2019 %% +%% Copyright (C) 2017-2021 %% %% dpstory@uakron.edu %% %% %% %% This program can redistributed and/or modified under %% @@ -14,7 +14,7 @@ % %\NeedsTeXFormat{LaTeX2e}[1997/12/01] %\ProvidesPackage{eq-save} -% [2019/08/07 v1.2.5 eq-save: save exerquiz quizzes and resume (dps)] +% [2021/02/17 v1.2 eq-save: save exerquiz quizzes and resume (dps)] %<*driver> \documentclass{ltxdoc} \usepackage[colorlinks,hyperindex=false]{hyperref} @@ -213,16 +213,11 @@ } % \end{macrocode} % \paragraph*{Open Page Action} We add a page open event to restore the data as needed. We only do this once -% per document session. The script used in contained in the command \DescribeMacro\restoreQD\cs{restoreQD}. -% \changes{v1.2.3}{2019/27/07}{Made the open doc script into a macro \string\cs{resoreQD}} -% \changes{v1.2.4}{2019/08/01}{Changed to page open} -% \changes{v1.2.5}{2019/08/07}{added dirty=false to \string\cs{restoreQD}} +% per document session. % \begin{macrocode} -\def\restoreQD{if(!restoreQuizData.hasRestoredData)\r\t - var\eqSP rqdTO=(app.setTimeOut("try{restoreQuizData()}catch(e){};% - app.clearTimeOut(rqdTO);% - restoreQuizData.hasRestoredData=true;dirty=false;",1000));} -\thisPageAction{\JS{\restoreQD}}{} +\thisPageAction{\JS{if(!restoreQuizData.hasRestoredData)\r\t + var rqdTO=(app.setTimeOut("restoreQuizData();app.clearTimeOut(rqdTO);% + restoreQuizData.hasRestoredData=true",1000));}}{} % \end{macrocode} % \paragraph*{Action prior to saving} It is important to save the quiz data, we can only do that if we save % it to a field, the value of the field will be saved. We save the data to a hidden text field @@ -371,9 +366,10 @@ cntCorrectResponses.nOutOfInDoc=0; cntCorrectResponses.nPtsCorrectInDoc=0; cntCorrectResponses.nPtsOutOfInDoc=0; % \end{macrocode} -%\leavevmode\IndexJS{cntCorrectResponses()}is the workhorse of \pkg{eq-save}. It keeps tabs on the -%total number of correct answers and the total number of questions. All \env{shortquiz}es are known immediately, -%but results from \env{quiz} environments are not known until the student presses the `End Quiz' button. +%\leavevmode\IndexJS{cntCorrectResponses()}^^A +% The workhorse of \pkg{eq-save}. It keeps tabs on the +% total number of correct answers and the total number of questions. All \env{shortquiz}es are known immediately, + %but results from \env{quiz} environments are not known until the student presses the `End Quiz' button. % \begin{macrocode} function cntCorrectResponses() { var f=this.getField("\eqsroot"); @@ -418,7 +414,6 @@ function cntCorrectResponses() { % included when they should. % \changes{v1.1}{2018/04/07}{Removed test for isCorrect} % \begin{macrocode} -% if (typeof f.isCorrect=="undefined") continue; cntCorrectResponses.nOutOfInDoc+=1; if (f.isCorrect==1) { cntCorrectResponses.nCorrectInDoc+=1; @@ -476,10 +471,11 @@ function cntCorrectResponses() { (cntCorrectResponses.nPtsOutOfInDoc)); } % \end{macrocode} -% \leavevmode\IndexJS{addInQuizResults()} is called by \texttt{cntCorrectResponses()} to add in the results +% \leavevmode\IndexJS{addInQuizResults()}^^A +% Called by \texttt{cntCorrectResponses()} to add in the results % from the quizzes, if known. Because `Begin Quiz' and `End Quiz' can be links (not recommended) we save % the results of the quiz as the value of the field \texttt{ScoreData.\ameta{quizName}}. \pkg{exerquiz} -% package save the quiz data in the form \texttt{"Score;\penalty0NQuestions;\penalty0ptScore;\penalty0NPointTotal"}. +% package saved the quiz data in the form \texttt{"Score;\penalty0NQuestions;\penalty0ptScore;\penalty0NPointTotal"}. % This string can be split and the individual % values may be retrieved. % \begin{macrocode} @@ -506,7 +502,8 @@ cntCorrectResponses.nCorrectInDoc; } } % \end{macrocode} -% \leavevmode\IndexJS{clearAllSQElements()} clears all the quiz fields (all types). Much of the code +% \leavevmode\IndexJS{clearAllSQElements()}^^A +% Clears all the quiz fields (all types). Much of the code % here is copied from \pkg{exerquiz}. % \begin{macrocode} function clearAllSQElements() { @@ -546,7 +543,8 @@ function clearAllSQElements() { oRecordOfQuizData=new Object(); } % \end{macrocode} -% \leavevmode\IndexJS{chk4PassToQuestions()} This function is used in the keystroke and format +% \leavevmode\IndexJS{chk4PassToQuestions()}^^A +% This function is used in the keystroke and format % phase of the \cs{nameField} command. If the student/user clears the field or changes the value % of the field once it has been committed, \texttt{chk4PassToQuestions()} then calls \texttt{clearAllSQElements()} % to clear all fields. @@ -576,7 +574,8 @@ function chk4PassToQuestions(event) { } } % \end{macrocode} -% \leavevmode\IndexJS{collectQuizData()} is called by the \texttt{willSave} event. It save +% \leavevmode\IndexJS{collectQuizData()}^^A +% Called by the \texttt{willSave} event. It saves % the object \texttt{oRecordOfQuizData} to the field \texttt{holdScoreData} as a string. % \begin{macrocode} function collectQuizData() { @@ -584,10 +583,9 @@ function collectQuizData() { f.value=(oRecordOfQuizData.toSource()); } % \end{macrocode} -% \leavevmode\IndexJS{restoreQuizData()} is called when the document is opened and attempts to +% \leavevmode\IndexJS{restoreQuizData()}^^A +% Called when the document is opened and attempts to % transfer the value of \texttt{holdScoreData} back into \texttt{oRecordOfQuizData}. -% \changes{v1.2}{2019/07/02}{Added ProbDist array} -% \changes{v1.2.1}{2019/07/05}{Added RightWrong array} % \begin{macrocode} restoreQuizData.hasRestoredData=false; function restoreQuizData() { @@ -599,31 +597,26 @@ function restoreQuizData() { // name of field is endQuiz.qzname var pos=fname.indexOf("."); var qzName=fname.substring(pos+1); - var qzRoot=fname.substring(0,pos); - switch(qzRoot) { - case "ScoreData": - lstOfQuizzes[qzName]=eval(qzName); - Score=1*oRecordOfQuizData[fname][0]; - NQuestions=1*oRecordOfQuizData[fname][1]; - ptScore=1*oRecordOfQuizData[fname][2]; - NPointTotal=1*oRecordOfQuizData[fname][3]; - var h=this.getField("ScoreData."+qzName); - h.value=Score+";"+NQuestions+";"+ptScore+";"+NPointTotal; - break; - case "ProbDist": - ProbDist=eval(oRecordOfQuizData[fname]); - break; - case "RightWrong": - RightWrong=eval(oRecordOfQuizData[fname]); - break; - default: - console.println("name not recognized:"+fname); +% \end{macrocode} +% (2021/02/17) Conditional to handle \texttt{ScoreData} only, this enables other +% data that are objects to be present in \texttt{oRecordOfQuizData}. +% \changes{v1.2}{2021/02/17}{Added conditional to process \texttt{ScoreData} only} +% \begin{macrocode} + if (fname.indexOf("ScoreData.")) { + lstOfQuizzes[qzName]=eval(qzName); + Score=1*oRecordOfQuizData[fname][0]; + NQuestions=1*oRecordOfQuizData[fname][1]; + ptScore=1*oRecordOfQuizData[fname][2]; + NPointTotal=1*oRecordOfQuizData[fname][3]; + var h=this.getField("ScoreData."+qzName); + h.value=Score+";"+NQuestions+";"+ptScore+";"+NPointTotal; } } else f.isCorrect=oRecordOfQuizData[fname]; } } % \end{macrocode} -% \leavevmode\IndexJS{IhrNameFormat()} is the format script for the \cs{nameField} command. +% \leavevmode\IndexJS{IhrNameFormat()}^^A +% The format script for the \cs{nameField} command. % \begin{macrocode} function IhrNameFormat(event){ if(event.value!="") { diff --git a/texmf-dist/tex/latex/eq-save/eq-save.sty b/texmf-dist/tex/latex/eq-save/eq-save.sty index 59bf56de..d0207087 100644 --- a/texmf-dist/tex/latex/eq-save/eq-save.sty +++ b/texmf-dist/tex/latex/eq-save/eq-save.sty @@ -8,7 +8,7 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% eq-save package, %% -%% Copyright (C) 2017-2019 %% +%% Copyright (C) 2017-2021 %% %% dpstory@uakron.edu %% %% %% %% This program can redistributed and/or modified under %% @@ -19,7 +19,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[1997/12/01] \ProvidesPackage{eq-save} - [2019/08/07 v1.2.5 eq-save: save exerquiz quizzes and resume (dps)] + [2021/02/17 v1.2 eq-save: save exerquiz quizzes and resume (dps)] \DeclareOption{devmode}{\def\devMode{true}} \DeclareOption{!devmode}{\def\devMode{false}} \def\devMode{false} @@ -83,11 +83,9 @@ [1*Score,1*NQuestions,1*ptScore,1*NPointTotal];\r\t\t cntCorrectResponses();\r } -\def\restoreQD{if(!restoreQuizData.hasRestoredData)\r\t - var\eqSP rqdTO=(app.setTimeOut("try{restoreQuizData()}catch(e){};% - app.clearTimeOut(rqdTO);% - restoreQuizData.hasRestoredData=true;dirty=false;",1000));} -\thisPageAction{\JS{\restoreQD}}{} +\thisPageAction{\JS{if(!restoreQuizData.hasRestoredData)\r\t + var rqdTO=(app.setTimeOut("restoreQuizData();app.clearTimeOut(rqdTO);% + restoreQuizData.hasRestoredData=true",1000));}}{} \begin{willSave} isAQuizUnfinishedAtSave(); if (typeof oRecordOfQuizData !="undefined") collectQuizData(); @@ -179,6 +177,7 @@ cntCorrectResponses.nCorrectInDoc=0; cntCorrectResponses.nOutOfInDoc=0; cntCorrectResponses.nPtsCorrectInDoc=0; cntCorrectResponses.nPtsOutOfInDoc=0; + %but results from \env{quiz} environments are not known until the student presses the `End Quiz' button. function cntCorrectResponses() { var f=this.getField("\eqsroot"); if (f==null) return; @@ -342,25 +341,14 @@ function restoreQuizData() { // name of field is endQuiz.qzname var pos=fname.indexOf("."); var qzName=fname.substring(pos+1); - var qzRoot=fname.substring(0,pos); - switch(qzRoot) { - case "ScoreData": - lstOfQuizzes[qzName]=eval(qzName); - Score=1*oRecordOfQuizData[fname][0]; - NQuestions=1*oRecordOfQuizData[fname][1]; - ptScore=1*oRecordOfQuizData[fname][2]; - NPointTotal=1*oRecordOfQuizData[fname][3]; - var h=this.getField("ScoreData."+qzName); - h.value=Score+";"+NQuestions+";"+ptScore+";"+NPointTotal; - break; - case "ProbDist": - ProbDist=eval(oRecordOfQuizData[fname]); - break; - case "RightWrong": - RightWrong=eval(oRecordOfQuizData[fname]); - break; - default: - console.println("name not recognized:"+fname); + if (fname.indexOf("ScoreData.")) { + lstOfQuizzes[qzName]=eval(qzName); + Score=1*oRecordOfQuizData[fname][0]; + NQuestions=1*oRecordOfQuizData[fname][1]; + ptScore=1*oRecordOfQuizData[fname][2]; + NPointTotal=1*oRecordOfQuizData[fname][3]; + var h=this.getField("ScoreData."+qzName); + h.value=Score+";"+NQuestions+";"+ptScore+";"+NPointTotal; } } else f.isCorrect=oRecordOfQuizData[fname]; } -- cgit v1.2.3