--- loncom/interface/londocs.pm 2010/01/22 03:41:58 1.325.2.6 +++ loncom/interface/londocs.pm 2009/02/02 11:23:56 1.333 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.325.2.6 2010/01/22 03:41:58 raeburn Exp $ +# $Id: londocs.pm,v 1.333 2009/02/02 11:23:56 muellerd Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,7 +59,6 @@ my $hadchanges; my %help=(); - sub mapread { my ($coursenum,$coursedom,$map)=@_; return @@ -117,17 +116,15 @@ sub authorhosts { sub dumpbutton { my ($home,$other,%outhash)=&authorhosts(); - my $crstype = &Apache::loncommon::course_type(); + my $type = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - return '
'. - ''. - &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'). - '
'; + return ''. + &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); } else { return '
'. - &mt('Dump '.$crstype. + &mt('Dump '.$type. ' DOCS to Construction Space: available on other servers'). '
'; } @@ -143,10 +140,10 @@ sub clean { sub dumpcourse { my ($r) = @_; - my $crstype = &Apache::loncommon::course_type(); - $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space'). - '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' DOCS to Construction Space')); + my $type = &Apache::loncommon::course_type(); + $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). + ''); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } my $origcrsid=$env{'request.course.id'}; @@ -257,46 +254,35 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } sub exportbutton { - my $crstype = &Apache::loncommon::course_type(); - return ''. - &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; + my $type = &Apache::loncommon::course_type(); + return ''. + &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); } sub exportcourse { my $r=shift; - my $crstype = &Apache::loncommon::course_type(); + my $type = &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 '.$crstype.' to IMS Package'). - '

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

'. - '
'); - 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'}); + $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'). + '

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'}); return; } my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); @@ -312,17 +298,7 @@ sub exportcourse { my @exportitems = &Apache::loncommon::get_env_multiple('form.archive'); my @discussions = &Apache::loncommon::get_env_multiple('form.discussion'); if (@exportitems == 0 && @discussions == 0) { - $outcome = - '

' - .&mt('As you did not select any content items or discussions' - .' for export, an IMS package has not been created.') - .'

' - .'

' - .&mt('Please [_1]go back[_2] to select either content items' - .' or discussions for export.' - ,'' - ,'') - .'

'; + $outcome = '
As you did not select any content items or discussions for export, an IMS package has not been created. Please go back to select either content items or discussions for export'; } else { my $now = time; my %symbs; @@ -345,53 +321,35 @@ 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.' - ,'','') - .'

'; + $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive
',$imszipfile,); if ($copyresult) { - $outcome .= '

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

'; + $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult); } } else { - $outcome = '

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

' - .'

' - .&mt('Go Back') - .'

