[LON-CAPA-cvs] cvs: loncom / lond /interface coursecatalog.pm courseclassifier.pm lonmodifycourse.pm lonparmset.pm lonpickcourse.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 06 Oct 2007 04:32:50 -0000


This is a MIME encoded message

--raeburn1191645170
Content-Type: text/plain

raeburn		Sat Oct  6 00:32:50 2007 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/interface	lonmodifycourse.pm coursecatalog.pm 
                     	courseclassifier.pm lonpickcourse.pm 
                     	lonparmset.pm 
  Log:
  Bug 5191.  Decouple storage of last access time for a course in nohist_courseids.db from storage of course information.
  - Retain backwards compatibility with legacy lonnet::courseiddump()
  
  Other general change: uniform use of 'inst_code' as key in frozen hash instead of 'instcode'. 
  
  lond
  &put_course_id_handler()
  - last access stored in escaped lasttime:courseid key = value hash item
    if legacy lonnet::courseiddump() updates courseinfo.   
  &put_course_id_hash_handler()
  - additional argument - $mode ('timeonly', 'notime' or 'all')
    - determines whether last access, or courseinfo (description,inst_code,owner,type) or both are stored
  &dump_course_id_handler()
  - documentation updated
  - style (replacing unless)
  - change location of unescaping when checking filters so double escaping no longer needed for courseinfo stored in frozen hash
  - return courseinfo in hash form, if requested as hash, when record has yet to be converted to a frozen hash
  &validate_class_access_handler()
  - eliminate extra unescaping of $ownerlist
  
  lonnet.pm
  &flushcourselogs() includes 'timeonly' argument in call to courseidput().
  &courseidput() - if in 'timeonly' mode only courseids are sent to lond in courseidputhash call.
  &createcourse()
  - courseinfo values in hash no longer escaped (freeze_hash handles this)
  - call to flushcourselogs() replaced by call to courseidput()
  
  lonmodifycourse.pm
  - courseinfo values in hash no longer escaped
  - call to courseidput() includes 'notime' as fourth arg.
  
  coursecatalog.pm
  - remove unneeded code, since entry for each course in %courses hash will now be a hash ref.
  
  courseclassifier.pm
  - remove unneeded code, since entry for each course in %courses hash will now be a hash ref.
  
  lonpickcourse.pm
  - Entry for each course in %courses hash should be a hash ref, when constructing for onlyown courses case.
  - instcode to inst_code
  - no need to unescape courseinfo value (thaw_hash in lonnet::courseiddump does it)
  
  lonparmset.pm
  - call to flushcourselogs() replaced by call to courseidput() after updating course description.
  - appenv user's session with new course description.   
  
  
  
--raeburn1191645170
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20071006003250.txt"

