File:  [LON-CAPA] / loncom / html / adm / helper / course.initialization.helper
Revision 1.2: download - view: text, annotated - select for diffs
Fri May 16 17:21:33 2003 UTC (21 years, 2 months ago) by bowersj2
Branches: MAIN
CVS tags: version_0_99_0, HEAD
Require the users of the parameter helper and course initialization helper
to have the 'opa' priviledge of setting parameters.

    1: <helper title="Course Initialization Helper" requiredpriv='opa'>
    2: 
    3:   <exec>
    4:     $helper->{DATA}->{DOM} = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
    5:     $helper->{DATA}->{CRS} = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
    6: 
    7:     $helper->{DATA}->{GETVAL} = sub {
    8:         my @resultlist = &Apache::lonnet::get('environment', [shift()], 
    9:                                               $helper->{DATA}->{DOM},
   10:                                               $helper->{DATA}->{CRS}); 
   11:         return $resultlist[1]; };
   12:     $helper->{DATA}->{SETVAL} = sub {
   13:         my $name = shift;
   14:         my $val = shift;
   15:         if (&{$helper->{DATA}->{GETVAL}}($name) ne $val) {
   16:             &Apache::lonnet::put('environment', {$name=>$val}, 
   17:                                  $helper->{DATA}->{DOM},
   18:                                  $helper->{DATA}->{CRS}); 
   19:             return 1;
   20:         } else {
   21:             return 0;
   22:         }
   23:     }
   24:   </exec>
   25: 
   26:   <state name="START" title="Welcome to Your New LON-CAPA Course">
   27:     <message nextstate="FORBID_DISCUSSION">
   28:          This Helper will help you set up your new LON-CAPA course and choose
   29:          which LON-CAPA features will be active in your course. You can 
   30:          re-visit it later to change settings in your course.
   31: 
   32:       <p><b>FIXME:</b> Figure out some way to detect whether this has been
   33:          run, and change that paragraph appropriatly.</p>
   34: 
   35:       <p>If you have previous experience with coordinating LON-CAPA courses and
   36:          prefer not to use the Helper,
   37:          <a href="/adm/navmaps">click here</a> to leave this Helper.</p>
   38: 
   39:       <p>All settings which you can change with this Helper can also be changed while the
   40:          course is running by going to the PARM screen and clicking on the &quot;Set
   41:          course environment&quot; button.</p>
   42: 
   43:       <p>If you do not have experience coordinating LON-CAPA courses, or if you
   44:          prefer the Helper interface, please click <nobr><b>Next -&gt;</b></nobr>.</p>
   45:       </message>
   46:     </state>
   47: 
   48:   <state name="FORBID_DISCUSSION" title="Discussion Participation">
   49:     <message nextstate="DISCUSSION_HTML">
   50:          LON-CAPA hosts discussions on all resources in a course. By default,
   51:          all users are allowed to participate in these discussions.
   52: 
   53:       <p>For more information about discussion and the abilities available
   54:          to you as a course coordinator, such as banning abusive users or
   55:          hiding discussion postings, please see <b>link</b>.</p>
   56: 
   57:       <p>If you do not wish certain classes of users to be able to use the 
   58:          discussion features, select those classes below. Note your class
   59:          may not have all of these roles; you may safely ignore roles you
   60:          do not intend to use. (For instance, &quot;Exam Proctor&quot; is
   61:          generally useful only for large courses.)</p>
   62: 
   63:       <p><b>Question: Does inability to use discussion mean they simply can't
   64:             post, or that they can't see the discussion at all?</b></p>
   65:       </message>
   66:     <choices variable="BANNED_DISCUSSION_ROLES" multichoice="1" allowempty='1'>
   67:       <choice computer="st"><b>Students</b> - students will not be able to participate in discussions</choice>
   68:       <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able to participate in discussions</choice>
   69:       <choice computer="in"><b>Instructor</b> - instructors will not be able to participate in discussions</choice>
   70:       <choice computer="ep"><b>Exam Proctor</b> - exam proctors will not be able to participate in discussions</choice>
   71:       <defaultvalue>
   72:         my $denied = &{$helper->{DATA}->{GETVAL}}('pch.roles.denied');
   73:         $denied =~ s/,/\|\|\|/g;
   74:         return $denied;
   75:       </defaultvalue>
   76:       <finalcode>
   77:         my $denied = $element->getValue();
   78:         $denied =~ s/\|\|\|/,/g;
   79:         if (&{$helper->{DATA}->{SETVAL}}('pch.roles.denied', $denied)) {
   80:             $denied =~ s/st/ students/;
   81:             $denied =~ s/in/ instructors/;
   82:             $denied =~ s/ta/ teaching assistants/;
   83:             $denied =~ s/ep/ exam proctors/;
   84:             if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
   85:                 $denied =~ s/,/ and/g;
   86:             } else { # add "and" to last comma
   87:                 $denied =~ s/,([^,]*)$/, and\1/;
   88:             }
   89:             if ($denied) {
   90:                 $denied = substr($denied, 1) . ' not allowed to participate in discussion.';
   91:                 $denied = ucfirst($denied);
   92:             } else {
   93:                 $denied = 'Everyone can participate in discussion.';
   94:             }
   95:             return $denied;
   96:         } else {
   97:             return '';
   98:         }
   99:       </finalcode>
  100:       </choices>
  101:     </state>
  102: 
  103:   <state name="DISCUSSION_HTML" title="HTML in Discussions">
  104:     <message nextstate="FINAL">
  105:       <p>If you like, limited HTML can be allowed in the course discussions.</p>
  106:       </message>
  107:     <choices variable="HTML_ALLOWED">
  108:       <choice computer=""><b>HTML banned</b>: HTML will not be allowed in discussion postings.</choice>
  109:       <choice computer="yes"><b>HTML allowed</b>: Discussion participants can use limited HTML in their postings.</choice>
  110:       <finalcode>return 'Choices finalcode.';</finalcode>
  111:       </choices>
  112:     </state>
  113: 
  114:   
  115: 
  116:   <state name="FINAL" title="Completed">
  117:     <message>Your course is now set up.</message>
  118:     <final />
  119:     </state>
  120:   </helper>

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