--- loncom/interface/loncreateuser.pm 2006/06/02 13:58:31 1.120 +++ loncom/interface/loncreateuser.pm 2006/07/19 10:10:40 1.125.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.120 2006/06/02 13:58:31 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.125.2.3 2006/07/19 10:10:40 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -142,7 +142,7 @@ sub print_username_entry_form { 'nr' => "Name of Role", 'cre' => "Custom Role Editor" ); - my $help = &Apache::loncommon::help_open_menu('',undef,undef,'',282,'Instructor Interface'); + my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface'); my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges'); my $helpecpr=&Apache::loncommon::help_open_topic('Course_Editing_Custom_Roles'); $r->print(<<"ENDDOCUMENT"); @@ -340,7 +340,7 @@ sub print_user_modification_page { } function setType() { - var crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value; + var crstype = 'Course' rolevals = new Array("$rolevalslist"); if (crstype == 'Group') { if (document.cu.currsec.options[0].text == "$pickcrsfirst") { @@ -378,7 +378,6 @@ ENDSCRIPT 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); @@ -415,15 +414,17 @@ ENDSCRIPT sections = document.cu.elements[i+1].value; } var newsecs = document.cu.elements[i+1].value; + var numsplit; if (newsecs != null && newsecs != "") { - var numsplit = newsecs.split(/,/g); + numsplit = newsecs.split(/,/g); numsec = numsec + numsplit.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 { + else if (numsplit != null) { for (var j=0; j<numsplit.length; j++) { if ((numsplit[j] == 'all') || (numsplit[j] == 'none')) { @@ -437,8 +438,8 @@ ENDSCRIPT } } } - document.cu.elements[i+2].value = sections; } + document.cu.elements[i+2].value = sections; } } } @@ -1584,7 +1585,7 @@ sub custom_role_editor { } my %lt=&Apache::lonlocal::texthash( 'prv' => "Privilege", - 'crl' => "Course/Group Level", + 'crl' => "Course Level", 'dml' => "Domain Level", 'ssl' => "System Level" ); @@ -1598,11 +1599,6 @@ sub custom_role_editor { ENDCCF 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"':'').' />':' '). @@ -1739,7 +1735,7 @@ sub course_level_table { 'new' => "Define new section", 'ssd' => "Set Start Date", 'sed' => "Set End Date", - 'crl' => "Course/Group Level", + 'crl' => "Course Level", 'act' => "Activate", 'rol' => "Role", 'ext' => "Extent", @@ -1770,9 +1766,6 @@ sub course_level_table { 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> @@ -1889,7 +1882,7 @@ sub course_level_dc { '<input type="hidden" name="origdom" value="'.$dcdom.'" />'. '<input type="hidden" name="dccourse" value="" />'; my $courseform='<b>'.&Apache::loncommon::selectcourse_link - ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Group').'</b>'; + ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course').'</b>'; my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom); my %lt=&Apache::lonlocal::texthash( 'typ' => "Type", @@ -1902,14 +1895,9 @@ sub course_level_dc { 'ssd' => "Set Start Date", 'sed' => "Set End Date" ); - 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". + my $header = '<h4>'.&mt('Course Level').'</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>'."\n". '<td><select name="role">'."\n"; foreach ('st','ta','ep','in','cc') { my $plrole=&Apache::lonnet::plaintext($_);