[LON-CAPA-cvs] cvs: loncom /html/adm/helper test.helper

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 11 Apr 2003 18:21:00 -0000


bowersj2		Fri Apr 11 14:21:00 2003 EDT

  Added files:                 
    /loncom/html/adm/helper	test.helper 
  Log:
  test.helper exercises the major features of the helper system. It is 
  meant for testing and will not be included in a normal install.
  
  

Index: loncom/html/adm/helper/test.helper
+++ loncom/html/adm/helper/test.helper
<helper title="Test Helper">
  <state name="START" title="Tom">
    <message>
      <message_text><p>Hey, bob, <b>this is great</b>!</p></message_text>
      <nextstate>Harry</nextstate>
      </message>
    <message>
      <message_text><p>This is <b>another message</b>!</p></message_text>
      </message>
    </state>
  <state name="Harry" title="Harry"> 
    <message>
      <message_text>This is Hairy Beatle, may I help you?</message_text>
      </message>
    <choices variable="harry">
      <choice computer='1' nextstate="Good">Yes</choice>
      <choice computer='0' nextstate="Bad">No</choice>
      </choices>
    </state>
  <state name="Good" title="Great!">
    <message>
      <message_text>I'm happy to hear I can help you. - Hairy Beetle</message_text>
      <nextstate>Sally</nextstate>
      </message>
    </state>
  <state name="Bad" title="Horrible!">
    <message>
      <message_text>I'm horrified to hear I can't help you. - Hairy Beetle</message_text>
      <nextstate>Sally</nextstate>
      </message>
    </state>
  <state name="Sally" title="Sally">
    <message>
      <message_text>Please select the kind of games you are interested in.<br /></message_text>
      </message>
    <choices variable="gametype" multichoice='1'>
      <nextstate>DATE</nextstate>
      <choice computer="rts"
        ><b>R</b>eal <b>T</b>ime <b>S</b>trategy</choice>
      <choice computer="puzzle"
        >P<i>u</i>z<i>z</i>l<i>e</i></choice>
      <condition><clause>return 0;</clause>
        <choice computer='shouldnotsee'>You should not see this.</choice>
      </condition>
      <condition><clause>return 1;</clause>
        <choice computer='shouldsee'>You should see this.</choice>
      </condition>
    <exec>
      push @{$state->{CHOICES}}, ['The Human Name!', 'compname'];
    </exec>
      </choices>
    </state>
  <state name="DATE" title="Choose a Date!">
    <message>
      <message_text>This is a test of the date state, with minutes:</message_text>
      </message>
    <date variable="date" hoursminutes='1'></date>
    <message>
      <message_text>and without:</message_text>
      </message>
    <date variable="date2">
      <nextstate>RESOURCE</nextstate>
      </date>
    </state>
  <state name="RESOURCE" title="Choose a resource">
    <message><message_text>Choose a resource</message_text></message>
    <resource variable="res1"></resource>
    <message><message_text>Choose a resource</message_text></message>
    <resource variable="res2">
      <filterfunc>return $res->is_map()</filterfunc>
      <nextstate>STUDENT</nextstate>
      </resource>    
    </state>
  <state name="STUDENT" title="Choose a Student">
    <message><message_text>Choose a student:<br /></message_text>
             <nextstate>FILES</nextstate></message>
    <student variable='stu1' />
    <student variable='stu2' multichoice='1' />
    </state>
  <state name="FILES" title="Choose some files">
    <message><message_text>Choose some files. Or else.</message_text></message>
    <files variable='files1'>
      <nextstate>FINAL</nextstate>
      <filechoice>return '/home/jerf/public_html';</filechoice>
      </files>
    <message><message_text>Choose some other files. Or else.</message_text></message>
    <files variable='files2' multichoice="1">
      <filechoice>return '/home/jerf/public_html';</filechoice>
      <filefilter>return $filename =~ /(.html$)|(.htm$)/;</filefilter>
      </files>
    </state>
  <state name="FINAL" title="Final State">
    <message><message_text>This is the final state.</message_text></message>
    </state>
  </helper>