Index: loncom/lond
diff -u loncom/lond:1.383 loncom/lond:1.384
--- loncom/lond:1.383	Wed Oct  3 15:57:23 2007
+++ loncom/lond	Sat Oct  6 00:32:23 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.383 2007/10/03 19:57:23 raeburn Exp $
+# $Id: lond,v 1.384 2007/10/06 04:32:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.383 $'; #' stupid emacs
+my $VERSION='$Revision: 1.384 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3305,32 +3305,39 @@
 	foreach my $pair (@pairs) {
             my ($key,$courseinfo) = split(/=/,$pair,2);
             $courseinfo =~ s/=/:/g;
-            if (ref($hashref) eq 'HASH') {
-                my @items = ('description','inst_code','owner','type');
-                my @new_items = split(/:/,$courseinfo,-1);
-                for (my $i=0; $i<@new_items; $i++) {
-                    $hashref->{$key}{$items[$i]} = $new_items[$i];
-                }
-                $hashref->{$key}{'lasttime'} = $now;
-            } else {
-                my @current_items = split(/:/,$hashref->{$key},-1);
-                shift(@current_items); # remove description
-                pop(@current_items);   # remove last access
-                my $numcurrent = scalar(@current_items);
-                if ($numcurrent > 3) {
-                    $numcurrent = 3;
+            if (defined($hashref->{$key})) {
+                my $value = &Apache::lonnet::thaw_unescape($hashref->{$key});
+                if (ref($value) eq 'HASH') {
+                    my @items = ('description','inst_code','owner','type');
+                    my @new_items = split(/:/,$courseinfo,-1);
+                    my %storehash; 
+                    for (my $i=0; $i<@new_items; $i++) {
+                        $storehash{$items[$i]} = $new_items[$i];
+                    }
+                    $hashref->{$key} = 
+                        &Apache::lonnet::freeze_escape(\%storehash);
+                    my $unesc_key = &unescape($key);
+                    $hashref->{&escape('lasttime:'.$unesc_key)} = $now;
+                    next;
                 }
-                my @new_items = split(/:/,$courseinfo,-1);
-                my $numnew = scalar(@new_items);
-                if ($numcurrent > 0) {
-                    if ($numnew <= $numcurrent) { # flushcourselogs() from pre 2.2 
-                        for (my $j=$numcurrent-$numnew; $j>=0; $j--) {
-                            $courseinfo .= ':'.$current_items[$numcurrent-$j-1];
-                        }
+            }
+            my @current_items = split(/:/,$hashref->{$key},-1);
+            shift(@current_items); # remove description
+            pop(@current_items);   # remove last access
+            my $numcurrent = scalar(@current_items);
+            if ($numcurrent > 3) {
+                $numcurrent = 3;
+            }
+            my @new_items = split(/:/,$courseinfo,-1);
+            my $numnew = scalar(@new_items);
+            if ($numcurrent > 0) {
+                if ($numnew <= $numcurrent) { # flushcourselogs() from pre 2.2 
+                    for (my $j=$numcurrent-$numnew; $j>=0; $j--) {
+                        $courseinfo .= ':'.$current_items[$numcurrent-$j-1];
                     }
                 }
-                $hashref->{$key}=$courseinfo.':'.$now;
             }
+            $hashref->{$key}=$courseinfo.':'.$now;
 	}
 	if (&untie_domain_hash($hashref)) {
 	    &Reply( $client, "ok\n", $userinput);
@@ -3352,16 +3359,31 @@
 sub put_course_id_hash_handler {
     my ($cmd, $tail, $client) = @_;
     my $userinput = "$cmd:$tail";
-    my ($udom, $what) = split(/:/, $tail,2);
+    my ($udom,$mode,$what) = split(/:/, $tail,3);
     chomp($what);
     my $now=time;
     my @pairs=split(/\&/,$what);
-    my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT(),
-                                   "P", $what);
+    my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT());
     if ($hashref) {
         foreach my $pair (@pairs) {
             my ($key,$value)=split(/=/,$pair);
-            $hashref->{$key} = $value;
+            my $unesc_key = &unescape($key);
+            if ($mode ne 'timeonly') {
+                if (!defined($hashref->{&escape('lasttime:'.$unesc_key)})) {
+                    my $curritems = &Apache::lonnet::thaw_unescape($key); 
+                    if (ref($curritems) ne 'HASH') {
+                        my @current_items = split(/:/,$hashref->{$key},-1);
+                        my $lasttime = pop(@current_items);
+                        $hashref->{&escape('lasttime:'.$unesc_key)} = $lasttime;
+                    } else {
+                        $hashref->{&escape('lasttime:'.$unesc_key)} = '';
+                    }
+                } 
+                $hashref->{$key} = $value;
+            }
+            if ($mode ne 'notime') {
+                $hashref->{&escape('lasttime:'.$unesc_key)} = $now;
+            }
         }
         if (&untie_domain_hash($hashref)) {
             &Reply($client, "ok\n", $userinput);
@@ -3403,6 +3425,15 @@
 #                            owner matches the supplied username and/or domain
 #                            will be returned. Pre-2.2.0 legacy entries from 
 #                            nohist_courseiddump will only contain usernames.
+#                 type     - optional parameter for selection 
+#                 regexp_ok - if true, allow the supplied institutional code
+#                            filter to behave as a regular expression.  
+#                 rtn_as_hash - whether to return the information available for
+#                            each matched item as a frozen hash of all 
+#                            key, value pairs in the item's hash, or as a 
+#                            colon-separated list of (in order) description,
+#                            institutional code, and course owner.
+#    
 #     $client  - The socket open on the client.
 # Returns:
 #    1     - Continue processing.
@@ -3410,11 +3441,10 @@
 #   a reply is written to $client.
 sub dump_course_id_handler {
     my ($cmd, $tail, $client) = @_;
-
     my $userinput = "$cmd:$tail";
 
     my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter,
-        $typefilter,$regexp_ok,$as_hash) =split(/:/,$tail);
+        $typefilter,$regexp_ok,$rtn_as_hash) =split(/:/,$tail);
     if (defined($description)) {
 	$description=&unescape($description);
     } else {
@@ -3454,71 +3484,94 @@
     if (defined($regexp_ok)) {
         $regexp_ok=&unescape($regexp_ok);
     }
-
-    unless (defined($since)) { $since=0; }
+    my $unpack = 1;
+    if ($description eq '.' && $instcodefilter eq '.' && $coursefilter eq '.' && 
+        $typefilter eq '.') {
+        $unpack = 0;
+    }
+    if (!defined($since)) { $since=0; }
     my $qresult='';
     my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT());
     if ($hashref) {
-	while (my ($key,$rawvalue) = each(%$hashref)) {
-	    my ($descr,$lasttime,$inst_code,$owner,$type);
-            my $value = &Apache::lonnet::thaw_unescape($rawvalue);
-            if (ref($value) eq 'HASH') {
-                $descr = $value->{'description'};
-                $inst_code = $value->{'inst_code'};
-                $owner = $value->{'owner'};
-                $type = $value->{'type'};
-                $lasttime = $value->{'lasttime'};
+	while (my ($key,$value) = each(%$hashref)) {
+            my ($unesc_key,$lasttime_key,$lasttime,$is_hash,%val,%unesc_val);
+            $unesc_key = &unescape($key);
+            if ($unesc_key =~ /^lasttime:/) {
+                next;
+            } else {
+                $lasttime_key = &escape('lasttime:'.$unesc_key);
+            }
+            if ($hashref->{$lasttime_key} ne '') {
+                $lasttime = $hashref->{$lasttime_key};
+                next if ($lasttime<$since);
+            }
+            my $items = &Apache::lonnet::thaw_unescape($value);
+            if (ref($items) eq 'HASH') {
+                $is_hash =  1;
+                if ($unpack || !$rtn_as_hash) {
+                    $unesc_val{'descr'} = $items->{'description'};
+                    $unesc_val{'inst_code'} = $items->{'inst_code'};
+                    $unesc_val{'owner'} = $items->{'owner'};
+                    $unesc_val{'type'} = $items->{'type'};
+                }
             } else {
-                my @courseitems = split(/:/,$rawvalue);
+                $is_hash =  0;
+                my @courseitems = split(/:/,&unescape($value));
                 $lasttime = pop(@courseitems);
-	        ($descr,$inst_code,$owner,$type)=@courseitems;
+                next if ($lasttime<$since);
+	        ($val{'descr'},$val{'inst_code'},$val{'owner'},$val{'type'}) = @courseitems;
             }
-	    if ($lasttime<$since) { next; }
             my $match = 1;
-	    unless ($description eq '.') {
-		my $unescapeDescr = &unescape($descr);
-		unless (eval('$unescapeDescr=~/\Q$description\E/i')) {
+	    if ($description ne '.') {
+                if (!$is_hash) {
+                    $unesc_val{'descr'} = &unescape($val{'descr'});
+                }
+                if (eval{$unesc_val{'descr'} !~ /\Q$description\E/i}) {
                     $match = 0;
-		}
+                }
             }
-            unless ($instcodefilter eq '.' || !defined($instcodefilter)) {
-                my $unescapeInstcode = &unescape($inst_code);
+            if ($instcodefilter ne '.') {
+                if (!$is_hash) {
+                    $unesc_val{'inst_code'} = &unescape($val{'inst_code'});
+                }
                 if ($regexp_ok) {
-                    unless (eval('$unescapeInstcode=~/$instcodefilter/')) {
+                    if (eval{$unesc_val{'inst_code'} !~ /$instcodefilter/}) {
                         $match = 0;
                     }
                 } else {
-                    unless (eval('$unescapeInstcode=~/\Q$instcodefilter\E/i')) {
+                    if (eval{$unesc_val{'inst_code'} !~ /\Q$instcodefilter\E/i}) {
                         $match = 0;
                     }
                 }
 	    }
-            unless ($ownerfilter eq '.' || !defined($ownerfilter)) {
-                my $unescapeOwner = &unescape($owner);
+            if ($ownerfilter ne '.') {
+                if (!$is_hash) {
+                    $unesc_val{'owner'} = &unescape($val{'owner'});
+                }
                 if (($ownerunamefilter ne '') && ($ownerdomfilter ne '')) {
-                    if ($unescapeOwner =~ /:/) {
-                        if (eval('$unescapeOwner !~ 
-                             /\Q$ownerunamefilter\E:\Q$ownerdomfilter\E$/i')) {
+                    if ($unesc_val{'owner'} =~ /:/) {
+                        if (eval{$unesc_val{'owner'} !~ 
+                             /\Q$ownerunamefilter\E:\Q$ownerdomfilter\E$/i}) {
                             $match = 0;
                         } 
                     } else {
-                        if (eval('$unescapeOwner!~/\Q$ownerunamefilter\E/i')) {
+                        if (eval{$unesc_val{'owner'} !~ /\Q$ownerunamefilter\E/i}) {
                             $match = 0;
                         }
                     }
                 } elsif ($ownerunamefilter ne '') {
-                    if ($unescapeOwner =~ /:/) {
-                        if (eval('$unescapeOwner!~/\Q$ownerunamefilter\E:[^:]+$/i')) {
+                    if ($unesc_val{'owner'} =~ /:/) {
+                        if (eval{$unesc_val{'owner'} !~ /\Q$ownerunamefilter\E:[^:]+$/i}) {
                              $match = 0;
                         }
                     } else {
-                        if (eval('$unescapeOwner!~/\Q$ownerunamefilter\E/i')) {
+                        if (eval{$unesc_val{'owner'} !~ /\Q$ownerunamefilter\E/i}) {
                             $match = 0;
                         }
                     }
                 } elsif ($ownerdomfilter ne '') {
-                    if ($unescapeOwner =~ /:/) {
-                        if (eval('$unescapeOwner!~/^[^:]+:\Q$ownerdomfilter\E/')) {
+                    if ($unesc_val{'owner'} =~ /:/) {
+                        if (eval{$unesc_val{'owner'} !~ /^[^:]+:\Q$ownerdomfilter\E/}) {
                              $match = 0;
                         }
                     } else {
@@ -3528,30 +3581,47 @@
                     }
                 }
             }
-            my $unescapeCourse = &unescape($key);
-            unless ($coursefilter eq '.' || !defined($coursefilter)) {
-                my $unescapeCourse = &unescape($key);
-                unless (eval('$unescapeCourse=~/^$udom(_)\Q$coursefilter\E$/')) {
+            if ($coursefilter ne '.') {
+                if (eval{$unesc_key !~ /^$udom(_)\Q$coursefilter\E$/}) {
                     $match = 0;
                 }
             }
-            unless ($typefilter eq '.' || !defined($typefilter)) {
-                my $unescapeType = &unescape($type);
-                if ($type eq '') {
+            if ($typefilter ne '.') {
+                if (!$is_hash) {
+                    $unesc_val{'type'} = &unescape($val{'type'});
+                }
+                if ($unesc_val{'type'} eq '') {
                     if ($typefilter ne 'Course') {
                         $match = 0;
                     }
                 } else {
-                    unless (eval('$unescapeType=~/^\Q$typefilter\E$/')) {
+                    if (eval{$unesc_val{'type'} !~ /^\Q$typefilter\E$/}) {
                         $match = 0;
                     }
                 }
             }
             if ($match == 1) {
-                if ($as_hash) {
-                    $qresult.=$key.'='.$rawvalue.'&'; 
+                if ($rtn_as_hash) {
+                    if ($is_hash) {
+                        $qresult.=$key.'='.$value.'&';
+                    } else {
+                        my %rtnhash = ( 'description' => &escape($val{'descr'}),
+                                        'inst_code' => &escape($val{'inst_code'}),
+                                        'owner'     => &escape($val{'owner'}),
+                                        'type'      => &escape($val{'type'}),
+                                      );
+                        my $items = &Apache::lonnet::freeze_escape(\%rtnhash);
+                        $qresult.=$key.'='.$items.'&';
+                    }
                 } else {
-                    $qresult.=$key.'='.$descr.':'.$inst_code.':'.$owner.'&';
+                    if ($is_hash) {
+                        $qresult .= $key.'='.&escape($unesc_val{'descr'}).':'.
+                                    &escape($unesc_val{'inst_code'}).':'.
+                                    &escape($unesc_val{'owner'}).'&';
+                    } else {
+                        $qresult .= $key.'='.$val{'descr'}.':'.$val{'inst_code'}.
+                                    ':'.$val{'owner'}.'&';
+                    }
                 }
             }
 	}
@@ -4385,7 +4455,6 @@
     my ($cmd, $tail, $client) = @_;
     my $userinput = "$cmd:$tail";
     my ($inst_class,$ownerlist,$cdom) = split(/:/, $tail);
-    $ownerlist = &unescape($ownerlist);
     my @owners = split(/,/,&unescape($ownerlist));
     my $outcome;
     eval {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.920 loncom/lonnet/perl/lonnet.pm:1.921
--- loncom/lonnet/perl/lonnet.pm:1.920	Thu Oct  4 15:59:16 2007
+++ loncom/lonnet/perl/lonnet.pm	Sat Oct  6 00:32:40 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.920 2007/10/04 19:59:16 raeburn Exp $
+# $Id: lonnet.pm,v 1.921 2007/10/06 04:32:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2172,7 +2172,7 @@
 # times and course titles for all courseids
 #
     my %courseidbuffer=();
-    foreach my $crsid (keys %courselogs) {
+    foreach my $crsid (keys(%courselogs)) {
         if (&reply('log:'.$coursedombuf{$crsid}.':'.$coursenumbuf{$crsid}.':'.
 		          &escape($courselogs{$crsid}),
 		          $coursehombuf{$crsid}) eq 'ok') {
@@ -2187,7 +2187,7 @@
         }
         $courseidbuffer{$coursehombuf{$crsid}}{$crsid} = {
             'description' => &escape($coursedescrbuf{$crsid}),
-            'instcode'    => &escape($courseinstcodebuf{$crsid}),
+            'inst_code'    => &escape($courseinstcodebuf{$crsid}),
             'type'        => &escape($coursetypebuf{$crsid}),
             'owner'       => &escape($courseownerbuf{$crsid}),
         };
@@ -2198,7 +2198,8 @@
 #
     foreach my $crs_home (keys(%courseidbuffer)) {
         my $response = &courseidput(&host_domain($crs_home),
-                                    $courseidbuffer{$crs_home},$crs_home);
+                                    $courseidbuffer{$crs_home},
+                                    $crs_home,'timeonly');
     }
 #
 # File accesses
@@ -2504,21 +2505,32 @@
 #
 
 sub courseidput {
-    my ($domain,$storehash,$coursehome)=@_;
-    my $items='';
-    my $now = time;
-    foreach my $item (keys(%$storehash)) {
-        $storehash->{$item}{'lasttime'} = $now;
-        $items.=&escape($item).'='.&freeze_escape($$storehash{$item}).'&';
+    my ($domain,$storehash,$coursehome,$caller) = @_;
+    my $outcome;
+    if ($caller eq 'timeonly') {
+        my $cids = '';
+        foreach my $item (keys(%$storehash)) {
+            $cids.=&escape($item).'&';
+        }
+        $cids=~s/\&$//;
+        $outcome = &reply('courseidputhash:'.$domain.':'.$caller.':'.$cids,
+                          $coursehome);       
+    } else {
+        my $items = '';
+        foreach my $item (keys(%$storehash)) {
+            $items.= &escape($item).'='.
+                     &freeze_escape($$storehash{$item}).'&';
+        }
+        $items=~s/\&$//;
+        $outcome = &reply('courseidputhash:'.$domain.':'.$caller.':'.$items,
+                          $coursehome);
     }
-    $items=~s/\&$//;
-    my $outcome = &reply('courseidputhash:'.$domain.':'.$items,$coursehome);
     if ($outcome eq 'unknown_cmd') {
         my $what;
         foreach my $cid (keys(%$storehash)) {
             $what .= &escape($cid).'=';
-            foreach my $item ('description','instcode','owner','type') {
-                $what .= $storehash->{$item}.':';
+            foreach my $item ('description','inst_code','owner','type') {
+                $what .= &escape($storehash->{$item}).':';
             }
             $what =~ s/\:$/&/;
         }
@@ -2530,7 +2542,8 @@
 }
 
 sub courseiddump {
-    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,$coursefilter,$hostidflag,$hostidref,$typefilter,$regexp_ok)=@_;
+    my ($domfilter,$descfilter,$sincefilter,$instcodefilter,$ownerfilter,
+        $coursefilter,$hostidflag,$hostidref,$typefilter,$regexp_ok)=@_;
     my $as_hash = 1;
     my %returnhash;
     if (!$domfilter) { $domfilter=''; }
@@ -2547,7 +2560,7 @@
                          $sincefilter.':'.&escape($descfilter).':'.
                          &escape($instcodefilter).':'.&escape($ownerfilter).
                          ':'.&escape($coursefilter).':'.&escape($typefilter).
-                         ':'.&escape($regexp_ok).':'.$as_hash,$tryserver); 
+                         ':'.&escape($regexp_ok).':'.$as_hash,$tryserver);
                 my @pairs=split(/\&/,$rep);
                 foreach my $item (@pairs) {
                     my ($key,$value)=split(/\=/,$item,2);
@@ -2557,10 +2570,10 @@
                     if (ref($result) eq 'HASH') {
                         $returnhash{$key}=$result;
                     } else {
-                        my @responses = split(/:/,$result);
-                        my @items = ('description','instcode','owner','type');
+                        my @responses = split(/:/,$value);
+                        my @items = ('description','inst_code','owner','type');
                         for (my $i=0; $i<@responses; $i++) {
-                            $returnhash{$key}{$items[$i]} = $responses[$i];
+                            $returnhash{$key}{$items[$i]} = &unescape($responses[$i]);
                         }
                     } 
                 }
@@ -5548,14 +5561,13 @@
 # log existence
     my $newcourse = {
                     $udom.'_'.$uname => {
-                                     description => &escape($description),
-                                     inst_code   => &escape($inst_code),
-                                     owner       => &escape($course_owner),
-                                     type        => &escape($crstype),
+                                     description => $description,
+                                     inst_code   => $inst_code,
+                                     owner       => $course_owner,
+                                     type        => $crstype,
                                                 },
                     };
-    &courseidput($udom,$newcourse);
-    &flushcourselogs();
+    &courseidput($udom,$newcourse,$uhome,'notime');
 # set toplevel url
     my $topurl=$url;
     unless ($nonstandard) {
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.33 loncom/interface/lonmodifycourse.pm:1.34
--- loncom/interface/lonmodifycourse.pm:1.33	Wed Oct  3 15:57:29 2007
+++ loncom/interface/lonmodifycourse.pm	Sat Oct  6 00:32:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # handler for DC-only modifiable course settings
 #
-# $Id: lonmodifycourse.pm,v 1.33 2007/10/03 19:57:29 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.34 2007/10/06 04:32:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -563,14 +563,14 @@
         my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type);
         my %courseid_entry = (
              $cdom.'_'.$cnum => {
-                                description => &escape($description),
-                                inst_code   => &escape($env{'form.coursecode'}),
-                                owner       => &escape($env{'form.courseowner'}),
-                                type        => &escape($type),
+                                description => $description,
+                                inst_code   => $env{'form.coursecode'},
+                                owner       => $env{'form.courseowner'},
+                                type        => $type,
                                },
         );
         &Apache::lonnet::courseidput($cdom,\%courseid_entry,
-                                     &Apache::lonnet::homeserver($cnum,$cdom));
+                                     &Apache::lonnet::homeserver($cnum,$cdom),'notime');
     }
     foreach my $param (@modifiable_params) {
         if ($currattr{$param} eq $newattr{$param}) {
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.22 loncom/interface/coursecatalog.pm:1.23
--- loncom/interface/coursecatalog.pm:1.22	Wed Oct  3 15:57:29 2007
+++ loncom/interface/coursecatalog.pm	Sat Oct  6 00:32:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.22 2007/10/03 19:57:29 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.23 2007/10/06 04:32:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -522,10 +522,6 @@
         my $descr;
         if (ref($courses->{$course}) eq 'HASH') {
             $descr = $courses->{$course}{'description'}; 
-        } elsif ($courses->{$course} =~ m/^([^:]*):/i) {
-            $descr = &unescape($1);
-        } else {
-            $descr = &unescape($courses->{$course});
         }
         my $cleandesc=&HTML::Entities::encode($descr,'<>&"');
         $cleandesc=~s/'/\\'/g;
@@ -534,7 +530,7 @@
         my ($descr,$instcode,$singleowner,$ttype,@owners,%ownernames);
         if (ref($courses->{$course}) eq 'HASH') {
             $descr = $courses->{$course}{'description'};
-            $instcode =  $courses->{$course}{'instcode'};
+            $instcode =  $courses->{$course}{'inst_code'};
             $singleowner = $courses->{$course}{'owner'};
             $ttype =  $courses->{$course}{'type'};
             push(@owners,$singleowner);
@@ -543,10 +539,6 @@
                     push(@owners,$item);
                 }
             }
-        } else {
-            ($descr,$instcode,$singleowner,$ttype) = 
-                split(/:/,$courses->{$course});
-            push(@owners,$singleowner);
         }
         foreach my $owner (@owners) {
             my ($ownername,$ownerdom) = @_; 
Index: loncom/interface/courseclassifier.pm
diff -u loncom/interface/courseclassifier.pm:1.2 loncom/interface/courseclassifier.pm:1.3
--- loncom/interface/courseclassifier.pm:1.2	Wed Oct  3 15:57:29 2007
+++ loncom/interface/courseclassifier.pm	Sat Oct  6 00:32:49 2007
@@ -34,10 +34,7 @@
     my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.',                                                undef,undef,'Course');
     foreach my $course (keys(%courses)) {
         if (ref($courses{$course}) eq 'HASH') {
-            $$coursecodes{$course} = $courses{$course}{'instcode'};
-            $totcodes ++;
-        } elsif ($courses{$course} =~ m/^[^:]*:([^:]+)/) {
-            $$coursecodes{$course} = &unescape($1);
+            $$coursecodes{$course} = $courses{$course}{'inst_code'};
             $totcodes ++;
         }
     }
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.64 loncom/interface/lonpickcourse.pm:1.65
--- loncom/interface/lonpickcourse.pm:1.64	Wed Oct  3 15:57:29 2007
+++ loncom/interface/lonpickcourse.pm	Sat Oct  6 00:32:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.64 2007/10/03 19:57:29 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.65 2007/10/06 04:32:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,7 +176,7 @@
     foreach my $course (keys(%courses)) {
         my $descr;
         if (ref($courses{$course}) eq 'HASH') {
-            $descr = &unescape($courses{$course}{'description'});
+            $descr = $courses{$course}{'description'};
         } elsif ($courses{$course} =~ m/^([^:]*):/i) {
             $descr = &unescape($1);
         } else {
@@ -200,7 +200,7 @@
             my ($descr,$instcode,$ttype,@owners);
             if (ref($courses{$course}) eq 'HASH') {
                 $descr = $courses{$course}{'description'};
-                $instcode =  $courses{$course}{'instcode'};
+                $instcode =  $courses{$course}{'inst_code'};
                 $ttype =  $courses{$course}{'type'};
                 push(@owners,&unescape($courses{$course}{'owner'}));
                 if (ref($courses{$course}{'co-owners'}) eq 'ARRAY') {
@@ -342,8 +342,7 @@
               'cog' => &mt('Course Type')
              );
 
-    $typeselectform =  '<select name="type" size="1"';
-    $typeselectform .= ">\n";
+    $typeselectform =  '<select name="type" size="1">'."\n";
     if ($type eq 'Course') {
         $instcodeform = 
                 '<input type="text" name="instcodefilter" size="10" value="'.
@@ -445,7 +444,7 @@
         $r->print('<br />');
         my %coursehash = &Apache::loncommon::findallcourses(); 
         foreach my $cid (sort(keys(%coursehash))) {
-            $courses{$cid} = $env{'course.'.$cid.'.description'};
+            $courses{$cid}{'description'} = $env{'course.'.$cid.'.description'};
         }
     }
     return %courses;
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.381 loncom/interface/lonparmset.pm:1.382
--- loncom/interface/lonparmset.pm:1.381	Mon Sep 10 21:59:30 2007
+++ loncom/interface/lonparmset.pm	Sat Oct  6 00:32:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.381 2007/09/11 01:59:30 albertel Exp $
+# $Id: lonparmset.pm,v 1.382 2007/10/06 04:32:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2124,9 +2124,19 @@
                 if ($name eq 'cloners') {
                     &change_clone($value,\@oldcloner);
                 }
-                # Flush the course logs so course description is immediately updated
+                # Update environment and nohist_courseids.db
                 if ($name eq 'description' && defined($value)) {
-                    &Apache::lonnet::flushcourselogs();
+                    my %crsinfo = 
+                        &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
+                                                 $crs,undef,undef,'Course');
+                    &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value);
+                    if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
+                        $crsinfo{$env{'request.course.id'}}{'description'} = $value; 
+                        my $chome = &Apache::lonnet::homeserver($crs,$dom);
+                        my $putresult =
+                            &Apache::lonnet::courseidput($dom,\%crsinfo,
+                                                         $chome,'notime');
+                    }
                 }
             } else {
                 $setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to').

--raeburn1191645170--