--- loncom/interface/londocs.pm 2009/12/02 18:33:27 1.411 +++ loncom/interface/londocs.pm 2010/06/06 02:40:30 1.428 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.411 2009/12/02 18:33:27 bisitz Exp $ +# $Id: londocs.pm,v 1.428 2010/06/06 02:40:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -120,14 +120,19 @@ sub dumpbutton { my $crstype = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - my $link = "".&mt('Dump '.$crstype.' DOCS to Construction Space').""; - return $link.' '. - &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; - } else { - return '
'. - &mt('Dump '.$crstype. - ' 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'); } } @@ -142,9 +147,9 @@ 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::loncommon::start_page('Dump '.$crstype.' Documents to Construction Space'). '
'); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' 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,7 +260,7 @@ sub dumpcourse { $r->print(&Apache::loncommon::end_data_table()); &untiehash(); $r->print( - '

'); + '

'); } } @@ -263,7 +268,7 @@ sub dumpcourse { sub exportbutton { my $crstype = &Apache::loncommon::course_type(); - return "".&mt('IMS Export')."". + return "".&mt('IMS Export')."". &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -341,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.') .'

' @@ -368,24 +373,26 @@ sub exportcourse { $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 '.$crstype.'.') - .'

'; - $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; @@ -396,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 ++; @@ -425,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(); @@ -1638,7 +1637,9 @@ sub editor { $r->print(''); } - my $output; + my $output; + + &Apache::loncommon::start_data_table_count(); #setup a row counter foreach my $res (@LONCAPA::map::order) { my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); $name=&LONCAPA::map::qtescape($name); @@ -1650,6 +1651,8 @@ sub editor { $idx++; $shown++; } + &Apache::loncommon::end_data_table_count(); + if ($shown) { $r->print(&Apache::loncommon::start_data_table()); if ($allowed) { @@ -1802,6 +1805,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; } @@ -2249,19 +2253,17 @@ sub list_symbs { } 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 $crstype = &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')); $hashtied=0; @@ -2272,9 +2274,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 '.$crstype.': '). + &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})})) { @@ -2282,8 +2284,13 @@ sub verifycontent { } } &untiehash(); - $r->print('

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

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

'.&mt('Done').'

' + .'
' + .'

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

' + ); } @@ -2475,11 +2482,11 @@ ENDHEADERS # Set version $r->print(&Apache::loncommon::select_form($setversions{$linkurl}, 'set_version_'.$linkurl, - ('select_form_order' => + {'select_form_order' => ['',1..$currentversion,'mostrecent'], '' => '', 'mostrecent' => &mt('most recent'), - map {$_,$_} (1..$currentversion)))); + map {$_,$_} (1..$currentversion)})); $r->print(''); my $lastold=1; for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { @@ -2533,7 +2540,7 @@ ENDHEADERS } } $r->print('
'); - $r->print('

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

'); + $r->print('

'.&mt('Done').'

