summaryrefslogtreecommitdiff
path: root/texmf-dist/tex/latex/acrotex/aebsumrytbls.def
blob: 1acf96e7df71f5a50c19b34b0bc6e2f44effdb9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
%%
%% This is file `aebsumrytbls.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% exerquiz.dtx  (with options: `copyright,sumrytbls')
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Exerquiz.sty package,                                %%
%% Copyright (C) 1999-2018  D. P. Story                 %%
%%   dpstory@uakron.edu                                 %%
%%                                                      %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1 of the  %%
%% License, or (at your option) any later version.      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesFile{aebsumrytbls.def}
 [2018/10/03 v8.2.5 %
 Exerquiz support for summary tables (dps)]
\def\ccatCurrQzWith(#1){\currQuiz#1}
\def\pbPopulateSumTable{\pushButton[\W0\BG{}\BC{}\S{S}\autoCenter{n}
    \TU{\thequestionno}\Ff{\FfReadOnly}
    \AA{\AAPageVisible{try{popVisitsTbl("\currQuiz",\thequestionno)}%
        catch(e){}}}]{\currQuiz activateSC}{0pt}{0pt}}
\def\pbDoNoCorrectSumryTbl{\makebox[0pt][l]{\pushButton[\F{\FHidden}]%
    {\currQuiz NoCorrections}{0pt}{0pt}}}
\newcount\eq@rowcnt
\newcommand{\sumryTblQ}{Question}
\newcommand{\sumryTblR}{Responded}
\newcommand{\sumryTblP}{Page}
\define@key{smrytbl}{ntables}{%
    \@tempcntb=#1
    \ifnum\@tempcntb<1 \@tempcntb=1 \fi
    \ifnum\@tempcntb>3 \@tempcntb=3 \fi
    \edef\smrytbl@ntables{\the\@tempcntb}%
}
\def\smrytbl@ntables{2}
\define@key{smrytbl}{showmarkup}[true]{%
    \csname if#1\endcsname\eqshowmarkuptrue
        \else\eqshowmarkupfalse\fi
}
\newif\ifsmrytbl@corrections\smrytbl@correctionstrue
\define@key{smrytbl}{nocorrections}[true]{%
    \csname if#1\endcsname\smrytbl@correctionsfalse
        \else\smrytbl@correctionstrue\fi
}
\define@key{smrytbl}{showOutOf}[true]{%
    \csname if#1\endcsname\eqshowOutOftrue\def\stfmtType{OO}%
        \gdef\showOutOfinSmryTbl{true}\let\stmarkupbox\relax
    \else
        \eqshowOutOffalse\let\stfmtType\@empty
        \gdef\showOutOfinSmryTbl{false}%
    \fi
}
\let\stfmtType\@empty
\define@key{smrytbl}{setDimens}[]{#1}
\def\showOutOfinSmryTbl{false}
\def\stmarkupbox{\makebox[0pt][l]}
\newcommand{\displaySumryTbl}[2][]{%
    \begingroup\edef\currQuiz{#2}\edef\oField{#2}\edef\curr@quiz{#2}%
    \setkeys{smrytbl}{#1}%
    \count0=\smrytbl@ntables
    \eq@rowcnt=0\relax\@tempcntb=\value{questionno}%
    \ifnum\count\z@=2\relax
        \divide\@tempcntb2\relax
        \advance\@tempcntb\ifodd\value{questionno}2\else1\fi
        \xdef\@beginSecCol{\the\@tempcntb}%
        \advance\@tempcntb-1\relax
    \fi
    \ifnum\count\z@=3
        \edef\eq@n{\the\@tempcntb}%
        \divide\@tempcntb\count\z@
        \edef\eq@q{\the\@tempcntb}%
        \@tempcnta=\@tempcntb\multiply\@tempcnta3
        \edef\eq@p{\the\@tempcnta}%
        \@tempcnta=\eq@n
        \advance\@tempcnta-\eq@p\relax
        \ifnum\@tempcnta=0
            \@tempcntb=\eq@q \advance\@tempcntb1
            \xdef\@beginSecCol{\the\@tempcntb}%
            \advance\@tempcntb\eq@q\relax
            \xdef\@beginThrdCol{\the\@tempcntb}%
        \else\ifnum\@tempcnta=1
            \@tempcntb=\eq@q \advance\@tempcntb1
            \edef\nB@lCols{\the\@tempcntb}%
            \advance\@tempcntb1\relax
            \xdef\@beginSecCol{\the\@tempcntb}%
            \advance\@tempcntb\eq@q\relax
            \xdef\@beginThrdCol{\the\@tempcntb}%
        \else\ifnum\@tempcnta=2
            \@tempcntb=\eq@q \advance\@tempcntb1
            \edef\nB@lCols{\the\@tempcntb}%
            \advance\@tempcntb1
            \xdef\@beginSecCol{\the\@tempcntb}%
            \advance\@tempcntb\nB@lCols
            \xdef\@beginThrdCol{\the\@tempcntb}%
        \fi\fi\fi
        \@tempcntb=\eq@n
    \fi
    \let\@eqListExp\@@eqListExp
    \eqQzQuesList
    \endgroup
}
\def\eq@begintab{%
    \begin{tabular}[t]{lcc}\sumryTblQ&\sumryTblR&\sumryTblP\\\sthline
    {\Large\strut}%
}
\def\sthline{\hline}
\def\eq@endtab{\end{tabular}}
\def\sumrytblCkMUsep{\kern3bp}
\def\sumrytbllinkHook#1{#1}
\newcommand{\sumryTblProbFmt}[1]{\textbf{\textcolor{blue}{#1}}}
\newcommand{\sumrytablesep}{\space}
\def\stmarkupWidth{12bp}\def\stmarkupHeight{9bp}\def\stmarkupTextSize{0}
\def\st@scndclmn{%
    \checkBox[\Ff{\FfReadOnly}]%
        {\ccatCurrQzWith(SanityCheck).\the\eq@rowcnt}%
        {\markupHeight}{\markupHeight}{Yes}\ifeqshowmarkup
        \stmarkupbox{\sumrytblCkMUsep\textField[%
            \Ff\FfReadOnly\BC{}\textColor{\pcMarkupColor}%
            \textSize{\stmarkupTextSize}\autoCenter{n}%
        ]{\ccatCurrQzWith(SanityCheck\stfmtType Pts).\the\eq@rowcnt}%
        {\stmarkupWidth}{\stmarkupHeight}}\fi
}
\def\st@thrdclmn#1{%
    \setLink[\linktxtcolor{\@linkcolor}
        \A{\JS{this.pageNum=(#1-1)}}]{\sumrytbllinkHook{#1}}}
\def\@@eqListExp#1#2{\global\advance\eq@rowcnt1\relax
    \ifnum\eq@rowcnt=1\relax
        \pbPopulateSumTable\ifsmrytbl@corrections\else
        \pbDoNoCorrectSumryTbl\fi\expandafter\eq@begintab\fi
    \ifnum\count0>1 \ifnum\eq@rowcnt=\@beginSecCol\relax
        \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab
    \fi\fi
    \ifnum\count0=3 \ifnum\eq@rowcnt=\@beginThrdCol\relax
        \eq@endtab\expandafter\sumrytablesep\expandafter\eq@begintab
    \fi\fi
    \sumryTblProbFmt{#1}&\st@scndclmn&\st@thrdclmn{#2}\\[1bp]
    \ifnum\eq@rowcnt=\thequestionno\relax\expandafter\eq@endtab\fi
}
\def\writeProListAux{%
    \eq@IWAuxOut{\string\expandafter\string\gdef
    \string\csname\space\currQuiz QzQuesList\string\endcsname
    {\eqQzQuesList}}%
    \eq@IWAuxOut{\string\expandafter\string\gdef
    \string\csname\space\currQuiz nQuestions\string\endcsname
    {\thequestionno}}%
}
\def\setParamSumryTblAux{%
    \edef\eqQzQuesList{\@nameuse{\currQuiz QzQuesList}}%
    \@ifundefined{\currQuiz nQuestions}{}{%
        \value{questionno}=\@nameuse{\currQuiz nQuestions}}%
}
\newenvironment{sumryTblAux}[1]{%
    \DeclareQuiz{#1}\setParamSumryTblAux}{}%
\begin{insDLJS}[correctSumryTbl]{sumtbljs}{Eq: Populate Summary Table}
function correctSumryTbl(qtfield,nQuestions) {
    var oQName=eval(qtfield);
    var rightColor=(typeof oQName.RightColorJSLoc=="undefined")%
?\rghtColorJS:oQName.RightColorJSLoc;
    var wrongColor=(typeof oQName.WrongColorJSLoc=="undefined")%
?\wrngColorJS:oQName.WrongColorJSLoc;
    var partialColor=(typeof oQName.PartialColorJSLoc=="undefined")%
?\partialColorJS:oQName.PartialColorJSLoc;
    var sc=this.getField(qtfield+"SanityCheck");
    var nc=this.getField(qtfield+"NoCorrections");
    if (sc != null && nc == null ) {
        for (var i=0; i<nQuestions; i++) {
            var cb=this.getField(qtfield+"SanityCheck."+(i+1));
            if (typeof RightWrong[i+1] == "undefined" ) {
                cb.strokeColor=wrongColor;
                continue;
            }
            if ( RightWrong[i+1] == 1 ) {
                cb.strokeColor=rightColor;
                continue;
            }
            if ( RightWrong[i+1] == 0 ) {
                // this is either an obj or multiple choice q
                if ( typeof ProbValue[i+1] == "object" )
                    cb.strokeColor=( ProbValue[i+1][2] > 0 )?%
partialColor:wrongColor;
                else cb.strokeColor=wrongColor; // obj q
                continue;
            }
            // either multiple selection or grouped math
            if ( RightWrong[i+1][0] == "grp" ) {
                // grouped question
                var f = this.getField("grpobj."+qtfield+"."+(i+1));
                var l = f.getArray().length;
                // is this right?
                for (var sum=0, j=1; j<=l; j++)
                    sum+=(!!RightWrong[i+1][j]);
                if ( sum == l ) cb.strokeColor=["RGB", 0, .6, 0];
                else cb.strokeColor=( sum > 0 )?%
partialColor:wrongColor;
                continue;
            }
            // multiple selection
            if ( RightWrong[i+1][0] == 1 ) cb.strokeColor=rightColor;
            else cb.strokeColor=(RightWrong[i+1][1]== 1)?%
partialColor:wrongColor;
        }
    }
    var f1=this.getField(qtfield+"SanityCheckPts");
    var f2=this.getField(qtfield+"SanityCheckOOPts");
    var h=this.getField(qtfield+"activateSC");
    if ( f1 != null ) {
        for ( var i = 1; i <= nQuestions; i++) {
            if ( ProbValue[i] == undefined ) ProbValue[i]=0
                // find the next non-null field
                var g=this.getField(qtfield+"SanityCheckPts."+i);
                var qpts=(ProbDist[i]==undefined) ? 0 : ProbDist[i];
                var thesePts= qpts + (( qpts == 1 )?%
" \eqptLabel":" \eqptsLabel");
                g.value = thesePts;
        }
    }
    if ( f2 != null ) {
        for ( var i = 1; i <= nQuestions; i++) {
            if ( ProbValue[i] == undefined ) ProbValue[i]=0
                // find the next non-null field
                var g=this.getField(qtfield+"SanityCheckOOPts."+i);
                var qpts=(ProbDist[i]==undefined) ? 0 : ProbDist[i];
                var ptValue = oQName.PtValues[i];
                var probPts = ptValue + (( ptValue == 1 )?%
" \eqptLabel":" \eqptsLabel");
                g.value = qpts +" \stOutOf\space"+probPts;
        }
    }
}
function popVisitsTbl(qtfield,nQuestions) {
    if ( aQuizControl[qtfield] == 1) {
        this.resetForm([qtfield+"SanityCheck"]);
        for ( var i=0; i < nQuestions; i++ ) {
            var f=this.getField(qtfield+"SanityCheck."+(i+1));
            f.checkThisBox(0,(typeof Responses[i+1]!="undefined"));
        }
    }
}
function fieldPopTbl(qtfield) {
    var f=this.getField(qtfield+"activateSC");
    if ( f != null) {
        var n=Number(f.userName);
        var a = [ qtfield, n ];
        popVisitsTbl.apply(null,a);
    }
}
\end{insDLJS}
\endinput
%%
%% End of file `aebsumrytbls.def'.