--- loncom/interface/londocs.pm 2009/10/17 00:09:26 1.394
+++ loncom/interface/londocs.pm 2009/10/22 22:25:36 1.401
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.394 2009/10/17 00:09:26 droeschl Exp $
+# $Id: londocs.pm,v 1.401 2009/10/22 22:25:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -998,7 +998,7 @@ sub group_import {
}
sub breadcrumbs {
- my ($where,$allowed,$type)=@_;
+ my ($allowed,$type)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
my (@folders);
if ($env{'form.pagepath'}) {
@@ -1013,6 +1013,15 @@ sub breadcrumbs {
my $isencrypted=0;
my $ishidden=0;
my $is_random_order=0;
+ if (!$allowed) {
+ my $description = $env{'course.'.$env{'request.course.id'}.'.description'};
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {'href' => '/adm/menu',
+ 'title'=> 'Go to main menu',
+ 'text' => $description,
+ });
+ $plain .= $description.' >';
+ }
while (@folders) {
my $folder=shift(@folders);
my $foldername=shift(@folders);
@@ -1503,9 +1512,14 @@ sub editor {
$LONCAPA::map::resources[$idx]='';
}
- my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
- &breadcrumbs($folder,$allowed,$type);
- $r->print($breadcrumbtrail);
+ my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
+ if ($allowed) {
+ ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
+ &breadcrumbs($allowed,$type);
+ $r->print($breadcrumbtrail);
+ } else {
+ $randompick = -1;
+ }
# ------------------------------------------------------------ Process commands
@@ -2047,7 +2061,7 @@ END
$url.='pagepath='.&escape($pagepath).
'&pagesymb='.&escape($symb).$cpinfo;
}
- if ($external) {
+ if (($external) && ($allowed)) {
my $form = ($folder =~ /^default/)? 'newext' : 'supnewext';
$external = ' '.&mt('Edit').'';
} else {
@@ -2756,12 +2770,14 @@ sub create_form_ul {
'Docs_Adding_Course_Doc')
);
} else {
- my $lc_type = lc($type);
- &Apache::lonhtmlcommon::add_breadcrumb({
- href=>"/adm/coursedocs",text=>"Supplemental $lc_type documents"});
-
+ my $folder=$env{'form.folder'};
+ if ($folder eq '' || $folder eq 'supplemental') {
+ $env{'form.folderpath'} = 'supplemental&'.
+ &escape(&mt('Supplemental '.$type.' Documents'));
+ }
+ my ($breadcrumbtrail) = &breadcrumbs($allowed,$type);
$r->print(&Apache::loncommon::start_page("Supplemental documents").
- &Apache::lonhtmlcommon::breadcrumbs());
+ $breadcrumbtrail);
}
my %allfiles = ();
@@ -2884,7 +2900,7 @@ sub create_form_ul {
'file' => 'File',
'title' => 'Title',
'comment' => 'Comment',
- 'parse' => 'Upload embedded images/multimedia files if HTML file!',
+ 'parse' => 'Upload embedded images/multimedia files if HTML file',
'nd' => 'Upload Document',
'pm' => 'Published Map',
'sd' => 'Special Document',
@@ -2994,33 +3010,35 @@ ERFORM
HIDDENFORM
}
# --------------------------------------------------------- Main tab structure
-
+
my $activeClass = 1;
my $active = '';
- $r->print('
');
- if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
- if($activeClass == 1){
- $active = 'class="active"';
- $activeClass = 0;
- }
- }
- if ($allowed){
+ if ($allowed) {
+ $r->print('');
+ if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
+ if($activeClass == 1){
+ $active = 'class="active"';
+ $activeClass = 0;
+ }
+ }
$r->print('- '.&mt('Main Course Documents').'
');
- }
- $active = '';
- if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
- if($activeClass == 1){
- $active = 'class="active"';
+ $active = '';
+ if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
+ if($activeClass == 1){
+ $active = 'class="active"';
+ }
}
+ $r->print('- '.&mt('Supplemental Course Documents').'
');
+ $r->print('
');
+ } else {
+ $r->print('
');
}
- $r->print('- '.&mt('Supplemental Course Documents').'
');
- $r->print('
'
- .''
+ $r->print('
'
.'
');
# --------------------------------------------------------- Standard documents
my $savefolderpath;
- my $active = 'style="display: none;"';
+ $active = 'style="display: none;"';
if($activeClass == 0){
$active = 'style="display: block;"';
}
@@ -3213,7 +3231,7 @@ NSYLFORM
NGFFORM
@specialdocumentsforma=(
- {'

'=>$newpageform},
+ {'

'=>$newpageform},
{'

'=>$newsylform},
{'

'=>$newgroupfileform},
);
@@ -3234,8 +3252,8 @@ NGFFORM
if($env{'form.pagepath'}) {
@specialdocumentsforma=(
- {'

'=>$newsmpproblemform},
- {'

'=>$newexuploadform}
+ {'

'=>$newsmpproblemform},
+ {'

'=>$newexuploadform}
);
$specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma));
}
@@ -3272,7 +3290,7 @@ $r->print('
');
if ($env{'form.pagepath'}) {
}
# ----------------------------------------------------- Supplemental documents
- my $active = 'style="display: none;"';
+ $active = 'style="display: none;"';
if($activeClass == 1){
$active = 'style="display: block;"';
}
@@ -3296,9 +3314,7 @@ $r->print('
');
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
- my @supupdocform = (
- {'

'=>"
$help{'Uploading_From_Harddrive'}"},
- );
+ my $supupdocformbtn = "
$help{'Uploading_From_Harddrive'}";
my $supupdocform=(<
@@ -3315,7 +3331,7 @@ $r->print(' ');
SUPDOCFORM
- $supupdocform .= create_form_ul(create_list_elements(@supupdocform))."";
+ $supupdocform .= create_form_ul(Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'}))."";
my $supnewfolderform=(<
@@ -3361,9 +3377,9 @@ SNAMFORM
my @specialdocs = (
- {'
'=>$supnewextform},
- {'
'=>$supnewsylform},
- {'
'=>$supnewaboutmeform},
+ {'
'=>$supnewextform},
+ {'
'=>$supnewsylform},
+ {'
'=>$supnewaboutmeform},
);
my %suporderhash = (
'00' => ['Supnewfolder', $supnewfolderform],
@@ -3466,7 +3482,7 @@ sub generate_edit_table {
}
}
$form .= '';
- $form .= '';
+ $form .= '
';
foreach my $field (keys(%orderhash)){
if($field ne '00'){
if($activetab eq '' || $activetab ne $field){