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

goltermann goltermann at source.lon-capa.org
Wed Mar 28 08:58:43 EDT 2012


goltermann		Wed Mar 28 12:58:43 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  ui redesign:
  - confirm_success() to display save message
  - reduced text on buttons to make them easier to recognize as buttons, put them in a fieldset
  - rework of resource table, now using data table for easier reading and unified design
  - if the used version of a resource is not equal to the current version in the course, it will now be red to be identified easier
  - added a second save button at the end of the table
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.478 loncom/interface/londocs.pm:1.479
--- loncom/interface/londocs.pm:1.478	Sat Mar 10 21:24:59 2012
+++ loncom/interface/londocs.pm	Wed Mar 28 12:58:42 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.478 2012/03/10 21:24:59 raeburn Exp $
+# $Id: londocs.pm,v 1.479 2012/03/28 12:58:42 goltermann Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1730,9 +1730,11 @@
         if (&Apache::lonnet::put('resourceversions',\%newsetversions,
 			  $env{'course.'.$env{'request.course.id'}.'.domain'},
 			  $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
-	    $r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>');
+	    $r->print(&Apache::loncommon::confirmwrapper(
+                &Apache::lonhtmlcommon::confirm_success(&mt('Your Version Settings have been Saved'))));
 	} else {
-	    $r->print('<h1><span class="LC_error">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</span></h1>');
+	    $r->print(&Apache::loncommon::confirmwrapper(
+                &Apache::lonhtmlcommon::confirm_success(&mt('An Error Occured while Attempting to Save your Version Settings'),1)));
 	}
 	&mark_hash_old();
     }
@@ -1798,12 +1800,19 @@
 'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below',
 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
-	       'di' => 'Differences');
+	       'di' => 'Differences',
+	       'save' => 'Save',
+	       'act' => 'Actions');
     $r->print(<<ENDHEADERS);
 <form action="/adm/coursedocs" method="post">
 <input type="hidden" name="versions" value="1" />
-<input type="submit" name="setmostrecent" value="$lt{'sm'}" />
-<input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
+<div class="LC_columnSection">
+<fieldset>
+<legend>$lt{'act'}</legend>
+$lt{'sm'}: <input type="submit" name="setmostrecent" value="Go" /><br />
+$lt{'sc'}: <input type="submit" name="setcurrent" value="Go" />
+</fieldset>
+</div>
 <select name="timerange">
 <option value='all' $allsel>$lt{'al'}</option>
 <option value="-1" $startsel>$lt{'st'}</option>
@@ -1812,47 +1821,49 @@
 <option value="86400" $daysel>$lt{'sy'}</option>
 </select>
 <input type="submit" name="display" value="$lt{'sd'}" />
-<h3>$header</h3>
-<input type="submit" name="setversions" value="$lt{'sv'}" />
+<h2>$header</h2>
+<input type="submit" name="setversions" value="$lt{'save'}" />
 <table border="0">
 ENDHEADERS
+    #number of columns for version history
+    my $num_ver_col = 1;
+    $r->print(
+    &Apache::loncommon::start_data_table().
+    &Apache::loncommon::start_data_table_header_row().
+    '<th>'.&mt('Resources').'</th>'.
+    "<th>$lt{'mr'}</th>".
+    "<th>$lt{'ve'}</th>".
+    "<th>$lt{'vu'}</th>".
+    '<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'.
+    '</b>');
     foreach my $key (sort(keys(%changes))) {
 	if ($changes{$key}>$starttime) {
 	    my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
 	    my $currentversion=&Apache::lonnet::getversion($key);
 	    if ($currentversion<0) {
-		$currentversion=&mt('Could not be determined.');
+                $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
 	    }
 	    my $linkurl=&Apache::lonnet::clutter($key);
-	    $r->print(
-		      '<tr><td colspan="5"><br /><br /><font size="+1"><b>'.
-		      &Apache::lonnet::gettitle($linkurl).
-                      '</b></font></td></tr>'.
-                      '<tr><td>   </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 title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
-                      '<font size="+1">'.$currentversion.'</font>'.
-                      '</span></td>'.
-                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$crstype.': '.
-                      '<font size="+1">');
+        $r->print(
+            &Apache::loncommon::end_data_table_header_row().
+            &Apache::loncommon::start_data_table_row().
+            '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'.
+            '<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
+            '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('.
+            &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.
+            '<td align="right">');
 # Used in course
 	    my $usedversion=$hash{'version_'.$linkurl};
 	    if (($usedversion) && ($usedversion ne 'mostrecent')) {
-		$r->print($usedversion);
+                if($usedversion != $currentversion){
+                    $r->print('<span class="LC_warning">'.$usedversion.'</span>');
+                }else{
+                    $r->print($usedversion);
+                }
 	    } else {
 		$r->print($currentversion);
 	    }
-	    $r->print('</font></span></td><td title="'.$lt{'vu'}.'">'.
-                      '<span class="LC_nobreak">Use: ');
+	    $r->print('</td><td title="'.$lt{'vu'}.'">');
 # Set version
 	    $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
 						      'set_version_'.$linkurl,
@@ -1861,7 +1872,6 @@
 						       '' => '',
 						       'mostrecent' => &mt('most recent'),
 						       map {$_,$_} (1..$currentversion)}));
-	    $r->print('</span></td></tr><tr><td></td>');
 	    my $lastold=1;
 	    for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
 		my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -1875,13 +1885,13 @@
             # 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;
+            if ($num_entries % $num_ver_col == 0) {
+                $entries_per_col = $num_entries/$num_ver_col;
             } else {
-                $entries_per_col = $num_entries/4 + 1;
+                $entries_per_col = $num_entries/$num_ver_col + 1;
             }
             my $entries_count = 0;
-            $r->print('<td valign="top"><font size="-2">');
+            $r->print('<td valign="top"><span class="LC_fontsize_medium">');
             my $cols_output = 1;
             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
 		my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -1900,21 +1910,21 @@
 		}
 		$r->print('</span><br />');
                 if (++$entries_count % $entries_per_col == 0) {
-                    $r->print('</font></td>');
-                    if ($cols_output != 4) {
-                        $r->print('<td valign="top"><font size="-2">');
+                    $r->print('</span></td>');
+                    if ($cols_output != $num_ver_col) {
+                        $r->print('<td valign="top"><span class="LC_fontsize_medium">');
                         $cols_output++;
                     }
                 }
 	    }
-            while($cols_output++ < 4) {
-                $r->print('</font></td><td><font>')
+            while($cols_output++ < $num_ver_col) {
+                $r->print('</span></td><td>');
             }
-	    $r->print('</font></td></tr>'."\n");
 	}
     }
-    $r->print('</table></form>');
-    $r->print('<p class="LC_success">'.&mt('Done').'</p>');
+    $r->print('</td>'.&Apache::loncommon::end_data_table_row().
+            &Apache::loncommon::end_data_table().
+            '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />');
 
     &untiehash();
 }


More information about the LON-CAPA-cvs mailing list