[LON-CAPA-cvs] cvs: loncom /interface londocs.pm lonhtmlcommon.pm lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Fri Nov 16 18:37:16 EST 2012
raeburn Fri Nov 16 23:37:16 2012 EDT
Modified files:
/loncom/interface londocs.pm lonmenu.pm lonhtmlcommon.pm
Log:
- Breadcrumbs when viewing items in Supplemental Content area.
- Move &breadcrumbs() routine from londocs.pm to &docs_breadcrumbs() in
lonhtmlcommon.pm to facilitate reuse.
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.508 loncom/interface/londocs.pm:1.509
--- loncom/interface/londocs.pm:1.508 Wed Nov 14 02:49:19 2012
+++ loncom/interface/londocs.pm Fri Nov 16 23:37:15 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.508 2012/11/14 02:49:19 raeburn Exp $
+# $Id: londocs.pm,v 1.509 2012/11/16 23:37:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -312,61 +312,6 @@
return &storemap($coursenum, $coursedom, $folder.'.'.$container,1);
}
-sub breadcrumbs {
- my ($allowed,$crstype)=@_;
- &Apache::lonhtmlcommon::clear_breadcrumbs();
- my (@folders);
- if ($env{'form.pagepath'}) {
- @folders = split('&',$env{'form.pagepath'});
- } else {
- @folders=split('&',$env{'form.folderpath'});
- }
- my $folderpath;
- my $plain='';
- my $randompick=-1;
- my $isencrypted=0;
- my $ishidden=0;
- my $is_random_order=0;
- while (@folders) {
- my $folder=shift(@folders);
- my $foldername=shift(@folders);
- if ($folderpath) {$folderpath.='&';}
- $folderpath.=$folder.'&'.$foldername;
- my $url;
- if ($allowed) {
- $url = '/adm/coursedocs?folderpath=';
- } else {
- $url = '/adm/supplemental?folderpath=';
- }
- $url .= &escape($folderpath);
- my $name=&unescape($foldername);
-# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername
- $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
- if ($1 ne '') {
- $randompick=$1;
- } else {
- $randompick=-1;
- }
- if ($2) { $ishidden=1; }
- if ($3) { $isencrypted=1; }
- if ($4 ne '') { $is_random_order = 1; }
- if ($folder eq 'supplemental') {
- $name = &mt('Supplemental '.$crstype.' Content');
- }
- &Apache::lonhtmlcommon::add_breadcrumb(
- {'href'=>$url,
- 'title'=>$name,
- 'text'=>$name,
- 'no_mt'=>1,
- });
- $plain.=$name.' > ';
- }
- $plain=~s/\>\;\s*$//;
- return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
- undef, undef, 1 ),$randompick,$ishidden,
- $isencrypted,$plain,$is_random_order);
-}
-
sub log_docs {
return &Apache::lonnet::write_log('course','docslog', at _);
}
@@ -464,7 +409,8 @@
if ($supplementalflag) {
$tid = 2;
}
- my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype);
+ my ($breadcrumbtrail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
$r->print($breadcrumbtrail.
&generate_edit_table($tid,\%orderhash,undef,$iconpath,$jumpto,
$readfile));
@@ -1749,7 +1695,7 @@
: 'sequence';
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
- &breadcrumbs($allowed,$crstype);
+ &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
$r->print($breadcrumbtrail);
my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
@@ -2459,6 +2405,9 @@
$form_start.
$form_common.'
<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="'."this.form.changeparms.value='randomorder';this.form.submit()".'" '.$ro_set.' /> '.&mt('Random Order').' </label></span></form>';
+ } elsif ($supplementalflag && !$allowed) {
+ $url .= ($url =~ /\?/) ? 'amp;':'?';
+ $url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');
}
if ($ispage) {
my $pagename=&escape($pagetitle);
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.391 loncom/interface/lonmenu.pm:1.392
--- loncom/interface/lonmenu.pm:1.391 Fri Nov 9 17:27:10 2012
+++ loncom/interface/lonmenu.pm Fri Nov 16 23:37:16 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.391 2012/11/09 17:27:10 raeburn Exp $
+# $Id: lonmenu.pm,v 1.392 2012/11/16 23:37:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -446,7 +446,7 @@
if ($env{'request.course.id'} && $env{'request.symb'} eq '') {
$resurl = $env{'request.noversionuri'};
}
-
+
if ( $env{'request.symb'} && $env{'request.course.id'} ) {
(my $mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
@@ -478,6 +478,29 @@
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
+ } elsif ($env{'request.course.id'}) {
+ my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
+ if ($env{'request.noversionuri'} =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) {
+ my $crstype = &Apache::loncommon::course_type();
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+ if ($env{'form.folderpath'}) {
+ my ($trail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
+ return $trail;
+ } else {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {text => "Supplemental $crstype Content",
+ href => "javascript:gopost('/adm/supplemental','')"});
+ if ($env{'httpref.'.$env{'request.noversionuri'}} ne '') {
+ &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
+ }
+ return &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
+ }
+ } else {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
+ }
} elsif (! $const_space){
#a situation when we're looking at a resource outside of context of a
#course or construction space (e.g. with cumulative rights)
@@ -888,7 +911,7 @@
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
&Apache::lonhtmlcommon::add_breadcrumb_tool(
'advtools', @funcs[61,71,72,73,74,92]);
- }
+ }
}
# ================================================================== Raw Config
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.330 loncom/interface/lonhtmlcommon.pm:1.331
--- loncom/interface/lonhtmlcommon.pm:1.330 Thu Nov 8 18:37:44 2012
+++ loncom/interface/lonhtmlcommon.pm Fri Nov 16 23:37:16 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.330 2012/11/08 18:37:44 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.331 2012/11/16 23:37:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1882,6 +1882,68 @@
} # End of scope for @Crumbs
+sub docs_breadcrumbs {
+ my ($allowed,$crstype,$contenteditor)=@_;
+ my ($folderpath, at folders);
+ if ($env{'form.pagepath'}) {
+ @folders = split('&',$env{'form.pagepath'});
+ } else {
+ @folders=split('&',$env{'form.folderpath'});
+ }
+ my $plain='';
+ my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
+ &clear_breadcrumbs();
+ while (@folders) {
+ my $folder=shift(@folders);
+ my $foldername=shift(@folders);
+ if ($folderpath) {$folderpath.='&';}
+ $folderpath.=$folder.'&'.$foldername;
+ my $url;
+ if ($allowed) {
+ $url = '/adm/coursedocs?folderpath=';
+ } else {
+ $url = '/adm/supplemental?folderpath=';
+ }
+ $url .= &escape($folderpath);
+ my $name=&unescape($foldername);
+# each of randompick number, hidden, encrypted, random order are
+# appended with ":"s to the foldername
+ $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
+ 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 ($folder eq 'supplemental') {
+ $name = &mt('Supplemental '.$crstype.' Content');
+ }
+ if ($contenteditor) {
+ $plain.=$name.' > ';
+ }
+ &add_breadcrumb(
+ {'href' => $url,
+ 'title' => $name,
+ 'text' => $name,
+ 'no_mt' => 1,
+ });
+ }
+ unless ($contenteditor) {
+ if ($env{'httpref.'.$env{'request.noversionuri'}} ne '') {
+ &add_breadcrumb({text => 'View Resource'});
+ }
+ } else {
+ $plain=~s/\>\;\s*$//;
+ }
+ return (&breadcrumbs(undef,undef,0,'nohelp',undef,undef,$contenteditor),
+ $randompick,$ishidden,$isencrypted,$plain,
+ $is_random_order);
+}
+
############################################################
############################################################
More information about the LON-CAPA-cvs
mailing list