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

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

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