--- loncom/interface/londocs.pm 2009/08/28 19:43:16 1.384 +++ loncom/interface/londocs.pm 2009/10/27 09:19:52 1.405 @@ -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.405 2009/10/27 09:19:52 bisitz 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 { @@ -2571,7 +2582,7 @@ sub init_breadcrumbs { my ($form,$text)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs", - text=>"Edit ".&Apache::loncommon::course_type(), + text=>&Apache::loncommon::course_type().' Editor', faq=>273, bug=>'Instructor Interface', help => 'Docs_Adding_Course_Doc'}); @@ -2687,7 +2698,9 @@ sub handler { if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { $showdoc='/'.$1; } - unless ($showdoc) { # got called from remote + if ($showdoc) { # got called in sequence from course + $allowed=0; + } else { if (($env{'form.folder'}=~/^(?:group|default)_/) || ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) { $forcestandard = 1; @@ -2698,8 +2711,6 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']); $script=&Apache::lonratedt::editscript('simple'); } - } else { # got called in sequence from course - $allowed=0; } # subroutine to list form elements @@ -2744,11 +2755,33 @@ 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') + ); + } elsif ($showdoc) { + $r->print(&Apache::loncommon::start_page("$type documents",undef, + {'force_register' => $showdoc,})); + } 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 = (); @@ -2870,7 +2903,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', @@ -2891,9 +2924,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(''); $r->print(''); @@ -3415,15 +3445,15 @@ sub generate_admin_options { my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); my @list = ( - {pic21=>"$lt{'vc'}$help{'Verify_Content'}"}, - {pic22=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + {''=>"$lt{'vc'}$help{'Verify_Content'}"}, + {''=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, ); if($dumpbut ne ''){ - push @list, {pic23=>$dumpbut}; + push @list, {''=>$dumpbut}; } - push @list, ({pic24=>$exportbut}, - {pic25=>"$lt{'ls'}"}, - {pic26=>"$lt{'sl'}"}, + push @list, ({''=>$exportbut}, + {''=>"$lt{'ls'}"}, + {''=>"$lt{'sl'}"}, ); return ''; @@ -3442,26 +3472,22 @@ sub generate_edit_table { $form = '