--- loncom/interface/londocs.pm 2009/10/20 12:26:02 1.398 +++ loncom/interface/londocs.pm 2010/03/18 16:33:44 1.423 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.398 2009/10/20 12:26:02 bisitz Exp $ +# $Id: londocs.pm,v 1.423 2010/03/18 16:33:44 onken Exp $ # # Copyright Michigan State University Board of Trustees # @@ -117,17 +117,22 @@ 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').""; - return $link.' '. - &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; - } else { - return '
'. - &mt('Dump '.$type. - ' DOCS to Construction Space: available on other servers'). - '
'; + my $link = + "" + .&mt('Dump '.$crstype.' Documents to Construction Space') + .''; + return + $link.' ' + .&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs') + .'
'; + } else { + return + &mt('Dump '.$crstype.' Documents to Construction Space: available on other servers'); } } @@ -141,10 +146,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.' Documents to Construction Space'). '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' Documents to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -255,15 +260,15 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } sub exportbutton { - my $type = &Apache::loncommon::course_type(); - return "".&mt('IMS Export')."". + my $crstype = &Apache::loncommon::course_type(); + return "".&mt('IMS Export')."". &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -271,18 +276,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); @@ -331,20 +346,20 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; + $outcome .= '

' + .&mt('[_1]Your IMS package[_2] is ready for download.' + ,'','') + .'

'; if ($copyresult) { $outcome .= '

' .&mt('The following errors occurred during export - [_1]' ,$copyresult) .'

'; } - $outcome .= '

' - .&mt('[_1]Your IMS package[_2] is ready for download.' - ,'','') - .'

'; } else { $outcome = '

' .&mt('Unfortunately you will not be able to retrieve' - .' an IMS archive of this posts at this time,' + .' an IMS archive of your course at this time,' .' because there was a problem creating a' .' manifest file.') .'

' @@ -353,29 +368,31 @@ 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()); } else { - my $display; - $display = '
'."\n"; - $display .= '

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

'; - $display .= '
'. + my $display=''."\n". + '

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

