[LON-CAPA-cvs] cvs: loncom /auth roles.tab rolesplain.tab /html/adm/helper course.initialization.helper /interface lonchat.pm lonchatfetch.pm loncreatecourse.pm lonmenu.pm lonparmset.pm mydesk.tab

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 24 Jul 2003 17:53:59 -0000


This is a MIME encoded message

--matthew1059069239
Content-Type: text/plain

matthew		Thu Jul 24 13:53:59 2003 EDT

  Modified files:              
    /loncom/auth	roles.tab rolesplain.tab 
    /loncom/interface	lonchat.pm lonchatfetch.pm loncreatecourse.pm 
                     	lonmenu.pm lonparmset.pm mydesk.tab 
    /loncom/html/adm/helper	course.initialization.helper 
  Log:
  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.
  
  
--matthew1059069239
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20030724135359.txt"

Index: loncom/auth/roles.tab
diff -u loncom/auth/roles.tab:1.20 loncom/auth/roles.tab:1.21
--- loncom/auth/roles.tab:1.20	Sat Apr 12 11:58:43 2003
+++ loncom/auth/roles.tab	Thu Jul 24 13:53:59 2003
@@ -2,18 +2,18 @@
 dc:s bre:sma
 dc:d cli&UIK:cau&U:cdg&UIK:mau:ccc&U:cin&UIK:cta&UIK:cep&UIK:ccr&UIK:cst&UIK:cad&UIK:dro:mky
 cc:s bre:sma:mcr
-cc:c cin&IK:cta&IK:cep&IK:ccr&IK:cst&IK:are:cre:ere:vgr:gan:srm:opa:mgr:rin:pch
+cc:c cin&IK:cta&IK:cep&IK:ccr&IK:cst&IK:are:cre:ere:vgr:gan:srm:opa:mgr:rin:pch:plc
 in:s sma
 in:d bre
-in:c vgr:mgr:gan:dcm:srm:pch&C:dch:pac:rin:las:opa
+in:c vgr:mgr:gan:dcm:srm:pch&C:plc&C:dch:pac:rin:las:opa
 ta:d sma
-ta:c bre&RL:vgr&CR:mgr&CR:srm:pch&C:dch:pac
+ta:c bre&RL:vgr&CR:mgr&CR:srm:pch&C:plc&C:dch:pac
 ep:d sma
 ep:c bre&R:mgr&R:dcm:las
 cr:d sma
-cr:c bre&R:vgr&SCR:mgr&SCR:gan&SCR:dcm&SC:srm&SC:pch:dch&S:pac:rin&S:las&SR:opa&SR
+cr:c bre&R:vgr&SCR:mgr&SCR:gan&SCR:dcm&SC:srm&SC:pch:plc:dch&S:pac:rin&S:las&SR:opa&SR
 st:d sma&L
-st:c bre&RXL:pch&CL:pac&CL
+st:c bre&RXL:pch&CL:plc&CL:pac&CL
 ad:d sma
 ad:c bre:gan:vgr:srm
 li:s gan:sma
Index: loncom/auth/rolesplain.tab
diff -u loncom/auth/rolesplain.tab:1.7 loncom/auth/rolesplain.tab:1.8
--- loncom/auth/rolesplain.tab:1.7	Sat Apr 12 11:58:43 2003
+++ loncom/auth/rolesplain.tab	Thu Jul 24 13:53:59 2003
@@ -52,7 +52,8 @@
 dcm:Disable all communication among students
 sma:Send internal email
 srm:Send broadcast and receipt-required email
-pch:Post to chatrooms and bulletin boards
+pch:Post discussion on course resources
+plc:Post to live chatrooms
 dch:Delete messages from bulletin boards
 pac:Post anonymously
 rin:Get identity behind anonymous postings
Index: loncom/interface/lonchat.pm
diff -u loncom/interface/lonchat.pm:1.6 loncom/interface/lonchat.pm:1.7
--- loncom/interface/lonchat.pm:1.6	Mon Jun 23 18:25:14 2003
+++ loncom/interface/lonchat.pm	Thu Jul 24 13:53:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Chat
 #
-# $Id: lonchat.pm,v 1.6 2003/06/23 22:25:14 albertel Exp $
+# $Id: lonchat.pm,v 1.7 2003/07/24 17:53:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -29,7 +29,7 @@
 package Apache::lonchat;
 
 use strict;
