Annotation of loncom/html/adm/helper/parameter.helper, revision 1.4

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

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