--- loncom/interface/lonhtmlcommon.pm 2015/05/28 02:53:29 1.364
+++ loncom/interface/lonhtmlcommon.pm 2017/11/16 13:31:29 1.390
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.364 2015/05/28 02:53:29 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.390 2017/11/16 13:31:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -92,7 +92,7 @@ sub raw_href_to_link {
sub entity_encode {
my ($text)=@_;
- return &HTML::Entities::encode($text, '<>&"');
+ return &HTML::Entities::encode($text, '\'<>&"');
}
sub direct_parm_link {
@@ -407,7 +407,7 @@ sub textbox {
##############################################
##############################################
sub checkbox {
- my ($name,$checked,$value) = @_;
+ my ($name,$checked,$value,$special) = @_;
my $Str = '';
return $Str;
}
@@ -538,6 +538,8 @@ sub date_setter {
if (! defined($state) || $state ne 'disabled') {
$state = '';
+ } else {
+ $state = 'disabled="disabled"';
}
if (! defined($no_hh_mm_ss)) {
$no_hh_mm_ss = 0;
@@ -673,7 +675,7 @@ ENDJS
my $minuteselector = qq{};
my $secondselector= qq{};
my $cal_link;
- if (!$nolink) {
+ unless (($nolink) || ($state eq 'disabled')) {
$cal_link = qq{};
}
#
@@ -700,7 +702,7 @@ ENDJS
$hourselector,$minuteselector,$secondselector).
$tzone;
}
- if (!$nolink) {
+ unless (($nolink) || ($state eq 'disabled')) {
$result .= &mt('[_1]Select Date[_2]',$cal_link,'');
}
$result .= "\n\n";
@@ -1023,11 +1025,15 @@ data structure used for bookkeeping.
=item $number_to_do The total number of items being processed.
+=item $preamble Optional HTML to display before the progress bar.
+
=back
=back
Returns a hash containing the progress state data structure.
+If $number_to_do is zero or null, an indeterminate progress bar will
+be used.
=item &Update_PrgWin()
@@ -1116,20 +1122,20 @@ Returns: none
# Create progress
sub Create_PrgWin {
- my ($r,$number_to_do)=@_;
+ my ($r,$number_to_do,$preamble)=@_;
my %prog_state;
$prog_state{'done'}=0;
$prog_state{'firststart'}=&Time::HiRes::time();
$prog_state{'laststart'}=&Time::HiRes::time();
$prog_state{'max'}=$number_to_do;
- &Apache::loncommon::LCprogressbar($r);
+ &Apache::loncommon::LCprogressbar($r,$prog_state{'max'},$preamble);
return %prog_state;
}
# update progress
sub Update_PrgWin {
my ($r,$prog_state,$displayString)=@_;
- &Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString);
+ &Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString,$$prog_state{'max'});
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1179,7 +1185,7 @@ sub Increment_PrgWin {
if ($$prog_state{'max'}) {
$percent=int(100.*$current/$$prog_state{'max'});
}
- &Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo);
+ &Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo,$$prog_state{'max'});
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1194,9 +1200,9 @@ sub Close_PrgWin {
# ------------------------------------------------------- Puts directory header
sub crumbs {
- my ($uri,$target,$prefix,$form,$skiplast)=@_;
+ my ($uri,$target,$prefix,$form,$skiplast,$onclick)=@_;
# You cannot crumbnify uploaded or adm resources
- if ($uri=~/^\/*(uploaded|adm)\//) { return &mt('(Internal Course/Group Content)'); }
+ if ($uri=~/^\/*(uploaded|adm)\//) { return &mt('(Internal Course/Community Content)'); }
if ($target) {
$target = ' target="'.
&Apache::loncommon::escape_single($target).'"';
@@ -1216,13 +1222,19 @@ sub crumbs {
} else {
$path.='/';
}
+ if ($path eq '/res/') {
+ unless (&Apache::lonnet::allowed('bre',$path)) {
+ $output.="$dir/";
+ next;
+ }
+ }
my $href_path = &HTML::Entities::encode($path,'<>&"');
&Apache::loncommon::inhibit_menu_check(\$href_path);
if ($form) {
my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
- $output.=qq{$dir/};
+ $output.=qq{$dir/};
} else {
- $output.=qq{$dir/};
+ $output.=qq{$dir/};
}
}
} else {
@@ -1293,9 +1305,9 @@ sub htmlareaheaders {
ENDEDITOR
}
$s.=(<
-
-
+
+
+
@@ -1704,7 +1716,8 @@ sub show_return_link {
if ($env{'request.noversionuri'}=~m{^/priv/} ||
$env{'request.uri'}=~m{^/priv/}) { return 1; }
return if ($env{'request.noversionuri'} eq '/adm/supplemental');
-
+ return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') &&
+ (!$env{'request.role.adv'}));
if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
|| ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
@@ -1718,7 +1731,7 @@ sub show_return_link {
(($env{'request.noversionuri'}=~/^\/adm\//) &&
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
($env{'request.noversionuri'}!~
- m{^/adm/.*/(smppg|bulletinboard)($|\?)})
+ m{^/adm/.*/(smppg|bulletinboard|ext\.tool)($|\?)})
));
}
@@ -1804,6 +1817,8 @@ the text on the right side of the breadc
=item $component_help
+the help item filename (without .tex extension).
+
=item $menulink
boolean, controls whether to include a link to /adm/menu
@@ -1820,6 +1835,21 @@ optional name for the class to apply to
optional flag, 1 if &mt() is _not_ to be applied to $component when including the text on the right
+=item $CourseBreadcrumbs
+
+optional flag, 1 if &breadcrumbs called from &docs_breadcrumbs, because breadcrumbs are being
+used to display hierarchy for current folder shown in the Course Editor.
+
+=item $topic_help
+
+optional help item to be displayed on right side of the breadcrumbs row, using
+loncommon::help_open_topic() to generate the link.
+
+=item $topic_help_text
+
+text to include in the link in the optional help item ($topic_help) on the right
+side of the breadcrumbs row.
+
=back
=back
@@ -1851,7 +1881,7 @@ returns: nothing
sub breadcrumbs {
my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt,
- $CourseBreadcrumbs,$topic_help,$topic_help_text) = @_;
+ $CourseBreadcrumbs,$topic_help,$topic_help_text,$crstype) = @_;
#
$css_class ||= 'LC_breadcrumbs';
@@ -1876,7 +1906,7 @@ returns: nothing
$env{'course.'.$env{'request.course.id'}.'.description'};
$no_mt_descr = 1;
if ($env{'request.noversionuri'} =~
- m{^/public/($match_domain)/($match_courseid)/syllabus$}) {
+ m{^/?public/($match_domain)/($match_courseid)/syllabus$}) {
unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
$description = 'Menu';
@@ -2081,6 +2111,16 @@ returns: nothing
undef(%tools);
}
+=item ¤t_breadcrumb_tools()
+
+returns: a hash containing the current breadcrumb tools.
+
+=cut
+
+ sub current_breadcrumb_tools {
+ return %tools;
+ }
+
=item &render_tools(\$breadcrumbs)
Creates html for breadcrumb tools (categories navigation and tools) and inserts
@@ -2165,11 +2205,11 @@ sub docs_breadcrumbs {
my $foldername=shift(@folders);
if ($folderpath) {$folderpath.='&';}
$folderpath.=$folder.'&'.$foldername;
- my $url;
+ my $url = $env{'request.use_absolute'};
if ($allowed) {
- $url = '/adm/coursedocs?folderpath=';
+ $url .= '/adm/coursedocs?folderpath=';
} else {
- $url = '/adm/supplemental?folderpath=';
+ $url .= '/adm/supplemental?folderpath=';
}
$url .= &escape($folderpath);
my $name=&unescape($foldername);
@@ -2461,7 +2501,7 @@ sub course_selection {
if ($totcodes > 0) {
my $numtitles = @$codetitles;
if ($numtitles > 0) {
- $output .= ' ';
+ $output .= ' ';
$output .= '