--- loncom/interface/londocs.pm 2009/08/28 19:43:16 1.384 +++ loncom/interface/londocs.pm 2009/10/19 16:13:17 1.397 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.384 2009/08/28 19:43:16 raeburn Exp $ +# $Id: londocs.pm,v 1.397 2009/10/19 16:13:17 wenzelju 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 { @@ -2744,11 +2755,30 @@ sub create_form_ul { .$script."\n" .'// ]]>'."\n" .''."\n"; - my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}]; - $r->print(&Apache::loncommon::start_page("$type Documents", $script, - {'force_register' => $showdoc, - 'bread_crumbs' => $brcrum}). - &Apache::loncommon::help_open_menu('','',273,'RAT')); + + # Breadcrumbs + &Apache::lonhtmlcommon::clear_breadcrumbs(); + if ($allowed) { + &Apache::lonhtmlcommon::add_breadcrumb({ + href=>"/adm/coursedocs",text=>"$type Editor"}); + + $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 = (); @@ -2891,9 +2921,7 @@ FIUP CHBO - my @fileuploada = ( - { pic01 => "$lt{'upld'} $help{'Uploading_From_Harddrive'}" }, - ); + my $fileuploada = " $help{'Uploading_From_Harddrive'}"; my $fileuploadform=(<'.$error.'
'); + } + 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(&generate_edit_table($tid,$varscd,\%suporderhash)); -} -my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); - if ($error) { - $r->print(''.$error.'
'); - } $r->print('