[LON-CAPA-cvs] cvs: modules /raeburn requests.pl
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 27 Apr 2005 21:45:39 -0000
This is a MIME encoded message
--raeburn1114638339
Content-Type: text/plain
raeburn Wed Apr 27 17:45:39 2005 EDT
Modified files:
/modules/raeburn requests.pl
Log:
Import of Blackboard and ANGEL IMS packages - no longer included - can use IMSimport in DOCS instead. Specification of clonable courses no longer requires separate window. Data written as XML for ingestion by automated course creation process. Warnings included about missing CLIFMS extries as appropriate.
--raeburn1114638339
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20050427174539.txt"
Index: modules/raeburn/requests.pl
diff -u modules/raeburn/requests.pl:1.2 modules/raeburn/requests.pl:1.3
--- modules/raeburn/requests.pl:1.2 Tue Aug 10 10:46:51 2004
+++ modules/raeburn/requests.pl Wed Apr 27 17:45:38 2005
@@ -11,6 +11,7 @@
use SISInfo;
use ROInfo;
use Authen::Krb4;
+ use Text::Capitalize;
use vars qw($MASTERDIR $DOCROOT $FORMDIR $ZIPDIR $TRACKDIR $contact_name $contact_email);
@@ -418,8 +419,11 @@
#
# get list of letter codes and list of user's CLIFMS entries
#
-
- getclifms($user,\@clifms,"both",\@official_classes);
+ my $dbhro;
+ if (&connect_clifms($dbhro) eq 'ok') {
+ &getclifms($dbhro,$user,\@clifms,"both",\@official_classes);
+ &disconnect_clifms($dbhro);
+ }
@official_classes = sort(@official_classes);
#
@@ -962,7 +966,7 @@
<table width="100%" border="0" cellpadding="8" cellspacing="0">
<tr>
<td>
- <input type="text" size="35" name="coursename" onBlur="return nd()" onFocus="return overlib('This is the title of the course. Do <b>not</b> include section(s) or the semester in the title as these will be added automatically at course creation.',CAPTION,'Course Title',WIDTH,250)"> <a href="javascript:void(0);" onmouseover="return overlib('This is the title of the course. Do <b>not</b> include section(s) or the semester in the title as these will be added automatically at course creation.',CAPTION,'Course Title',WIDTH,250)"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a>
+ <input type="text" size="35" name="coursename" onBlur="return nd()" onFocus="return overlib('This is the title of the course (e.g., Physics for Scientists and Engineers I). Do <b>not</b> include section(s) or the semester in the title as these will be added automatically at course creation.',CAPTION,'Course Title',WIDTH,250)"> <a href="javascript:void(0);" onmouseover="return overlib('This is the title of the course (e.g., Physics for Scientists and Engineers I). Do <b>not</b> include section(s) or the semester in the title as these will be added automatically at course creation.',CAPTION,'Course Title',WIDTH,250)"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a>
</td>
</tr>
</tr>
@@ -1008,7 +1012,7 @@
<td width="100%" valign="top" bgcolor="FFFFBB">
<table width="100%" border="0" cellpadding="8" cellspacing="0">
<tr>
- <td valign="top"><input type="text" size="4" name="countsections" onBlur="return nd()" onFocus="return overlib('Enter the total number of sections for which you will be using LON-CAPA. For example, if you are expecting to teach sections 009 and 009, you should enter <b>2</b>.',CAPTION,'How many sections?',WIDTH,250)"> <a href="javascript:void(0);" onmouseover="return overlib('Enter the total number of sections for which you will be using LON-CAPA. For example, if you are expecting to teach sections 009 and 009, you should enter <b>2</b>.',CAPTION,'How many sections?',WIDTH,250)"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
+ <td valign="top"><input type="text" size="4" name="countsections" onBlur="return nd()" onFocus="return overlib('Enter the total number of sections for which you will be using LON-CAPA. For example, if you are expecting to teach sections 003 and 004, you should enter <b>2</b>.',CAPTION,'How many sections?',WIDTH,250)"> <a href="javascript:void(0);" onmouseover="return overlib('Enter the total number of sections for which you will be using LON-CAPA. For example, if you are expecting to teach sections 008 and 009, you should enter <b>2</b>.',CAPTION,'How many sections?',WIDTH,250)"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
</tr>
</table>
</td>
@@ -1416,7 +1420,7 @@
</select>
</font>
</td>
- <td valign="bottom" align="center"><font face="Arial, Helvetica, sans-serif"><b>No end date?</b> <input type="checkbox" name="noenddate" value="1"/></td>
+ <td valign="bottom" align="center"><nobr><font face="Arial, Helvetica, sans-serif"><b>No end date?</b> </font><input type="checkbox" name="noenddate" value="1"/></nobr></td>
<td><a href="javascript:void(0);" onmouseover="return overlib('Choose when course access should end for students added by the auto-enrollment process. After this date student roles for registered students will become inactive.',CAPTION,'Last access date',WIDTH,250)"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
</tr>
</table>
@@ -1685,7 +1689,11 @@
}
}
}
- &getclifms($user,\@clifmsclasses,"check");
+ my $dbhro;
+ if (&connect_clifms($dbhro) eq 'ok') {
+ &getclifms($dbhro,$user,\@clifmsclasses,"check");
+ &disconnect_clifms($dbhro);
+ }
if (@clifmsclasses > 0) {
return 'ok';
}
@@ -1750,7 +1758,7 @@
$adcookie_file->set_cookie(0,"MSUAIS_NTWeb1_HTTPS",$aisid,"/","ntweb1.ais.msu.edu",undef,0,0,60,0);
$URL = "https://ntweb1.ais.msu.edu/fsra/Search.Asp";
my $found = 'bad';
- my $request = POST $URL,
+ $request = POST $URL,
Content =>
[
'SearchName' => "$user",
@@ -1765,14 +1773,24 @@
} elsif ($dump =~ m/No records found\./) {
print STDERR "requests.pl script - No records found for $user in AIS FSR\n";
}
+ if ($dump =~ m/Detail.Asp\?PID=([^"]+)"/) {
+ my $token = $1;
+ $URL = "https://ntweb1.ais.msu.edu/fsra/Detail.Asp?PID=".$token;
+ $request = GET $URL;
+ $adcookie_file->add_cookie_header($request);
+ $response = $ua->request($request);
+ if ($response->is_success) {
+ $dump = $response->content;
+ }
+ }
}
return $found;
}
sub check_status($$$$) {
my ($last,$first,$user,$inforef) = @_;
- my $called_script = "cgi-bin/pilotdir";
- my $URL = "http://pilot.msu.edu/$called_script?lname=$last&fname=$first";
+ my $called_script = "msusearch/msupeople.php";
+ my $URL = "http://isweb1.cl.msu.edu/$called_script?lname=$last&fname=$first";
my $count = 0;
my $matchcount = 0;
my $matchflag = 0;
@@ -1783,12 +1801,12 @@
# print $response->is_success ? $response->content : $response->status_line;
if ($response->is_success) {
my $dump = $response->content;
- if (!($dump =~m /No\smatches\sfound\./)) {
+ if ($dump =~ /<hr>/) {
my @matches=split /<hr>/,$dump;
- for (my $j=1; $j<@matches; $j++) {
+ for (my $j=1; $j<@matches-1; $j++) {
my %lineitem = ();
- my $fullname = substr($matches[$j], index($matches[$j],"<h2>")+4);
- $fullname = substr($fullname,0,index($fullname,"</h2>"));
+ my $fullname = substr($matches[$j], index($matches[$j],"<h3>")+4);
+ $fullname = substr($fullname,0,index($fullname,"</h3>"));
$matched[$count]{last} = substr($fullname,0,index($fullname,","));
$matched[$count]{first} = substr($fullname,index($fullname,",")+1);
while (index($matched[$count]{first}," ") == 0) {
@@ -1799,8 +1817,11 @@
chomp(@info);
if (!($info[1] =~ m/mailto:/)) {
$matched[$count]{ofc} = $info[1];
- if ($matched[$count]{ofc} =~ m/(.+),?\s?East Lansing/) {
+ if ($matched[$count]{ofc} =~ m/(.+),?\s?East Lansing/i) {
$matched[$count]{ofc} = $1;
+ $matched[$count]{ofc} =~ s/^\s+//;
+ $matched[$count]{ofc} = lc ($matched[$count]{ofc});
+ $matched[$count]{ofc} = capitalize_title($matched[$count]{ofc});
}
}
if (!($info[2] =~ m/mailto:/)) {
@@ -1809,11 +1830,15 @@
for (my $q=0; $q<@info; $q++) {
chomp($info[$q]);
$info[$q] =~ s/\s//g;
- if ($info[$q] =~ m/href="http/) {
+ if ($info[$q] =~ m/href="?http/) {
$lineitem{web} = $q;
}
- elsif ($info[$q] =~ m/href="mailto:(\w+)\@/) {
+ elsif ($info[$q] =~ m/href="?mailto:(\w+)\@/) {
$matched[$count]{pilot} = $1;
+ $matched[$count]{dept} = $info[$q+1];
+ $matched[$count]{dept} = lc ($matched[$count]{dept});
+ $matched[$count]{dept} = capitalize_title($matched[$count]{dept});
+ $matched[$count]{dept} =~ s/,.+$//g;
}
elsif (($info[$q] =~ m/^Student$/) || ($info[$q] =~ m/^Faculty$/) || ($info[$q] =~ m/^Staff$/) || ($info[$q] =~ m/^Non-Affiliated$/)) {
$matched[$count]{status} = $info[$q];
@@ -2116,7 +2141,11 @@
my @clifms = ();
if ($crosslistings > 0) {
$xlflag = 1;
- getclifms($user,\@clifms,"codes",\@official_classes);
+ my $dbhro;
+ if (&connect_clifms($dbhro) eq 'ok') {
+ &getclifms($dbhro,$user,\@clifms,"codes",\@official_classes);
+ &disconnect_clifms($dbhro);
+ }
@official_classes = sort(@official_classes);
}
my $globalflag = 0;
@@ -2193,8 +2222,8 @@
my $ot_elem = 7;
my $xl_elem = 6;
- my $se_elem = 6;
- my $id_elem = 1;
+ my $se_elem = 5;
+ my $id_elem = 0;
$coursenum=~tr/A-Z/a-z/;
$user =~ tr/A-Z/a-z/;
@@ -2243,7 +2272,6 @@
$globalflag = 1;
@radios = ("coursechoice");
push @globals, "template$totalsections";
- push @textboxes, "tempchk$totalsections";
}
else {
$id_elem = $id_elem+4;
@@ -2258,7 +2286,6 @@
push @parents, ("parent$j");
push @templates, ("template$j");
push @pulldowns, ("template$j");
- push @textboxes, ("tempchk$j");
push @textboxes, ("gp$j");
}
}
@@ -2268,7 +2295,6 @@
push @textboxes, ("sec0");
}
push @pulldowns, ("template0");
- push @textboxes, ("tempchk0");
push @textboxes, ("gp0");
}
@@ -2301,22 +2327,31 @@
push @excluded, ("page","go","allsections","semyr","img_count","req_type","lett","year","semester","month_live","day_live","year_live","coursename","coursenum","countsections","crosslistings","countothers","firstname","lastname","office","telno","univdept","tracking");
-# Check for course coordinator role in existing LON-CAPA courses
+# Check for course coordinator role in existing LON-CAPA courses, or set to cloner
- my $cc_courses = &get_cclist($user);
+ my $cloneable = &get_cclist($user);
my $num_LC=0;
my %oldtitle = ();
my @existing = ();
- unless ( ($cc_courses == 0) || ($cc_courses eq '') ) {
- my @lines = split/\n/,$cc_courses;
+ unless ($cloneable eq '') {
+ my @lines = ();
+ if ($cloneable =~ /\n/s) {
+ @lines = split/\n/,$cloneable;
+ } else {
+ @lines = ($cloneable);
+ }
foreach $_ (@lines) {
- if ($_ =~ m/^(\w+):(.+)$/) {
- push @existing, $1;
- $oldtitle{$1} = $2;
- $oldtitle{$1} =~ s/"//g;
- $oldtitle{$1} =~ s/'//g;
+ if ($_ =~ m/^(\w+):(\w+):(\w*):(.+)$/) {
+ push @existing, $_;
+ if ($3 eq '') {
+ $oldtitle{$_} = $4;
+ $oldtitle{$_} =~ s/'//g;
+ $oldtitle{$_} = substr($oldtitle{$_},0,35);
+ } else {
+ $oldtitle{$_} = $3;
+ }
$num_LC ++;
- }
+ }
}
}
@@ -2464,30 +2499,36 @@
}
if ($globalflag) {
- print qq|
+ if ($num_LC > 0) {
+ print qq|
if (courseForm.global.value == 1) {
courseForm.elements[8].options.length=0
courseForm.elements[8].options[0]=new Option("Please select","-1",true,true)
- courseForm.elements[8].options[1]=new Option("None","0",false,false)
- courseForm.elements[8].options[2]=new Option("IMS Export File","1",false,false)
- |;
- if ($num_LC > 0) {
- print qq| courseForm.elements[8].options[3]=new Option("Clone LON-CAPA course","2",false,false)\n
- |;
- }
- foreach my $name (@globals) {
- my $value = $q->param("$name");
- if ($value ne "") {
- print qq|
+|;
+ foreach (@existing) {
+ print qq|
+ courseForm.elements[8].options[0]=new Option("$oldtitle{$_}","$_",false,false)\n
+|;
+ }
+ } else {
+ print qq|
+ courseForm.elements[8].options.length=0
+ courseForm.elements[8].options[0]=new Option("No courses to clone","-1",true,true)
+ |;
+ }
+ foreach my $name (@globals) {
+ my $value = $q->param("$name");
+ if ($value ne "") {
+ print qq|
for (iter=0; iter<courseForm.$name.length; iter++) {
if(courseForm.$name.options[iter].value == "$value") {
courseForm.$name.options[iter].selected = true
}
}
- |;
+ |;
+ }
}
- }
- print "
+ print "
}\n";
}
print "
@@ -2703,20 +2744,6 @@
ONESEC_BREAK_THREE
}
print qq|
- var tempChoice = courseForm.elements[$id_elem+$se_elem-2].options[courseForm.elements[$id_elem+$se_elem-2].selectedIndex].value
- var tempCheck = courseForm.elements[$id_elem+$se_elem-1].value
- if (tempChoice == "1" ) {
- if (tempCheck == "") {
- alert("Although you indicated use of an IMS export file as a template you have not successfully uploaded a file. \\nIf you do not wish to use an 'IMS export file' as a template, please select 'None' from the Template select box'. \\nIf you still plan to use an export file, select 'Please select' from the Template menu, and then choose 'IMS export file' to open a new 'Template Options' window. \\nIn the pop-up window use the 'Browse' button to select a file from your desktop file system, and then click 'Proceed' to upload the file to the server.")
- return
- }
- }
- if ((tempChoice != "-1") && (tempChoice != "0") && (tempChoice != "1")) {
- if (tempCheck == "") {
- alert("Although you indicated that you wish to clone a LON-CAPA course, you have not recorded which course is to be cloned. \\nIf you do not wish to clone a course, please select 'None' from the Template select box'. \\nIf you still plan to use a cloned course, select 'Please select' from the Template menu, and then choose 'Clone LON-CAPA course' again to open a new 'Template Options' window. \\nIn the pop-up window, select which course you wish to clone and then click 'Proceed' to store your choices.")
- return
- }
- }
courseForm.go.value="NextPage"
courseForm.submit()
return
@@ -2785,8 +2812,8 @@
message = 'Use a GroupID if you want students in a particular MSU section to be identified in your course as members of a particular LON-CAPA section/group. Open and close dates and other parameters affecting course content can be set on a section-by-section basis'
height = 70;
}
- if (caller == 'Template') {
- message = 'For sections identified as "Primary", you may select "Clone LON-CAPA course" to open a window to select an old course to clone when building the new course, or select "IMS Export File" if you have an IMS context package exported from Blackboard or ANGEL from which you wish to build the course';
+ if (caller == 'Cloned Course') {
+ message = 'For sections identified as "Primary", you may select an existing course (in which you have cloning rights) to clone when building the new course.';
height = 100;
}
}
@@ -2810,7 +2837,7 @@
height = 100;
}
if (caller == 'Template') {
- message = 'For sections identified as "Primary", you may select "Clone LON-CAPA course" to open a window to select an old course to clone when building the new course, or select "IMS Export File" if you have an IMS context package exported from Blackboard or ANGEL from which you wish to build the course';
+ message = 'For sections identified as "Primary", you may select an old course to clone when building the new course, if you have cloning rights in any existing courses.';
height = 120;
}
|;
@@ -2863,7 +2890,6 @@
var courseForm = document.secondForm
oldsec = new Array()
oldtemp = new Array()
- oldtempchk = new Array()
oldtype = new Array ()
oldpar = new Array ()
newSecs = new Array ()
@@ -2871,7 +2897,6 @@
for (var j=0; j<$totalsections; j++) {
oldsec[j] = courseForm.elements[$id_elem+$se_elem*j].value
oldtemp[j] = courseForm.elements[$id_elem+$se_elem*j+4].options[courseForm.elements[$id_elem+$se_elem*j+4].selectedIndex].value
- oldtempchk[j] = courseForm.elements[$id_elem+$se_elem*j+5].value
oldtype[j] = courseForm.elements[$id_elem+$se_elem*j+1].selectedIndex
oldpar[j] = courseForm.elements[$id_elem+$se_elem*j+2].options[courseForm.elements[$id_elem+$se_elem*j+2].selectedIndex].value
}
@@ -2931,7 +2956,6 @@
for (var m=0; m<courseForm.elements[$id_elem+$se_elem*i+4].length; m++) {
if (courseForm.elements[$id_elem+$se_elem*i+4].options[m].value == oldtemp[k]) {
courseForm.elements[$id_elem+$se_elem*i+4].selectedIndex = m
- courseForm.elements[$id_elem+$se_elem*i+5].value = oldtempchk[k]
tempmatch = 1
}
}
@@ -3066,13 +3090,23 @@
if (courseForm.coursechoice[choice].value.indexOf("global") == 0) {
courseForm.global.value=1
courseForm.elements[8].options.length=0
- courseForm.elements[8].options[0]=new Option("Please select","-1",true,true)
- courseForm.elements[8].options[1]=new Option("None","0",false,false)
- courseForm.elements[8].options[2]=new Option("IMS Export File","1",false,false)
|;
if ($num_LC > 0) {
- print qq( courseForm.elements[8].options[3]=new Option("Clone LON-CAPA course","2",false,false)
- );
+ print qq|
+ courseForm.elements[8].options[0]=new Option("Please select","-1",true,true)
+ courseForm.elements[8].options[1]=new Option("None","0",false,false)
+ |;
+ my $clonecount = 2;
+ foreach (@existing) {
+ print qq|
+ courseForm.elements[8].options[$clonecount]=new Option("$oldtitle{$_}","$_",false,false)\n|;
+ $clonecount ++;
+ }
+ } else {
+ print qq|
+ courseForm.elements[8].options.length=0
+ courseForm.elements[8].options[0]=new Option("None available","-1",true,true)
+|;
}
print qq|
courseForm.elements[8].selectedIndex=0
@@ -3085,10 +3119,10 @@
if (crosstotal > 0) {
for (var kk=0; kk<crosstotal; kk++) {
if (courseForm.global.value==1) {
- courseForm.elements[9+$xl_elem*kk].checked = true
+ courseForm.elements[8+$xl_elem*kk].checked = true
}
else {
- courseForm.elements[9+$xl_elem*kk].checked = false
+ courseForm.elements[8+$xl_elem*kk].checked = false
}
}
}
@@ -3131,7 +3165,7 @@
var courseForm = document.secondForm
var message = 'Possible use of a template only applies if you choose to create a global course';
if (courseForm.global.value == 1) {
- message = 'If you are a Course Coordinator in existing LON-CAPA courses, select "Clone LON-CAPA course" to open a window to select a course to clone to create your new course, or select "IMS Export File" if you have an IMS context package exported from Blackboard or ANGEL from which you wish to build the course';
+ message = 'If you have rights to clone an existing LON-CAPA course you may select the course which you wish to clone to create your new global course.';
}
return overlib(message,CAPTION,'Template for Global course',WIDTH, 300);
}
@@ -3192,12 +3226,20 @@
function slaveSet (caller) {
|;
if ($num_LC > 0) {
- print " var numTemplates = 1\n";
- print qq| var oldTemplates = new Array("Clone LON-CAPA course")\n|;
+ print " var numTemplates = $num_LC\n";
+ my $oldTemplates_str = join('","',@existing);
+ my $oldTemplateNames_str = '';
+ foreach (@existing) {
+ $oldTemplateNames_str .= '"'.$oldtitle{$_}.'",';
+ }
+ $oldTemplateNames_str =~ s/,$//;
+ print qq| var oldTemplates = new Array("$oldTemplates_str")\n|;
+ print qq| var oldTemplateNames = new Array($oldTemplateNames_str)\n|;
}
else {
print " var numTemplates = 0\n";
print " var oldTemplates = new Array()\n";
+ print " var oldTemplateNames = new Array ()\n";
}
print <<"SCRIPT_BREAK_TWO";
var global = $globalflag
@@ -3275,14 +3317,13 @@
else {
courseForm.elements[templateChoice].options[0] = new Option("Please select","-1",true,true)
courseForm.elements[templateChoice].options[1] = new Option("None","0",false,false)
- courseForm.elements[templateChoice].options[2] = new Option("IMS Export file","1",false,false)
if (numTemplates > 0) {
for (var p=0; p<numTemplates; p++) {
- courseForm.elements[templateChoice].options[3+p] = new Option(oldTemplates[p],"2",false,false)
+ courseForm.elements[templateChoice].options[2+p] = new Option(oldTemplateNames[p],oldTemplates[p],false,false)
}
}
for (var q=0; q<courseForm.elements[templateChoice].length; q++) {
- if (courseForm.elements[templateChoice].options[q].value == oldTempChoice) {
+ if (courseForm.elements[templateChoice].options[q].value == oldTempChoice) {
courseForm.elements[templateChoice].options[q].selected = true
}
}
@@ -3495,20 +3536,6 @@
this.scroll(0,400)
return
}
- var tempChoice = courseForm.elements[$id_elem+$se_elem*(q+1)-2].options[courseForm.elements[$id_elem+$se_elem*(q+1)-2].selectedIndex].value
- var tempCheck = courseForm.elements[$id_elem+$se_elem*(q+1)-1].value
- if (tempChoice == "1" ) {
- if (tempCheck == "") {
- alert("Although you indicated use of an IMS Export File as a template for section "+courseForm.elements[$id_elem+$se_elem*q].value+" you have not successfully uploaded a file. If you do not wish to use an 'IMS Export file' as a template, please select 'None' from the Template select box'. If you still plan to use an an IMS Export File, select 'Please select' from the Template menu, and then choose 'IMS Export file' again to open a new 'Template Options' window")
- return
- }
- }
- if ((tempChoice != "-1") && (tempChoice != "0") && (tempChoice != "1")) {
- if (tempCheck == "") {
- alert("Although you indicated that you wish to clone a LON-CAPA course, you have not recorded which course is to be clone to build the new course for section "+courseForm.elements[$id_elem+$se_elem*q].value+". If you do not wish to clone a course, please select 'None' from the Template select box'. If you still plan to clone an existing course, select 'Please select' from the Template menu, and then choose 'Clone LON-CAPA course' again to open a new 'Template Options' window")
- return
- }
- }
}
for (var q=0; q<sectotal; q++) {
if (courseForm.elements[1+$id_elem+$se_elem*q].options[courseForm.elements[1+$id_elem+$se_elem*q].selectedIndex].value != "0") {
@@ -3519,20 +3546,6 @@
}
}
if (global == 1) {
- var gtempChoice = courseForm.elements[8].options[courseForm.elements[8].selectedIndex].value
- var gtempCheck = courseForm.elements[9].value
- if (gtempChoice == "1" ) {
- if (gtempCheck == "") {
- alert("Although you indicated use of an IMS Export File as a template for global section '000' you have not successfully uploaded a file. If you do not wish to use an 'IMS Export File' as a template, please select 'None' from the Template select box. If you still plan to use an export file, select 'Please select' from the Template menu, and then choose 'IMS Export file' again to open a new 'Template Options' window")
- return
- }
- }
- if ((gtempChoice != "-1") && (gtempChoice != "0") && (gtempChoice != "1")) {
- if (gtempCheck == "") {
- alert("Although you indicated use of an existing LON-CAPA course as a template for global section '000' you have not recorded which course you wish to clone. If you do not wish to use an existing course as a template, please select 'None' from the Template select box'. If you still plan to clone an existing course, select 'Please select' from the Template menu, and then choose 'Clone LON-CAPA course' again to open a new 'Template Options' window")
- return
- }
- }
if (crosstotal > 0) {
re = /^\\d{3}:\/
var gtop = 4
@@ -3647,7 +3660,7 @@
}
for (i=0; i<othtotal; i++) {
var othseltot = 0
- var othSel = ""
+ var othSel = -1
for (j=0; j<courseForm.elements[($id_elem-1+$se_elem*sectotal+$xl_elem*crosstotal*sectotal+xlsecs+$ot_elem*(i+1))].length; j++) {
if (courseForm.elements[($id_elem-1+$se_elem*sectotal+$xl_elem*crosstotal*sectotal+xlsecs+$ot_elem*(i+1))].options[j].selected) {
othseltot ++
@@ -3656,7 +3669,7 @@
othSel = j
}
}
- if (othSel != "") {
+ if (othSel != -1) {
if (courseForm.elements[($id_elem-1+$se_elem*sectotal+$xl_elem*crosstotal*sectotal+xlsecs+$ot_elem*(i+1))].options[othSel].selected) {
alert("One of the sections selected for one of the users is 'Please select'. Please deselect this option")
return
@@ -3762,98 +3775,11 @@
|;
}
-print <<"END_OF_FIRST";
+print <<"END_OF_FIRST_A";
function backPage() {
document.forms.secondForm.go.value="PreviousPage"
document.forms.secondForm.submit();
}
-
-function archiveWin(call) {
- var stem = "$semyr$lett$coursenum"
- var sectotal = $totalsections
- var courseForm = document.secondForm
- var section
- var choice
- if (call == '-2') {
- section = '000'
- choice = courseForm.elements[8].options[courseForm.elements[8].selectedIndex].value
- if ((choice == -1) || (choice == 0)) {
- courseForm.elements[9].value = ""
- }
- }
- else {
- section = courseForm.elements[$id_elem+$se_elem*call].value
- choice = courseForm.elements[$id_elem+$se_elem*(call+1)-2].options[courseForm.elements[$id_elem+$se_elem*(call+1)-2].selectedIndex].value
- if ((choice == -1) || (choice == 0)) {
- courseForm.elements[$id_elem+$se_elem*(call+1)-1].value = ""
- }
- }
- if ((choice == '2') || (choice == '1')) {
- newWindow = window.open("",choice,"HEIGHT=500,WIDTH=450,scrollbars=yes")
- newWindow.document.open()
- newWindow.document.write("<html><head><title>Template Options</title><meta http-equiv='pragma' content='no-cache'>\\n</head><body bgcolor='#ffff99' topmargin='0' leftmargin='0' marginheight='0'marginwidth='0' rightmargin='0'>\\n")
- newWindow.document.write("<img border='0' src='/images/requests/banner_sm.jpg' alt='[Small Request Header]'>\\n")
- newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='430' bgcolor='#ffff99'>\\n")
- newWindow.document.write("<tr><td width='2'> </td><td width='3'> </td>\\n")
- newWindow.document.write("<td><form name='export' action='/cgi-bin/uploader.pl' enctype='multipart/form-data' method='post'>\\n")
- newWindow.document.write("<input type='hidden' name='course_id' value='")
- newWindow.document.write(stem)
- newWindow.document.write(section)
- newWindow.document.write("'>")
- newWindow.document.write("<input type='hidden' name='id_elem' value='$id_elem'>")
- newWindow.document.write("<input type='hidden' name='se_elem' value='$se_elem'>")
- newWindow.document.write("<input type='hidden' name='tracking' value='$zipid'>")
- newWindow.document.write("<input type='hidden' name='caller' value='")
- newWindow.document.write(call)
- newWindow.document.write("'>")
-
- if (choice == 1 ) {
- var addNum = courseForm.img_count.value
- newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='422' bgcolor='#ffff99'><tr><td colspan='2'> </td></tr>\\n")
- newWindow.document.write("<tr><td> </td><td>\\n")
- newWindow.document.write("<font face='Arial,Helvetica,sans-serif'>Click the 'Browse ..' button to locate an IMS Export File previously exported from Blackboard or ANGEL and now stored on your local filesystem. IMS Export files contain data stored in the zip compression format, and will have a .zip file extension.</font></td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'> </td></tr>")
- newWindow.document.write("<tr><td> </td><td><font face='Arial,Helvetica,sans-serif'>Note: if the archive contains user information, any information for users other than you, the requestor ($firstname $lastname), and the $countothers user(s) listed at step ")
- newWindow.document.write(addNum)
- newWindow.document.write(" in the main request window, will be discarded when the new course is built from the uploaded IMS Export File.</font></td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'> </td></tr><tr><td> </td>")
- newWindow.document.write("<td><font face='Arial,Helvetica,sans-serif'><b>IMS Export file:</b> <input type='file' name='filename' size='15'>\\n")
- newWindow.document.write("<input type='hidden' name='action' value='zip'></font></td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'> </td></tr><tr><td> </td>\\n")
- newWindow.document.write("<td><font face='Arial,Helvetica,sans-serif'>After clicking the 'Proceed' button, please do not close this window until you see a message confirming that upload of your IMS Export file was successful. As transfer of export files that are more than a few Mb in size may take a minute or two, some patience may be required.</font></td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'> </td></tr><tr><td> </td><td><input align='left' type='image' src='/images/requests/proceed_button.gif' name='button' value='Proceed' border='0' onClick='javascript:document.forms[0].submit()'></td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'> </td></tr></table>\\n")
- }
- else {
- newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' width='422'><tr><td> </td></tr><tr><td>\\n")
- newWindow.document.write("<table border='0' cellspacing='0' cellpadding='0' align='center' width='375' bgcolor='#000000' align='center'><tr><td>\\n")
- newWindow.document.write("<table border='0' cellspacing='1' cellpadding='0'><tr bgcolor='#ffffff' align='center'><td>\\n")
- newWindow.document.write("<table border='0' cellspacing='1' cellpadding='1'>\\n")
- newWindow.document.write("<tr><td width='390' bgcolor='#ffcc33'><font size='+1' face='Arial,Helvetica,sans-serif'>Template Choices</font></td>\\n")
- newWindow.document.write("</tr><tr><td bgcolor='#ffffff'><font face='Arial,Helvetica,sans-serif'><b>Instructions: </b>\\n")
- newWindow.document.write("Please choose the LON-CAPA course which you would like to clone to create your new course. You may select from all courses for which you have the role of Course Coordinator.</td></tr>")
- newWindow.document.write("<tr><td> </td></tr><tr><td>")
-END_OF_FIRST
-if ($num_LC > 0) {
- print qq| newWindow.document.write("<select name='cloneID'>\\n<option value='-1'>Please select\\n")\n|;
- for (my $i=0; $i<@existing; $i++) {
- print qq| newWindow.document.write("<option value='$existing[$i]:$oldtitle{$existing[$i]}'>$oldtitle{$existing[$i]}\\n")\n|;
- }
- print qq| newWindow.document.write("</select><br/><br/>\\n")\n|;
-}
-print <<"END_OF_FIRST_A";
- newWindow.document.write("</td></tr><tr><td> </td></tr>\\n")
- newWindow.document.write("<tr><td colspan='2'><input align='right' type='image' src='/images/requests/proceed_button.gif' name='submit' value='Proceed' border='0' onClick='javascript:document.forms[0].submit()'>")
- newWindow.document.write("<input type='hidden' name='action' value='old'>\\n")
-newWindow.document.write("<tr><td> </td></tr></table></td></tr></table></td></tr></table></td></tr><tr><td> </td></tr></table>\\n")
- }
- newWindow.document.write("</td></tr>\\n")
- newWindow.document.write("</table></body></html>")
- newWindow.document.close()
- newWindow.focus()
- }
-}
-
// End hiding -->
</script>
<script type="text/javascript" src="/scripts/overlib.js"><!-- overLIB (c) Erik Bosrup --></script>
@@ -3981,11 +3907,11 @@
</tr>
<tr>
<td> </td>
- <td><font face="Arial,Helvetica,sans-serif"><b>Template for global course:</b>
- <select name="template$totalsections" onChange="archiveWin('-2')">
+ <td><font face="Arial,Helvetica,sans-serif"><b>Template for Global Course</b>
+ <select name="template$totalsections">
<option value="-1" selected>Not Applicable</option>
</select>
- <input type="hidden" name="tempchk$totalsections" value=""></font> <a href="javascript:void(0);" onmouseover="globalTemplate()"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
+ </font> <a href="javascript:void(0);" onmouseover="globalTemplate()"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
</tr>
<tr>
<td colspan='2'> </td>
@@ -4190,10 +4116,10 @@
<tr bgcolor="#FFEEBB">
<td valign="middle" align="center"><b><font face="Arial,Helvetica,sans-serif">Item</font></b></td>
<td valign="middle" align ="center"><b><font face="Arial,Helvetica,sans-serif">Section</font></b></td>
- <td valign="middle" align="center"><b><font face="Arial,Helvetica,sans-serif">Type</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Type')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
- <td valign="middle" align="center"><b><font face="Arial,Helvetica,sans-serif">Parent section</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Parent')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
- <td valign="middle" align="center"><b><font face="Arial,Helvetica,sans-serif">GroupID</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Group')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></td>
- <td valign="middle" align="center"><b><font face="Arial,Helvetica,sans-serif">Template</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Template')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></td>
+ <td valign="middle" align="center"><nobr><b><font face="Arial,Helvetica,sans-serif">Type</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Type')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></nobr></td>
+ <td valign="middle" align="center"><nobr><b><font face="Arial,Helvetica,sans-serif">Parent section</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Parent')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></nobr></td>
+ <td valign="middle" align="center"><nobr><b><font face="Arial,Helvetica,sans-serif">GroupID</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Group')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></nobr></td>
+ <td valign="middle" align="center"><nobr><b><font face="Arial,Helvetica,sans-serif">Cloned Course</font></b> <a href="javascript:void(0);" onmouseover="sectionOptions('Cloned Course')"; onmouseout="return nd();"><img name="name_help" border="0" src="/images/requests/v2help_out.gif" width="75" height="30" align="top"></a></nobr></td>
</tr>
END_OF_SECOND
for (my $i=0; $i<$totalsections; $i++) {
@@ -4232,19 +4158,24 @@
print qq( </select></font>
</td>
<td align="center"><font face="Arial,Helvetica,sans-serif">
- <input type="text" name="gp$i" size="15">
+ <input type="text" name="gp$i" size="10">
</td>
<td align="center"><font face="Arial,Helvetica,sans-serif">
- <select name="template$i" onChange='archiveWin($i)'>
- <option value="-1" selected>Please select</option>
- <option value="0">None</option>
- <option value="1">IMS Export File</option>
+ <select name="template$i">
);
if ($num_LC > 0) {
- print qq( <option value="2">Clone LON-CAPA course</option>
- );
+ print qq|
+ <option value="-1" selected>Please select</option>
+ <option value="0">None</option>
+ |;
+ foreach (@existing) {
+ print qq| <option value="$_">$oldtitle{$_}</option>|;
+ }
+ } else {
+ print qq( <option value="0">None available</option> );
}
- print qq( </select><input type="hidden" name="tempchk$i" value=""></font>
+ print qq(
+ </select></font>
</td>
</tr>);
}
@@ -4294,7 +4225,7 @@
<tr><td colspan='2'> </td></tr>
<tr>
<td> </td>
- <td><font face="Arial,Helvetica,sans-serif">If you have used LON-CAPA before you may choose to build your new course by cloning an existing course. If you have Course Coordinator access in a course currently in the LON-CAPA system you may select "Clone LON-CAPA course" from the <b>Template</b> select box, and a new window will appear prompting you to select a course to clone. Alternatively, if you would like to build your course using an IMS package created from a Blackboard or ANGEL course you should select "IMS Export File" from the <b>Template</b> select box. When you do this a new window will appear that will allow you to upload your IMS package file to the LON-CAPA Request System.</font></td>
+ <td><font face="Arial,Helvetica,sans-serif">If you have used LON-CAPA before you may choose to build your new course by cloning an existing course. If you have Course Coordinator access or have been assigned "cloner" rights in a course currently in the LON-CAPA system you may select a course to clone.</font></td>
</tr>
<tr>
<td colspan='2'> </td>
@@ -4318,16 +4249,23 @@
<td valign="middle" align ="center"><input type="text" name="sec0" size="4"><input type = "hidden" name="type0" value="0"><input type = "hidden" name="parent0" value = "None"></td>
<td valign="middle" align ="center"><input type="text" name="gp0" size="10">
<td valign="middle" align ="center"><font face="Arial,Helvetica,sans-serif">
- <select name="template0" onChange="archiveWin('0')">
- <option value="-1" selected>Please select</option>
- <option value="0">None</option>
- <option value="1">IMS Export File</option>
+ <select name="template0">
);
if ($num_LC > 0) {
- print qq( <option value="2">Clone LON-CAPA course</option>
+ print qq(
+ <option value="-1" selected>Please select</option>
+ <option value="0">None</option>
+ );
+ foreach (@existing) {
+ print qq( <option value="$_">$oldtitle{$_}</option>
);
+ }
+ } else {
+ print qq(
+ <option value="0" selected>None available</option>
+ );
}
- print qq( </select></font> <input type="hidden" name="tempchk0" value="">
+ print qq( </select></font>
</td>
</tr>
</table>
@@ -4362,8 +4300,7 @@
<tr><td colspan='2'> </td></tr>
<tr>
<td> </td>
-<td><font face="Arial,Helvetica,sans-serif">If you have used LON-CAPA before you may choose to use a previous LON-CAPA course as a template for
-your new course. If you exported a previous Blackboard or ANGEL course to an IMS export file you should select "IMS Export file" from the <b>Template</b> select box. When you do this a new window will appear that will allow you to upload your file to the LON-CAPA Request System. Alternatively, if you have Course Coordinator access in a course currently in the LON-CAPA system you may select the "Clone LON-CAPA course from the Template select box, and a new window will appear prompting you to select the course that is to be cloned.</font></td>
+<td><font face="Arial,Helvetica,sans-serif">If you have Course Coordinator access, or have been assigned cloner status in a course currently in the LON-CAPA system you may select the course that is to be cloned to create the new course.</font></td>
</tr>
<tr>
<td colspan='2'> </td>
@@ -4371,16 +4308,23 @@
<tr>
<td> </td>
<td><font face="Arial,Helvetica,sans-serif"><b>Template</b>
- <select name="template0" onChange="archiveWin('0')">
+ <select name="template0"">
<option value="-1" selected>Please select</option>
- <option value="0">None</option>
- <option value="1">IMS Export File</option>
);
if ($num_LC > 0) {
- print qq( <option value="2">Clone LON-CAPA course</option>
+ print qq(
+ <option value="-1" selected>Please select</option>
+ );
+ foreach (@existing) {
+ print qq( <option value="$_">$oldtitle{$_}</option>
+ );
+ }
+ } else {
+ print qq(
+ <option value="0" selected>None available</option>
);
}
- print qq( </select></font> <input type="hidden" name="tempchk0" value=""></td>
+ print qq( </select></font></td>
</tr>
<tr>
<td colspan='2'> </td>
@@ -4632,10 +4576,10 @@
<select name="othrole$l">
<option value="-1">Please select
<option value="cc">Course Coordinator
- <option value="i">Instructor
- <option value="t">TA
- <option value="p">Proctor
- <option value="s">Student
+ <option value="in">Instructor
+ <option value="ta">TA
+ <option value="ep">Proctor
+ <option value="st">Student
</select> </font>
</td>
<td> <font face="Arial,Helvetica,sans-serif" valign="top">
@@ -4860,10 +4804,10 @@
);
my %roles = (
cc => 'Course Coordinator',
- i => 'Instructor',
- t => 'TA',
- p => 'Proctor',
- s => 'Student',
+ in => 'Instructor',
+ ta => 'TA',
+ ep => 'Proctor',
+ st => 'Student',
);
my %autostatus = (
'0' => "OFF",
@@ -4880,7 +4824,6 @@
my @secparent = ();
my @sectemp = ();
my @group = ();
-my @sectempcheck = ();
my @crosslist = ();
my $zipid = $req->param("tracking");
my $modifieditem = $req->param("modifieditem");
@@ -4995,18 +4938,12 @@
$group[$j] = $req->param("gp$j");
}
$sectemp[$j] = $req->param("template$j");
- $sectempcheck[$j] = $req->param("tempchk$j");
- if ($sectemp[$j] eq "1") {
- $sectempcheck[$j] = substr($sectempcheck[$j],index($sectempcheck[$j],",")+1);
- $sectemp[$j] = "Use uploaded IMS export - ";
- $sectemp[$j] .= "file size: $sectempcheck[$j] bytes";
- }
- elsif (($sectemp[$j] eq "0") || ($sectemp[$j] eq "-1")) {
+ if (($sectemp[$j] eq "0") || ($sectemp[$j] eq "-1")) {
$sectemp[$j] = "No template";
}
- elsif ($sectemp[$j] eq "2") {
- if ($sectempcheck[$j] =~ m/(\w+):(\w*):(.+)$/) {
- $sectemp[$j] = "Clone $2 - $3";
+ elsif ($sectemp[$j]) {
+ if ($sectemp[$j] =~ m/(\w+):(\w+):(\w*):(.+)$/) {
+ $sectemp[$j] = "Clone $3 - $4";
}
}
}
@@ -5278,7 +5215,7 @@
<b>GroupID</b>
</td>
<td><font face="Arial,Helvetica,sans-serif">
- <b>Template?</b>
+ <b>Cloned Course</b>
</td>
<td><font face="Arial,Helvetica,sans-serif">
<b>Crosslisting?</b></font>
@@ -5485,6 +5422,7 @@
fs => 'Fall',
ss => 'Spring',
);
+ my %children = ();
my @dirlist = ("addcourse","addstaff","crosslistings","details","enrollstaff","holdcourse","livedates","deaddates","startdates","enddates","redirects","shares","templates","uploads","autoadds","autodrops");
my @plusdirlist =("templates","uploads");
my @reqlogs = ("submitted","modified","cancelled");
@@ -5544,7 +5482,11 @@
my %secure_type = (0 => "not verified",
1 => "verified",
);
- $clifmsflag = clifmscheck ($user,$lett,$coursenum);
+ my $dbhro;
+ my $dbhro_connect = &connect_clifms($dbhro);
+ if ($dbhro_connect eq 'ok') {
+ $clifmsflag = &clifmscheck ($dbhro,$user,$lett,$coursenum);
+ }
if ($clifmsflag == 1) {
$securityflag = 1;
}
@@ -5561,7 +5503,7 @@
$present[4] += 1;
$present[5] += 1900;
if (length($present[1]) == 1) {
- $present[1] = "0".$present[1];
+ $present[1] = "0".$present[1];
}
#
@@ -5629,16 +5571,19 @@
if ($globalflag && $num == $totalsections) {
$type{$sections[$num]} = "0";
$group{$sections[$num]} = "";
+ @{$children{$sections[$num]}} = ();
+ }
+ if ($type{$sections[$num]} eq "0") {
+ @{$children{$sections[$num]}} = ();
}
if (($type{$sections[$num]} eq "0") || ($type{$sections[$num]} eq "1") ) {
push @newsections, $sections[$num];
}
my $file = $q->param("template$num");
- if ($file ne "-1" && $file ne "0") {
- $zipflag{$sections[$num]} = $file;
- }
- else {
+ if ($file eq '-1' || $file eq '0' || $file eq '') {
$zipflag{$sections[$num]} = 0;
+ } else {
+ $zipflag{$sections[$num]} = $file;
}
}
@@ -6175,6 +6120,17 @@
print FILE $newcode;
close(FILE);
}
+# Create XML directory
+ if (!-e "$MASTERDIR/$FORMDIR/req_xml/$firstlett/") {
+ mkdir("$MASTERDIR/$FORMDIR/req_xml/$firstlett/",0755);
+ }
+ if (!-e "$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user") {
+ mkdir("$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user",0755);
+ }
+ if (!-e "$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user/$idcode") {
+ mkdir("$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user/$idcode",0755);
+ }
+
my $timecode = time;
for (my $num=0; $num<@sections; $num++) {
my $file = $q->param("template$num");
@@ -6282,11 +6238,11 @@
#
# Get names of cross-listed courses
#
+ my %cross = ();
if ($crosslistings > 0) {
for (my $k=0; $k<$totalsections; $k++) {
@{$crosslist[$k]} = ();
}
- my %cross = ();
if ($globalflag) {
@{$crosslist[$totalsections]} = ();
for (my $j=0; $j<$crosslistings; $j++) {
@@ -6303,11 +6259,13 @@
$xlsecs[0] = $xlseclist;
}
foreach my $sect (@xlsecs) {
- if (!grep/$sect/,@{$cross{$xlname}}) {
+ if (!grep/^$sect$/,@{$cross{$xlname}}) {
push @{$cross{$xlname}}, $sect;
}
my $xlitem = $xlname.$sect;
- push @{$crosslist[$totalsections]}, $xlitem;
+ if (!grep/^$xlitem$/,@{$crosslist[$totalsections]}) {
+ push @{$crosslist[$totalsections]}, $xlitem;
+ }
}
}
}
@@ -6332,7 +6290,9 @@
push @{$cross{$xlname}}, $sect;
}
my $xlitem = $xlname.$sect;
- push @{$crosslist[$n]}, $xlitem;
+ if (!grep/^$xlitem$/,@{$crosslist[$n]}) {
+ push @{$crosslist[$n]}, $xlitem;
+ }
}
}
$crossnum ++;
@@ -6369,13 +6329,50 @@
$authorization{$section} = 1;
}
}
+#
+# Check if user is listed in CLIFMS for sections and crosslistings.
+#
+ my @oksections = ();
+ my @okxls = ();
+ my @noauth_xls = ();
+ my @noauth_sections = ();
+ if ($dbhro_connect eq 'ok') {
+ &clifms_sections($user,$semyr,$lett,$coursenum,\%cross,\@oksections,\@okxls);
+ for (my $k=0; $k<@crosslist; $k++) {
+ if (@{$crosslist[$k]} > 0) {
+ foreach my $xlist (@{$crosslist[$k]}) {
+ if (!grep/^$xlist$,@okxlists) {
+ push (@noauth_xls,$xlist);
+ }
+ }
+ }
+ }
+ foreach my $sec (@sections) {
+ unless ($sec eq '000') {
+ if (!grep/^$sec$/,@oksections) {
+ push (@noauth_sections,$sec);
+ }
+ }
+ }
+ }
+
+ my $autowarn;
+
+ if (@noauth_sections > 0) {
+ $autowarn = "If auto-enrollment of registered students is enabled for this class, students from the following sections: ".join(", ",@noauth_sections)." will not be enrolled automatically because you are not currently listed in CLIFMS as instructor or supervisor for semester: $semyr for $lett$coursenum. Once your department has added you to CLIFMS with either of these two roles for this/these section(s), auto-enrollment can occur for the sections.<br /><br />\n";
+ }
+ if (@noauth_xls) > 0) {
+ $autowarn .= "If auto-enrollment of registered students is enabled for this class, students from the following crosslisted class section(s): ".join(", ",@noauth_xls)." will not be enrolled automatically because you are not currently listed in CLIFMS as instructor or supervisor for these class sections. Once your department has added you to CLIFMS with either of these two roles for this/these crosslistings, auto-enrollment can occur for these sections.<br /><br />\n";
+ }
+
my $header =
"From: raeburn\@msu.edu\n".
"Subject: New LON-CAPA course request\n".
"This is an automatically generated message.\n\n".
"A request has been submitted for a new course.\n\n";
my $footer = "\n\n\n\nLON-CAPA Support Team";
- my $raeburn = "To: helpdesk\@lon-capa.org\n".$header;
+# my $raeburn = "To: helpdesk\@lon-capa.org\n".$header;
+ my $raeburn = "To: raeburn\@msu.edu\n".$header;
#
# Write information to section files
#
@@ -6391,8 +6388,15 @@
print SHARE "$semyr$lett$coursenum$sections[$k],$classid\n";
}
close(SHARE);
- }
+ }
my $parent=$q->param("parent$num");
+ unless ($parent eq '000') {
+ push @{$children{$parent}},$sections[$num];
+ }
+ if ($globalflag) {
+ push @{$children{'000'}}, $sections[$num];
+ }
+
open (CLASS, ">$MASTERDIR/$FORMDIR/$COURSEDIR/$classid") || error_exit ($q,$page,"Can't open classfile");
print CLASS qq("$classid","$coursename: Section $sections[$num] - $longsem $longyr"\n);
close(CLASS);
@@ -6440,35 +6444,123 @@
close(GROUPS);
}
if ($type == 0) {
- if ($zipflag{$sections[$num]} eq "0") {
- if (-e "$MASTERDIR/$FORMDIR/$ZIPDIR/$classid.zip") {
- system("mv $MASTERDIR/$FORMDIR/$ZIPDIR/$classid.zip $MASTERDIR/$FORMDIR/$ZIPDIR/$classid.old.zip");
- $itds = "Form requests no use of zip archive but $classid.zip file exists - moved to $classid.old.zip\n";
- }
- if (-e "$MASTERDIR/$FORMDIR/templates/$classid") {
- system("mv $MASTERDIR/$FORMDIR/templates/$classid $MASTERDIR/$FORMDIR/templates/$classid.old");
- $itds = "Form requests no use of template but $classid template file exists - moved to $classid.old\n";
- }
- if ($security{$sections[$num]} == 1) {
- $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}.\n";
- }
- elsif ($authorization{$sections[$num]} == 1) {
- $itds2 = "$sectype{$type}. Faculty $secure_type{$authorization{$sections[$num]}}.\n";
- }
- else {
- $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}.\n";
- }
- }
- else {
- my $usetemplate;
- $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}. Template to be used: $usetemplate. Request for following:\n";
- }
- $raeburn = $raeburn.$itds.$itds2." ".$classid."\n";
+ my ($clonedom,$clonecrs);
+ if ($zipflag{$sections[$num]} > 0) {
+ ($clonedom,$clonecrs) = ($zipflag{$sections[$num]} =~ /^(\w+):(\w+):\w*:.+$/);
+ }
+ open(XML,">$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user/$idcode/$classid");
+ print XML <<"XMLONE";
+<class id="$classid">
+ <title>$coursename</title>
+ <coursecode>$semyr$lett$coursenum</coursecode>
+ <coursehome>msul1</coursehome>
+ <coursedomain>msu</coursedomain>
+ <reshome>/res/msu/</reshome>
+ <optional_id></optional_id>
+ <adds>$autoadds</adds>
+ <drops>$autodrops</drops>
+ <enrollstart>$liveday,$livemonth,$liveyr</enrollstart>
+ <enrollend>$deadday,$deadmonth,$deadyr</enrollend>
+ <accessstart>$startday,$startmonth,$startyr</accessstart>
+XMLONE
+ if ($noenddate == 1) {
+ print XML " <accessend><accessend>\n";
+ } else {
+ print XML " <accessend>$endday,$endmonth,$endyr</accessend>\n";
+ }
+ print XML <<"XMLTWO";
+ <authentication>
+ <method>krb4</method>
+ <param>MSU.EDU</param>
+ </authentication>
+ <nonstandard></nonstandard>
+ <topmap></topmap>
+ <firstres>syl</firstres>
+ <clonecrs>$clonecrs</clonecrs>
+ <clonedom>$clonedom</clonedomn>
+ <showphotos></showphotos>
+ <setpolicy>1</setpolicy>
+ <setcontent>1</setcontent>
+ <setkeys>0</setkeys>
+ <keyauth></keyauth>
+ <disresdis>0</disresdis>
+ <disablechat>0</disablechat>
+ <openall></openall>
+ <notify_dc></notify_dc>
+ <notify_owner>1</notify_owner>
+ <owner>
+ <username>$user</username>
+ <domain>msu</domain>
+ <authtype>krb4</authtype>
+ <autharg>MSU.EDU</autharg>
+ </owner>
+ <sections>
+XMLTWO
+ unless ($sections[$num] eq '000') {
+ print XML " <section>
+ <inst>$sections[$num]</inst>
+ <loncapa>$group{$sections[$num]}</loncapa>
+ </section>
+";
+ }
+ foreach my $sec (@{$children{$sections[$num]}}) {
+ print XML " <section>
+ <inst>$sec</inst>
+ <loncapa>$group{$sec}</loncapa>
+ </section>
+";
+ }
+ print XML " </sections>
+ <crosslists>\n";
+ if ($crosslistings > 0) {
+ if (@{$crosslist[$num]} > 0) {
+ for (my $xcount=0; $xcount<@{$crosslist[$num]}; $xcount++) {
+ print XML " <xlist>
+ <inst>$crosslist[$num][$xcount]</inst>
+ <loncapa></loncapa>
+ </xlist>
+";
+ }
+ }
+ }
+ print XML " </crosslists>
+ <users>
+ <user>
+ <username>$user</username>
+ <domain>msu</domain>
+ <email>$user\@msu.edu</email>
+ <authtype>krb4</authtype>
+ <autharg>MSU</autharg>
+ <firstname>$firstname</firstname>
+ <generation></generation>
+ <lastname>$lastname</lastname>
+ <middlename></middlename>
+ <studentID></studentID>
+ <roles>
+ <role id='cc'>
+ <start></start>
+ <end></end>
+ <usec></usec>
+ <role>
+ </roles>
+ </user>
+";
+ close(XML);
+ if ($zipflag{$sections[$num]} eq "0") {
+ if ($security{$sections[$num]} == 1) {
+ $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}.\n";
+ } elsif ($authorization{$sections[$num]} == 1) {
+ $itds2 = "$sectype{$type}. Faculty $secure_type{$authorization{$sections[$num]}}.\n";
+ } else {
+ $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}.\n";
+ }
+ } else {
+ my ($usetemplate) = ($zipflag{$sections[$num]} =~ //);
+ $itds2 = "$sectype{$type}. Faculty $secure_type{$security{$sections[$num]}}. Template to be used: $usetemplate. Request for following:\n";
+ }
+ $raeburn = $raeburn.$itds.$itds2." ".$classid."\n";
}
elsif ($type == 1 || $type == 2) {
- if (-e "$MASTERDIR/$FORMDIR/$ZIPDIR/$classid.zip") {
- system("mv $MASTERDIR/$FORMDIR/$ZIPDIR/$classid.zip $MASTERDIR/$FORMDIR/$ZIPDIR/$classid.old.zip");
- }
if (-e "$MASTERDIR/$FORMDIR/templates/$classid") {
system("mv $MASTERDIR/$FORMDIR/templates/$classid $MASTERDIR/$FORMDIR/templates/$classid.old");
}
@@ -6571,21 +6663,29 @@
#
# Write information for users to file
-#
+#
if ($countothers >0) {
for (my $k=0; $k<$countothers; $k++) {
my $first=$q->param("othfname$k");
my $last= $q->param("othlname$k");
my $email= $q->param("othmail$k");
+ my $domain = 'msu';
+ my $userid = $userids[$k];
+ if ($userid =~ /^(\w+):(\w+)$/) {
+ $userid = $1;
+ $domain = $2;
+ } else {
+ $userid =~ s/\@/_/g;
+ }
my $role= $q->param("othrole$k");
if ($role eq "cc") {
push @profs, $pilotid[$k];
}
- elsif ($role eq "i") {
+ elsif ($role eq "in") {
push @ins, $pilotid[$k];
}
- elsif ($role eq "t") {
+ elsif ($role eq "ta") {
push @tas, $pilotid[$k];
}
else {
@@ -6613,15 +6713,55 @@
my @othsec;
if ($totalsections > 1) {
@othsec = $q->param("othsec$k");
- if ($othsec[0] eq "all") {
- @othsec=@newsections;
- }
}
else {
@othsec=("$sections[0]");
}
foreach my $othersec (@othsec) {
my $classid= $semyr.$lett.$coursenum.$othersec;
+ my $usec_all = 0;
+ if ($type{$othersec} == 0) { #look for children
+ open(XML,">>$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user/$idcode/$classid");
+ print XML "
+ <user>
+ <username>$userid</username>
+ <domain>$domain</domain>
+ <roles>
+ <role id='$role'>
+ <start></start>
+ <end></end>";
+ if (($role eq 'cc') || ($othsec[0] eq "all") || ($usec_all == 1)) {
+ print XML "
+ <usec></usec>";
+ $usec_all = 1;
+ } else {
+ unless ($othersec eq '000') {
+ if (defined($group{$othersec})) {
+ unless($group{$othersec} eq '') {
+ print XML "
+ <usec>$group{$othersec}</usec>";
+ }
+ }
+ }
+ if (ref($children{$othersec}) eq 'ARRAY') {
+ foreach my $child (sort @{$children{$othersec}}) {
+ if (grep/^$child$/,@othsec) {
+ if (defined($group{$child})) {
+ unless($group{$child} eq '') {
+ print XML "
+ <usec>$group{$child}</usec>";
+ }
+ }
+ }
+ }
+ }
+ }
+ print XML "
+ </role>
+ </roles>
+ </user>\n";
+ close(XML);
+ }
if ($type{$othersec} == 0 || $type{$othersec} == 1 ) {
open (STAFF, ">>$MASTERDIR/$FORMDIR/$PEOPLEDIR/$classid") || error_exit ($q,$page,"Can't open stafffile");
print STAFF qq("$userids[$k]","$last","$first","$email","$pid"\n);
@@ -6633,6 +6773,19 @@
}
}
}
+
+# Write closing entries to XML files
+ for (my $num=0; $num<@sections; $num++) {
+ my $classid = $semyr.$lett.$coursenum.$sections[$num];
+ my $type=$q->param("type$num");
+ if ($type == 0) {
+ open(XML,">>$MASTERDIR/$FORMDIR/req_xml/$firstlett/$user/$idcode/$classid");
+ print XML "
+ </users>
+</class>";
+ close XML;
+ }
+ }
if (scalar(@profs) > 0) {
$proflist = join(" ", @profs);
}
@@ -6696,7 +6849,7 @@
" $otherlist\n\n".
"If you need to modify or cancel this course request before the course(s) has/have been created,\n".
"please visit the MSU LON-CAPA Request Tracking page at: \n".
- "http://loncapa.msu,edu/cgi-bin/req.pl\n\n";
+ "http://loncapa.msu.edu/cgi-bin/req.pl\n\n";
my $identifier = $semyr.$lett.$coursenum.$longseclist;
if (!-e "$MASTERDIR/$FORMDIR/$APPDIR/$firstlett") {
@@ -6875,22 +7028,16 @@
if ((grep/^$coursecode$/,@owned) || ($security{$coursecode}) || ($authorization{$coursecode})) {
my $snippet = "";
if ($security{$coursecode}) {
- $snippet = qq|You are listed as an instructor or supervisor in CLIFMS for this class. Consequently, your course request has been authorized automatically, and there is no need to contact your department chair to provide the LON-CAPA office with verification that you are the authorized instructor or supervisor.\n|;
+ $snippet = qq|You are listed as an instructor or supervisor in CLIFMS for this class. Consequently, your course request has been authorized, and your course(s) will be created automatically within the next 10 minutes.\n|;
$requestmail .= "As you are listed as instructor or supervisor in CLIFMS for this class,\n".
- "your course request has been authorized automatically.\n".
- "There is no need to contact your department chair to provide the \n".
- "LON-CAPA office with verification that you are the authorized instructor\n".
- "or supervisor.\n\n";
+ "your course request has been authorized automatically.\n\n".
}
elsif ((grep/^$coursecode$/,@owned) || ($authorization{$coursecode})) {
- $snippet = "As you have used LON-CAPA in the past for this course, your course request has been authorized automatically, and there is no need to contact your department chair to provide the LON-CAPA office with verification that you are the authorized instructor or supervisor.\n";
+ $snippet = "As you have used LON-CAPA in the past for this course, your course request has been authorized automatically.\n";
$requestmail .= "As you have used LON-CAPA in the past for this course, your course \n".
- "request has been authorized automatically, and there is no need \n".
- "to contact your department chair to provide the LON-CAPA office \n".
- "with verification that you are the authorized instructor or supervisor.\n\n";
+ "request has been authorized automatically.\n\n";
}
- $requestmail .= "Your course(s) will be created by the end of the next business day.\n".
- "E-mail notification will be sent automatically to $user\@msu.edu \n".
+ $requestmail .= "Your course(s) will be created automatically within the next 10 minutes. E-mail notification will be sent to $user\@msu.edu \n".
"when the course(s) is/are ready.\n";
print qq|
<td> <font face="Arial,Helvetica,sans-serif" size="+1"><b>Request Confirmation</b></font>
@@ -6914,31 +7061,34 @@
<td>
<font face="Arial,Helvetica,sans-serif">
|;
- print qq|Your course(s) will be created by the end of the next business day. |;
- print qq | E-mail notification will be sent automatically to $user\@msu.edu when the course(s) is/are ready.</font>
- <br>
- <br>
+ print qq|Your course(s) will be created within the next 10 minutes. |;
+ print qq | E-mail notification will be sent to $user\@msu.edu when the course(s) is/are ready.</font>
+ <br />
+ <br />
+ |;
+ if ($autowarn) {
+ print "$autowarn\n";
+ }
+ print qq|
<font face="Arial,Helvetica,sans-serif">If you wish to print
a paper record of your LON-CAPA request you can access a copy of your completed
application form at: <a href="http://loncapa.msu.edu/forms/sub/$long_user/$identifier.html" target="appform">Application Form for $coursename ($semyr$lett$coursenum)</a>.</font>
</td>
</tr>
- |;
+ |;
}
else {
- $requestmail .= "In order to complete the LON-CAPA application procedure \n".
- "you need to either (a) contact the department chair and ask \n".
- "the chair to send an e-mail to helpdesk\@lon-capa.org to verify \n".
- "that you are an authorized instructor or supervisor for this course ($semyr$lett$coursenum), \n".
- "or (b) contact your department chair and ask the chair to have your \n".
- "MSUNetID added to the CLIFMS database maintained by the Office of Planning & \n".
+ $requestmail .= "Your LON-CAPA course request will be placed in a queue \n".
+ "Please contact your department chair and ask the chair to have your \n".
+ "MSUNetID added (as instructor or supervisor) to the CLIFMS database maintained by the Office of Planning & \n".
"Budgets, for the following semester, course and sections: \n".
"$semyr - $lett - $coursenum: $displayseclist.\n\n".
- "The second of these actions will also be required if you intend to \n".
- "employ automated enrollment of registered students in your course.\n\n".
- "You can expect your new course(s) to be available the business day \n".
- "following your verification as authorized instructor or supervisor (either \n".
- "by e-mail from your chair, or by your addition to the appropriate \n".
+ "This action will also insure that \n".
+ "automated enrollment of registered students will be available
+ "for your course should you have decided to enable this.\n\n".
+ "Your new course(s) will be created automatically once your MSU Net ID \n".
+ "has been added as instructor or supervisor \n".
+ "to the appropriate \n".
"semester, course and section(s) in CLIFMS).\n\n".
"E-mail notification will be sent automatically to $user\@msu.edu \n".
"when the course(s) is/are ready.\n";
@@ -6951,13 +7101,11 @@
<tr>
<td> </td>
<td><font face="Arial,Helvetica,sans-serif">In order to complete
- the LON-CAPA course application procedure, you need to either: (a)
- contact the department chair and ask the chair to send an e-mail to
- helpdesk\@lon-capa.org to verify that you are an authorized instructor
- or supervisor for this course ($semyr$lett$coursenum), or (b) contact your department
- chair and ask the chair
- to have your MSUNetID added to the CLIFMS database maintained by the
- Office of Planning & Budgets, for the following semester, course number and sections:
+ the LON-CAPA course application procedure, you need to
+ contact your department and ask to have your MSUNetID added as faculty
+ instructor or supervisor to the
+ CLIFMS database maintained by the Office of Planning & Budgets,
+ for the following semester, course number and sections:
$semyr - $lett$coursenum: $displayseclist.<br/><br/>The second of these
actions will also be required if you intend to use automated enrollment of
registered students in your course.</font>
@@ -6979,11 +7127,10 @@
</tr>
<tr>
<td> </td>
- <td><font face="Arial,Helvetica,sans-serif">You can expect your
- new course(s) to be available the business day following
- your verification as authorized instructor or supervisor (either by e-mail from
- your chair to helpdesk\@loncapa.org, or by your addition to the
- appropriate semester, course and section(s) in CLIFMS).
+ <td><font face="Arial,Helvetica,sans-serif">Your
+ new course(s) will be created automatically once your MSU Net ID
+ appears in CLIFMS in the instructor or supervisor role
+ for the appropriate semester, course and section(s).
E-mail notification will be sent
automatically to $user\@msu.edu when the course(s) is/are ready.</font>
</td>
@@ -7264,10 +7411,10 @@
}
sub clifmscheck ($$$) {
- my ($user,$lett,$course) = @_;
+ my ($dbhro,$user,$lett,$course) = @_;
my $clifmsflag = 0;
my @clifms = ();
- getclifms($user,\@clifms,"check");
+ &getclifms($dbhro,$user,\@clifms,"check");
if (@clifms) {
if (grep/^$lett$course$/,@clifms) {
$clifmsflag = 1;
@@ -7714,16 +7861,24 @@
return @secs;
}
+sub connect_clifms {
+ my ($dbhro) = shift;
+ eval {$dbhro = &ROInfo::DBM_CONNECT();};
+ if ($@) {
+ print STDERR "Problem connecting to RO_CLIFMS\n";
+ return 'fail';
+ } else {
+ return 'ok';
+ }
+}
+
+sub disconnect_clifms {
+ my $dbhro = shift;
+ $dbhro->disconnect;
+}
+
sub getclifms () {
- my ($user,$authclassref,$mode,$codesref) = @_;
- my $dbhro;
- eval {$dbhro = &ROInfo::DBM_CONNECT();};
- if ($@)
- {
- print STDERR "Problem connecting to RO_CLIFMS\n";
- }
- else
- {
+ my ($dbhro,$user,$authclassref,$mode,$codesref) = @_;
if (($mode eq "check") || ($mode eq "both")) {
eval{
my $user_quoted = $dbhro->quote( $user );
@@ -7760,15 +7915,62 @@
print STDERR "Problem retrieving data from RO_CLIFMS\n";
}
}
- $dbhro->disconnect;
- }
- return;
+ return;
+}
+
+sub clifms_sections {
+ my ($user,$sem,$subj,$crse,$xlists,$oksections,$okxls) = @_;
+ eval{
+ my $sth = $dbhro->prepare("SELECT Sctn_Code
+ FROM RO_CLIFMS_VIEW
+ WHERE MSUNetId = '$user'
+ AND Sem_Code = '$sem'
+ AND Subj_Code = '$subj'
+ AND Crse_Code = '$crse'");
+ $sth->execute;
+ while (my ($sec) = $sth->fetchrow_array) {
+ unless (grep/^$sec/,@{$oksections}) {
+ push @{$oksections}, $sec;
+ }
+ }
+ $sth->finish;
+ };
+ if ($@) {
+ print STDERR "Problem retrieving data from RO_CLIFMS\n";
+ }
+ if (exists($xlists)) {
+ foreach my $class (keys (%$xlists) {
+ @{$$okxls{$class}} = ();
+ my ($sem,$dept,$crse) = ($class =~ /^([suf]s\d{2})(\w{2,3})(\d{3,4}\w?)$/);
+ if ($sem && $dept && $crse) {
+ eval {
+ my $sth = $dbhro->prepare("SELECT Sctn_Code
+ FROM RO_CLIFMS_VIEW
+ WHERE MSUNetId = '$user'
+ AND Sem_Code = '$sec'
+ AND Subj_Code = '$subj'
+ AND Crse_Code = '$crse'");
+ $sth->execute;
+ while (my ($sec) = $sth->fetchrow_array) {
+ my $item = $class.$sec;
+ unless (grep/^$item$/,@{$$okxls}) {
+ push @{$$okxls}, $item;
+ }
+ }
+ $sth->finish;
+ }
+ if ($@) {
+ print STDERR "Problem retrieving data from RO_CLIFMS\n";
+ }
+ }
+ }
+ }
+ return;
}
sub get_cclist () {
my $user = shift;
- my $calling_script = "/bin/common/msu/admin_create_user_account.pl";
- my $URL = "http://s10.lite.msu.edu/cgi-bin/check_ccstatus.pl?username=$user";
+ my $URL = "http://s10.lite.msu.edu/cgi-bin/check_ccstatus2.pl?username=$user";
my $request = new HTTP::Request;
$request = GET $URL;
$request->authorization_basic("lonadm","litelite");
--raeburn1114638339--