File:  [LON-CAPA] / loncom / html / adm / helper / parameter.helper
Revision 1.8: download - view: text, annotated - select for diffs
Tue Apr 20 18:03:00 2004 UTC (20 years, 2 months ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
Small correction - added empty space between words.

    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:                         'weight' => 'problem weight'
   10:                        );
   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">
   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>
   37: 
   38:         <p>After the helper is done, you will be shown where in
   39:            the advanced interface you would have gone to set
   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?">
   49:     <message>Which problems do you wish to set a parameter for?</message>
   50:     <choices variable="GRANULARITY">
   51:       <choice computer="whole_course" nextstate="CHOOSE_ACTION">
   52:         Course default for all problems
   53:         </choice>
   54:       <choice computer="map" nextstate="CHOOSE_FOLDER">
   55:         Every problem in a particular folder (overrides course default)
   56:         </choice>
   57:       <choice computer="resource" nextstate="CHOOSE_RESOURCE">
   58:         One particular problem (overrides folder and course defaults)
   59:         </choice>
   60:       </choices>
   61:     </state>
   62: 
   63:   <state name="CHOOSE_FOLDER" title="Select Folder">
   64:     <message>Select the folder you wish to set the parameter for:</message>
   65: 
   66:     <resource variable="RESOURCE_ID">
   67:       <nextstate>CHOOSE_ACTION</nextstate>
   68:       <filterfunc>return $res->is_map()</filterfunc>
   69:       <valuefunc>return $res->map_pc();</valuefunc>
   70:       </resource>
   71:     </state>
   72: 
   73:   <state name="CHOOSE_RESOURCE" title="Select Problem">
   74:     <message>Select the problem you wish to set the parameter for:</message>
   75: 
   76:     <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION">
   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">
   84:     <eval>return 'What parameter do you want to set for ' . 
   85:       &{$helper->{DATA}->{'levelType'}}()
   86:       . '?';
   87:       </eval>
   88:     <choices variable="ACTION_TYPE">
   89:       <nextstate>CHOOSE_DATE</nextstate>
   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>
   94:       <choice computer="weight" nextstate="CHOOSE_WEIGHT">Set the <b>problem weight</b></choice>
   95:       </choices>
   96:     </state>
   97: 
   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]+)?$/) { 
  105:                    return '&quot;' . $element->getValue() . '&quot; is not '.
  106:                      'an acceptable weight. Weight must be a positive number. ';} 
  107:                  return undef;
  108:         </validator>
  109:       </string>
  110:     </state>
  111: 
  112:   <state name="CHOOSE_TRIES" title="Set Problem Tries">
  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]+$/) { 
  119:                    return '&quot;' . $element->getValue() . '&quot; is not '.
  120:                      'an acceptable number of tries. Tries must be a positive number ' .
  121:                      'with no decimal point.';} 
  122:                  return undef;
  123:         </validator>
  124:       </string>
  125:     </state>
  126: 
  127:   <state name="CHOOSE_DATE" title="Set Date">
  128:     <eval>
  129:       return 'What should the ' .
  130:        &{$helper->{DATA}->{'dateType'}}() . 
  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'}}() .
  142:         ' for ' .
  143:        &{$helper->{DATA}->{'levelType'}}() .
  144:         ' for. . .';
  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>
  151:       <choice computer="student" nextstate="CHOOSE_STUDENT">
  152:          . . . for an individual <b>student</b></choice>
  153:       </choices>
  154:     </state>
  155: 
  156:   <state name="CHOOSE_SECTION" title="Select Section">
  157:     <eval>
  158:       return 'Please select the section you wish to set the ' .
  159:        &{$helper->{DATA}->{'dateType'}}() .
  160:          ' for:<br />';</eval>
  161:     <section variable="SECTION_NAME" nextstate="FINISH" />
  162:     </state>
  163: 
  164:   <state name="CHOOSE_STUDENT" title="Select Student">
  165:     <eval>
  166:       return 'Please select the student you wish to set the ' .
  167:        &{$helper->{DATA}->{'dateType'}}() .
  168:          ' for:<br />';</eval>
  169:     <student variable="USER_NAME" nextstate="FINISH" coursepersonnel='1'/>
  170:     </state>
  171: 
  172:   <state name="FINISH" title="Verify Selection">
  173:     <parmwizfinal />
  174:     </state>
  175: 
  176:   </helper>

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