--- loncom/interface/londocs.pm 2009/10/07 19:57:12 1.390 +++ 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.390 2009/10/07 19:57:12 tempelho 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); @@ -1032,11 +1041,7 @@ sub breadcrumbs { if ($3) { $isencrypted=1; } if ($4 ne '') { $is_random_order = 1; } if ($folder eq 'supplemental') { - if ($allowed) { - $name = &mt('Supplemental '.$type.' Documents'); - } else { - $name = &mt($type.' Documents'); - } + $name = &mt('Supplemental '.$type.' Documents'); } &Apache::lonhtmlcommon::add_breadcrumb( {'href'=>$url.$cpinfo, @@ -1493,7 +1498,6 @@ sub handle_edit_cmd { sub editor { my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; - my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1508,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 @@ -1632,18 +1641,21 @@ sub editor { $shown++; } if ($shown) { - $r->print(&Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_header_row() - .'
' .&mt('Currently no documents.') .'
' @@ -1793,7 +1805,6 @@ sub parse_supplemental_title { sub entryline { my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; - my ($foldertitle,$pagetitle,$renametitle); if (&is_supplemental_title($title)) { ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title); @@ -2050,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 { @@ -2747,16 +2758,27 @@ sub create_form_ul { # Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); - &Apache::lonhtmlcommon::add_breadcrumb({ - href=>"/adm/createuser",text=>"$type Documents"}); + if ($allowed) { + &Apache::lonhtmlcommon::add_breadcrumb({ + href=>"/adm/coursedocs",text=>"$type Editor"}); - $r->print(&Apache::loncommon::start_page("$type Documents", $script, - {'force_register' => $showdoc,}) - .&Apache::loncommon::help_open_menu('','',273,'RAT') - .&Apache::lonhtmlcommon::breadcrumbs( - 'Editing the Table of Contents for your '.$type, - 'Docs_Adding_Course_Doc') - ); + $r->print(&Apache::loncommon::start_page("$type Editor", $script, + {'force_register' => $showdoc,}) + .&Apache::loncommon::help_open_menu('','',273,'RAT') + .&Apache::lonhtmlcommon::breadcrumbs( + 'Editing the Table of Contents for your '.$type, + 'Docs_Adding_Course_Doc') + ); + } else { + 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"). + $breadcrumbtrail); + } my %allfiles = (); my %codebase = (); @@ -2878,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', @@ -2899,9 +2921,7 @@ FIUP CHBO - my @fileuploada = ( - { '' => " $help{'Uploading_From_Harddrive'}" }, - ); + my $fileuploada = " $help{'Uploading_From_Harddrive'}"; my $fileuploadform=(<'.$error.'
'); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + if ($error) { + $r->print(''.$error.'
'); } -$r->print(&generate_edit_table($tid,$varscd,\%suporderhash)); -} + my $tid='2'; + my $varscd = 'Supplemental Course Documents'; + $r->print(&generate_edit_table($tid,$varscd,\%suporderhash)); + } else { + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + if ($error) { + $r->print(''.$error.'
'); + } + } $r->print(''); @@ -3415,15 +3442,15 @@ sub generate_admin_options { my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); my @list = ( - {''=>"$lt{'vc'}$help{'Verify_Content'}"}, - {''=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + {''=>"$lt{'vc'}$help{'Verify_Content'}"}, + {''=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, ); if($dumpbut ne ''){ - push @list, {''=>$dumpbut}; + push @list, {''=>$dumpbut}; } - push @list, ({''=>$exportbut}, - {''=>"$lt{'ls'}"}, - {''=>"$lt{'sl'}"}, + push @list, ({''=>$exportbut}, + {''=>"$lt{'ls'}"}, + {''=>"$lt{'sl'}"}, ); return ''; @@ -3455,7 +3482,7 @@ sub generate_edit_table { } } $form .= ''; - $form .= '