File:  [LON-CAPA] / loncom / html / adm / helper / course.initialization.helper
Revision 1.12: download - view: text, annotated - select for diffs
Thu Jul 24 17:53:59 2003 UTC (20 years, 11 months ago) by matthew
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
Bug 679: Need to be able to disable chatroom.
   Added plc (permission for live chat).
   lonchat.pm and lonchatfetch.pm now both call &lonnet::allowed('plc',...)
   lonparmset.pm, loncreatecourse.pm, and course.initialization.helper
       now all allow setting $ENV{'course.'.$courseid.'.plc.roles.deny'}
       lonparmset.pm also allows the user to set
       $ENV{'course.'.$courseid.'.plc.users.deny'}
   lonmenu.pm was modified to allow us to require the user both be in
       a course AND have permissions.
   mydesk.tab, roles.tab, and rolesplain.tab were modified to include the
       new role.

    1: <helper title="Course Initialization Helper" requiredpriv='opa'>
    2: 
    3:   <exec>
    4:     my $courseid = $ENV{'request.course.id'};
    5:     my $crsdom = $ENV{'course.'.$courseid.'.domain'};
    6:     my $crsnum = $ENV{'course.'.$courseid.'.num'};
    7:     $helper->{DATA}->{DOM} = $crsdom;
    8:     $helper->{DATA}->{CRS} = $crsnum;
    9: 
   10:     $helper->{DATA}->{FIRST_RUN} = $ENV{'course.'.$crsnum.
   11:                                         '.course.intialization.not.run'};
   12:     # Delete the 'course.initialization.not.run' course environment
   13:     Apache::lonnet::put('environment', {'course.helper.not.run' => 0}, 
   14:                         $crsdom, $crsnum);
   15:     Apache::lonnet::coursedescription($ENV{'request.course.id'});
   16: 
   17:     $helper->{DATA}->{GETVAL} = sub {
   18:         my @resultlist = &Apache::lonnet::get('environment', [shift()], 
   19:                                               $helper->{DATA}->{DOM},
   20:                                               $helper->{DATA}->{CRS}); 
   21:         return $resultlist[1]; };
   22:     $helper->{DATA}->{SETVAL} = sub {
   23:         my $name = shift;
   24:         my $val = shift;
   25:         if (&{$helper->{DATA}->{GETVAL}}($name) ne $val) {
   26:             &Apache::lonnet::put('environment', {$name=>$val}, 
   27:                                  $helper->{DATA}->{DOM},
   28:                                  $helper->{DATA}->{CRS});
   29:             # Try to fix bug 1757
   30:             Apache::lonnet::coursedescription($ENV{'request.course.id'});
   31:             return 1;
   32:         } else {
   33:             return 0;
   34:         }
   35:     }
   36:   </exec>
   37: 
   38:   <state name="START" title="Welcome to Your New LON-CAPA Course">
   39:     <eval>
   40:       return $helper->{DATA}->{FIRST_RUN} ?
   41:         'This Helper will set up your new LON-CAPA course and choose '.
   42:         'which features will be active. You can '.
   43:         're-visit it later to change settings in your course.' .
   44: 
   45:         '<p>If you have previous experience with coordinating LON-CAPA courses and '.
   46:         'prefer not to use the helper, <a href="/adm/menu">click here</a> to leave.'
   47:         :
   48:         'This helper will set up your LON-CAPA course and choose ' .
   49:         'which features will be active.';
   50:       </eval>
   51:     <message nextstate="COURSE_DESCRIPTION">
   52:       <p>All settings which you can change with this Helper can also be changed
   53:          by going to the PARM screen and clicking on the &quot;Set
   54:          course environment&quot; button.</p>
   55: 
   56:       <p>If you do not have experience coordinating LON-CAPA courses or if you
   57:          prefer the Helper interface, please click <nobr><b>Next -&gt;</b></nobr>.</p>
   58:       </message>
   59:     </state>
   60: 
   61:   <state name="COURSE_DESCRIPTION" title="Course Description">
   62:     <message nextstate="FORBID_CHAT">
   63:       The &quot;Course Description&quot; is the name of the course that will be
   64:       seen by the students.  You may now modify the description and hit 
   65:       <nobr>&quot;<b>Next -&gt;</b>&quot;</nobr> to continue.<br />
   66:       </message>
   67:     <string variable='description' size='60' >
   68:       <defaultvalue>
   69:         return &{$helper->{DATA}->{GETVAL}}('description');
   70:       </defaultvalue>
   71:       <finalcode>
   72:         if (&{$helper->{DATA}->{SETVAL}}('description', $element->getValue())) {
   73:           return 'Course description changed to <b>' . $element->getValue() . 
   74:                  '</b>.';
   75:         }
   76:         </finalcode>
   77:       </string>
   78:     </state>
   79: 
   80:   <state name="FORBID_CHAT" title="Chat Participation">
   81:     <message nextstate="FORBID_DISCUSSION">
   82:       <p>LON-CAPA has live chat functionality.  This course will receive
   83:          its own chat room.  You may deny students, TAs, or instructors
   84:          the right to access the chat room.</p>
   85:       </message>
   86:     <choices variable="BANNED_CHAT_ROLES" multichoice="1" allowempty='1'>
   87:       <choice computer="st"><b>Students</b> - students will not be able to use or view the chat room.</choice>
   88:       <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able use or view the chat room</choice>
   89:       <choice computer="in"><b>Instructor</b> - instructors will not be able to use or view the chat room</choice>
   90:       <defaultvalue>
   91:         my $denied = &{$helper->{DATA}->{GETVAL}}('plch.roles.denied');
   92:         $denied =~ s/,/\|\|\|/g;
   93:         return $denied;
   94:       </defaultvalue>
   95:       <finalcode>
   96:         my $denied = $element->getValue();
   97:         $denied =~ s/\|\|\|/,/g;
   98:         if (&{$helper->{DATA}->{SETVAL}}('plc.roles.denied', $denied)) {
   99:             $denied =~ s/st/ students/;
  100:             $denied =~ s/in/ instructors/;
  101:             $denied =~ s/ta/ teaching assistants/;
  102:             $denied =~ s/ep/ exam proctors/;
  103:             if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
  104:                 $denied =~ s/,/ and/g;
  105:             } else { # add "and" to last comma
  106:                 $denied =~ s/,([^,]*)$/, and\1/;
  107:             }
  108:             if ($denied) {
  109:                 $denied = substr($denied, 1) . ' not allowed to participate in discussion.';
  110:                 $denied = ucfirst($denied);
  111:             } else {
  112:                 $denied = 'Everyone can participate in discussion.';
  113:             }
  114:             return $denied;
  115:         } else {
  116:             return '';
  117:         }
  118:       </finalcode>
  119:       </choices>
  120:     </state>
  121: 
  122:   <state name="FORBID_DISCUSSION" title="Discussion Participation">
  123:     <message nextstate="DISCUSSION_HTML">
  124:          LON-CAPA hosts discussions on all resources in a course. By default,
  125:          all users are allowed to participate in these discussions.
  126: 
  127:       <p>If you do not wish certain types of users to be able to use the 
  128:          discussion features, select those types below. Note your class
  129:          may not have all of these roles; you may safely ignore roles you
  130:          do not intend to use. (For instance, &quot;Exam Proctor&quot; is
  131:          generally useful only for large courses.)</p>
  132: 
  133:       <p>Types of users not allowed to participate in discussion can
  134:          still view any discussion that other users post.</p>
  135: 
  136:       </message>
  137:     <choices variable="BANNED_DISCUSSION_ROLES" multichoice="1" allowempty='1'>
  138:       <choice computer="st"><b>Students</b> - students will not be able to participate in discussions</choice>
  139:       <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able to participate in discussions</choice>
  140:       <choice computer="in"><b>Instructor</b> - instructors will not be able to participate in discussions</choice>
  141:       <defaultvalue>
  142:         my $denied = &{$helper->{DATA}->{GETVAL}}('pch.roles.denied');
  143:         $denied =~ s/,/\|\|\|/g;
  144:         return $denied;
  145:       </defaultvalue>
  146:       <finalcode>
  147:         my $denied = $element->getValue();
  148:         $denied =~ s/\|\|\|/,/g;
  149:         if (&{$helper->{DATA}->{SETVAL}}('pch.roles.denied', $denied)) {
  150:             $denied =~ s/st/ students/;
  151:             $denied =~ s/in/ instructors/;
  152:             $denied =~ s/ta/ teaching assistants/;
  153:             $denied =~ s/ep/ exam proctors/;
  154:             if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
  155:                 $denied =~ s/,/ and/g;
  156:             } else { # add "and" to last comma
  157:                 $denied =~ s/,([^,]*)$/, and\1/;
  158:             }
  159:             if ($denied) {
  160:                 $denied = substr($denied, 1) . ' not allowed to participate in discussion.';
  161:                 $denied = ucfirst($denied);
  162:             } else {
  163:                 $denied = 'Everyone can participate in discussion.';
  164:             }
  165:             return $denied;
  166:         } else {
  167:             return '';
  168:         }
  169:       </finalcode>
  170:       </choices>
  171:     </state>
  172: 
  173:   <state name="DISCUSSION_HTML" title="HTML in Discussions">
  174:     <message nextstate="FEEDBACK_ADDRESSES">
  175:       <p>HTML can be allowed or banned inside of course discussion.</p>
  176:       </message>
  177:     <choices variable="HTML_ALLOWED">
  178:       <choice computer=""><b>HTML banned</b>: HTML will not be allowed in discussion postings.</choice>
  179:       <choice computer="yes"><b>HTML allowed</b>: Discussion participants can use limited HTML in their postings.</choice>
  180:       <defaultvalue>
  181:         return &{$helper->{DATA}->{GETVAL}}('allow_limited_html_in_feedback');
  182:       </defaultvalue>
  183:       <finalcode>
  184:         if (&{$helper->{DATA}->{SETVAL}}('allow_limited_html_in_feedback', $element->getValue())) {
  185:           if ($element->getValue() eq 'yes') {
  186:             return 'Limited HTML allowed in feedback.';
  187:           } else {
  188:             return 'HTML not allowed in feedback.';
  189:           }
  190:         }
  191:         </finalcode>
  192:       </choices>
  193:     </state>
  194: 
  195:   <state name="FEEDBACK_ADDRESSES" title="Feedback Addresses for Course Content">
  196:     <message nextstate="FINAL">
  197:       Course members can provide feedback about the course. You can choose
  198:       who will receive the feedback, such as a different instructor or a
  199:       TA. Please enter their LON-CAPA address below, in the
  200:       form <b>user:domain</b>, where &quot;user&quot; and &quot;domain&quot;
  201:       are both the LON-CAPA username and LON-CAPA domain, not an email
  202:       address.</p> 
  203:       </message>
  204:     <eval>return '<p>Your current LON-CAPA domain is &quot;<b>' 
  205:                  . $helper->{DATA}->{DOM} .
  206:                  '</b>&quot;.</p>';
  207:       </eval>
  208:     <string variable='feedback_addresses' size='60' >
  209:       <defaultvalue>
  210:         return &{$helper->{DATA}->{GETVAL}}('comment.email');
  211:       </defaultvalue>
  212:       <finalcode>
  213:         if (&{$helper->{DATA}->{SETVAL}}('comment.email', $element->getValue())) {
  214:           return 'Comment address(es) updated to <b>' . $element->getValue() . 
  215:                  '</b>.';
  216:         }
  217:         </finalcode>
  218:       </string>
  219:     <message>
  220:       <p><b>Advanced</b>: You can send the feedback from different sections
  221:          to different people, by doing the following:</p>
  222: 
  223:       <ul><li>Separate each entry with a comma.</li>
  224:           <li>To send feedback to a certain address for different sections,
  225:               append the section name or names (separated by semi-colons)
  226:               in a parenthesized list after the <b>user:domain</b>.</li></ul>
  227: 
  228:       <p>For example,</p>
  229: 
  230:       <p><b>john102:msu(001;002;003),bob293:msu(004;005;006),madeupname:here(007;008;009)</b></p>
  231: 
  232:       <p>will route course feedback to &quot;john102&quot; for sections 1, 2, and 3, to
  233:          &quot;bob293&quot; for 4, 5, and 6, and to &quot;madeupname:here&quot; for
  234:          7, 8, and 9. Note there is no requirement that the addresses be in any
  235:          particular domain.</p>
  236:       </message>
  237:     </state>
  238: 
  239:   <state name="FINAL" title="Completed">
  240:     <message>Your course is now set up. Please select the <b>Finish Course 
  241:       Initialization</b> button to re-intialize the course with your chosen
  242:       settings.
  243: 
  244:       <p>Remember that all of these settings can be modified in the <b>PARMS</b>
  245:          screen, by pushing the <b>Course Environment</b> button.</p>
  246:       </message>
  247:     <final restartCourse='1' />
  248:     </state>
  249:   </helper>

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