'; + $outcome = '
'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'
'; } } - $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package')); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); + $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { - my $display='
'."\n". - '

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

'. - '
'. - ''.&mt('Content items').''. - '
'); + $display .= ''. + ''. + ''. + ''. + '
 Content items'. + ''. - '  
'; - if ($numdisc > 0) { - $display .= '
'. - ''.&mt('Discussion posts').''. - ''. - '  '. - '
'; - } - $display .= ''; + '  
  
 Discussion posts'. + ''. + '  
'; my $curRes; my $depth = 0; my $count = 0; @@ -400,13 +358,13 @@ sub exportcourse { my %parent = (); my %children = (); my $lastcontainer = $startcount; - $display .= &Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_header_row() - .''.&mt('Export content item?').''; + my @bgcolors = ('#F6F6F6','#FFFFFF'); + $display .= ''. + ''; + $display.='Export discussion posts?'."\n"; } - $display .= &Apache::loncommon::end_data_table_header_row(); + $display.=' '; while ($curRes = $it->next()) { if (ref($curRes)) { $count ++; @@ -427,43 +385,38 @@ 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"; - - # Existing discussion posts? - + $display .= ' '.$curRes->title().''; if ($discussiontime{$ressymb} > 0) { $boards ++; - $display .= ''."\n"; + $currelem = $count+$boards+$startcount; + $display .= ''."\n"; } else { - $display .= ''."\n"; + $display .= ''."\n"; } - $display .= &Apache::loncommon::end_data_table_row(); } } - $display .= &Apache::loncommon::end_data_table(); my $scripttag = qq| - |; - $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package', - $scripttag)); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($crstype).' to IMS content package')); - $r->print($display. - '

'. + $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', + $scripttag)); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print($display.'

Export content item?
 '."\n"; if ($numdisc > 0) { - $display .= ''.&mt('Export discussion posts?').'
'."\n" - .''."\n". + 'is_sequence()) || ($curRes->is_page())) { - $lastcontainer = $currelem; - $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"'; + my $checkitem = $count + $boards + $startcount; + $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"'; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { - $display .= ('' x2)."\n"; + $display .= ''."\n"; } if ($curRes->is_sequence()) { - $display .= ' '."\n"; + $display .= ' '."\n"; + $lastcontainer = $count + $startcount + $boards; } elsif ($curRes->is_page()) { - $display .= ' '."\n"; + $display .= ' '."\n"; + $lastcontainer = $count + $startcount + $boards; } + my $currelem = $count+$boards+$startcount; $children{$parent{$depth}} .= $currelem.':'; - $display .= ' '.$curRes->title().'' - .'' - .'    
'. + '

'. '

'); + &mt('Export '.$type.' DOCS').'" />

'); } } @@ -551,7 +503,7 @@ sub create_ims_store { my $manifestfilename = $$tempexport.$manifest; if ($ims_manifest = Apache::File->new('>'.$manifestfilename)) { $$manifestok=1; - print $ims_manifest + print $ims_manifest ''."\n". ' $title}); ($title) = &parse_supplemental_title($title); } elsif ($env{'docs.markedcopy_supplemental'}) { - &Apache::lonnet::delenv('docs.markedcopy_supplemental'); + &Apache::lonnet::delenv('docs\\.markedcopy_supplemental'); } $url=~s{http(:|:)//https(:|:)//}{https$2//}; @@ -1375,7 +1327,7 @@ sub do_paste_from_buffer { } # published maps can only exists once, so remove it from paste buffer when done if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) { - &Apache::lonnet::delenv('docs.markedcopy'); + &Apache::lonnet::delenv('docs\\.markedcopy'); } if ($url=~ m{/smppg$}) { my $db_name = &Apache::lonsimplepage::get_db_name($url); @@ -1503,7 +1455,7 @@ sub handle_edit_cmd { } sub editor { - my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_; + my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1520,7 +1472,7 @@ sub editor { } my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)= - &breadcrumbs($allowed,$crstype); + &breadcrumbs($folder,$allowed,$type); $r->print($breadcrumbtrail); # ------------------------------------------------------------ Process commands @@ -1619,7 +1571,7 @@ sub editor { unless ($name) { $name=(split(/\//,$url))[-1]; } unless ($name) { $idx++; next; } $r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, - $coursenum,$crstype)); + $coursenum)); $idx++; $shown++; } @@ -1697,7 +1649,7 @@ sub process_file_upload { return 'failed'; } else { if ($parseaction eq 'parse') { - my $total_embedded = scalar(keys(%{$allfiles})); + my $total_embedded = keys(%{$allfiles}); if ($total_embedded > 0) { my $num = 0; my $state = ' @@ -1770,7 +1722,7 @@ sub parse_supplemental_title { # --------------------------------------------------------------- An entry line sub entryline { - my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_; + my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; my ($foldertitle,$pagetitle,$renametitle); if (&is_supplemental_title($title)) { @@ -1823,7 +1775,7 @@ sub entryline { ' '.&mt('Random Order').' '; +'; } if ($ispage) { my $pagename=&escape($pagetitle); @@ -2036,36 +1987,30 @@ 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?'':' '.$reinit.'').$external." + '.($url?"":'').$title.($url?'':' '.&mt('(re-initialize course to access)').'').$external." "; if (($allowed) && ($folder!~/^supplemental/)) { my %lt=&Apache::lonlocal::texthash( 'hd' => 'Hidden', 'ec' => 'URL hidden'); my $enctext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); my $hidtext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); + ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); $line.=(< $form_start - + $form_end $form_start - + $form_end $form_start $rand_order_text $form_end @@ -2148,7 +2093,7 @@ sub checkonthis { if (($errorcount) || ($warningcount)) { if ($errorcount) { - $r->print(''.&mt('bomb').''. + $r->print(''. &mt('[quant,_1,error]',$errorcount).''); } if ($warningcount) { @@ -2173,7 +2118,7 @@ sub checkonthis { unless ($url=~/\$/) { $r->print(''.&mt('not found').''); } else { - $r->print(''.&mt('unable to verify variable URL').''); + $r->print(''.&mt('unable to verify variable URL').''); } } else { $r->print(''.&mt('access denied').''); @@ -2195,7 +2140,7 @@ List Symbs sub list_symbs { my ($r) = @_; - my $crstype = &Apache::loncommon::course_type(); + my $type = &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(); @@ -2204,7 +2149,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($crstype).':'.$env{'request.course.id'}); + &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); } else { $r->print("
\n");
         foreach my $res ($navmap->retrieveResources()) {
@@ -2218,11 +2163,11 @@ sub list_symbs {
 
 sub verifycontent {
     my ($r) = @_;
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
-   $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
-   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+   $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2231,7 +2176,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 '.$crstype.': '). + &mt('The following sequence or page is included more than once in your '.$type.': '). &unescape($hash{$key}).'
'. &mt('Note that grading records for problems included in this sequence or folder will overlap.
')); } @@ -2254,9 +2199,9 @@ sub devalidateversioncache { sub checkversions { my ($r) = @_; - 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 $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 $header=''; my $startsel=''; my $monthsel=''; @@ -2317,7 +2262,7 @@ sub checkversions { &changewarning($r,''); if ($env{'form.timerange'} eq 'all') { # show all documents - $header=&mt('All Documents in '.$crstype); + $header=&mt('All Documents in '.$type); $allsel=1; foreach my $key (keys(%hash)) { if ($key=~/^ids\_(\/res\/.+)$/) { @@ -2362,7 +2307,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 '.$crstype, + ('st' => 'Version changes since start of '.$type, 'lm' => 'Version changes since last Month', 'lw' => 'Version changes since last Week', 'sy' => 'Version changes since Yesterday', @@ -2371,9 +2316,9 @@ sub checkversions { 'fi' => 'File', 'md' => 'Modification Date', 'mr' => 'Most recently published Version', - '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', + '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', 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)', 'sc' => 'Set all Resource Versions to current Version (Fix Versions)', 'di' => 'Differences'); @@ -2420,7 +2365,7 @@ ENDHEADERS 'Most Recent: '. ''.$currentversion.''. ''. - 'In '.$crstype.': '. + 'In '.$type.': '. ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; @@ -2437,7 +2382,7 @@ ENDHEADERS ('select_form_order' => ['',1..$currentversion,'mostrecent'], '' => '', - 'mostrecent' => &mt('most recent'), + 'mostrecent' => 'most recent', map {$_,$_} (1..$currentversion)))); $r->print(''); my $lastold=1; @@ -2538,19 +2483,14 @@ sub changewarning { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } $r->print("\n\n". -''."\n". +''."\n". '
'. '

'. +'" />

'. &mt($message,' '). -$help{'Caching'}.'

'."\n\n"); - + &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />'). +$help{'Caching'}.'

'."\n\n"); } @@ -2558,7 +2498,7 @@ sub init_breadcrumbs { my ($form,$text)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs", - text=>&Apache::loncommon::course_type().' Editor', + text=>"Edit ".&Apache::loncommon::course_type(), faq=>273, bug=>'Instructor Interface', help => 'Docs_Adding_Course_Doc'}); @@ -2576,7 +2516,8 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; - my $crstype = &Apache::loncommon::course_type(); + my $type = &Apache::loncommon::course_type(); + # --------------------------------------------- Initialize help topics for this foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', @@ -2619,7 +2560,7 @@ sub handler { &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space'); &dumpcourse($r); } elsif ($allowed && $env{'form.exportcourse'}) { - &init_breadcrumbs('exportcourse','IMS Export'); + &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS'); &exportcourse($r); } else { # is this a standard course? @@ -2631,6 +2572,8 @@ sub handler { my $showdoc=0; my $containertag; my $uploadtag; + + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['folderpath','pagepath', 'pagesymb']); @@ -2648,7 +2591,7 @@ sub handler { } if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { $env{'form.folderpath'} = 'supplemental&'. - &escape(&mt('Supplemental '.$crstype.' Documents')).'&'. + &escape(&mt('Supplemental '.$type.' Documents')).'&'. $env{'form.folderpath'}; } &Apache::loncommon::store_course_settings('docs_folderpath', @@ -2703,13 +2646,9 @@ sub handler { $script .= &editing_js($udom,$uname); } # -------------------------------------------------------------------- Body tag - $script = ''."\n"; - my $brcrum = [{href=>"/adm/createuser",text=>"$crstype Documents"}]; - $r->print(&Apache::loncommon::start_page("$crstype Documents", $script, + $script = ''; + 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')); @@ -2804,12 +2743,11 @@ sub handler { unless ($showdoc || $upload_result eq 'phasetwo') { # ----------------------------------------------------------------------------- my %lt=&Apache::lonlocal::texthash( - 'uplm' => 'Upload a new main '.lc($crstype).' document', - 'upls' => 'Upload a new supplemental '.lc($crstype).' document', + 'uplm' => 'Upload a new main '.lc($type).' document', + 'upls' => 'Upload a new supplemental '.lc($type).' document', 'impp' => 'Import a document', - 'pubd' => 'Published documents', + 'pubd' => 'Published Documents', 'copm' => 'All documents out of a published map into this folder', - 'spec' => 'Special documents', 'upld' => 'Upload Document', 'srch' => 'Search', 'impo' => 'Import', @@ -2822,37 +2760,99 @@ sub handler { 'extr' => 'External Resource', 'syll' => 'Syllabus', 'navc' => 'Navigate Contents', - 'sipa' => 'Simple Course Page', + 'sipa' => 'Simple Page', 'sipr' => 'Simple Problem', 'drbx' => 'Drop Box', 'scuf' => 'Score Upload Form', - 'bull' => 'Discussion Board', - 'mypi' => 'My Personal Information Page', - 'grpo' => 'Group Portfolios', + 'bull' => 'Bulletin Board', + 'mypi' => 'My Personal Info', + 'grpo' => 'Group Files', 'rost' => 'Course Roster', 'abou' => 'About User', - 'imsf' => 'IMS Import', - 'imsl' => 'Import IMS package', + 'imsf' => 'Import IMS package', 'file' => 'File', 'title' => 'Title', 'comment' => 'Comment', - 'parse' => 'If HTML file, upload embedded images/multimedia files' + 'parse' => 'Upload embedded images/multimedia files if HTML file!', + 'nd' => 'New Document', + 'pm' => 'Published Map', + 'sd' => 'Special Document', + 'mo' => 'More Options', + 'hao' => 'Hide all Options' ); # ----------------------------------------------------------------------------- - my %tabtitles = ( - main => { - Course => &mt('Main Course Documents'), - Community => &mt('Main Community Documents'), - }, - supplemental => { - Course => &mt('Supplemental Course Documents'), - Community => &mt('Supplemental Community Documents'), - }, - ); + my $fileupload=(< + +FIUP + + my $checkbox=(<$lt{'parse'}? + + --> + +CHBO + + my $fileuploadform=(< + $fileupload +
+ $lt{'title'}:
+ + $uploadtag + +
+ + $checkbox + +
+
+ + + $help{'Uploading_From_Harddrive'} + + +FUFORM + + my $simpleeditdefaultform=(< + $lt{'pubd'}
+ $uploadtag + +
+ + + $help{'Importing_LON-CAPA_Resource'} + +
+ +
+

+ $lt{'copm'}
+
+ + $help{'Load_Map'} +

+ +SEDFFORM + + my $extresourcesform=(< + $uploadtag + + + $help{'Adding_External_Resource'} + + +ERFORM + if ($allowed) { &update_paste_buffer($coursenum,$coursedom); - my $dumpbut=&dumpbutton(); - my $exportbut=&exportbutton(); my %lt=&Apache::lonlocal::texthash( 'vc' => 'Verify Content', 'cv' => 'Check/Set Resource Versions', @@ -2864,7 +2864,8 @@ sub handler { if (!$folderpath) { if ($env{'form.folder'} eq '' || $env{'form.folder'} eq 'supplemental') { - $folderpath='default&'.&escape($tabtitles{'main'}{$crstype}); + $folderpath='default&'. + &escape(&mt('Main '.$type.' Documents')); } } unless ($env{'form.pagepath'}) { @@ -2872,71 +2873,28 @@ sub handler { $uploadtag = ''; } - $r->print(< - - - - - $containertag - -
- - $uploadtag -
-
-
- -
- $help{'Verify_Content'} -
-
- $help{'Check_Resource_Versions'} -
- $dumpbut - $exportbut -
- -
-
- - -
-
-
-
 
-ENDCOURSEVERIFY + $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env)); $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', - &mt('Editing the Table of Contents for your '.$crstype))); + &mt('Editing the Table of Contents for your '.$type))); } # --------------------------------------------------------- Standard documents - $r->print(''); - if (($standard) && ($allowed) && (!$forcesupplement)) { - $r->print(' - - - - - - -'."\n". -'
'); -# '

'.&mt('Main Course Documents'). -# ($allowed?' '.$help{'Main_Course_Documents'}:'').'

'); my $folder=$env{'form.folder'}; if ($folder eq '' || $folder eq 'supplemental') { $folder='default'; - $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$crstype.' Documents')); + $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); $uploadtag = ''; } my $postexec=''; if ($folder eq 'default') { - $r->print(''."\n" - ); + $r->print(''); } else { #$postexec='self.close();'; } $hadchanges=0; my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed, - $upload_output,$crstype); + $upload_output,$type); if ($error) { $r->print('

'.$error.'

'); } @@ -2953,230 +2911,219 @@ ENDCOURSEVERIFY $container='page'; } my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; - $r->print(< -
$lt{'uplm'}$lt{'impp'}$lt{'spec'}
-$lt{'file'}:
-
- -
-$lt{'title'}:
- -$uploadtag - -
- - - -
-
- - - $help{'Uploading_From_Harddrive'} - -
-
-
-$lt{'pubd'}
-$uploadtag - -
- - -$help{'Importing_LON-CAPA_Resource'} - -
- -
-

-$lt{'copm'}
-
- -$help{'Load_Map'} -

-
-
-
- -
-ENDFORM - unless ($env{'form.pagepath'}) { - $r->print(< -
-$uploadtag - - - $help{'Adding_External_Resource'} - -
-
- - -
-ENDFORM - } - $r->print('
'); + + + + my $recoverform=(< + + +RFORM + + my $imspform=(< + + + +IMSPFORM + + my $newnavform=(< + $uploadtag + + + + $help{'Navigate_Content'} + + +NNFORM + my $newsmppageform=(< + $uploadtag + + + $help{'Simple Page'} + + +NSPFORM + + my $newsmpproblemform=(< + $uploadtag + + + $help{'Simple Problem'} + + + +NSPROBFORM + + my $newdropboxform=(< + $uploadtag + + + + + +NDBFORM + + my $newexuploadform=(< + $uploadtag + + + + $help{'Score_Upload_Form'} + + +NEXUFORM + + my $newbulform=(< + $uploadtag + + + + $help{'Bulletin Board'} + + +NBFORM + + my $newaboutmeform=(< + $uploadtag + + + + $help{'My Personal Info'} + + +NAMFORM + + my $newaboutsomeoneform=(< + $uploadtag + + + + + +NASOFORM + + + my $newrosterform=(< + $uploadtag + + + + $help{'Course Roster'} + + +NROSTFORM + unless ($env{'form.pagepath'}) { my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - $r->print(<
- - - -$help{'Adding_Folders'} - -
-
- - - -$help{'Adding_Pages'} - -
-
-$uploadtag - - - - $help{'Syllabus'} - -
-
-$uploadtag - - - -$help{'Navigate_Content'} - -
-
-$uploadtag - - - $help{'Simple Page'} - -
-
-$uploadtag - - -$help{'Simple Problem'} - -
-
-$uploadtag - - - - -
-
-$uploadtag - - - -$help{'Score_Upload_Form'} - -
-
-$uploadtag - - - -$help{'Bulletin Board'} - -
-
-$uploadtag - - - -$help{'My Personal Info'} - -
-
-$uploadtag - - - - -
-
-$uploadtag - - - -$help{'Group Files'} - -
-
-$uploadtag - - - -$help{'Course Roster'} - -
-ENDFORM - } + + my $newpageform=(< + + + + $help{'Adding_Pages'} + + +NPFORM + + my $newfolderform=(< + + + + $help{'Adding_Folders'} + + +NFFORM + + my $newsylform=(< + $uploadtag + + + + $help{'Syllabus'} + + +NSYLFORM + + my $newgroupfileform=(< + $uploadtag + + + + $help{'Group Files'} + + +NGFFORM + + + my $specialdocumentsform=(<$newfolderform +
$newpageform +
$newsylform +
$newnavform +
$newsmppageform +
$newsmpproblemform +
$newdropboxform +
$newexuploadform +
$newbulform +
$newaboutmeform +
$newaboutsomeoneform +
$newgroupfileform +
$newrosterform +SPDOFORM + + +my %orderhash = ( + 'aa' => 'New Document', + 'bb' => 'Published Documents', + 'cc' => 'Special Documents', + 'dd' => 'More Options', + 'zz' => 'Hide all Option', + ); +my %namehash = ( + 'New Document' => $fileuploadform, + 'Published Documents' => $simpleeditdefaultform, + 'Special Documents' => $specialdocumentsform, + 'More Options' => $extresourcesform.'
'.$imspform.'
'.$recoverform, + 'drei' => 'dr', + ); +my $tid = '1'; +my $varcd = 'Course Documents'; +$r->print(&generate_edit_table($varcd,\%namehash,\%orderhash)); + } if ($env{'form.pagepath'}) { - $r->print(< -$uploadtag - - -$help{'Simple Problem'} - - -
-$uploadtag - - - -$help{'Score_Upload_Form'} - -
-ENDBLOCK } - $r->print('
'); - $r->print(''); } # ----------------------------------------------------- Supplemental documents if (!$forcestandard) { - $r->print(''); -# '

'.&mt('Supplemental Course Documents'). -# ($allowed?' '.$help{'Supplemental'}:'').'

'); my $folder=$env{'form.folder'}; unless ($folder=~/^supplemental/) { $folder='supplemental'; @@ -3184,9 +3131,9 @@ ENDBLOCK if ($folder =~ /^supplemental$/ && (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { $env{'form.folderpath'} = 'supplemental&'. - &escape($tabtitles{'supplemental'}{$crstype}); + &escape(&mt('Supplemental '.$type.' Documents')); } - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); if ($error) { $r->print('

'.$error.'

'); } @@ -3196,77 +3143,104 @@ ENDBLOCK '.sequence'; my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); - $r->print(< -$lt{'upls'} -$lt{'spec'} - - -
- -
-
- - - -

-$lt{'comment'}:
- -
- - - - - $help{'Uploading_From_Harddrive'} - -
- - -
- - - - $help{'Adding_Folders'} - -
-
- - - - $help{'Adding_External_Resource'} - -
-
- - - - -$help{'Syllabus'} - -
-
- - - - -$help{'My Personal Info'} - -
- - -ENDSUPFORM - } - } - $r->print(''); + + my $supupdocform=(< + $fileupload +
+
+ + $checkbox + +

+ $lt{'comment'}:
+ +
+ + + + + $help{'Uploading_From_Harddrive'} + + +SUPDOCFORM + + my $supnewfolderform=(< + + + + $help{'Adding_Folders'} + + +SNFFORM + + + my $supnewextform=(< + + + + $help{'Adding_External_Resource'} + + +SNEFORM + + my $supnewsylform=(< + + + + + $help{'Syllabus'} + + +SNSFORM + + my $supnewaboutmeform=(< + + + + + $help{'My Personal Info'} + + +SNAMFORM + + + +my %suporderhash = ( + 'ee' => 'New Document', + 'ff' => 'Special Documents', + 'zz' => 'Hide all Options', + ); + +my %supnamehash = ( + 'New Document' => $supupdocform, + 'Special Documents' => $supnewfolderform.'
'.$supnewextform.'
'.$supnewsylform.'
'.$supnewaboutmeform, + ); +my $tid='2'; +my $varscd = 'Supplemented Course Documents'; + +$r->print(< +
  • New Document
  • +
  • Special Documents
  • + +FORM + +#$r->print(&generate_edit_table($varscd,\%supnamehash,\%suporderhash)); + + } + } if ($allowed) { $r->print('
    @@ -3290,6 +3264,79 @@ ENDSUPFORM return OK; } +sub generate_admin_options { + my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_; + my %lt = %{$lt_ref}; + my %help = %{$help_ref}; + my %env = %{$env_ref}; + my $dumpbut=&dumpbutton(); + my $exportbut=&exportbutton(); + return (< + + + + + $containertag + +
    + + $uploadtag +
    +
    +
      +
    • + $help{'Verify_Content'} +
    • +
    • + $help{'Check_Resource_Versions'} +
    • +
    • + $dumpbut +
    • +
    • + $exportbut +
    • +
    • + +
    • +
    • + + +
    • +
    +
    +
     
    +ENDOPTIONFORM + +} + + +sub generate_edit_table { + my ($varcd,$namehash_ref,$orderhash_ref) = @_; + my %namehash = %{$namehash_ref}; #name verlinkt mit id + my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name + my $form; + + { + + $form = '

    '.&mt('Upload '.$varcd).'

    '; + $form .= '
    '; + } + return $form; +} sub editing_js { my ($udom,$uname) = @_; @@ -3300,10 +3347,10 @@ sub editing_js { p_mnp => 'Name of New Page', t_mnp => 'New Page', p_mxu => 'Title for the Uploaded Score', - p_msp => 'Name of the Simple Course Page', + p_msp => 'Title for the Page', p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', - p_mbb => 'Title for the Discussion Board', + p_mbb => 'Title for the Bulletin Board', p_mab => "Enter user:domain for User's 'About Me' Page", p_mab2 => "About [_99]", p_mab_alrt1 => 'Not a valid user:domain', @@ -3492,6 +3539,34 @@ function markcopy(folderpath,index,oldti this.document.forms.renameform.submit(); } +function unselectInactive() { + currentTable = document.getElementById('tableId'); + currentNav = document.getElementById('navigation'); + currentLis = currentNav.getElementsByTagName('LI'); + for (i = 0; i < currentLis.length; i++) { + currentLis[i].className = 'i'; + } +} + +function hideAll(current) { + unselectInactive(); + current.className = 'active'; + currentData = document.getElementById('content'); + currentDivs = currentData.getElementsByTagName('DIV'); + for (i = 0; i < currentDivs.length; i++) { + currentDivs[i].style.display = 'none'; + } +} + +function showPage(current, pageId) { + hideAll(current); + unselectInactive(); + current.className = 'active'; + currentData = document.getElementById(pageId); + currentData.style.display = 'block'; + return false; +} + ENDNEWSCRIPT } 1;