'); &untiehash(); } @@ -2657,7 +2664,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'); @@ -2898,18 +2905,18 @@ sub create_form_ul { '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', 'syll' => 'Syllabus', - 'navc' => 'Navigate Contents', + 'navc' => 'Table of Contents', 'sipa' => 'Simple Course Page', 'sipr' => 'Simple Problem', 'drbx' => 'Drop Box', @@ -2972,9 +2979,9 @@ FUFORM SEDFFORM my @simpleeditdefaultforma = ( - { ''.&mt('Search').'' => "$uploadtag$lt{'srch'}" }, - { ''.&mt('Import').'' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" }, - { ''.&mt('Import Bookmarks').'' => "$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 @@ -3110,14 +3117,14 @@ HIDDENFORM my $recoverform=(< - $lt{'reco'} + $lt{'reco'} RFORM my $imspform=(< - $lt{'imsf'} + $lt{'imsf'} IMSPFORM @@ -3127,7 +3134,7 @@ IMSPFORM $uploadtag - $lt{'navc'} + $lt{'navc'} $help{'Navigate_Content'} NNFORM @@ -3136,7 +3143,7 @@ NNFORM $uploadtag - $lt{'sipa'} + $lt{'sipa'} $help{'Simple Page'} NSPFORM @@ -3146,7 +3153,7 @@ NSPFORM $uploadtag - $lt{'sipr'} + $lt{'sipr'} $help{'Simple Problem'} @@ -3157,7 +3164,7 @@ NSPROBFORM $uploadtag - $lt{'drbx'} + $lt{'drbx'} NDBFORM @@ -3166,7 +3173,7 @@ NDBFORM $uploadtag - $lt{'scuf'} + $lt{'scuf'} $help{'Score_Upload_Form'} NEXUFORM @@ -3176,7 +3183,7 @@ NEXUFORM $uploadtag - $lt{'bull'} + $lt{'bull'} $help{'Bulletin Board'} NBFORM @@ -3187,7 +3194,7 @@ NBFORM $uploadtag - $lt{'mypi'} + $lt{'mypi'} $help{'My Personal Information Page'} NAMFORM @@ -3197,7 +3204,7 @@ NAMFORM $uploadtag - $lt{'abou'} + $lt{'abou'} NASOFORM @@ -3208,7 +3215,7 @@ NASOFORM $uploadtag - $lt{'rost'} + $lt{'rost'} $help{'Course Roster'} NROSTFORM @@ -3226,7 +3233,7 @@ my $newfolderb; - $lt{'newp'} + $lt{'newp'} $help{'Adding_Pages'} NPFORM @@ -3237,7 +3244,7 @@ NPFORM - $lt{'newf'}$help{'Adding_Folders'} + $lt{'newf'}$help{'Adding_Folders'} NFFORM @@ -3247,7 +3254,7 @@ NFFORM $uploadtag - $lt{'syll'} + $lt{'syll'} $help{'Syllabus'} @@ -3259,47 +3266,52 @@ NSYLFORM $uploadtag - $lt{'grpo'} + $lt{'grpo'} $help{'Group Portfolio'} NGFFORM @specialdocumentsforma=( - {''.&mt('New Composite Page').''=>$newpageform}, - {''.&mt('Syllabus').''=>$newsylform}, - {''.&mt('Group Portfolio').''=>$newgroupfileform}, + {''.$lt{newp}.''=>$newpageform}, + {''.$lt{syll}.''=>$newsylform}, + {''.$lt{grpo}.''=>$newgroupfileform}, ); } - 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},); + 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=( - {''.&mt('Simple Problem').''=>$newsmpproblemform}, - {''.&mt('Score Upload Form').''=>$newexuploadform} + {''.&mt('Simple Problem').''=>$newsmpproblemform}, + {''.&mt('Score Upload Form').''=>$newexuploadform} ); $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma)); } my @tools = ( - {''.&mt('External Resource').''=>$extresourcesform}, - {''.&mt('IMS Import').''=>$imspform}, - {''.&mt('Recover Deleted Resources').''=>$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)], @@ -3370,7 +3382,7 @@ SUPDOCFORM - $lt{'newf'} + $lt{'newf'} $help{'Adding_Folders'} SNFFORM @@ -3381,7 +3393,7 @@ SNFFORM - $lt{'extr'} $help{'Adding_External_Resource'} + $lt{'extr'} $help{'Adding_External_Resource'} SNEFORM @@ -3391,7 +3403,7 @@ SNEFORM - $lt{'syll'} + $lt{'syll'} $help{'Syllabus'} SNSFORM @@ -3402,20 +3414,26 @@ SNSFORM - $lt{'mypi'} + $lt{'mypi'} $help{'My Personal Information Page'} SNAMFORM my @specialdocs = ( - {''.&mt('External Resource').''=>$supnewextform}, - {''.&mt('Syllabus').''=>$supnewsylform}, - {''.&mt('My Personal Information Page').''=>$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))] ); @@ -3466,22 +3484,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 = ( - {''.&mt('Verify Content').''=>"$lt{'vc'}$help{'Verify_Content'}"}, - {''.&mt('Check/Set Resource Versions').''=>"$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, {''.&mt('Dump Course DOCS to Construction Space: available on other servers').''=>$dumpbut}; + push @list, {''.$lt{dcd}.''=>$dumpbut}; } - push @list, ({''.&mt('IMS Export').''=>$exportbut}, - {''.&mt('List Symbs').''=>"$lt{'ls'}"}, - {''.&mt('Show Log').''=>"$lt{'sl'}"}, + push @list, ({''.$lt{imse}.'' + =>$exportbut}, + {''.$lt{ls}.'' + =>"$lt{'ls'}"}, + {''.$lt{sl}.'' + =>"$lt{'sl'}"}, ); return '
'.create_form_ul(create_list_elements(@list)).'
'; @@ -3498,7 +3523,7 @@ sub generate_edit_table { if($env{'form.active'} ne ''){ $activetab = $env{'form.active'}; } - $form = '
'; + $form = '
'; $form .= '
'; @@ -3770,6 +3795,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'; }