[LON-CAPA-cvs] cvs: loncom /interface londocs.pm lonhtmlcommon.pm portfolio.pm /publisher lonpubdir.pm

raeburn raeburn at source.lon-capa.org
Fri Jun 10 18:31:35 EDT 2016


raeburn		Fri Jun 10 22:31:35 2016 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonhtmlcommon.pm portfolio.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  - Display course's quota usage in file upload section in Course Editor
  - Consistent conversion for kB -> MB
  - div style for disk usage: inline in Authoring Space; block in portfolio.    
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.604 loncom/interface/londocs.pm:1.605
--- loncom/interface/londocs.pm:1.604	Mon Jun  6 17:40:48 2016
+++ loncom/interface/londocs.pm	Fri Jun 10 22:31:27 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.604 2016/06/06 17:40:48 raeburn Exp $
+# $Id: londocs.pm,v 1.605 2016/06/10 22:31:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5224,8 +5224,22 @@
                                "userfiles/$subdir",1); # expressed in kB
     }
     my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
+    my $usage = $current_disk_usage/1024; # in MB
+    my $quota = $disk_quota;
+    my $percent;
+    if ($disk_quota == 0) {
+        $percent = 100.0;
+    } else {
+        $percent = 100*($current_disk_usage/$disk_quota);
+    }
+    $usage = sprintf("%.2f",$usage);
+    $quota = sprintf("%.2f",$quota);
+    $percent = sprintf("%.0f",$percent);
+    my $quotainfo = '<p>'.&mt('Currently using [_1] of the [_2] available.',
+                              $percent.'%',$quota.' MB').'</p>';
 
 	my $fileupload=(<<FIUP);
+        $quotainfo
 	$lt{'file'}:<br />
 	<input type="file" name="uploaddoc" class="flUpload" size="40" />
     <input type="hidden" id="free_space" value="$free_space" />
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.371 loncom/interface/lonhtmlcommon.pm:1.372
--- loncom/interface/lonhtmlcommon.pm:1.371	Sat Apr  2 04:30:20 2016
+++ loncom/interface/lonhtmlcommon.pm	Fri Jun 10 22:31:27 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.371 2016/04/02 04:30:20 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.372 2016/06/10 22:31:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2673,9 +2673,9 @@
 #
 
 sub display_usage {
-    my ($current_disk_usage,$disk_quota) = @_;
-    my $usage = $current_disk_usage/1000;
-    my $quota = $disk_quota/1000;
+    my ($current_disk_usage,$disk_quota,$context) = @_;
+    my $usage = $current_disk_usage/1024;
+    my $quota = $disk_quota/1024;
     my $percent;
     if ($disk_quota == 0) {
         $percent = 100.0;
@@ -2699,9 +2699,13 @@
     if ($prog_width > 100) {
         $prog_width = 100;
     }
+    my $display = 'block';
+    if ($context eq 'authoring') {
+        $display = 'inline';
+    }
     return '
-  <div id="meter1" align="left" '.$cssclass.'>'.&mt('Currently using [_1] of the [_2] available.',$usage.' MB <span style="font-weight:bold;">('.$percent.'%)</span>',$quota.' MB')."\n".
-'   <div id="meter2" style="display:block; margin-top:5px; margin-bottom:5px; margin-left:0px; margin-right:0px; width:400px; border:1px solid #000000; height:10px;">'."\n".
+  <div id="meter1" align="left" style="display:'.$display.'" '.$cssclass.'>'.&mt('Currently using [_1] of the [_2] available.',$usage.' MB <span style="font-weight:bold;">('.$percent.'%)</span>',$quota.' MB')."\n".
+'   <div id="meter2" style="display:block; margin-top:3px; margin-bottom:3px; margin-left:0px; margin-right:0px; width:400px; border:1px solid #000000; height:10px;">'."\n".
 '    <div id="meter3" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000; margin:0px;"></div>'."\n".
 '   </div>'."\n".
 '  </div>';
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.256 loncom/interface/portfolio.pm:1.257
--- loncom/interface/portfolio.pm:1.256	Thu Jun 18 20:19:06 2015
+++ loncom/interface/portfolio.pm	Fri Jun 10 22:31:27 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.256 2015/06/18 20:19:06 musolffc Exp $
+# $Id: portfolio.pm,v 1.257 2016/06/10 22:31:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -203,7 +203,8 @@
                     .$helpitem
                     .'</div>'
                     .'<div>'
-                    .&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota)
+                    .&Apache::lonhtmlcommon::display_usage($current_disk_usage,
+                                                           $disk_quota,'portfolio')
                     .'</div>');
 }
 
@@ -2571,7 +2572,7 @@
     } else {
         $disk_quota = &Apache::loncommon::get_user_quota($env{'user.name'},
                                     $env{'user.domain'}); #expressed in MB
-        $disk_quota = 1000 * $disk_quota; # convert from MB to kB
+        $disk_quota = 1024 * $disk_quota; # convert from MB to kB
     }
     return $disk_quota;
 }
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.167 loncom/publisher/lonpubdir.pm:1.168
--- loncom/publisher/lonpubdir.pm:1.167	Wed Jan  6 16:44:35 2016
+++ loncom/publisher/lonpubdir.pm	Fri Jun 10 22:31:34 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Authoring Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.167 2016/01/06 16:44:35 damieng Exp $
+# $Id: lonpubdir.pm,v 1.168 2016/06/10 22:31:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -375,7 +375,8 @@
 
     $r->print(&Apache::loncommon::head_subbox(
                      '<div style="float:right;padding-top:0;margin-top;0">'
-                    .&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota)
+                    .&Apache::lonhtmlcommon::display_usage($current_disk_usage,
+                                                           $disk_quota,'authoring')
                     .'</div>'
                     .&Apache::loncommon::CSTR_pageheader()));
 




More information about the LON-CAPA-cvs mailing list