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

www lon-capa-cvs@mail.lon-capa.org
Mon, 13 Nov 2006 01:57:58 -0000


www		Sun Nov 12 20:57:58 2006 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  * just saving my work on docs log - does not work yet
  * setting parameters does not work anymore - not sure when and where it broke
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.248 loncom/interface/londocs.pm:1.249
--- loncom/interface/londocs.pm:1.248	Sun Nov 12 01:29:33 2006
+++ loncom/interface/londocs.pm	Sun Nov 12 20:57:57 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.248 2006/11/12 06:29:33 albertel Exp $
+# $Id: londocs.pm,v 1.249 2006/11/13 01:57:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1001,6 +1001,7 @@
     my $parmidx;
     my %parmaction=();
     my %parmvalue=();
+    my $changedflag;
 
     sub snapshotbefore {
         @oldresources=@LONCAPA::map::resources;
@@ -1008,6 +1009,7 @@
         $parmidx=undef;
         %parmaction=();
         %parmvalue=();
+        $changedflag=0;
     }
 
     sub remember_parms {
@@ -1015,11 +1017,12 @@
         $parmidx=$idx;
         $parmaction{$parameter}=$action;
         $parmvalue{$parameter}=$value;
+        $changedflag=1;
     }
 
     sub log_differences {
-        my $r=shift;
-        my %storehash=('folder' => $env{'form.folder'});
+        my ($coursenum,$coursedom,$folder)=@_;
+        my %storehash=('folder' => '/uploaded/'.$coursedom.'/'.$coursenum.'/userfiles/'.$folder);
         if ($parmidx) {
            $storehash{'parameter_idx'}=$parmidx;
            $storehash{'parameter_res'}=$oldresources[$parmidx];
@@ -1036,15 +1039,17 @@
            if ($LONCAPA::map::resources[$idx] ne $oldresources[$idx]) {
               $storehash{'before_resources_'.$idx}=$oldresources[$idx];
               $storehash{'after_resources_'.$idx}=$LONCAPA::map::resources[$idx];
+              $changedflag=1;
            }
            if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) {
               $storehash{'before_order_'.$idx}=$oldorder[$idx];
               $storehash{'after_order_'.$idx}=$LONCAPA::map::order[$idx];
               $storehash{'before_order_res_'.$idx}=$oldresources[$idx];
               $storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$idx];
+              $changedflag=1;
            }
         }
-        &log_docs(\%storehash);
+        if ($changedflag) { &log_docs(\%storehash); }
     }
 }
 
@@ -1080,7 +1085,7 @@
     $r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'.
               '<input type="submit" value="'.&mt('Display').'" /></form>');
     $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
-              '<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'.
+              '<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Folder').'</th><th>'.&mt('Users').'</th><th>'.
               &mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'.
               &Apache::loncommon::end_data_table_header_row());
     my $shown=0;
@@ -1109,7 +1114,8 @@
                        <td>'.$about_me_link.
                   '<br /><tt>'.$docslog{$id}{'exe_uname'}.
                                   ':'.$docslog{$id}{'exe_udom'}.'</tt>'.
-                  $send_msg_link.'</td>');
+                  $send_msg_link.'</td><td>'.
+                  &Apache::lonnet::gettitle($docslog{$id}{'logentry'}{'folder'}).'</td>');
 
         $r->print(&Apache::loncommon::end_data_table_row());
         $shown++;
@@ -1329,7 +1335,7 @@
 		    }
 		}
 # Store the changed version
-		($errtext,$fatal)=group_import($coursenum, $coursedom, $folder,
+		($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder,
 					       $container,'londocs',@imports);
 		if ($fatal) {
 		    $r->print('<p><font color="red">'.$errtext.'</font></p>');
@@ -1356,7 +1362,8 @@
                    $r->print('<p><font color="red">'.&mt('No map selected.').'</font></p>');
                }
            }
-           &log_differences($r);
+           &log_differences($coursenum,$coursedom,
+                            $folder.'.'.$container);
        }
 # ---------------------------------------------------------------- End commands
 # ---------------------------------------------------------------- Print screen