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

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

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