[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm lonpickcourse.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 30 May 2006 20:12:15 -0000


This is a MIME encoded message

--raeburn1149019935
Content-Type: text/plain

raeburn		Tue May 30 16:12:15 2006 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm loncreateuser.pm 
  Log:
  Adding thin veneer to support "ANGEL-style" Discussion groups. "Select course" page modified to permit filtering based on course/group character. 
  
  
--raeburn1149019935
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20060530161215.txt"

Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.47 loncom/interface/lonpickcourse.pm:1.48
--- loncom/interface/lonpickcourse.pm:1.47	Tue May 30 08:46:09 2006
+++ loncom/interface/lonpickcourse.pm	Tue May 30 16:12:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.47 2006/05/30 12:46:09 www Exp $
+# $Id: lonpickcourse.pm,v 1.48 2006/05/30 20:12:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,7 +52,8 @@
 			       'sincefilter','form','cnumelement',
 			       'cdomelement','cnameelement','roleelement',
                                'pickedcourse','instcodefilter',
-                               'ownerfilter','coursefilter','multiple']);
+                               'ownerfilter','coursefilter','multiple',
+                               'type']);
 # domain filter and selection
     my $domainfilter=$env{'form.domainfilter'};
     $domainfilter=~s/\W//g;
@@ -108,29 +109,46 @@
         my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum);
         my @sections =  (sort {$a <=> $b} keys(%sections_count));
 	$seclist = join('","',@sections);
-
+        $num_sections = scalar(@sections);
         my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
 	$groupslist = join(',',sort(keys(%curr_groups)));
     }
     my $jscript;
-    my $title = 'Selecting a course';
+    my $type = $env{'form.type'};
+    if (!defined($env{'form.type'})) {
+        $type = 'Course';
+    }
+    my $typeselectform =  '<select name="type" size="1"';
+    if (!$type) {
+        $typeselectform .= ' selected="selected"';
+    }
+    $typeselectform .= ">\n";
+    foreach my $posstype ('Course','Group') { 
+        $typeselectform.='<option value="'.$posstype.'" "'.
+            ($posstype eq $type ? 'selected="selected" ' : ''). ">$posstype</option>\n";
+    }
+    $typeselectform.="</select>";
+    my $title = &mt('Selecting a [_1]',$type);
 # Setup for multiple course selections, if flag for multiples set.
     my $multiple = $env{'form.multiple'};
     my $multelement;
     if ($multiple) {
-        $title = 'Selecting course(s)';
+        $title = &mt('Selecting [_1](s)',lc($type));
         $jscript = &Apache::loncommon::check_uncheck_jscript();
         $multelement = '<input type="hidden" name="multiple" value="'.$multiple.'" />';
     }
     $r->print(&Apache::loncommon::start_page($title,undef,
 					     {'add_entries' => \%loaditem,
 					      'no_nav_bar'  => 1, }));
-    my %lt=&Apache::lonlocal::texthash(
-				       'cac' => 'Course Activity',
-				       'cde' => 'Course Description',
-				       'cdo' => 'Course Domain',
-                                       'cin' => 'Course Institutional Code',
-                                       'cow' => "Course Owner's Username");
+    my %lt = (
+	      'cac' => &mt('[_1] Activity',$type),
+	      'cde' => &mt('[_1] Description',$type),
+	      'cdo' => &mt('[_1] Domain',$type),
+              'cin' => &mt('Course Institutional Code'),
+              'cow' => &mt("[_1] Owner's Username",$type),
+              'cog' => &mt('Course or Group')
+             );
+   
     my ($name_code,$name_input);
     if (defined($env{'form.cnameelement'}) && $env{'form.cnameelement'} ne '') {
 	$name_code = "opener.document.$env{'form.form'}.$env{'form.cnameelement'}.value=cdesc;";
@@ -151,6 +169,25 @@
         $submitopener = &Apache::lonroles::processpick();
         $autosubmit = 'process_pick("'.$roledom.'")';
     }
