--- loncom/interface/londocs.pm 2009/10/17 00:09:26 1.394 +++ loncom/interface/londocs.pm 2010/11/08 19:47:04 1.411.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.394 2009/10/17 00:09:26 droeschl Exp $ +# $Id: londocs.pm,v 1.411.2.6 2010/11/08 19:47:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,6 +41,7 @@ use Apache::lonratedt(); use Apache::lonxml; use Apache::lonclonecourse; use Apache::lonnavmaps; +use Apache::londocsgci; use HTML::Entities; use GDBM_File; use Apache::lonlocal; @@ -117,15 +118,15 @@ sub authorhosts { sub dumpbutton { my ($home,$other,%outhash)=&authorhosts(); - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - my $link = "".&mt('Dump '.$type.' DOCS to Construction Space').""; + my $link = "".&mt('Dump '.$crstype.' DOCS to Construction Space').""; return $link.' '. &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; } else { return '
'. - &mt('Dump '.$type. + &mt('Dump '.$crstype. ' DOCS to Construction Space: available on other servers'). '
'; } @@ -141,10 +142,10 @@ sub clean { sub dumpcourse { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). + my $crstype = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space'). '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' DOCS to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -255,14 +256,14 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } sub exportbutton { - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); return "".&mt('IMS Export')."". &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -271,18 +272,28 @@ sub exportbutton { sub exportcourse { my $r=shift; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); my %discussiontime = &Apache::lonnet::dump('discussiontimes', $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); my $numdisc = keys(%discussiontime); my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { - $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'). + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'). '

'.&mt('IMS Export Failed').'

'. - '
'. - &mt('Unable to retrieve information about course contents'). - '
'.&mt('Return to Course Editor').''); - &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); + '
'); + if ($crstype eq 'Community') { + $r->print(&mt('Unable to retrieve information about community contents')); + } else { + $r->print(&mt('Unable to retrieve information about course contents')); + } + $r->print('
'); + if ($crstype eq 'Community') { + $r->print(&mt('Return to Community Editor')); + } else { + $r->print(&mt('Return to Course Editor')); + } + $r->print(''); + &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); return; } my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); @@ -353,7 +364,7 @@ sub exportcourse { .'

'; } } - $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package')); + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package')); $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); @@ -361,7 +372,7 @@ sub exportcourse { my $display; $display = '
'."\n"; $display .= '

' - .&mt('Choose which items you wish to export from your '.$type.'.') + .&mt('Choose which items you wish to export from your '.$crstype.'.') .'

