--- loncom/interface/lonhtmlcommon.pm 2013/05/03 21:57:13 1.344 +++ loncom/interface/lonhtmlcommon.pm 2013/07/10 22:07:37 1.349 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.344 2013/05/03 21:57:13 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.349 2013/07/10 22:07:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1226,6 +1226,7 @@ ENDEDITOR + ENDJQUERY return $s; @@ -1259,7 +1260,8 @@ sub htmlareaselectactive { my ($args) = @_; unless (&htmlareabrowser()) { return ''; } my $output=''; return $output; @@ -1957,7 +1960,7 @@ sub docs_breadcrumbs { } } if ($folder eq 'supplemental') { - $name = &mt('Supplemental '.$crstype.' Contents'); + $name = &mt('Supplemental Content'); } if ($contenteditor) { $plain.=$name.' > '; @@ -2398,6 +2401,49 @@ sub resource_info_box { return $return; } +# display_usage +# +# Generates a div containing a block, filled to show percentage of current quota used +# +# Quotas available for user portfolios, group portfolios, authoring spaces, and course +# content stored directly within a course (i.e., excluding published content). +# + +sub display_usage { + my ($current_disk_usage,$disk_quota) = @_; + my $usage = $current_disk_usage/1000; + my $quota = $disk_quota/1000; + 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 ($color,$cssclass); + if ($percent <= 60) { + $color = '#00A000'; + } elsif ($percent > 60 && $percent < 90) { + $color = '#FFD300'; + $cssclass = 'class="LC_warning"'; + } elsif( $percent >= 90) { + $color = '#FF0000'; + $cssclass = 'class="LC_error"'; + } + my $prog_width = $percent; + if ($prog_width > 100) { + $prog_width = 100; + } + return ' +
'.&mt('Currently using [_1] of the [_2] available.',$usage.' MB ('.$percent.'%)',$quota.' MB')."\n". +'
'."\n". +'
'."\n". +'
'."\n". +'
'; +} + ############################################## ############################################## @@ -2896,7 +2942,10 @@ sub resize_scrollbox_js { scroll => 'contentscroll', boxh => 'contenteditor', ); - $paddingwfrac = 0.09; + $paddingwfrac = 0; + unless ($env{'browser.mobile'}) { + $paddingwfrac = 0.09; + } $offsetwfrac = 0.015; $offsetv = 20; $minw = 250; @@ -3584,7 +3633,7 @@ highlighted and set to the value 'Action The actionlist is used to offer contextual actions, mostly at the bottom of a page, on which the outcome of an processed action is shown, -e.g. a file operation in Construction Space. +e.g. a file operation in Authoring Space. =over