+    my $instcodeform;
+    if ($type eq 'Course') {
+        $instcodeform = $lt{'cin'}.':<input type="text" name="instcodefilter" 
+ size="10" value="'.$listinstcode.'" /><br />';
+    }
+
+    my %elements = (
+                     Course => {
+                                 name  => 'coursepick',
+                                 total => 'coursetotal',
+                                 list  => 'courselist',
+                               },
+                     Group => {
+                                 name  => 'grouppick',
+                                 total => 'grouptotal',
+                                 list  => 'grouplist',
+                             },
+                    );
+
     $r->print(<<ENDSCRIPT);
 <script>
 function gochoose(cname,cdom,cdesc,multiple,caller) {
@@ -172,26 +209,26 @@
 		}
 	    }
 	} 
-        opener.document.$env{'form.form'}.coursetotal.value = courseCount;
-	if (typeof(opener.document.$env{'form.form'}.coursepick.length) ==
+        opener.document.$env{'form.form'}.$elements{$type}{'total'}.value = courseCount;
+	if (typeof(opener.document.$env{'form.form'}.$elements{$type}{'name'}.length) ==
 	    'undefined') {
-	    if (opener.document.$env{'form.form'}.coursepick.value == 'specific') {  
-		opener.document.$env{'form.form'}.coursepick.checked = true;
+	    if (opener.document.$env{'form.form'}.$elements{$type}{'name'}.value == 'specific') {  
+		opener.document.$env{'form.form'}.$elements{$type}{'name'}.checked = true;
 	    } else {
-		opener.document.$env{'form.form'}.coursepick.checked = false;
+		opener.document.$env{'form.form'}.$elements{$type}{'name'}.checked = false;
 	    }
 	} else {
-	    for (var j=0; j<opener.document.$env{'form.form'}.coursepick.length; j++) { 
-		if (opener.document.$env{'form.form'}.coursepick[j].value == 'specific') {  
-		    opener.document.$env{'form.form'}.coursepick[j].checked = true;
+	    for (var j=0; j<opener.document.$env{'form.form'}.$elements{$type}{'name'}.length; j++) { 
+		if (opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].value == 'specific') {  
+		    opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].checked = true;
 		} else {
-		    opener.document.$env{'form.form'}.coursepick[j].checked = false;
+		    opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].checked = false;
 		}
 	    }
 	}
 	if (courseCount > 0) {
 	    courses = courses.substr(0,courses.length-2);
-	    opener.document.$env{'form.form'}.courselist.value = courses;
+	    opener.document.$env{'form.form'}.$elements{$type}{'list'}.value = courses;
 	}
     } else {
         $name_code
@@ -246,7 +283,7 @@
 $jscript
 </script>
 $submitopener
-<form method="post" name="filterpicker">
+<form method="post" name="filterpicker" action="/adm/pickcourse">
 <input type="hidden" name="cnumelement" value="$env{'form.cnumelement'}" />
 <input type="hidden" name="cdomelement" value="$env{'form.cdomelement'}" />
 $name_input
@@ -257,9 +294,9 @@
 <br />
 $lt{'cdo'}: $domainselectform
 <br />
-$lt{'cin'}:
-<input type="text" name="instcodefilter" size="10" value="$listinstcode" />
+$lt{'cog'}: $typeselectform
 <br />
+$instcodeform
 $lt{'cow'}:
 <input type="text" name="ownerfilter" size="10" value="$listowner" />
 <br />
@@ -278,11 +315,12 @@
         unless ($instcodefilter) { $instcodefilter='.'; }
         unless ($ownerfilter) { $ownerfilter='.'; }
         unless ($coursefilter) { $coursefilter='.'; }
+        unless ($type) { $type = '.'; }
         my $timefilter=($sincefilter==-1?1:time-$sincefilter);
 	my %courses=
 	    &Apache::lonnet::courseiddump
-	    ($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter,$coursefilter);
-	$r->print('<form name="courselist">');
+	    ($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter,$coursefilter,undef,undef,$type);
+	$r->print('<form name="courselist" method="post" action="/adm/pickcourse">');
 	my %by_descrip;
         my $numcourses = keys(%courses);
 	foreach my $course (keys(%courses)) {
@@ -307,7 +345,7 @@
 	        my $cleandesc=&HTML::Entities::encode($description,'<>&"');
 	        $cleandesc=~s/'/\\'/g;
 	        my ($cdom,$cnum)=split(/\_/,$course);
-                my ($descr,$instcode,$owner) = split/:/,$courses{$course};
+                my ($descr,$instcode,$owner,$ttype) = split/:/,$courses{$course};
                 $r->print(&course_chooser($multiple,$cdom,$cnum,$cleandesc));
 	        $r->print($description.'('.
 		      ($Apache::lonnet::domaindescription{$cdom}?
@@ -318,6 +356,9 @@
                 unless ($owner eq '') {
                     $r->print(", owner - ".&unescape($owner));
                 }
+                unless ($ttype eq '') {
+                    $r->print('('.&Apache::lonnet::unescape($ttype).')');
+                }
 		if ($multiple) { $r->print("</label>\n"); }
                 $r->print("<br />\n");
             }
@@ -330,7 +371,8 @@
         $r->print('<input type="hidden" name="form" value="'.$env{'form.form'}.'" />'."\n".
                    '<input type="hidden" name="pickedcourse" value="" />'."\n".
                    '<input type="hidden" name="cnumelement" value="'.$env{'form.cnumelement'}.'" />'."\n".
-                   '<input type="hidden" name="cdomelement" value="'.$env{'form.cdomelement'}.'" />'."\n");
+                   '<input type="hidden" name="cdomelement" value="'.$env{'form.cdomelement'}.'" />'."\n".
+                   '<input type="hidden" name="type" value="'.$type.'" />'."\n");
         if ((exists($env{'form.roleelement'})) && ($env{'form.form'} eq 'rolechoice')) {
            $r->print('<input type="hidden" name="roleelement" value="'.$env{'form.roleelement'}.'" />'."\n");
         }
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.118 loncom/interface/loncreateuser.pm:1.119
--- loncom/interface/loncreateuser.pm:1.118	Tue May 30 08:46:09 2006
+++ loncom/interface/loncreateuser.pm	Tue May 30 16:12:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.118 2006/05/30 12:46:09 www Exp $
+# $Id: loncreateuser.pm,v 1.119 2006/05/30 20:12:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -195,81 +195,6 @@
 
     $nondc_setsection_code
 
-    function setSections() {
-        var re1 = /^currsec_/;
-        var groups = new Array($groupslist);
-        for (var i=0;i<document.cu.elements.length;i++) {
-            var str = document.cu.elements[i].name;
-            var checkcurr = str.match(re1);
-            if (checkcurr != null) {
-                var re2 = /^currsec_[a-zA-Z0-9]+_[a-zA-Z0-9]+_(\\w+)\$/;
-                if (document.cu.elements[i-1].checked == true) {
-                    var re2 = /^currsec_[a-zA-Z0-9]+_[a-zA-Z0-9]+_(\\w+)\$/;
-                    match = re2.exec(str);
-                    var role = match[1];
-                    if (role == 'cc') {
-                        alert("Section designations do not apply to Course Coordinator roles.\\nA course coordinator role will be added with access to all sections.");
-                    }
-                    else {
-                        var sections = '';
-                        var numsec = 0;
-                        var sections;
-                        for (var j=0; j<document.cu.elements[i].length; j++) {
-                            if (document.cu.elements[i].options[j].selected == true ) {
-                                if (document.cu.elements[i].options[j].value != "") {
-                                    if (numsec == 0) {
-                                        if (document.cu.elements[i].options[j].value != "") {
-                                            sections = document.cu.elements[i].options[j].value;
-                                            numsec ++;
-                                        }
-                                    }
-                                    else {
-                                        sections = sections + "," +  document.cu.elements[i].options[j].value
-                                        numsec ++;
-                                    }
-                                }
-                            }
-                        }
-                        if (numsec > 0) {
-                            if (document.cu.elements[i+1].value != "" && document.cu.elements[i+1].value != null) {
-                                sections = sections + "," +  document.cu.elements[i+1].value;
-                            }
-                        }
-                        else {
-                            sections = document.cu.elements[i+1].value;    
-                        }
-                        var newseclist = document.cu.elements[i+1].value;
-                        var newsecs = new Array();
-                        if (newseclist != null && newseclist != "") {
-                            newsecs = newseclist.split(/,/g);
-                            numsec = numsec + newsecs.length;
-                        }
-                        if ((role == 'st') && (numsec > 1)) {
-                            alert("In each course, each user may only have one student role at a time. You had selected "+numsec+" sections.\\nPlease modify your selections so they include no more than one section.")  
-                            return;
-                        }
-                        else {
-                            for (var j=0; j<newsecs.length; j++) {
-                                if ((newsecs[j] == 'all') || 
-                                    (newsecs[j] == 'none')) {
-                                    alert("'"+newsecs[j]+"' may not be used as the name for a section, as it is a reserved word.\\nPlease choose a different section name.");
-                                    return;
-                                }
-                                for (var k=0; k<groups.length; k++) {
-                                    if (newsecs[j] == groups[k]) {
-                                        alert("'"+newsecs[j]+"' may not be used as a section name, as it is the name of a course group.\\nSection names and group names must be distinct. Please choose a different section name.");
-                                        return;
-                                    }
-                                }
-                            }
-                            document.cu.elements[i+2].value = sections;
-                        }
-                    }
-                }
-            }
-        }
-        document.cu.submit();
-    }
 </script>
 END
 }
@@ -304,7 +229,8 @@
     $ccdomain=~s/\W//g;
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dc_setcourse_code = '';
-    my $nondc_setsection_code = '';
+    my $nondc_setsection_code = '';                                        
+
     my %loaditem;
 
     my $groupslist;
@@ -316,7 +242,18 @@
 
     if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) {
         my $dcdom = $1;
-        $loaditem{'onload'} = "document.cu.coursedesc.value=''";
+        $loaditem{'onload'} = "document.cu.coursedesc.value='';";
+        my @rolevals = ('st','ta','ep','in','cc');
+        my (@crsroles,@grproles);
+        for (my $i=0; $i<@rolevals; $i++) {
+            $crsroles[$i]=&Apache::lonnet::plaintext($rolevals[$i]);
+            $grproles[$i]=&Apache::loncommon::convert_role($crsroles[$i],'Group');
+        }
+        my $rolevalslist = join('","',@rolevals);
+        my $crsrolenameslist = join('","',@crsroles);
+        my $grprolenameslist = join('","',@grproles);
+        my $pickcrsfirst = '<--'.&mt('Pick course first');
+        my $pickgrpfirst = '<--'.&mt('Pick group first'); 
         $dc_setcourse_code = <<"ENDSCRIPT";
     function setCourse() {
         var course = document.cu.dccourse.value;
@@ -384,10 +321,10 @@
             else { 
                 var coursename = "_$dcdom"+"_"+course+"_"+userrole
                 document.cu.elements[numcourse].name = "act"+coursename
-                document.cu.elements[numcourse+4].name = "sec"+coursename
-                document.cu.elements[numcourse+4].value = section
-                document.cu.elements[numcourse+5].name = "start"+coursename
-                document.cu.elements[numcourse+6].name = "end"+coursename
+                document.cu.elements[numcourse+5].name = "sec"+coursename
+                document.cu.elements[numcourse+5].value = section
+                document.cu.elements[numcourse+7].name = "start"+coursename
+                document.cu.elements[numcourse+8].name = "end"+coursename
             }
         }
         document.cu.submit();
@@ -401,6 +338,36 @@
         }
         return -1;
     }
