--- loncom/interface/londocs.pm 2009/10/04 10:27:55 1.388 +++ loncom/interface/londocs.pm 2009/10/16 19:00:44 1.393 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.388 2009/10/04 10:27:55 tempelho Exp $ +# $Id: londocs.pm,v 1.393 2009/10/16 19:00:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1032,11 +1032,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 +1489,6 @@ sub handle_edit_cmd { sub editor { my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; - my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1632,18 +1627,21 @@ sub editor { $shown++; } if ($shown) { - $r->print(&Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_header_row() - .''.&mt('Move').'' - .''.&mt('Actions').'' - .''.&mt('Document').'' - .''.&mt('Settings').'' - .&Apache::loncommon::end_data_table_header_row() - .$output - .&Apache::loncommon::end_data_table() - ) - } - unless($shown) { + $r->print(&Apache::loncommon::start_data_table()); + if ($allowed) { + $r->print(&Apache::loncommon::start_data_table_header_row() + .''.&mt('Move').'' + .''.&mt('Actions').'' + .''.&mt('Document').''); + if ($folder !~ /^supplemental/) { + $->print(''.&mt('Settings').''); + } + $r->print(&Apache::loncommon::end_data_table_header_row()); + } + $r->print($output + .&Apache::loncommon::end_data_table() + ); + } else { $r->print('

' .&mt('Currently no documents.') .'

' @@ -1793,7 +1791,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); @@ -2747,16 +2744,25 @@ 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 $lc_type = lc($type); + &Apache::lonhtmlcommon::add_breadcrumb({ + href=>"/adm/coursedocs",text=>"Supplemental $lc_type documents"}); + + $r->print(&Apache::loncommon::start_page("Supplemental documents"). + &Apache::lonhtmlcommon::breadcrumbs()); + } my %allfiles = (); my %codebase = (); @@ -2999,8 +3005,8 @@ HIDDENFORM $activeClass = 0; } } - if($env{'request.role'}=~/^cc/){ - $r->print('
  • '.&mt('Main Course Documents').'
  • '); + if ($allowed){ + $r->print('
  • '.&mt('Main Course Documents').'
  • '); } $active = ''; if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) { @@ -3018,7 +3024,7 @@ HIDDENFORM if($activeClass == 0){ $active = 'style="display: block;"'; } - if($env{'request.role'}=~/^cc/){ + if ($allowed) { $r->print('
    '); my $folder=$env{'form.folder'}; if ($folder eq '' || $folder=~/^supplemental/) { @@ -3159,6 +3165,7 @@ NROSTFORM my $specialdocumentsform; my @specialdocumentsforma; my $newfolderform; +my $newfolderb; unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); @@ -3172,7 +3179,8 @@ my $newfolderform; $help{'Adding_Pages'} NPFORM - + + $newfolderform=(< @@ -3181,12 +3189,6 @@ NPFORM $lt{'newf'}$help{'Adding_Folders'} NFFORM - my @newfolderforma= ( - { 'pic02' => "$newfolderform" } - ); - - - $newfolderform = create_form_ul(create_list_elements(@newfolderforma)); my $newsylform=(< @@ -3245,15 +3247,14 @@ my @tools = ( ); my %orderhash = ( - 'aa' => ['Upload Document',$fileuploadform.''.$newfolderform], + '00' => ['Newfolder',$newfolderform], + 'aa' => ['Upload Document',$fileuploadform], 'bb' => ['Published Resources',$simpleeditdefaultform], 'cc' => ['Special Documents',$specialdocumentsform], 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)], - 'zz' => ['Hide'], ); my $tid='1'; my $varcd = 'Main Course Documents'; -$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); $hadchanges=0; my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { @@ -3264,6 +3265,8 @@ $r->print(&generate_edit_table($tid,$var } &changewarning($r,''); +$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); + $r->print('
    '); } if ($env{'form.pagepath'}) { @@ -3282,7 +3285,7 @@ $r->print(''); (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. &escape(&mt('Supplemental '.$type.' Documents')); - }else{ + } elsif ($allowed) { $env{'form.folderpath'} = $savefolderpath; } $env{'form.pagepath'} = ''; @@ -3324,9 +3327,6 @@ SUPDOCFORM SNFFORM - my @supnewfolderforma = ({'pic28'=>$supnewfolderform}); - $supnewfolderform = create_form_ul(create_list_elements(@supnewfolderforma)); - my $supnewextform=(< @@ -3366,21 +3366,26 @@ my @specialdocs = ( {'pic31'=>$supnewaboutmeform}, ); my %suporderhash = ( - 'ee' => ['Upload Document',$supupdocform.' '.$supnewfolderform], - 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))], - 'zz' => ['Hide'], + '00' => ['Supnewfolder', $supnewfolderform], + 'ee' => ['Upload Document',$supupdocform], + 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))] ); -my $tid='2'; -my $varscd = 'Supplemental Course Documents'; + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + if ($error) { + $r->print('

    '.$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(''); @@ -3448,19 +3453,22 @@ sub generate_edit_table { $form = '
    '; $form .= ''; $form .= '
    '; foreach my $field (keys(%orderhash)){ - if($field ne 'zz'){ + if($field ne '00'){ if($activetab eq '' || $activetab ne $field){ $active = 'style="display: none;"'; }elsif($activetab eq $field){ @@ -3708,7 +3716,7 @@ for (i = 0; i < currentDivs.length; i++) function openTabs(pageId) { tabnav = document.getElementById(pageId).getElementsByTagName('UL'); if(tabnav.length > 2 ){ - currentNav = document.getElementById(tabnav[0].id); + currentNav = document.getElementById(tabnav[1].id); currentLis = currentNav.getElementsByTagName('LI'); for(i = 0; i< currentLis.length; i++){ if(currentLis[i].className == 'active') {