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

1.20      raeburn     1: <helper title="Course Parameter Helper" requiredpriv='opa&S'>
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>
1.23    ! raeburn    56:      <condition>
        !            57:         <clause>return 1 if (&Apache::lonnet::get_server_loncaparev($env{'course.'.$env{'request.course.id'}.'.home'}) >= 2.12)</clause>
        !            58:         <choice computer="maprecurse" nextstate="CHOOSE_FOLDER">
        !            59:         Every problem in a particular folder and (recursively) for sub-folders 
        !            60:         (overrides course default)
        !            61:         </choice>
        !            62:       <condition>
1.1       bowersj2   63:       <choice computer="map" nextstate="CHOOSE_FOLDER">
1.7       albertel   64:         Every problem in a particular folder (overrides course default)
1.1       bowersj2   65:         </choice>
                     66:       <choice computer="resource" nextstate="CHOOSE_RESOURCE">
1.7       albertel   67:         One particular problem (overrides folder and course defaults)
1.1       bowersj2   68:         </choice>
                     69:       </choices>
                     70:     </state>
                     71: 
                     72:   <state name="CHOOSE_FOLDER" title="Select Folder">
1.4       bowersj2   73:     <message>Select the folder you wish to set the parameter for:</message>
1.1       bowersj2   74: 
                     75:     <resource variable="RESOURCE_ID">
                     76:       <nextstate>CHOOSE_ACTION</nextstate>
                     77:       <filterfunc>return $res->is_map()</filterfunc>
1.3       bowersj2   78:       <valuefunc>return $res->map_pc();</valuefunc>
1.1       bowersj2   79:       </resource>
                     80:     </state>
                     81: 
                     82:   <state name="CHOOSE_RESOURCE" title="Select Problem">
1.4       bowersj2   83:     <message>Select the problem you wish to set the parameter for:</message>
1.1       bowersj2   84: 
1.13      albertel   85:     <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION" addparts="true">
1.1       bowersj2   86:       <nextstate>CHOOSE_ACTION</nextstate>
                     87:       <filterfunc>return $res->is_map || $res->is_problem()</filterfunc>
                     88:       <choicefunc>return $res->is_problem()</choicefunc>
                     89:       </resource>
                     90:     </state>
                     91: 
                     92:   <state name="CHOOSE_ACTION" title="Parameter Type">
1.19      wenzelju   93:     <eval>return &mt('What parameter do you want to set for ' . 
1.1       bowersj2   94:       &{$helper->{DATA}->{'levelType'}}()
1.19      wenzelju   95:       . '?');
1.1       bowersj2   96:       </eval>
                     97:     <choices variable="ACTION_TYPE">
                     98:       <nextstate>CHOOSE_DATE</nextstate>
1.4       bowersj2   99:       <choice computer="open_date" nextstate="CHOOSE_DATE">Set an <b>open date</b></choice>
                    100:       <choice computer="due_date" nextstate="CHOOSE_DATE">Set a <b>due date</b></choice>
                    101:       <choice computer="answer_date" nextstate="CHOOSE_DATE">Set an <b>answer open date</b></choice>
                    102:       <choice computer="tries" nextstate="CHOOSE_TRIES">Set the <b>number of tries</b></choice>
1.6       bowersj2  103:       <choice computer="weight" nextstate="CHOOSE_WEIGHT">Set the <b>problem weight</b></choice>
1.1       bowersj2  104:       </choices>
                    105:     </state>
                    106: 
1.6       bowersj2  107:   <state name="CHOOSE_WEIGHT" title="Set Problem Weight">
1.19      wenzelju  108:     <eval>return &mt('What weight should be set for ' . 
1.6       bowersj2  109:       &{$helper->{DATA}->{'levelType'}}()
1.19      wenzelju  110:       . '?').'<br />';
1.6       bowersj2  111:       </eval>
                    112:     <string nextstate="CHOOSE_STUDENT_LEVEL" variable="WEIGHT">
                    113:       <validator>if ($val !~ /^[1234567890]+(\.[1234567890]+)?$/) { 
1.18      bisitz    114:                    return &mt('[_1] is not an acceptable weight. Weight must be a positive number.','&quot;'.$element->getValue().'&quot;');
1.10      albertel  115:                  } 
1.6       bowersj2  116:                  return undef;
                    117:         </validator>
                    118:       </string>
                    119:     </state>
                    120: 
                    121:   <state name="CHOOSE_TRIES" title="Set Problem Tries">
