--- loncom/interface/londocs.pm 2010/12/07 01:15:39 1.442 +++ loncom/interface/londocs.pm 2010/12/07 17:33:36 1.443 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.442 2010/12/07 01:15:39 www Exp $ +# $Id: londocs.pm,v 1.443 2010/12/07 17:33:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2643,23 +2643,23 @@ sub startContentScreen { my $href; if ($allowed) { - if (($mode eq 'navmaps') || ($mode eq 'tools')) { - $href="/adm/coursedocs"; +# if (($mode eq 'navmaps') || ($mode eq 'tools')) { + $href="/adm/coursedocs?forcestandard=1"; $onclick=''; - } else { - $href='#'; - $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"'; - } +# } else { +# $href='#'; +# $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"'; +# } $r->print('
  •       '.&mt('Content Editor').'      
  • '); } - if (($mode eq 'navmaps') || ($mode eq 'tools')) { - $href="/adm/coursedocs"; +# if (($mode eq 'navmaps') || ($mode eq 'tools')) { + $href="/adm/coursedocs?forcesupplement=1"; $onclick=''; - } else { - $href='#'; - $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"'; - } +# } else { +# $href='#'; +# $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"'; +# } $r->print('
  • '.&mt('Supplemental Documents').'
  • '); @@ -2685,7 +2685,7 @@ sub handler { return OK if $r->header_only; my $crstype = &Apache::loncommon::course_type(); - +# # --------------------------------------------- Initialize help topics for this foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', 'Adding_External_Resource','Navigate_Content', @@ -2743,7 +2743,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['folderpath','pagepath', - 'pagesymb']); + 'pagesymb','forcesupplement','forcestandard']); # No folderpath, no pagepath, see if we have something stored if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) { &Apache::loncommon::restore_course_settings('docs_folderpath', @@ -2979,10 +2979,7 @@ CHBO FUFORM #$list .= Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'}); #$fileuploadform .= create_form_ul(create_list_elements(@fileuploada)); - $fileuploadform .= create_form_ul(Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'})); - $fileuploadform .= (< -FUFORM + $fileuploadform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'})).''; my $simpleeditdefaultform=(< @@ -2993,7 +2990,7 @@ SEDFFORM { ''.$lt{impo}.'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, { ''.$lt{wish}.'' => "$lt{'wish'}" }, ); - $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma)); + $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma)); $simpleeditdefaultform .=(<

    @@ -3040,15 +3037,29 @@ ERFORM HIDDENFORM } +# +# Decide whether this should display supplemental or main content +# supplementalflag=1: show supplemental documents +# supplementalflag=0: show standard documents + + my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); + if (($standard) && ($allowed) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'}))) { + $supplementalflag=0; + } + if ($env{'form.forcesupplement'}) { $supplementalflag=1; } + if ($env{'form.forcestandard'}) { $supplementalflag=0; } + # Generate the tabs - &startContentScreen($r,'docs'); + &startContentScreen($r,($supplementalflag?'supdocs':'docs')); + + # my $savefolderpath; if ($allowed) { my $folder=$env{'form.folder'}; - if ($folder eq '' || $folder=~/^supplemental/) { + if ($folder eq '' || $supplementalflag) { $folder='default'; $savefolderpath = $env{'form.folderpath'}; $env{'form.folderpath'}='default&'.&escape(&mt('Content')); @@ -3242,7 +3253,7 @@ NGFFORM my @importdoc = ( {''.$lt{extr}.''=>$extresourcesform}, {''.$lt{imsf}.''=>$imspform},); - $fileuploadform = create_form_ul(create_list_elements(@importdoc)) . '


    ' . $fileuploadform; + $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '
    ' . $fileuploadform; push @specialdocumentsforma, ({''.$lt{navc}.''=>$newnavform}, {''.$lt{sipa}.''=>$newsmppageform}, @@ -3254,7 +3265,7 @@ NGFFORM {''.$lt{abou}.''=>$newaboutsomeoneform}, {''.$lt{rost}.''=>$newrosterform},); - $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma)); + $specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma)); } if($env{'form.pagepath'}) { @@ -3263,7 +3274,7 @@ if($env{'form.pagepath'}) { {''.&mt('Simple Problem').''=>$newsmpproblemform}, {''.&mt('Score Upload Form').''=>$newexuploadform} ); - $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma)); + $specialdocumentsform= &create_form_ul(&create_list_elements(@specialdocumentsforma)); } my @tools = ( @@ -3276,30 +3287,32 @@ my %orderhash = ( 'aa' => ['Import Documents',$fileuploadform], 'bb' => ['Published Resources',$simpleeditdefaultform], 'cc' => ['Special Documents',$specialdocumentsform], - 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options(\%help,\%env)], + 'dd' => ['Tools', &create_form_ul(&create_list_elements(@tools)).&generate_admin_options(\%help,\%env)], ); unless($env{'form.pagepath'}) { $orderhash{'00'} = ['Newfolder',$newfolderform]; } -my $tid='1'; $hadchanges=0; - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); - if ($error) { - $r->print('

    '.$error.'

    '); - } - if ($hadchanges) { - &mark_hash_old(); - } + unless ($supplementalflag) { + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + if ($error) { + $r->print('

    '.$error.'

    '); + } + if ($hadchanges) { + &mark_hash_old(); + } - &changewarning($r,''); -$r->print(&generate_edit_table($tid,\%orderhash)); + &changewarning($r,''); + $r->print(&generate_edit_table('1',\%orderhash)); + } -$r->print(''); } +# Supplemental documents start here + my $folder=$env{'form.folder'}; - unless ($folder=~/^supplemental/) { + unless ($supplementalflag) { $folder='supplemental'; } if ($folder =~ /^supplemental$/ && @@ -3334,7 +3347,7 @@ $r->print(''); SUPDOCFORM - $supupdocform .= create_form_ul(Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'})).""; + $supupdocform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'})).""; my $supnewfolderform=(< @@ -3389,20 +3402,20 @@ my @supimportdoc = ( {''.$lt{extr}.'' =>$supnewextform}, ); -$supupdocform = create_form_ul(create_list_elements(@supimportdoc)) . '
    ' . $supupdocform; +$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '
    ' . $supupdocform; my %suporderhash = ( '00' => ['Supnewfolder', $supnewfolderform], 'ee' => ['Import Documents',$supupdocform], - 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))] + 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] ); - - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); - if ($error) { - $r->print('

    '.$error.'

    '); + if ($supplementalflag) { + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + if ($error) { + $r->print('

    '.$error.'

    '); + } + $r->print(&generate_edit_table('2',\%suporderhash)); } - my $tid='2'; - $r->print(&generate_edit_table($tid,\%suporderhash)); - } else { + } elsif ($supplementalflag) { my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); if ($error) { $r->print('

    '.$error.'

    '); @@ -3500,7 +3513,7 @@ sub generate_admin_options { {''.$lt{sl}.'' =>"$lt{'sl'}"}, ); - return '
    '.create_form_ul(create_list_elements(@list)).'
    '; + return '
    '.&create_form_ul(&create_list_elements(@list)).'
    '; }