+
+    function setType() {
+        var crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value;
+        rolevals = new Array("$rolevalslist");
+        if (crstype == 'Group') {
+            if (document.cu.currsec.options[0].text == "$pickcrsfirst") {
+                document.cu.currsec.options[0].text = "$pickgrpfirst";
+            } 
+            grprolenames = new Array("$grprolenameslist");
+            for (var i=0; i<rolevals.length; i++) {
+                if (document.cu.role.selectedIndex == i) {
+                    document.cu.role.options[i] = new Option(grprolenames[i],rolevals[i],true,false);
+                } else {
+                    document.cu.role.options[i] = new Option(grprolenames[i],rolevals[i],false,false);
+                }
+            }
+        } else {
+            if (document.cu.currsec.options[0].text == "$pickgrpfirst") {
+                document.cu.currsec.options[0].text = "$pickcrsfirst";
+            }
+            crsrolenames = new Array("$crsrolenameslist");
+            for (var i=0; i<rolevals.length; i++) {
+                if (document.cu.role.selectedIndex == i) {
+                    document.cu.role.options[i] = new Option(crsrolenames[i],rolevals[i],true,false);
+                } else {
+                    document.cu.role.options[i] = new Option(crsrolenames[i],rolevals[i],false,false);
+                }
+            }
+        }
+    }
 ENDSCRIPT
     } else {
         $nondc_setsection_code = <<"ENDSECCODE";
@@ -646,6 +613,7 @@
                            '<br />'.&mt('Domain').': '.$coursedom.('&nbsp;'x8).
      &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom);
 		       $sortkey.="\0".$coursedata{'description'};