1.19      wenzelju  122:     <eval>return &mt('How many tries should be set for ' . 
1.4       bowersj2  123:       &{$helper->{DATA}->{'levelType'}}()
1.19      wenzelju  124:       . '?').'<br />';
1.4       bowersj2  125:       </eval>
                    126:     <string nextstate="CHOOSE_STUDENT_LEVEL" variable="TRIES">
                    127:       <validator>if ($val !~ /^[1234567890]+$/) { 
1.18      bisitz    128:                    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  129:                  return undef;
                    130:         </validator>
                    131:       </string>
                    132:     </state>
                    133: 
1.1       bowersj2  134:   <state name="CHOOSE_DATE" title="Set Date">
                    135:     <eval>
1.19      wenzelju  136:       return &mt('What should the ' .
1.4       bowersj2  137:        &{$helper->{DATA}->{'dateType'}}() . 
1.19      wenzelju  138:        ' be set to?').'<br /><br />';
1.1       bowersj2  139:       </eval>
                    140:     <date variable="PARM_DATE" hoursminutes='1'>
                    141:       <nextstate>CHOOSE_STUDENT_LEVEL</nextstate>
                    142:       </date>
                    143:     </state>
                    144: 
                    145:   <state name="CHOOSE_STUDENT_LEVEL" title="Students Affected">
                    146:     <eval>
1.19      wenzelju  147:       return &mt('Set ' . 
1.1       bowersj2  148:        &{$helper->{DATA}->{'dateType'}}() .
1.8       sakharuk  149:         ' for ' .
1.1       bowersj2  150:        &{$helper->{DATA}->{'levelType'}}() .
1.19      wenzelju  151:         ' for ...');
1.1       bowersj2  152:       </eval>
                    153:     <choices variable="TARGETS">
1.20      raeburn   154:       <condition>
                    155:         <clause>return 1 if ($env{'request.course.sec'} eq '')</clause>
                    156:         <choice computer="course" nextstate="FINISH">
                    157:            . . . for <b>all students</b> in the course</choice>
                    158:       </condition>
1.1       bowersj2  159:       <choice computer="section" nextstate="CHOOSE_SECTION">
                    160:          . . . for a particular <b>section</b></choice>
1.16      albertel  161:       <condition>
1.22      raeburn   162:         <clause>return 1 if (($env{'request.course.groups'} ne '') || (&Apache::lonnet::allowed('mdg',$env{'request.course.id'}) && (&Apache::longroup::coursegroups())))</clause>
1.16      albertel  163:         <choice computer="group" nextstate="CHOOSE_GROUP">
                    164:            . . . for a particular <b>group</b></choice>
                    165:       </condition>
1.1       bowersj2  166:       <choice computer="student" nextstate="CHOOSE_STUDENT">
1.21      raeburn   167:          . . . for an individual <b>student</b> or <b>user</b></choice>
1.1       bowersj2  168:       </choices>
                    169:     </state>
                    170: 
                    171:   <state name="CHOOSE_SECTION" title="Select Section">
                    172:     <eval>
1.19      wenzelju  173:       return &mt('Please select the section you wish to set the ' .
1.1       bowersj2  174:        &{$helper->{DATA}->{'dateType'}}() .
1.19      wenzelju  175:          ' for:').'<br />';</eval>
1.20      raeburn   176:     <section variable="SECTION_NAME" nextstate="FINISH" onlysections="1" />
1.1       bowersj2  177:     </state>
                    178: 
1.15      raeburn   179:   <state name="CHOOSE_GROUP" title="Select Group">
                    180:     <eval>
1.19      wenzelju  181:       return &mt('Please select the group you wish to set the ' .
1.15      raeburn   182:        &{$helper->{DATA}->{'dateType'}}() .
1.19      wenzelju  183:          ' for:').'<br />';</eval>
1.22      raeburn   184:     <group variable="GROUP_NAME" nextstate="FINISH" grouponly="1" />
1.15      raeburn   185:     </state>
                    186: 
                    187: 
1.21      raeburn   188:   <state name="CHOOSE_STUDENT" title="Select User">
1.1       bowersj2  189:     <eval>
1.21      raeburn   190:       return &mt('Please select the person you wish to set the ' .
1.1       bowersj2  191:        &{$helper->{DATA}->{'dateType'}}() .
1.19      wenzelju  192:          ' for:').'<br />';</eval>
1.21      raeburn   193:     <student variable="USER_NAME" nextstate="FINISH" coursepersonnel="1" sectiononly="1" />
1.1       bowersj2  194:     </state>
                    195: 
                    196:   <state name="FINISH" title="Verify Selection">
                    197:     <parmwizfinal />
                    198:     </state>
                    199: 
                    200:   </helper>

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