'. + '
'. ''.&mt('Content items').''. ''. '  
'. - '
'. - ''.&mt('Discussion posts').''. - ''. - '  '. - '
'; + ' onclick="javascript:uncheckAll(document.exportdoc.archive)" />
'; + if ($numdisc > 0) { + $display .= '
'. + ''.&mt('Discussion posts').''. + ''. + '  '. + '
'; + } + $display .= '
'; my $curRes; my $depth = 0; my $count = 0; @@ -386,15 +403,11 @@ sub exportcourse { my $lastcontainer = $startcount; $display .= &Apache::loncommon::start_data_table() .&Apache::loncommon::start_data_table_header_row() - .''.&mt('Export content item?').'' - .''; + .''.&mt('Export content item?').''; if ($numdisc > 0) { - $display .= &mt('Export discussion posts?'); - } else { - $display .= ' '; + $display .= ''.&mt('Export discussion posts?').''; } - $display .= '' - .&Apache::loncommon::end_data_table_header_row(); + $display .= &Apache::loncommon::end_data_table_header_row(); while ($curRes = $it->next()) { if (ref($curRes)) { $count ++; @@ -415,37 +428,33 @@ sub exportcourse { $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; } } + my $currelem = $count+$boards+$startcount; $display .= &Apache::loncommon::start_data_table_row() .''."\n" .'is_sequence()) || ($curRes->is_page())) { - my $checkitem = $count + $boards + $startcount; - $display .= 'onclick="javascript:propagateCheck('."'$checkitem'".')"'; + $lastcontainer = $currelem; + $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"'; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { - $display .= '' - .''."\n"; + $display .= ('' x2)."\n"; } if ($curRes->is_sequence()) { $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; } elsif ($curRes->is_page()) { $display .= ' '."\n"; - $lastcontainer = $count + $startcount + $boards; } - my $currelem = $count+$boards+$startcount; $children{$parent{$depth}} .= $currelem.':'; $display .= ' '.$curRes->title().''."\n"; # Existing discussion posts? if ($discussiontime{$ressymb} > 0) { $boards ++; - $currelem = $count+$boards+$startcount; $display .= '' .'' .''."\n"; - } else { + } elsif ($numdisc > 0) { $display .= ' '."\n"; } $display .= &Apache::loncommon::end_data_table_row(); @@ -507,7 +516,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 +1007,7 @@ sub group_import { } sub breadcrumbs { - my ($allowed,$type)=@_; + my ($allowed,$crstype)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); my (@folders); if ($env{'form.pagepath'}) { @@ -1041,7 +1050,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, @@ -1497,7 +1506,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'; @@ -1515,7 +1524,7 @@ sub editor { my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order); if ($allowed) { ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) = - &breadcrumbs($allowed,$type); + &breadcrumbs($allowed,$crstype); $r->print($breadcrumbtrail); } else { $randompick = -1; @@ -1636,7 +1645,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++; } @@ -1792,6 +1801,7 @@ sub parse_supplemental_title { $foldertitle=&Apache::lontexconvert::msgtexconverted($4); my $name = &Apache::loncommon::plainname($uname,$udom); $name = &HTML::Entities::encode($name,'"<>&\''); + $renametitle = &HTML::Entities::encode($renametitle,'"<>&\''); $title=''.&Apache::lonlocal::locallocaltime($time).' '. $name.':
'.$foldertitle; } @@ -1804,7 +1814,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); @@ -2067,12 +2077,18 @@ END } 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( @@ -2220,7 +2236,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(); @@ -2229,25 +2245,25 @@ 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()) {
-	    $r->print($res->compTitle()."\t".$res->symb()."\n");
+            $r->print($res->compTitle()."\t".$res->symb()."\n");
         }
         $r->print("\n
\n"); } - $r->print(''.&mt('Return to DOCS').''); + $r->print('
'.&mt('Back to Course Editor').''); } 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=(); @@ -2256,9 +2272,9 @@ 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.
')); + &mt('Note that grading records for problems included in this sequence or folder will overlap.').'
'); } } if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) { @@ -2266,8 +2282,13 @@ sub verifycontent { } } &untiehash(); - $r->print('

'.&mt('Done').'.

'.''. - &mt('Return to DOCS').''); + $r->print( + '

'.&mt('Done').'

' + .'
' + .'

' + .&mt('Back to Course Editor') + .'

' + ); } @@ -2279,9 +2300,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=''; @@ -2342,7 +2363,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\/.+)$/) { @@ -2387,7 +2408,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', @@ -2396,9 +2417,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'); @@ -2445,7 +2466,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In '.$type.': '. + 'In '.$crstype.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2462,7 +2483,7 @@ ENDHEADERS ('select_form_order' => ['',1..$currentversion,'mostrecent'], '' => '', - 'mostrecent' => 'most recent', + 'mostrecent' => &mt('most recent'), map {$_,$_} (1..$currentversion)))); $r->print(''); my $lastold=1; @@ -2517,7 +2538,7 @@ ENDHEADERS } } $r->print(''); - $r->print('

'.&mt('Done').'.

'); + $r->print('

'.&mt('Done').'

'); &untiehash(); } @@ -2582,7 +2603,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'}); @@ -2600,7 +2621,7 @@ 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(); # --------------------------------------------- Initialize help topics for this @@ -2641,7 +2662,7 @@ sub handler { &init_breadcrumbs('versions','Check/Set Resource Versions'); &checkversions($r); } elsif ($allowed && $env{'form.dumpcourse'}) { - &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space'); + &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Documents to Construction Space'); &dumpcourse($r); } elsif ($allowed && $env{'form.exportcourse'}) { &init_breadcrumbs('exportcourse','IMS Export'); @@ -2666,7 +2687,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'}); } @@ -2675,7 +2701,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', @@ -2698,7 +2724,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; @@ -2709,8 +2737,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 @@ -2760,22 +2786,25 @@ 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') ); + } 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 '.$type.' Documents')); + &escape(&mt('Supplemental '.$crstype.' Documents')); } - my ($breadcrumbtrail) = &breadcrumbs($allowed,$type); + my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype); $r->print(&Apache::loncommon::start_page("Supplemental documents"). $breadcrumbtrail); } @@ -2870,17 +2899,17 @@ 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', + 'upld' => 'Import Document', 'srch' => 'Search', 'impo' => 'Import', 'book' => 'Import Bookmarks', 'selm' => 'Select Map', 'load' => 'Load Map', - 'reco' => 'Recover Deleted Resources', + 'reco' => 'Recover Deleted Documents', 'newf' => 'New Folder', 'newp' => 'New Composite Page', 'extr' => 'External Resource', @@ -2900,7 +2929,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', @@ -2948,9 +2977,9 @@ FUFORM SEDFFORM my @simpleeditdefaultforma = ( - { 'pic03' => "$uploadtag$lt{'srch'}" }, - { 'pic04' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, - { 'pic05' => "$lt{'book'}" }, + { ''.$lt{srch}.'' => "$uploadtag$lt{'srch'}" }, + { ''.$lt{impo}.'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, + { ''.$lt{book}.'' => "$lt{'book'}" }, ); $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma)); $simpleeditdefaultform .=(< $uploadtag - $lt{'extr'}$help{'Adding_External_Resource'} + $lt{'extr'}$help{'Adding_External_Resource'} ERFORM @@ -2988,7 +3017,7 @@ ERFORM if ($env{'form.folder'} eq '' || $env{'form.folder'} eq 'supplemental') { $folderpath='default&'. - &escape(&mt('Main '.$type.' Documents')); + &escape(&mt('Main '.$crstype.' Documents')); } } unless ($env{'form.pagepath'}) { @@ -3013,7 +3042,16 @@ HIDDENFORM my $activeClass = 1; my $active = ''; - + my %tabtitles = ( + main => { + Course => &mt('Main Course Documents'), + Community => &mt('Main Community Documents'), + }, + supplemental => { + Course => &mt('Supplemental Course Documents'), + Community => &mt('Supplemental Community Documents'), + }, + ); if ($allowed) { $r->print(''); } else { $r->print('
'); @@ -3048,7 +3086,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 = ''; } @@ -3077,14 +3115,14 @@ HIDDENFORM my $recoverform=(< - $lt{'reco'} + $lt{'reco'} RFORM my $imspform=(< - $lt{'imsf'} + $lt{'imsf'} IMSPFORM @@ -3094,7 +3132,7 @@ IMSPFORM $uploadtag - $lt{'navc'} + $lt{'navc'} $help{'Navigate_Content'} NNFORM @@ -3103,7 +3141,7 @@ NNFORM $uploadtag - $lt{'sipa'} + $lt{'sipa'} $help{'Simple Page'} NSPFORM @@ -3113,7 +3151,7 @@ NSPFORM $uploadtag - $lt{'sipr'} + $lt{'sipr'} $help{'Simple Problem'} @@ -3124,7 +3162,7 @@ NSPROBFORM $uploadtag - $lt{'drbx'} + $lt{'drbx'} NDBFORM @@ -3133,7 +3171,7 @@ NDBFORM $uploadtag - $lt{'scuf'} + $lt{'scuf'} $help{'Score_Upload_Form'} NEXUFORM @@ -3143,7 +3181,7 @@ NEXUFORM $uploadtag - $lt{'bull'} + $lt{'bull'} $help{'Bulletin Board'} NBFORM @@ -3154,7 +3192,7 @@ NBFORM $uploadtag - $lt{'mypi'} + $lt{'mypi'} $help{'My Personal Information Page'} NAMFORM @@ -3164,7 +3202,7 @@ NAMFORM $uploadtag - $lt{'abou'} + $lt{'abou'} NASOFORM @@ -3175,7 +3213,7 @@ NASOFORM $uploadtag - $lt{'rost'} + $lt{'rost'} $help{'Course Roster'} NROSTFORM @@ -3193,7 +3231,7 @@ my $newfolderb; - $lt{'newp'} + $lt{'newp'} $help{'Adding_Pages'} NPFORM @@ -3204,7 +3242,7 @@ NPFORM - $lt{'newf'}$help{'Adding_Folders'} + $lt{'newf'}$help{'Adding_Folders'} NFFORM @@ -3214,7 +3252,7 @@ NFFORM $uploadtag - $lt{'syll'} + $lt{'syll'} $help{'Syllabus'} @@ -3226,55 +3264,59 @@ NSYLFORM $uploadtag - $lt{'grpo'} + $lt{'grpo'} $help{'Group Portfolio'} NGFFORM @specialdocumentsforma=( - {'pic06'=>$newpageform}, - {'pic07'=>$newsylform}, - {'pic08'=>$newgroupfileform}, + {''.$lt{newp}.''=>$newpageform}, + {''.$lt{syll}.''=>$newsylform}, + {''.$lt{grpo}.''=>$newgroupfileform}, ); } - push @specialdocumentsforma, ({'pic09'=>$newnavform}, - {'pic10'=>$newsmppageform}, - {'pic11'=>$newsmpproblemform}, - {'pic12'=>$newdropboxform}, - {'pic13'=>$newexuploadform}, - {'pic14'=>$newbulform}, - {'pic15'=>$newaboutmeform}, - {'pic16'=>$newaboutsomeoneform}, - {'pic17'=>$newrosterform},); + push @specialdocumentsforma, ({''.$lt{navc}.''=>$newnavform}, + {''.$lt{sipa}.''=>$newsmppageform}, + {''.$lt{sipr}.''=>$newsmpproblemform}, + {''.$lt{drbx}.''=>$newdropboxform}, + {''.$lt{scuf}.''=>$newexuploadform}, + {''.$lt{bull}.''=>$newbulform}, + {''.$lt{mypi}.''=>$newaboutmeform}, + {''.$lt{abou}.''=>$newaboutsomeoneform}, + {''.$lt{rost}.''=>$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}, +# {''.$lt{extr}.''=>$extresourcesform}, +# {''.$lt{imsf}.''=>$imspform}, + {''.$lt{reco}.''=>$recoverform}, ); +my @importdoc = ( + {''.$lt{extr}.''=>$extresourcesform}, + {''.$lt{imsf}.''=>$imspform}, +); +$fileuploadform = create_form_ul(create_list_elements(@importdoc)) . '
' . $fileuploadform; my %orderhash = ( '00' => ['Newfolder',$newfolderform], - 'aa' => ['Upload Document',$fileuploadform], + 'aa' => ['Import Documents',$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)], ); 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.'