'; $display .= '
'. ''.&mt('Content items').''. @@ -507,7 +518,7 @@ function containerCheck(item) { // ]]> |; - $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package', + $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package', $scripttag)); $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($display. @@ -998,7 +1009,7 @@ sub group_import { } sub breadcrumbs { - my ($where,$allowed,$type)=@_; + my ($allowed,$crstype)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); my (@folders); if ($env{'form.pagepath'}) { @@ -1013,6 +1024,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,7 +1052,7 @@ sub breadcrumbs { if ($3) { $isencrypted=1; } if ($4 ne '') { $is_random_order = 1; } if ($folder eq 'supplemental') { - $name = &mt('Supplemental '.$type.' Documents'); + $name = &mt('Supplemental '.$crstype.' Documents'); } &Apache::lonhtmlcommon::add_breadcrumb( {'href'=>$url.$cpinfo, @@ -1488,7 +1508,7 @@ sub handle_edit_cmd { } sub editor { - my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; + my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_; my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1503,9 +1523,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,$crstype); + $r->print($breadcrumbtrail); + } else { + $randompick = -1; + } # ------------------------------------------------------------ Process commands @@ -1622,7 +1647,7 @@ sub editor { unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $idx++; next; } $output .= &entryline($idx,$name,$url,$folder,$allowed,$res, - $coursenum); + $coursenum,$crstype); $idx++; $shown++; } @@ -1790,7 +1815,7 @@ sub parse_supplemental_title { # --------------------------------------------------------------- An entry line sub entryline { - my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; + my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_; my ($foldertitle,$pagetitle,$renametitle); if (&is_supplemental_title($title)) { ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title); @@ -2047,18 +2072,24 @@ END $url.='pagepath='.&escape($pagepath). '&pagesymb='.&escape($symb).$cpinfo; } - if ($external) { + if (($external) && ($allowed)) { my $form = ($folder =~ /^default/)? 'newext' : 'supnewext'; $external = ' '.&mt('Edit').''; } else { undef($external); } + my $reinit; + if ($crstype eq 'Community') { + $reinit = &mt('(re-initialize community to access)'); + } else { + $reinit = &mt('(re-initialize course to access)'); + } $line.=' '.($url?'':'').''.($url?'':'').' - '.($url?"":'').$title.($url?'':' '.&mt('(re-initialize course to access)').'').$external." + '.($url?"":'').$title.($url?'':' '.$reinit.'').$external." "; if (($allowed) && ($folder!~/^supplemental/)) { my %lt=&Apache::lonlocal::texthash( @@ -2206,7 +2237,7 @@ List Symbs sub list_symbs { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); $r->print(&Apache::loncommon::start_page('Symb List')); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List')); my $navmap = Apache::lonnavmaps::navmap->new(); @@ -2215,7 +2246,7 @@ sub list_symbs { '
'. &mt('Unable to retrieve information about course contents'). '
'); - &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); + &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); } else { $r->print("
\n");
         foreach my $res ($navmap->retrieveResources()) {
@@ -2229,11 +2260,11 @@ sub list_symbs {
 
 sub verifycontent {
     my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
-   $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
-   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
+   $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2242,7 +2273,7 @@ sub verifycontent {
        if ($hash{$key}=~/\.(page|sequence)$/) {
 	   if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
 	       $r->print('
'. - &mt('The following sequence or page is included more than once in your '.$type.': '). + &mt('The following sequence or page is included more than once in your '.$crstype.': '). &unescape($hash{$key}).'
'. &mt('Note that grading records for problems included in this sequence or folder will overlap.
')); } @@ -2265,9 +2296,9 @@ sub devalidateversioncache { sub checkversions { my ($r) = @_; - my $type = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page("Check $type Document Versions")); - $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions")); + my $crstype = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions")); + $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions")); my $header=''; my $startsel=''; my $monthsel=''; @@ -2328,7 +2359,7 @@ sub checkversions { &changewarning($r,''); if ($env{'form.timerange'} eq 'all') { # show all documents - $header=&mt('All Documents in '.$type); + $header=&mt('All Documents in '.$crstype); $allsel=1; foreach my $key (keys(%hash)) { if ($key=~/^ids\_(\/res\/.+)$/) { @@ -2373,7 +2404,7 @@ sub checkversions { $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); my %lt=&Apache::lonlocal::texthash - ('st' => 'Version changes since start of '.$type, + ('st' => 'Version changes since start of '.$crstype, 'lm' => 'Version changes since last Month', 'lw' => 'Version changes since last Week', 'sy' => 'Version changes since Yesterday', @@ -2382,9 +2413,9 @@ sub checkversions { 'fi' => 'File', 'md' => 'Modification Date', 'mr' => 'Most recently published Version', - 've' => 'Version used in '.$type, - 'vu' => 'Set Version to be used in '.$type, -'sv' => 'Set Versions to be used in '.$type.' according to Selections below', + 've' => 'Version used in '.$crstype, + 'vu' => 'Set Version to be used in '.$crstype, +'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below', 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)', 'sc' => 'Set all Resource Versions to current Version (Fix Versions)', 'di' => 'Differences'); @@ -2431,7 +2462,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In '.$type.': '. + 'In '.$crstype.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2448,7 +2479,7 @@ ENDHEADERS ('select_form_order' => ['',1..$currentversion,'mostrecent'], '' => '', - 'mostrecent' => 'most recent', + 'mostrecent' => &mt('most recent'), map {$_,$_} (1..$currentversion)))); $r->print(''); my $lastold=1; @@ -2568,7 +2599,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'}); @@ -2586,8 +2617,17 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; - my $type = &Apache::loncommon::course_type(); + my $crstype = &Apache::loncommon::course_type(); + my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; + if ($coursedom eq 'gcitest') { + my $coursenum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); + if ($allowed) { + &concept_test_builder($r,$coursedom,$coursenum); + return OK; + } + } # --------------------------------------------- Initialize help topics for this foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', @@ -2652,7 +2692,12 @@ sub handler { &Apache::loncommon::restore_course_settings('docs_folderpath', {'folderpath' => 'scalar'}); } - if (!$env{'form.folderpath'}) { + if (!$allowed) { + unless($env{'form.folderpath'} =~ /^supplemental/) { + $env{'form.folderpath'} = ''; + } + } + if (!$env{'form.folderpath'} && $allowed) { &Apache::loncommon::restore_course_settings('docs_folderpath', {'pagepath' => 'scalar'}); } @@ -2661,7 +2706,7 @@ sub handler { } if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { $env{'form.folderpath'} = 'supplemental&'. - &escape(&mt('Supplemental '.$type.' Documents')).'&'. + &escape(&mt('Supplemental '.$crstype.' Documents')).'&'. $env{'form.folderpath'}; } &Apache::loncommon::store_course_settings('docs_folderpath', @@ -2684,7 +2729,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; @@ -2695,8 +2742,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 @@ -2746,22 +2791,27 @@ sub create_form_ul { &Apache::lonhtmlcommon::clear_breadcrumbs(); if ($allowed) { &Apache::lonhtmlcommon::add_breadcrumb({ - href=>"/adm/coursedocs",text=>"$type Editor"}); + href=>"/adm/coursedocs",text=>"$crstype Editor"}); - $r->print(&Apache::loncommon::start_page("$type Editor", $script, + $r->print(&Apache::loncommon::start_page("$crstype Editor", $script, {'force_register' => $showdoc,}) .&Apache::loncommon::help_open_menu('','',273,'RAT') .&Apache::lonhtmlcommon::breadcrumbs( - 'Editing the Table of Contents for your '.$type, + 'Editing the Table of Contents for your '.$crstype, 'Docs_Adding_Course_Doc') ); - } else { - my $lc_type = lc($type); - &Apache::lonhtmlcommon::add_breadcrumb({ - href=>"/adm/coursedocs",text=>"Supplemental $lc_type documents"}); - + } elsif ($showdoc) { + $r->print(&Apache::loncommon::start_page("$crstype documents",undef, + {'force_register' => $showdoc,})); + } else { + my $folder=$env{'form.folder'}; + if ($folder eq '' || $folder eq 'supplemental') { + $env{'form.folderpath'} = 'supplemental&'. + &escape(&mt('Supplemental '.$crstype.' Documents')); + } + my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype); $r->print(&Apache::loncommon::start_page("Supplemental documents"). - &Apache::lonhtmlcommon::breadcrumbs()); + $breadcrumbtrail); } my %allfiles = (); @@ -2854,8 +2904,8 @@ sub create_form_ul { unless ($showdoc || $upload_result eq 'phasetwo') { # ----------------------------------------------------------------------------- my %lt=&Apache::lonlocal::texthash( - 'uplm' => 'Upload a new main '.lc($type).' document', - 'upls' => 'Upload a new supplemental '.lc($type).' document', + 'uplm' => 'Upload a new main '.lc($crstype).' document', + 'upls' => 'Upload a new supplemental '.lc($crstype).' document', 'impp' => 'Import a document', 'copm' => 'All documents out of a published map into this folder', 'upld' => 'Upload Document', @@ -2884,7 +2934,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', @@ -2932,9 +2982,9 @@ FUFORM SEDFFORM my @simpleeditdefaultforma = ( - { 'pic03' => "$uploadtag$lt{'srch'}" }, - { 'pic04' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, - { 'pic05' => "$lt{'book'}" }, + { ''.&mt('Search').'' => "$uploadtag$lt{'srch'}" }, + { ''.&mt('Import').'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, + { ''.&mt('Import Bookmarks').'' => "$lt{'book'}" }, ); $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma)); $simpleeditdefaultform .=(<print('' - .'
' + $r->print('
' .'
'); # --------------------------------------------------------- Standard documents my $savefolderpath; - my $active = 'style="display: none;"'; + $active = 'style="display: none;"'; if($activeClass == 0){ $active = 'style="display: block;"'; } @@ -3030,7 +3091,7 @@ HIDDENFORM if ($folder eq '' || $folder=~/^supplemental/) { $folder='default'; $savefolderpath = $env{'form.folderpath'}; - $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); + $env{'form.folderpath'}='default&'.&escape($tabtitles{'main'}{$crstype}); $uploadtag = ''; } @@ -3213,37 +3274,37 @@ NSYLFORM NGFFORM @specialdocumentsforma=( - {'pic06'=>$newpageform}, - {'pic07'=>$newsylform}, - {'pic08'=>$newgroupfileform}, + {''.&mt('New Composite Page').''=>$newpageform}, + {''.&mt('Syllabus').''=>$newsylform}, + {''.&mt('Group Portfolio').''=>$newgroupfileform}, ); } - push @specialdocumentsforma, ({'pic09'=>$newnavform}, - {'pic10'=>$newsmppageform}, - {'pic11'=>$newsmpproblemform}, - {'pic12'=>$newdropboxform}, - {'pic13'=>$newexuploadform}, - {'pic14'=>$newbulform}, - {'pic15'=>$newaboutmeform}, - {'pic16'=>$newaboutsomeoneform}, - {'pic17'=>$newrosterform},); + push @specialdocumentsforma, ({''.&mt('Navigate Contents').''=>$newnavform}, + {''.&mt('Simple Course Page').''=>$newsmppageform}, + {''.&mt('Simple Problem').''=>$newsmpproblemform}, + {''.&mt('Drop Box').''=>$newdropboxform}, + {''.&mt('Score Upload Form').''=>$newexuploadform}, + {''.&mt('Discussion Board').''=>$newbulform}, + {''.&mt('My Personal Information Page').''=>$newaboutmeform}, + {''.&mt('Personal Information Page for a User').''=>$newaboutsomeoneform}, + {''.&mt('Course Roster').''=>$newrosterform},); $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma)); if($env{'form.pagepath'}) { @specialdocumentsforma=( - {'pic32'=>$newsmpproblemform}, - {'pic33'=>$newexuploadform} + {''.&mt('Simple Problem').''=>$newsmpproblemform}, + {''.&mt('Score Upload Form').''=>$newexuploadform} ); $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma)); } my @tools = ( - {'pic18'=>$extresourcesform}, - {'pic19'=>$imspform}, - {'pic20'=>$recoverform}, + {''.&mt('External Resource').''=>$extresourcesform}, + {''.&mt('IMS Import').''=>$imspform}, + {''.&mt('Recover Deleted Resources').''=>$recoverform}, ); my %orderhash = ( @@ -3254,9 +3315,8 @@ my %orderhash = ( 'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)], ); my $tid='1'; -my $varcd = 'Main Course Documents'; $hadchanges=0; - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); if ($error) { $r->print('

'.$error.'

'); } @@ -3265,14 +3325,14 @@ my $varcd = 'Main Course Documents'; } &changewarning($r,''); -$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); +$r->print(&generate_edit_table($tid,\%orderhash)); $r->print('
'); } if ($env{'form.pagepath'}) { } # ----------------------------------------------------- Supplemental documents - my $active = 'style="display: none;"'; + $active = 'style="display: none;"'; if($activeClass == 1){ $active = 'style="display: block;"'; } @@ -3284,7 +3344,7 @@ $r->print('
'); if ($folder =~ /^supplemental$/ && (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. - &escape(&mt('Supplemental '.$type.' Documents')); + &escape(&mt('Supplemental '.$crstype.' Documents')); } elsif ($allowed) { $env{'form.folderpath'} = $savefolderpath; } @@ -3296,9 +3356,7 @@ $r->print('
'); my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - my @supupdocform = ( - {'pic27'=>"$help{'Uploading_From_Harddrive'}"}, - ); + my $supupdocformbtn = "$help{'Uploading_From_Harddrive'}"; my $supupdocform=(< @@ -3315,7 +3373,7 @@ $r->print('
'); SUPDOCFORM - $supupdocform .= create_form_ul(create_list_elements(@supupdocform)).""; + $supupdocform .= create_form_ul(Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'})).""; my $supnewfolderform=(< @@ -3361,9 +3419,9 @@ SNAMFORM my @specialdocs = ( - {'pic29'=>$supnewextform}, - {'pic30'=>$supnewsylform}, - {'pic31'=>$supnewaboutmeform}, + {''.&mt('External Resource').''=>$supnewextform}, + {''.&mt('Syllabus').''=>$supnewsylform}, + {''.&mt('My Personal Information Page').''=>$supnewaboutmeform}, ); my %suporderhash = ( '00' => ['Supnewfolder', $supnewfolderform], @@ -3371,15 +3429,14 @@ my %suporderhash = ( 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))] ); - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); if ($error) { $r->print('

'.$error.'

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

'.$error.'

'); } @@ -3426,15 +3483,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'}"}, + {''.&mt('Verify Content').''=>"$lt{'vc'}$help{'Verify_Content'}"}, + {''.&mt('Check/Set Resource Versions').''=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, ); if($dumpbut ne ''){ - push @list, {'pic23'=>$dumpbut}; + push @list, {''.&mt('Dump Course DOCS to Construction Space: available on other servers').''=>$dumpbut}; } - push @list, ({'pic24'=>$exportbut}, - {'pic25'=>"$lt{'ls'}"}, - {'pic26'=>"$lt{'sl'}"}, + push @list, ({''.&mt('IMS Export').''=>$exportbut}, + {''.&mt('List Symbs').''=>"$lt{'ls'}"}, + {''.&mt('Show Log').''=>"$lt{'sl'}"}, ); return '
'.create_form_ul(create_list_elements(@list)).'
'; @@ -3442,7 +3499,8 @@ sub generate_admin_options { sub generate_edit_table { - my ($tid,$varcd,$orderhash_ref) = @_; + my ($tid,$orderhash_ref) = @_; + return unless(ref($orderhash_ref) eq 'HASH'); my %orderhash = %{$orderhash_ref}; my $form; my $activetab; @@ -3466,7 +3524,7 @@ sub generate_edit_table { } } $form .= ''; - $form .= '
'; + $form .= '
'; foreach my $field (keys(%orderhash)){ if($field ne '00'){ if($activetab eq '' || $activetab ne $field){ @@ -3484,6 +3542,74 @@ sub generate_edit_table { return $form; } +sub concept_test_builder { + my ($r,$cdom,$cnum) = @_; + &Apache::londocsgci::setdefaults(); + if ($env{'form.context'} eq 'requestcrs') { + if ($env{'form.phase'} eq 'storemap') { + &Apache::londocsgci::evaluate(); + my $error = &Apache::londocsgci::store('requestcrs',$cdom,$cnum); + my $output = '

'; + if ($error) { + $output .= ''. + &mt('An error occurred saving your concept test: [_1].',$error). + ''; + } else { + &Apache::lonuserstate::readmap($cdom.'/'.$cnum); + $output .= &mt('Your concept test has been saved.'); + } + $output .= '

'; + if (&Apache::lonrequestcourse::generate_page($r,'new','chooseitems')) { + my $formname = 'requestcrs'; + $r->print('
'); + my $title = &mt('Concept Test Created'); + &Apache::lonrequestcourse::roster_upload_form($r,$output,$formname,$title); + } + $r->print(&Apache::loncommon::end_page()); + return; + } + } + my $js = ' + +'; + $r->print(&Apache::loncommon::start_page('Assemble Test',$js)); + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/coursedocs', + text=>"Assemble Test"}); + if ($env{'form.phase'} eq 'storemap') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/coursedocs?phase=storemap', + text=>"Validate Test"}); + &Apache::londocsgci::evaluate(); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ('Build Concept Test','Concept_Test_Assembly')); + $r->print(&Apache::londocsgci::store('edit',$cdom,$cnum)); + } elsif ($env{'form.phase'} eq 'storeparms') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/coursedocs?phase=storeparms', + text=>"Set Availability"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ('Build Concept Test','Concept_Test_Assembly')); + $r->print(&Apache::londocsgci::store_dates_parms($cdom,$cnum)); + $r->print(&Apache::loncommon::end_page()); + return; + } else { + $r->print(&Apache::lonhtmlcommon::breadcrumbs + ('Build Concept Test','Concept_Test_Assembly')); + } + &Apache::londocsgci::load(); + &Apache::londocsgci::listresources($r,'edit',$cdom,$cnum); + $r->print(&Apache::loncommon::end_page()); + return; +} + sub editing_js { my ($udom,$uname) = @_; my $now = time();