Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
67 bpr 1
!set special_list=imagefill,expandlines,rename,help,tooltip
20 reyssat 2
 
3
<p><center><h2>Advanced features of OEF</h2></center>
4
 
5
<h3>Hiding image names</h3>
6
If your exercise requires recognition of a randomly picked picture, the file
7
name of the picture might give clue to the exercise. In order to hide this
8
file name, you can write
9
 
10
<pre>\img{\imagedir/picture.jpg align=middle alt="picture"}</pre>
11
 
12
Then on the browser, the student will see
13
 
14
<pre>&lt;img src="a_random_unrelated_file_name" align=middle alt="picture"&gt;</pre>
15
 
16
The true file name is thus hidden to the student.
17
 
18
<p><b>Note</b>. Don't use directly the WIMS command <em>rename</em> to
19
process the file name, or the exercise won't work correctly under saved
20
environment.
21
 
22
<h3>Multi-step exercises</h3>
23
Multi-step exercises can be defined via the command <tt>\steps</tt>. For
24
example, if you define (among parameters)
25
 
26
<pre>\steps{choice 1, reply 1
27
choice 2, reply 2, reply 3
28
choice 3
29
}</pre>
30
 
31
the exercise will be presented with 3 steps, the first asks for a multiple
32
choice (choice 1) and a freestyle reply (reply 1), the second a multiple
33
choice and two freestyle replies, etc.
34
<p>
35
The content of <tt>\steps</tt> accepts (earlier-defined) parameters as well as
36
conditional definitions, in the same way as the definition of parameters.
37
This allows you to selectively present response
38
fields (according to random variations of parameters), even in the case
39
where there is only one step.
40
<p>
41
It is to be noted that if a user makes a mistake in
42
an early step, subsequent steps will not be presented (and will be
43
considered all wrong).
44
<p>
45
The current step number is available to the statement of the exercise,
46
via the variable
47
<tt>\step</tt> which takes successively the values of 1,2,... when the user
48
advances in his/her answering.
49
<p>
50
To make dynamic multi-step exercises (steps varying with student answers), you
51
can use the command <tt>\nextstep{...}</tt>. The content of
52
<tt>\nextstep</tt> is the similar to <tt>\steps</tt> but only the first line
53
is effective. It is useful only when the content is given by a variable
54
which is changed by post-reply parameter definitions. The exercise stops when
55
the content of <tt>\nextstep</tt> is empty at some step.
56
<p>
57
In any case, at most one declaration <tt>\steps</tt> or <tt>\nextstep</tt>
58
should appear in an OEF source.
59
 
60
<h3>Conditional branching and loops</h3>
61
 
62
Available commands:
63
 
64
<pre>
65
\if{condition}{if_content}
66
\if{condition}{if_content}{otherwise_content}
67
\for{var=n1 to n2}{loop_content}
68
\while{condition}{loop_content}     (main environment only)
69
</pre>
70
 
71
These commands can be used either within statement, hint, solution or
72
feedback, or in the main environment. In the latter case, the conditional
73
execution only affects parameter definitions.
74
 
1179 bpr 75
<a name=special></a>
76
<h3>Special methods</h3>
20 reyssat 77
 
78
With the command <tt>\special{...}</tt> in the statement of an exercise, the
79
following special methods are available:
80
<p>
81
!if $special_parm=all
82
 !for sp in $special_list
83
  <p><center><h4>The special method <tt>$sp</tt></h4></center> <p>
84
  General syntax: <tt>\special{$sp <i>parameters</i>}</tt> <p>
85
 
86
  !read oef/special/$sp.phtml help
87
 !next sp
88
!else
89
 !for sp in $special_list
90
  !href cmd=help&special_parm=oefadv&special_parm2=$sp#special $sp
91
  &nbsp;
92
 !next sp
93
!endif
94
 
95
!if $special_parm2 isitemof $special_list
96
<p><center><h4>The special method <tt>$special_parm2</tt></h4></center> <p>
97
General syntax: <tt>\special{$special_parm2 <i>parameters</i>}</tt> <p>
98
 
99
!read oef/special/$special_parm2.phtml help
100
!endif
101
 
102
<h3>Preprocessed sources</h3>
103
 
104
This feature is not available for Createxo. You can use it if you write OEF
105
(and Deductio) exercises under Modtool.
106
<p>
107
It allows you to include common portions of codes into several oef files.
108
You can also use it to make batch generation of several oefs from one
109
pre-source, each differing from the others by some macro definitions.
110
<p>
111
To use this feature, a subdirectory cpp/ should be created under src. Put
112
into it pre-source files with extension .cpp. In these files, you can add
113
cpp directives like <tt>#include</tt> or <tt>#if</tt>. (Please refer to cpp
114
manual and c specification for details of the syntax.)
115
<p>
116
The first line of the cpp file must define a list of targets, in the format
117
<pre>
118
target=targ1 targ2 targ3 ...
119
</pre>
2664 reyssat 120
This line means that this cpp file should generate targ1.oef, targ2.oef, etc.
20 reyssat 121
(the extension .oef will be
122
appended to the output names). When generating the target file <em>targ1</em>, the
123
predicate <tt>#TARGET</tt> will be defined as <em>targ1</em>. (And a macro
124
<em>TARGET_targ1</em> is also defined.)
125
Therefore in the cpp source file, you can add lines like
126
<pre>
127
#if #TARGET (targ1)
128
 \title{Exercise 1}
129
 \integer{v1=3}
130
 \text{t1=this is target 1}
131
#endif
132
#if #TARGET (targ2)
133
 \title{Exercise 2}
134
 \integer{v1=5}
135
 \text{t1=this is target 2}
136
#endif
137
</pre>
138
in order to make the contents target-dependent.
139
<p>
140
Include files should also be put into the src/cpp directory, with extension
141
.inc. And a line
142
<pre>
143
#include "common.inc"
144
</pre>
145
will insert the content of common.inc into the generated oef file.
146
Please note that for security reasons, it is prohibited to specify
147
directories of include files.
148
<p>
149
A special remark: cpp gets confused when your file contains single or double
150
quotes in the text that are not closed. In this case, you can protect the
151
commands containing such texts by c comments (<tt>/* ... */</tt>).
152
 
153
<h3>Exercise environment</h3>
154
A special variable <tt>\oefenv</tt> can be used to test the environment of
155
an exercise (if it is not redefined within the exercise).
156
<p>
157
For the time being, the only testable content of the variable is the word
158
``debug''. This word appears within <tt>\oefenv</tt> in the following
159
situations: <ol>
160
<li>When it is executed within Createxo.
161
<li>When it is under test in Modtool, by the developer himself.
162
<li>When it is a class exercise and is executed by the supervisor.
163
</ol>
164
Note that in these cases, the good reply will appear as default in the input
165
fields of many types, allowing you to see what the exercise expects without
166
typing into the fields.
167
<p>
168
You may add debugging informations into your exercise using things like
169
<pre>
170
\if{debug iswordof \oefenv}{debugging informations to add into}
171
</pre>
172
These debugging informations will be automatically shown when the exercise
173
is under test, and automatically hidden when students work on it.
174
 
152 bpr 175