'); } @@ -3283,7 +3325,7 @@ my $varcd = 'Main Course Documents'; } &changewarning($r,''); -$r->print(&generate_edit_table($tid,$varcd,\%orderhash)); +$r->print(&generate_edit_table($tid,\%orderhash)); $r->print(''); } @@ -3302,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; } @@ -3314,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=(< @@ -3333,14 +3373,14 @@ $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=(< - $lt{'newf'} + $lt{'newf'} $help{'Adding_Folders'} SNFFORM @@ -3351,7 +3391,7 @@ SNFFORM - $lt{'extr'} $help{'Adding_External_Resource'} + $lt{'extr'} $help{'Adding_External_Resource'} SNEFORM @@ -3361,7 +3401,7 @@ SNEFORM - $lt{'syll'} + $lt{'syll'} $help{'Syllabus'} SNSFORM @@ -3372,32 +3412,37 @@ SNSFORM - $lt{'mypi'} + $lt{'mypi'} $help{'My Personal Information Page'} SNAMFORM my @specialdocs = ( - {'pic29'=>$supnewextform}, - {'pic30'=>$supnewsylform}, - {'pic31'=>$supnewaboutmeform}, + {''.$lt{syll}.'' + =>$supnewsylform}, + {''.$lt{mypi}.'' + =>$supnewaboutmeform}, ); +my @supimportdoc = ( + {''.$lt{extr}.'' + =>$supnewextform}, + ); +$supupdocform = create_form_ul(create_list_elements(@supimportdoc)) . '
' . $supupdocform; my %suporderhash = ( '00' => ['Supnewfolder', $supnewfolderform], - 'ee' => ['Upload Document',$supupdocform], + 'ee' => ['Import Documents',$supupdocform], '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.'

