File:  [LON-CAPA] / loncom / html / adm / helper / parameter.helper
Revision 1.5: download - view: text, annotated - select for diffs
Wed Jul 23 19:26:01 2003 UTC (20 years, 11 months ago) by bowersj2
Branches: MAIN
CVS tags: version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, HEAD
Show course personnel for modifying parameters.

    1: <helper title="Course Parameter Helper" requiredpriv='opa'>
    2: 
    3:   <exec>
    4:     # 'dateTypeHash' should really be renamed now that we have tries...
    5:     my %dateTypeHash = ('open_date' => "opening date",
    6:                         'due_date' => "due date",
    7:                         'answer_date' => "answer open date",
    8:                         'tries' => 'number of tries'
    9:                        );
   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">
   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>
   36: 
   37:         <p>After the helper is done, you will be shown where in
   38:            the advanced interface you would have gone to set
   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?">
   48:     <message>Which problems do you wish to set a parameter for?</message>
   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">
   54:         Every problem in <b>a particular folder</b>
   55:         </choice>
   56:       <choice computer="resource" nextstate="CHOOSE_RESOURCE">
   57:         <b>One particular problem</b>
   58:         </choice>
   59:       </choices>
   60:     </state>
   61: 
   62:   <state name="CHOOSE_FOLDER" title="Select Folder">
   63:     <message>Select the folder you wish to set the parameter for:</message>
   64: 
   65:     <resource variable="RESOURCE_ID">
   66:       <nextstate>CHOOSE_ACTION</nextstate>
   67:       <filterfunc>return $res->is_map()</filterfunc>
   68:       <valuefunc>return $res->map_pc();</valuefunc>
   69:       </resource>
   70:     </state>
   71: 
   72:   <state name="CHOOSE_RESOURCE" title="Select Problem">
   73:     <message>Select the problem you wish to set the parameter for:</message>
   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">
   83:     <eval>return 'What parameter do you want to set for ' . 
   84:       &{$helper->{DATA}->{'levelType'}}()
   85:       . '?';
   86:       </eval>
   87:     <choices variable="ACTION_TYPE">
   88:       <nextstate>CHOOSE_DATE</nextstate>
   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>
   93:       </choices>
   94:     </state>
   95: 
   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: 
  111:   <state name="CHOOSE_DATE" title="Set Date">
  112:     <eval>
  113:       return 'What should the ' .
  114:        &{$helper->{DATA}->{'dateType'}}() . 
  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'}}() .
  126:         'for ' .
  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" coursepersonnel='1'/>
  154:     </state>
  155: 
  156:   <state name="FINISH" title="Verify Selection">
  157:     <parmwizfinal />
  158:     </state>
  159: 
  160:   </helper>

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