File:  [LON-CAPA] / loncom / html / adm / helper / parameter.helper
Revision 1.16: download - view: text, annotated - select for diffs
Tue May 16 21:41:18 2006 UTC (18 years, 1 month ago) by albertel
Branches: MAIN
CVS tags: HEAD
- hid the group option if course has no groups

    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: 
   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>
   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>
   39: 
   40:         <p>After the helper is done, you will be shown where in
   41:            the advanced interface you would have gone to set
   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?">
   51:     <message>Which problems do you wish to set a parameter for?</message>
   52:     <choices variable="GRANULARITY">
   53:       <choice computer="whole_course" nextstate="CHOOSE_ACTION">
   54:         Course default for all problems
   55:         </choice>
   56:       <choice computer="map" nextstate="CHOOSE_FOLDER">
   57:         Every problem in a particular folder (overrides course default)
   58:         </choice>
   59:       <choice computer="resource" nextstate="CHOOSE_RESOURCE">
   60:         One particular problem (overrides folder and course defaults)
   61:         </choice>
   62:       </choices>
   63:     </state>
   64: 
   65:   <state name="CHOOSE_FOLDER" title="Select Folder">
   66:     <message>Select the folder you wish to set the parameter for:</message>
   67: 
   68:     <resource variable="RESOURCE_ID">
   69:       <nextstate>CHOOSE_ACTION</nextstate>
   70:       <filterfunc>return $res->is_map()</filterfunc>
   71:       <valuefunc>return $res->map_pc();</valuefunc>
   72:       </resource>
   73:     </state>
   74: 
   75:   <state name="CHOOSE_RESOURCE" title="Select Problem">
   76:     <message>Select the problem you wish to set the parameter for:</message>
   77: 
   78:     <resource variable="RESOURCE_ID" nextstate="CHOOSE_ACTION" addparts="true">
   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">
   86:     <eval>return 'What parameter do you want to set for ' . 
   87:       &{$helper->{DATA}->{'levelType'}}()
   88:       . '?';
   89:       </eval>
   90:     <choices variable="ACTION_TYPE">
   91:       <nextstate>CHOOSE_DATE</nextstate>
   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>
   96:       <choice computer="weight" nextstate="CHOOSE_WEIGHT">Set the <b>problem weight</b></choice>
   97:       </choices>
   98:     </state>
   99: 
  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]+)?$/) { 
  107:                    return &mt('&quot; [_1] &quot; is not an acceptable weight. Weight must be a positive number.',$element->getValue());
  108:                  } 
  109:                  return undef;
  110:         </validator>
  111:       </string>
  112:     </state>
  113: 
  114:   <state name="CHOOSE_TRIES" title="Set Problem Tries">
  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]+$/) { 
  121:                    return &mt('&quot; [_1] &quot; is not an acceptable number of tries. Tries must be a positive number with no decimal point.',$element->getValue());} 
  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:       <condition>
  152:         <clause>return 1 if (&Apache::loncommon::coursegroups())</clause>
  153:         <choice computer="group" nextstate="CHOOSE_GROUP">
  154:            . . . for a particular <b>group</b></choice>
  155:       </condition>
  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: 
  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: 
  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>
  183:     <student variable="USER_NAME" nextstate="FINISH" coursepersonnel='1'/>
  184:     </state>
  185: 
  186:   <state name="FINISH" title="Verify Selection">
  187:     <parmwizfinal />
  188:     </state>
  189: 
  190:   </helper>

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