'); } @@ -3437,22 +3482,29 @@ sub generate_admin_options { 'vc' => 'Verify Content', 'cv' => 'Check/Set Resource Versions', 'ls' => 'List Symbs', - 'sl' => 'Show Log' + 'sl' => 'Show Log', + 'imse' => 'IMS Export', + 'dcd' => 'Dump Course Documents to Construction Space: available on other servers' ); my %help = %{$help_ref}; my %env = %{$env_ref}; my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); my @list = ( - {'pic21'=>"$lt{'vc'}$help{'Verify_Content'}"}, - {'pic22'=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + {''.$lt{vc}.'' + => "$lt{'vc'}$help{'Verify_Content'}"}, + {''.$lt{cv}.'' + =>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, ); if($dumpbut ne ''){ - push @list, {'pic23'=>$dumpbut}; + push @list, {''.$lt{dcd}.''=>$dumpbut}; } - push @list, ({'pic24'=>$exportbut}, - {'pic25'=>"$lt{'ls'}"}, - {'pic26'=>"$lt{'sl'}"}, + push @list, ({''.$lt{imse}.'' + =>$exportbut}, + {''.$lt{ls}.'' + =>"$lt{'ls'}"}, + {''.$lt{sl}.'' + =>"$lt{'sl'}"}, ); return '
'.create_form_ul(create_list_elements(@list)).'
'; @@ -3460,7 +3512,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; @@ -3468,7 +3521,7 @@ sub generate_edit_table { if($env{'form.active'} ne ''){ $activetab = $env{'form.active'}; } - $form = '
'; + $form = '
'; $form .= '
'; @@ -3740,6 +3793,9 @@ function openTabs(pageId) { if(currentLis[i].className == 'active') { funcString = currentLis[i].onclick.toString(); tab = funcString.split('"'); + if(tab.length < 2) { + tab = funcString.split("'"); + } currentData = document.getElementById(tab[1]); currentData.style.display = 'block'; }