summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eq-save
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-04-28 03:01:33 +0000
committerNorbert Preining <norbert@preining.info>2021-04-28 03:01:33 +0000
commitd929e40413ebfcbeaadd7e5469ed1eb0d867ba97 (patch)
tree29822671cc2b8a5972bc139952a695cd038df417 /macros/latex/contrib/eq-save
parent95b070aee1a6351879af117f723c84d50b48338d (diff)
CTAN sync 202104280301
Diffstat (limited to 'macros/latex/contrib/eq-save')
-rw-r--r--macros/latex/contrib/eq-save/README.md4
-rw-r--r--macros/latex/contrib/eq-save/docs/eqsave-man.pdfbin294027 -> 294253 bytes
-rw-r--r--macros/latex/contrib/eq-save/docs/eqsave-man.tex9
-rw-r--r--macros/latex/contrib/eq-save/eq-save.dtx85
-rw-r--r--macros/latex/contrib/eq-save/examples/eqsave-noname.pdfbin151583 -> 272696 bytes
5 files changed, 60 insertions, 38 deletions
diff --git a/macros/latex/contrib/eq-save/README.md b/macros/latex/contrib/eq-save/README.md
index b62034bb3c..cfec2944d9 100644
--- a/macros/latex/contrib/eq-save/README.md
+++ b/macros/latex/contrib/eq-save/README.md
@@ -1,6 +1,6 @@
The eq-save Package
Author: D. P. Story
-Dated: 2021-02-17
+Dated: 2021-04-27
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,6 +17,8 @@ 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-04-27) Bug fixes; extension of logic in \string\texttt{restoreQuizData()}}
+
What's New (2021-02-17) Minor modification of restoreQuizData() to accomodate
the eq-pin2corr package.
diff --git a/macros/latex/contrib/eq-save/docs/eqsave-man.pdf b/macros/latex/contrib/eq-save/docs/eqsave-man.pdf
index 583ba2a63b..ac8f68302f 100644
--- a/macros/latex/contrib/eq-save/docs/eqsave-man.pdf
+++ b/macros/latex/contrib/eq-save/docs/eqsave-man.pdf
Binary files differ
diff --git a/macros/latex/contrib/eq-save/docs/eqsave-man.tex b/macros/latex/contrib/eq-save/docs/eqsave-man.tex
index 510258b877..e30fa9fe49 100644
--- a/macros/latex/contrib/eq-save/docs/eqsave-man.tex
+++ b/macros/latex/contrib/eq-save/docs/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, 2021/02/17},
+ version={1.2.5, 2021/04/27},
Keywords={LaTeX, form field, hints, AcroTeX},
copyrightStatus=True,
copyrightNotice={Copyright (C) \the\year, D. P. Story},
@@ -106,9 +106,10 @@ _path=_path.substring(0,pos)+"/"+manualfilename;
\section{Introduction}
-In this documentation, the one reading an \AEB\footnote{{\AcroTeX} eDucation
-Bundle} document is referred to as a student, as that is the intended target
-audience for education materials developed by the various packages of \AEB.
+In this documentation, the person consuming an \AEB\footnote{{\AcroTeX}
+eDucation Bundle} (PDF) document is referred to as a student, as that is the
+intended target audience for education materials developed by the various
+packages of \AEB.
The \pkg{exerquiz} package defines the \env{oQuestion}, \env{shortquiz}, and
\env{quiz} environments that are used to pose interactive questions to
diff --git a/macros/latex/contrib/eq-save/eq-save.dtx b/macros/latex/contrib/eq-save/eq-save.dtx
index dbdf6b4868..531995f8b3 100644
--- a/macros/latex/contrib/eq-save/eq-save.dtx
+++ b/macros/latex/contrib/eq-save/eq-save.dtx
@@ -14,7 +14,7 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
%<package>\ProvidesPackage{eq-save}
-%<package> [2021/02/17 v1.2 eq-save: save exerquiz quizzes and resume (dps)]
+%<package> [2021/04/27 v1.2.5 eq-save: save exerquiz quizzes and resume (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -213,11 +213,21 @@
}
% \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.
-% \begin{macrocode}
-\thisPageAction{\JS{if(!restoreQuizData.hasRestoredData)\r\t
- var rqdTO=(app.setTimeOut("restoreQuizData();app.clearTimeOut(rqdTO);%
- restoreQuizData.hasRestoredData=true",1000));}}{}
+% 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}}
+% \begin{macrocode}
+\def\restoreQD{if(!restoreQuizData.hasRestoredData)\r\t
+ var rqdTO=(app.setTimeOut("try{restoreQuizData()}catch(e){};%
+ app.clearTimeOut(rqdTO);%
+ restoreQuizData.hasRestoredData=true;dirty=false;",1000));}
+%\addToDocOpen{\JS{\restoreQD}}
+\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
@@ -366,10 +376,9 @@ cntCorrectResponses.nOutOfInDoc=0;
cntCorrectResponses.nPtsCorrectInDoc=0;
cntCorrectResponses.nPtsOutOfInDoc=0;
% \end{macrocode}
-%\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.
+%\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.
% \begin{macrocode}
function cntCorrectResponses() {
var f=this.getField("\eqsroot");
@@ -414,6 +423,7 @@ 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;
@@ -471,11 +481,10 @@ function cntCorrectResponses() {
(cntCorrectResponses.nPtsOutOfInDoc));
}
% \end{macrocode}
-% \leavevmode\IndexJS{addInQuizResults()}^^A
-% Called by \texttt{cntCorrectResponses()} to add in the results
+% \leavevmode\IndexJS{addInQuizResults()} is 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 saved the quiz data in the form \texttt{"Score;\penalty0NQuestions;\penalty0ptScore;\penalty0NPointTotal"}.
+% package save 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}
@@ -502,8 +511,7 @@ cntCorrectResponses.nCorrectInDoc;
}
}
% \end{macrocode}
-% \leavevmode\IndexJS{clearAllSQElements()}^^A
-% Clears all the quiz fields (all types). Much of the code
+% \leavevmode\IndexJS{clearAllSQElements()} clears all the quiz fields (all types). Much of the code
% here is copied from \pkg{exerquiz}.
% \begin{macrocode}
function clearAllSQElements() {
@@ -543,8 +551,7 @@ function clearAllSQElements() {
oRecordOfQuizData=new Object();
}
% \end{macrocode}
-% \leavevmode\IndexJS{chk4PassToQuestions()}^^A
-% This function is used in the keystroke and format
+% \leavevmode\IndexJS{chk4PassToQuestions()} 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.
@@ -574,8 +581,7 @@ function chk4PassToQuestions(event) {
}
}
% \end{macrocode}
-% \leavevmode\IndexJS{collectQuizData()}^^A
-% Called by the \texttt{willSave} event. It saves
+% \leavevmode\IndexJS{collectQuizData()} is called by the \texttt{willSave} event. It save
% the object \texttt{oRecordOfQuizData} to the field \texttt{holdScoreData} as a string.
% \begin{macrocode}
function collectQuizData() {
@@ -583,9 +589,10 @@ function collectQuizData() {
f.value=(oRecordOfQuizData.toSource());
}
% \end{macrocode}
-% \leavevmode\IndexJS{restoreQuizData()}^^A
-% Called when the document is opened and attempts to
+% \leavevmode\IndexJS{restoreQuizData()} is 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() {
@@ -597,26 +604,38 @@ function restoreQuizData() {
// name of field is endQuiz.qzname
var pos=fname.indexOf(".");
var qzName=fname.substring(pos+1);
-% \end{macrocode}
+ var qzRoot=fname.substring(0,pos);
+ % \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;
+% \changes{v1.2.5}{2021/04/27}{Added a switch (JS) for more complex decision within
+% \string\texttt{restoreQuizData}}
+% \begin{macrocode}
+ 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);
}
} else f.isCorrect=oRecordOfQuizData[fname];
}
}
% \end{macrocode}
-% \leavevmode\IndexJS{IhrNameFormat()}^^A
-% The format script for the \cs{nameField} command.
+% \leavevmode\IndexJS{IhrNameFormat()} is the format script for the \cs{nameField} command.
% \begin{macrocode}
function IhrNameFormat(event){
if(event.value!="") {
diff --git a/macros/latex/contrib/eq-save/examples/eqsave-noname.pdf b/macros/latex/contrib/eq-save/examples/eqsave-noname.pdf
index 327205d6b5..5d8261a86e 100644
--- a/macros/latex/contrib/eq-save/examples/eqsave-noname.pdf
+++ b/macros/latex/contrib/eq-save/examples/eqsave-noname.pdf
Binary files differ