--- loncom/interface/lonhtmlcommon.pm 2013/02/05 16:22:27 1.341 +++ loncom/interface/lonhtmlcommon.pm 2013/07/11 18:25:51 1.350 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.341 2013/02/05 16:22:27 bisitz Exp $ +# $Id: lonhtmlcommon.pm,v 1.350 2013/07/11 18:25:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -216,6 +216,8 @@ sub dependencycheck_js { } elsif ($folderpath) { $link = '/adm/dependencies?folderpath='.&HTML::Entities::encode($folderpath,'<>&"'); $url = $uri; + } elsif ($uri =~ m{^/public/$match_domain/$match_courseid/syllabus$}) { + $link = '/adm/dependencies'; } $link .= (($link=~/\?/)?'&':'?').'title='. &HTML::Entities::encode($title,'<>&"'); @@ -1224,6 +1226,7 @@ ENDEDITOR + ENDJQUERY return $s; @@ -1257,7 +1260,8 @@ sub htmlareaselectactive { my ($args) = @_; unless (&htmlareabrowser()) { return ''; } my $output=''; return $output; @@ -1908,8 +1921,11 @@ returns: nothing sub docs_breadcrumbs { my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_; - my ($folderpath,@folders); + my ($folderpath,@folders,$supplementalflag); @folders = split('&',$env{'form.folderpath'}); + if ($env{'form.folderpath'} =~ /^supplemental/) { + $supplementalflag = 1; + } my $plain=''; my $container = 'sequence'; my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0); @@ -1930,19 +1946,21 @@ sub docs_breadcrumbs { # each of randompick number, hidden, encrypted, random order, is_page # are appended with ":"s to the foldername $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//; - if ($contenteditor) { - if ($1 ne '') { - $randompick=$1; - } else { - $randompick=-1; + unless ($supplementalflag) { + if ($contenteditor) { + if ($1 ne '') { + $randompick=$1; + } else { + $randompick=-1; + } + if ($2) { $ishidden=1; } + if ($3) { $isencrypted=1; } + if ($4 ne '') { $is_random_order = 1; } + if ($5 == 1) {$container = 'page'; } } - if ($2) { $ishidden=1; } - if ($3) { $isencrypted=1; } - if ($4 ne '') { $is_random_order = 1; } - if ($5 == 1) {$container = 'page'; } } if ($folder eq 'supplemental') { - $name = &mt('Supplemental '.$crstype.' Contents'); + $name = &mt('Supplemental Content'); } if ($contenteditor) { $plain.=$name.' > '; @@ -2383,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". +'
'; +} + ############################################## ############################################## @@ -2881,7 +2942,7 @@ sub resize_scrollbox_js { scroll => 'contentscroll', boxh => 'contenteditor', ); - $paddingwfrac = 0.09; + $paddingwfrac = 0.09; $offsetwfrac = 0.015; $offsetv = 20; $minw = 250; @@ -2920,6 +2981,7 @@ function resize_scrollbox(scrollboxname, var scrolltableid = 'table_'+scrollboxname; var scrollbox; var scrolltable; + var ismobile = '$env{'browser.mobile'}'; if (document.getElementById("$names{'boxw'}") == null) { return; @@ -2956,6 +3018,7 @@ FIRST } $output .= <<"SECOND"; var listwchange; + var scrollchange; if (chkw == 1) { var boxw = document.getElementById("$names{'boxw'}").offsetWidth; var itemw; @@ -2967,6 +3030,7 @@ FIRST var scrollboxw = scrollbox.offsetWidth; var scrollboxscrollw = scrollbox.scrollWidth; + var scrollstart = scrollboxw; var offsetw = parseInt(vpw * $offsetwfrac); var paddingw = parseInt(vpw * $paddingwfrac); @@ -3041,11 +3105,19 @@ PARAMSONE } } + if (newscrollboxw != scrollboxw) { + scrollchange = 1; + } + if (itemid.offsetWidth != itemwstart) { listwchange = 1; } } if ((chkh == 1) || (listwchange)) { + var itemid = document.getElementById("$names{'item'}"); + if (itemid != null) { + itemh = itemid.offsetHeight; + } var primaryheight = document.getElementById('LC_nav_bar').offsetHeight; var secondaryheight; if (document.getElementById('LC_secondary_menu') != null) { @@ -3066,6 +3138,7 @@ PARAMSONE var scrollboxheight = scrollbox.offsetHeight; var scrollboxscrollheight = scrollbox.scrollHeight; + var scrollboxh = scrollboxheight; var minvscrollbox = $minv; var offsetv = $offsetv; @@ -3096,6 +3169,13 @@ PARAMSONE scrollbox.style.height = newscrollheight+"px"; } } + var newscrollboxh = scrollbox.offsetHeight; + if (scrollboxh != newscrollboxh) { + scrollchange = 1; + } + } + if (ismobile && scrollchange) { + \$("#div_$names{'scroll'}").getNiceScroll().onResize(); } return; } @@ -3569,7 +3649,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