Subversion Repositories wimsdev

Rev

Rev 152 | Rev 404 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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