File:  [LON-CAPA] / loncom / html / adm / helper / parameter.helper
Revision 1.3: download - view: text, annotated - select for diffs
Thu May 29 16:38:01 2003 UTC (21 years, 1 month ago) by bowersj2
Branches: MAIN
CVS tags: version_0_99_2, version_0_99_1, conference_2003, HEAD
Half of a fix for bug 1511, param helper doesn't work for maps.

    1: <helper title="Course Parameter Helper" requiredpriv='opa'>
    2: 
    3:   <exec>
    4:     my %dateTypeHash = ('open_date' => "opening date",
    5:                         'due_date' => "due date",
    6:                         'answer_date' => "answer open date");
    7:     my %levelTypeHash = ('whole_course' => "all problems in the course",
    8:                          'map' => 'the selected folder',
    9:                          'resource' => 'the selected problem');
   10:     $helper->{DATA}->{'dateTypeHash'} = \%dateTypeHash;
   11:     $helper->{DATA}->{'levelTypeHash'} = \%levelTypeHash;
   12: 
   13:     $helper->{DATA}->{'levelType'} = sub { 
   14:            return $helper->{DATA}->{'levelTypeHash'}->{$helper->{VARS}->{GRANULARITY}};
   15:        };
   16: 
   17:     $helper->{DATA}->{'dateType'} = sub { 
   18:            return $helper->{DATA}->{'dateTypeHash'}->{$helper->{VARS}->{ACTION_TYPE}};
   19:        };
   20: 
   21:   </exec>
   22: 
   23:   <state name="START" title="Welcome to the Assignment Parameter Helper">
   24:     <message nextstate="CHOOSE_LEVEL">
   25:         <p>This wizard will allow you to <b>set open, due, and 
   26:            answer dates for problems</b>. You will be asked to 
   27:            select a problem, what kind of date you want to set, 
   28:            and for whom the date should be effective.</p>
   29: 
   30:         <p>After the wizard is done, you will be shown where in
   31:            the advanced interface you would have gone to change
   32:            the parameter you have chosen, so in the future you
   33:            can do it directly.</p>
   34: 
   35:         <p>Press <b>Next -&gt;</b> to begin, or select <b>&lt;- 
   36:            Previous</b> to go back to the previous screen.</p>
   37:       </message>    
   38:     </state>
   39: 
   40:   <state name="CHOOSE_LEVEL" title="Which Problem or Problems?">
   41:     <message>Which problems do you wish to change a date for?</message>
   42:     <choices variable="GRANULARITY">
   43:       <choice computer="whole_course" nextstate="CHOOSE_ACTION">
   44:         <b>Every problem</b> in the course
   45:         </choice>
   46:       <choice computer="map" nextstate="CHOOSE_FOLDER">
   47:         Every problem in a particular <b>folder</b>
   48:         </choice>
   49:       <choice computer="resource" nextstate="CHOOSE_RESOURCE">
   50:         One particular <b>problem</b>
   51:         </choice>
   52:       </choices>
   53:     </state>
   54: 
   55:   <state name="CHOOSE_FOLDER" title="Select Folder">
   56:     <message>Select the folder you wish to set the date for:</message>
   57: 
   58:     <resource variable="RESOURCE_ID">
   59:       <nextstate>CHOOSE_ACTION</nextstate>
   60:       <filterfunc>return $res->is_map()</filterfunc>
   61:       <valuefunc>return $res->map_pc();</valuefunc>
   62:       </resource>
   63:     </state>
   64: 
   65:   <state name="CHOOSE_RESOURCE" title="Select Problem">
   66:     <message>Select the problem you wish to change the date for:</message>
   67: 
   68:     <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION">
   69:       <nextstate>CHOOSE_ACTION</nextstate>
   70:       <filterfunc>return $res->is_map || $res->is_problem()</filterfunc>
   71:       <choicefunc>return $res->is_problem()</choicefunc>
   72:       </resource>
   73:     </state>
   74: 
   75:   <state name="CHOOSE_ACTION" title="Parameter Type">
   76:     <eval>return 'What parameters do you want to set for ' . 
   77:       &{$helper->{DATA}->{'levelType'}}()
   78:       . '?';
   79:       </eval>
   80:     <choices variable="ACTION_TYPE">
   81:       <nextstate>CHOOSE_DATE</nextstate>
   82:       <choice computer="open_date">Set an <b>open date</b></choice>
   83:       <choice computer="due_date">Set a <b>due date</b></choice>
   84:       <choice computer="answer_date">Set an <b>answer open date</b></choice>
   85:       </choices>
   86:     </state>
   87: 
   88:   <state name="CHOOSE_DATE" title="Set Date">
   89:     <eval>
   90:       return 'What should the ' .
   91:        &{$helper->{DATA}->{'dateType'}}() .
   92:        ' be set to? <br /><br />';
   93:       </eval>
   94:     <date variable="PARM_DATE" hoursminutes='1'>
   95:       <nextstate>CHOOSE_STUDENT_LEVEL</nextstate>
   96:       </date>
   97:     </state>
   98: 
   99:   <state name="CHOOSE_STUDENT_LEVEL" title="Students Affected">
  100:     <eval>
  101:       return 'Set ' . 
  102:        &{$helper->{DATA}->{'dateType'}}() .
  103:         ' of ' .
  104:        &{$helper->{DATA}->{'levelType'}}() .
  105:         ' for. . .';
  106:       </eval>
  107:     <choices variable="TARGETS">
  108:       <choice computer="course" nextstate="FINISH">
  109:          . . . for <b>all students</b> in the course</choice>
  110:       <choice computer="section" nextstate="CHOOSE_SECTION">
  111:          . . . for a particular <b>section</b></choice>
  112:       <choice computer="student" nextstate="CHOOSE_STUDENT">
  113:          . . . for an individual <b>student</b></choice>
  114:       </choices>
  115:     </state>
  116: 
  117:   <state name="CHOOSE_SECTION" title="Select Section">
  118:     <eval>
  119:       return 'Please select the section you wish to set the ' .
  120:        &{$helper->{DATA}->{'dateType'}}() .
  121:          ' for:<br />';</eval>
  122:     <section variable="SECTION_NAME" nextstate="FINISH" />
  123:     </state>
  124: 
  125:   <state name="CHOOSE_STUDENT" title="Select Student">
  126:     <eval>
  127:       return 'Please select the student you wish to set the ' .
  128:        &{$helper->{DATA}->{'dateType'}}() .
  129:          ' for:<br />';</eval>
  130:     <student variable="USER_NAME" nextstate="FINISH" />
  131:     </state>
  132: 
  133:   <state name="FINISH" title="Verify Selection">
  134:     <parmwizfinal />
  135:     </state>
  136: 
  137:   </helper>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>