+                       $class=$coursedata{'type'};
 		   } else {
 		       $carea=&mt('Unavailable course').': '.$area;
 		       $sortkey.="\0".&mt('Unavailable course').': '.$area;
@@ -738,6 +706,9 @@
 	       my $plaintext='';
 	       unless ($croletitle) {
 		   $plaintext=&Apache::lonnet::plaintext($role_code);
+                   if ($class eq 'Group') {
+                       $plaintext = &Apache::loncommon::convert_role($plaintext,$class);
+                   }
 	       } else {
 	           $plaintext=
 		"Customrole '$croletitle' defined by $croleuname\@$croleudom";
@@ -757,7 +728,7 @@
            } # end of foreach        (table building loop)
            my $rolesdisplay = 0;
            my %output = ();
-	   foreach my $type ('Construction Space','Course','Domain','System','Unknown') {
+	   foreach my $type ('Construction Space','Course','Group','Domain','System','Unknown') {
 	       $output{$type} = '';
 	       foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
 		   if ( ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/ ) && ($rolepriv{$sortrole{$which}}) ) { 
@@ -779,7 +750,7 @@
 <tr><th>$lt{'rev'}</th><th>$lt{'ren'}</th><th>$lt{'del'}</th><th>$lt{'rol'}</th><th>$lt{'e
 xt'}</th><th>$lt{'sta'}</th><th>$lt{'end'}</th>
 END
-               foreach my $type ('Construction Space','Course','Domain','System','Unknown') {
+               foreach my $type ('Construction Space','Course','Group','Domain','System','Unknown') {
                    if ($output{$type}) {
                        $r->print($output{$type}."\n");
                    }
@@ -977,11 +948,11 @@
         $r->print($domaintext);
     }
 #
-# Course level
+# Course and group levels
 #
 
     if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) {
-        $r->print(&course_level_dc($1));
+        $r->print(&course_level_dc($1,'Course'));
         $r->print('<hr /><input type="button" value="'.&mt('Modify User').'" onClick="setCourse()">'."\n");
     } else {
         $r->print(&course_level_table(%inccourses));
@@ -1616,7 +1587,7 @@
     }
     my %lt=&Apache::lonlocal::texthash(
 		    'prv'  => "Privilege",
-		    'crl'  => "Course Level",
+		    'crl'  => "Course/Group Level",
                     'dml'  => "Domain Level",
                     'ssl'  => "System Level"
 				       );
@@ -1628,16 +1599,22 @@
 <tr><th>$lt{'prv'}</th><th>$lt{'crl'}</th><th>$lt{'dml'}</th>
 <th>$lt{'ssl'}</th></tr>
 ENDCCF
-    foreach (sort keys %full) {
-	$r->print('<tr><td>'.&Apache::lonnet::plaintext($_).'</td><td>'.
-    ($courselevel{$_}?'<input type="checkbox" name="'.$_.':c" '.
-    ($courselevelcurrent{$_}?'checked="1"':'').' />':'&nbsp;').
+    foreach my $priv (sort keys %full) {
+        my $privtext = &Apache::lonnet::plaintext($priv);
+        if ($env{'course.'.$env{'request.course.id'}.'.type'}) {
+            $privtext =~ s/Student/Member/;
+            $privtext =~ s/student/member/;
+            $privtext =~ s/course/group/;
+        } 
+	$r->print('<tr><td>'.$privtext.'</td><td>'.
+    ($courselevel{$priv}?'<input type="checkbox" name="'.$priv.':c" '.
+    ($courselevelcurrent{$priv}?'checked="1"':'').' />':'&nbsp;').
     '</td><td>'.
-    ($domainlevel{$_}?'<input type="checkbox" name="'.$_.':d" '.
-    ($domainlevelcurrent{$_}?'checked="1"':'').' />':'&nbsp;').
+    ($domainlevel{$priv}?'<input type="checkbox" name="'.$priv.':d" '.
+    ($domainlevelcurrent{$priv}?'checked="1"':'').' />':'&nbsp;').
     '</td><td>'.
-    ($systemlevel{$_}?'<input type="checkbox" name="'.$_.':s" '.
-    ($systemlevelcurrent{$_}?'checked="1"':'').' />':'&nbsp;').
+    ($systemlevel{$priv}?'<input type="checkbox" name="'.$priv.':s" '.
+    ($systemlevelcurrent{$priv}?'checked="1"':'').' />':'&nbsp;').
     '</td></tr>');
     }
     $r->print(
@@ -1765,7 +1742,7 @@
             'new'  => "Define new section",
             'ssd'  => "Set Start Date",
             'sed'  => "Set End Date",
-            'crl'  => "Course Level",
+            'crl'  => "Course/Group Level",
             'act'  => "Activate",
             'rol'  => "Role",
             'ext'  => "Extent",
@@ -1780,6 +1757,7 @@
 	$thiscourse=~s:_:/:g;
 	my %coursedata=&Apache::lonnet::coursedescription($thiscourse);
 	my $area=$coursedata{'description'};
+        my $type=$coursedata{'type'};
 	if (!defined($area)) { $area=&mt('Unavailable course').': '.$_; }
 	my $bgcol=$thiscourse;
 	$bgcol=~s/[^7-9a-e]//g;
@@ -1792,9 +1770,12 @@
 		    &Apache::loncommon::get_sections($domain,$cnum);
             }
         }
-	foreach  ('st','ta','ep','ad','in','cc') {
+	foreach  ('st','ta','ep','in','cc') {
 	    if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) {
 		my $plrole=&Apache::lonnet::plaintext($_);
+                if ($type eq 'Group') {
+                    $plrole = &Apache::loncommon::convert_role($plrole,$type);
+                } 
 		$table .= <<ENDEXTENT;
 <tr bgcolor="#$bgcol">
 <td><input type="checkbox" name="act_$protectedcourse\_$_"></td>
@@ -1911,12 +1892,10 @@
                       '<input type="hidden" name="origdom" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="dccourse" value="" />';
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link
-                     ('cu','dccourse','dcdomain','coursedesc').'</b>';
-                                                                                      
-    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,$dcdom);
+            ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Group').'</b>';
+    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom);
     my %lt=&Apache::lonlocal::texthash(
-                    'crl'  => "Course Level",
-                    'crt'  => "Course Title",
+                    'typ' => "Type",
                     'rol'  => "Role",
                     'grs'  => "Section",
                     'exs'  => "Existing sections",
@@ -1926,11 +1905,16 @@
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"
                   );
-    my $header = '<h4>'.$lt{'crl'}.'</h4>'.
-                 '<table border="2"><tr><th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th></tr>';
-    my $otheritems = '<tr><td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'".'cu'."'".','."'".'dccourse'."'".','."'".'dcdomain'."'".','."'".'coursedesc'."',''".')" /></td>'.
+    my $header = '<h4>'.&mt('Course/Group Level').'</h4>'.
+                 '<table border="2"><tr><th>'.$lt{'typ'}.'</th><th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th></tr>';
+    my $otheritems = '<tr><td><select name="crstype" onChange="javascript:setType();">'."\n".
+                     ' <option value="">'.&mt('Please select')."\n".
+                     ' <option value="Course">'.&mt('Course')."\n".
+                     ' <option value="Group">'.&mt('Group')."\n".
+                     '</select>'."\n".
+                     '<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc','".')" /></td>'."\n".
                      '<td><select name="role">'."\n";
-    foreach  ('st','ta','ep','ad','in','cc') {
+    foreach  ('st','ta','ep','in','cc') {
         my $plrole=&Apache::lonnet::plaintext($_);
         $otheritems .= '  <option value="'.$_.'">'.$plrole;
     }

--raeburn1149019935--