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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 05 Feb 2004 15:19:41 -0000


matthew		Thu Feb  5 10:19:41 2004 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Utterly reworked interface to set versions page.  Functionality remains the
  same.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.102 loncom/interface/londocs.pm:1.103
--- loncom/interface/londocs.pm:1.102	Wed Feb  4 15:53:54 2004
+++ loncom/interface/londocs.pm	Thu Feb  5 10:19:41 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.102 2004/02/04 20:53:54 matthew Exp $
+# $Id: londocs.pm,v 1.103 2004/02/05 15:19:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -709,10 +709,7 @@
 <input type="submit" name="display" value="$lt{'sd'}" />
 <h3>$header</h3>
 <input type="submit" name="setversions" value="$lt{'sv'}" />
-<table border="2">
-<tr>
-<th>$lt{'fi'}</th><th>$lt{'md'}</th><th>$lt{'mr'}</th>
-<th>$lt{'ve'}</th><th>$lt{'vu'}</th><th>$lt{'di'}</th></tr>
+<table border="0">
 ENDHEADERS
     foreach (sort keys %changes) {
 	if ($changes{$_}>$starttime) {
@@ -723,16 +720,25 @@
 	    }
 	    my $linkurl=&Apache::lonnet::clutter($_);
 	    $r->print(
-		      '<tr><td><b>'.
+		      '<tr><td colspan="5"><br /><br /><font size="+1"><b>'.
 		      &Apache::lonnet::gettitle($linkurl).
-		   '</b><br /><a href="'.$linkurl.'" target="cat">'.$linkurl.
-		      '</a></td><td>'.
+                      '</b></font></td></tr>'.
+                      '<tr><td>&nbsp;&nbsp;&nbsp;</td>'.
+                      '<td colspan="4">'.
+                      '<a href="'.$linkurl.'" target="cat">'.$linkurl.
+		      '</a></td></tr>'.
+                      '<tr><td></td>'.
+                      '<td title="'.$lt{'md'}.'">'.
 		      &Apache::lonlocal::locallocaltime(
                            &Apache::lonnet::metadata($root.'.'.$extension,
                                                      'lastrevisiondate')
                                                         ).
-                      '</td><td><font size="+2">'.
-		      $currentversion.'</font></td><td><font size="+2">');
+                      '</td>'.
+                      '<td title="'.$lt{'mr'}.'"><nobr>Most Recent: '.
+                      '<font size="+1">'.$currentversion.'</font>'.
+                      '</nobr></td>'.
+                      '<td title="'.$lt{'ve'}.'"><nobr>In Course: '.
+                      '<font size="+1">');
 # Used in course
 	    my $usedversion=$hash{'version_'.$linkurl};
 	    if (($usedversion) && ($usedversion ne 'mostrecent')) {
@@ -740,14 +746,15 @@
 	    } else {
 		$r->print($currentversion);
 	    }
-	    $r->print('</font></td><td>');
+	    $r->print('</font></nobr></td><td title="'.$lt{'vu'}.'">'.
+                      '<nobr>Use: ');
 # Set version
 	    $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
 						      'set_version_'.$linkurl,
 						      ('' => '',
 						       'mostrecent' => 'most recent',
 						       map {$_,$_} (1..$currentversion))));
-	    $r->print('</td><td><font size="1"><ul>');
+	    $r->print('</nobr></td></tr><tr><td></td>');
 	    my $lastold=1;
 	    for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
 		my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -756,11 +763,27 @@
 		    $lastold=$prevvers;
 		}
 	    }
+            # 
+            # Code to figure out how many version entries should go in
+            # each of the four columns
+            my $entries_per_col = 0;
+            my $num_entries = ($currentversion-$lastold);
+            if ($num_entries % 4 == 0) {
+                $entries_per_col = $num_entries/4;
+            } else {
+                $entries_per_col = $num_entries/4 + 1;
+            }
+            my $entries_count = 0;
+            $r->print('<td valign="top"><font size="-2">'); 
+            my $cols_output = 1;
             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
 		my $url=$root.'.'.$prevvers.'.'.$extension;
-		$r->print('<li><a href="'.&Apache::lonnet::clutter($url).
+		$r->print('<nobr><a href="'.&Apache::lonnet::clutter($url).
 			  '">'.&mt('Version').' '.$prevvers.'</a> ('.
-			  &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
+			  &Apache::lonlocal::locallocaltime(
+                                &Apache::lonnet::metadata($url,
+                                                          'lastrevisiondate')
+                                                            ).
 			  ')');
 		if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
                     $r->print(' <a href="/adm/diff?filename='.
@@ -768,9 +791,19 @@
 			      '&versionone='.$prevvers.
 			      '">'.&mt('Diffs').'</a>');
 		}
-		$r->print('</li>');
+		$r->print('</nobr><br />');
+                if (++$entries_count % $entries_per_col == 0) {
+                    $r->print('</font></td>');
+                    if ($cols_output != 4) {
+                        $r->print('<td valign="top"><font size="-2">');
+                        $cols_output++;
+                    }
+                }
 	    }
-	    $r->print('</ul></font></td></tr>');
+            while($cols_output++ < 4) {
+                $r->print('</font></td><td><font>')
+            }
+	    $r->print('</font></td></tr>'."\n");
 	}
     }
     $r->print('</table></form>');