-use Apache::Constants qw(:common);
+use Apache::Constants qw(:common :http);
 use Apache::loncommon;
 
 sub handler {
@@ -37,6 +37,11 @@
     $r->content_type('text/html');
     $r->send_http_header;
     return OK if $r->header_only;
+    if (! &Apache::lonnet::allowed('plc',$ENV{'request.course.id'}.
+              ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:'')
+                                   )) {
+        return HTTP_NOT_ACCEPTABLE;
+    }
 
     if ($ENV{'form.newchat'}) {
 	&Apache::lonnet::chatsend(&Apache::lonfeedback::clear_out_html($ENV{'form.newchat'}),$ENV{'form.anonymous'});
Index: loncom/interface/lonchatfetch.pm
diff -u loncom/interface/lonchatfetch.pm:1.11 loncom/interface/lonchatfetch.pm:1.12
--- loncom/interface/lonchatfetch.pm:1.11	Mon Jun 23 17:30:42 2003
+++ loncom/interface/lonchatfetch.pm	Thu Jul 24 13:53:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Chat Fetching
 #
-# $Id: lonchatfetch.pm,v 1.11 2003/06/23 21:30:42 albertel Exp $
+# $Id: lonchatfetch.pm,v 1.12 2003/07/24 17:53:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -29,13 +29,19 @@
 package Apache::lonchatfetch;
 
 use strict;
-use Apache::Constants qw(:common);
+use Apache::Constants qw(:common :http);
 use Apache::lontexconvert;
 use Apache::loncommon;
 use Apache::lonnet;
 
 sub handler {
     my $r = shift;
+
+    if (! &Apache::lonnet::allowed('pch',$ENV{'request.course.id'}.
+             ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))
+        ) {
+        return HTTP_NOT_ACCEPTABLE;
+    }
 
     my $loaderror=&Apache::lonnet::overloaderror($r);
     if ($loaderror) { return $loaderror; }
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.25 loncom/interface/loncreatecourse.pm:1.26
--- loncom/interface/loncreatecourse.pm:1.25	Thu Jul 17 11:16:45 2003
+++ loncom/interface/loncreatecourse.pm	Thu Jul 24 13:53:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.25 2003/07/17 15:16:45 matthew Exp $
+# $Id: loncreatecourse.pm,v 1.26 2003/07/24 17:53:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -138,7 +138,9 @@
 <h2>Communication</h2>
 <p>
 <b>Disable student resource discussion: </b>
-<input type="checkbox" name="disresdis" />
+<input type="checkbox" name="disresdis" /> <br />
+<b>Disable student use of chatrooms: </b>
+<input type="checkbox" name="disablechat" />
 </p>
 <h2>Access Control</h2>
 <p>
@@ -239,6 +241,10 @@
     if ($ENV{'form.disresdis'}) {
 	$envflag=1;
         $cenv{'pch.roles.denied'}='st';
+    }
+    if ($ENV{'form.disablechat'}) {
+	$envflag=1;
+        $cenv{'plc.roles.denied'}='st';
     }
 
     # Record we've not yet viewed the Course Initialization Helper for this course
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.80 loncom/interface/lonmenu.pm:1.81
--- loncom/interface/lonmenu.pm:1.80	Sat Jul  5 06:07:11 2003
+++ loncom/interface/lonmenu.pm	Thu Jul 24 13:53:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.80 2003/07/05 10:07:11 www Exp $
+# $Id: lonmenu.pm,v 1.81 2003/07/24 17:53:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -714,13 +714,21 @@
                $output.=&secondlevel(
 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
             }
-        } elsif (($pro=~/p(\w+)/) && ($prt)) {
+        } elsif (($pro=~/^p(\w+)/) && ($prt)) {
 	    if (&Apache::lonnet::allowed($1,$prt)) {
                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
             }
         } elsif ($pro eq 'course') {
             if ($ENV{'request.course.fn'}) {
                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
+	    }
+        } elsif ($pro =~ /^course_(.*)$/) {
+            # Check for permissions inside of a course
+            if (($ENV{'request.course.id'}) &&
+                (&Apache::lonnet::allowed($1,$ENV{'request.course.id'}.
+            ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))
+                 )) {
+                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
 	    }
         } elsif ($pro eq 'author') {
             if ($author) {
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.117 loncom/interface/lonparmset.pm:1.118
--- loncom/interface/lonparmset.pm:1.117	Thu Jul 17 11:16:45 2003
+++ loncom/interface/lonparmset.pm	Thu Jul 24 13:53:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.117 2003/07/17 15:16:45 matthew Exp $
+# $Id: lonparmset.pm,v 1.118 2003/07/24 17:53:59 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1500,6 +1500,17 @@
              'pageseparators'  => '<b>Visibly Separate Items on Pages</b><br />'.
                                  '("<tt>yes</tt>" for visible separation, '.
                                  'changes will not show until next login)',
+
+             'plc.roles.denied'=> '<b>Disallow live chatroom use for '.
+                                  'Roles</b><br />"<tt>st</tt>": '.
+                                  'student, "<tt>ta</tt>": '.
+                                  'TA, "<tt>in</tt>": '.
+                                  'instructor;<br /><tt>role,role,...</tt>) '.
+	       Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
+             'plc.users.denied' => 
+                          '<b>Disallow live chatroom use for Users</b><br />'.
+                                 '(<tt>user:domain,user:domain,...</tt>)',
+
              'pch.roles.denied'=> '<b>Disallow Resource Discussion for '.
                                   'Roles</b><br />"<tt>st</tt>": '.
                                   'student, "<tt>ta</tt>": '.
@@ -1549,6 +1560,7 @@
         my @Display_Order = ('url','description','courseid','grading',
                              'default_xml_style','pageseparators',
                              'question.email','comment.email','policy.email',
+                             'plc.roles.denied','plc.users.denied',
                              'pch.roles.denied','pch.users.denied',
                              'allow_limited_html_in_feedback',
                              'languages',
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.43 loncom/interface/mydesk.tab:1.44
--- loncom/interface/mydesk.tab:1.43	Fri May 16 13:54:21 2003
+++ loncom/interface/mydesk.tab	Thu Jul 24 13:53:59 2003
@@ -9,6 +9,7 @@
 # pro = author   prt = any 
 # pro = p???     allowed if the user has the permissions given in ???
 # course         allowed if in course
+# course_p???    allowed if in course and have permissions
 # author         allowed if an author
 #
 1:1:smp:any:courses.gif:choose:course:go('/adm/roles');:Choose the course to work on
@@ -54,7 +55,7 @@
 10:1:any:any:anno.gif:calendar:announce:go('/adm/announcements');:Course announcements and my calendar
 10:2:any:any:com.gif:commu-:nication:go('/adm/communicate');:Send and receive messages
 10:3:clear
-10:3:course:any:bchat.gif:course:chat:chat_win();:Enter the chatroom for the course
+10:3:course_plc:any:bchat.gif:course:chat:chat_win();:Enter the chatroom for the course
 11:1:clear
 11:1:course:any:src.gif:search:course:go('/adm/searchcat');:Search the contents of this course
 11:1:pbre:$requested_domain:src.gif:search:library:go('/adm/searchcat');:Search the database of published resources
Index: loncom/html/adm/helper/course.initialization.helper
diff -u loncom/html/adm/helper/course.initialization.helper:1.11 loncom/html/adm/helper/course.initialization.helper:1.12
--- loncom/html/adm/helper/course.initialization.helper:1.11	Mon Jul 21 10:08:30 2003
+++ loncom/html/adm/helper/course.initialization.helper	Thu Jul 24 13:53:59 2003
@@ -59,7 +59,7 @@
     </state>
 
   <state name="COURSE_DESCRIPTION" title="Course Description">
-    <message nextstate="FORBID_DISCUSSION">
+    <message nextstate="FORBID_CHAT">
       The &quot;Course Description&quot; is the name of the course that will be
       seen by the students.  You may now modify the description and hit 
       <nobr>&quot;<b>Next -&gt;</b>&quot;</nobr> to continue.<br />
@@ -75,6 +75,48 @@
         }
         </finalcode>
       </string>
+    </state>
+
+  <state name="FORBID_CHAT" title="Chat Participation">
+    <message nextstate="FORBID_DISCUSSION">
+      <p>LON-CAPA has live chat functionality.  This course will receive
+         its own chat room.  You may deny students, TAs, or instructors
+         the right to access the chat room.</p>
+      </message>
+    <choices variable="BANNED_CHAT_ROLES" multichoice="1" allowempty='1'>
+      <choice computer="st"><b>Students</b> - students will not be able to use or view the chat room.</choice>
+      <choice computer="ta"><b>Teaching Assistants</b> - teaching assistants will not be able use or view the chat room</choice>
+      <choice computer="in"><b>Instructor</b> - instructors will not be able to use or view the chat room</choice>
+      <defaultvalue>
+        my $denied = &{$helper->{DATA}->{GETVAL}}('plch.roles.denied');
+        $denied =~ s/,/\|\|\|/g;
+        return $denied;
+      </defaultvalue>
+      <finalcode>
+        my $denied = $element->getValue();
+        $denied =~ s/\|\|\|/,/g;
+        if (&{$helper->{DATA}->{SETVAL}}('plc.roles.denied', $denied)) {
+            $denied =~ s/st/ students/;
+            $denied =~ s/in/ instructors/;
+            $denied =~ s/ta/ teaching assistants/;
+            $denied =~ s/ep/ exam proctors/;
+            if ($denied =~ /^[^,]*,[^,]*$/) { # only one comma
+                $denied =~ s/,/ and/g;
+            } else { # add "and" to last comma
+                $denied =~ s/,([^,]*)$/, and\1/;
+            }
+            if ($denied) {
+                $denied = substr($denied, 1) . ' not allowed to participate in discussion.';
+                $denied = ucfirst($denied);
+            } else {
+                $denied = 'Everyone can participate in discussion.';
+            }
+            return $denied;
+        } else {
+            return '';
+        }
+      </finalcode>
+      </choices>
     </state>
 
   <state name="FORBID_DISCUSSION" title="Discussion Participation">

--matthew1059069239--