--- loncom/interface/londocs.pm 2009/06/17 17:15:00 1.372 +++ loncom/interface/londocs.pm 2009/10/20 20:23:23 1.399 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.372 2009/06/17 17:15:00 bisitz Exp $ +# $Id: londocs.pm,v 1.399 2009/10/20 20:23:23 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,6 +35,7 @@ use Apache::Constants qw(:common :http); use Apache::imsexport; use Apache::lonnet; use Apache::loncommon; +use Apache::lonhtmlcommon; use LONCAPA::map(); use Apache::lonratedt(); use Apache::lonxml; @@ -119,8 +120,8 @@ sub dumpbutton { my $type = &Apache::loncommon::course_type(); if ($home+$other==0) { return ''; } if ($home) { - return ''. + my $link = "".&mt('Dump '.$type.' DOCS to Construction Space').""; + return $link.' '. &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'
'; } else { return '
'. @@ -262,8 +263,7 @@ sub dumpcourse { sub exportbutton { my $type = &Apache::loncommon::course_type(); - return ''. + return "".&mt('IMS Export')."". &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'
'; } @@ -277,8 +277,8 @@ sub exportcourse { my $numdisc = keys(%discussiontime); my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'). - '

IMS Export Failed

'. + $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'). + '

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

'. '
'. &mt('Unable to retrieve information about course contents'). '
'.&mt('Return to Course Editor').''); @@ -298,7 +298,17 @@ 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 = '
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'; + $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.' + ,'' + ,'') + .'

'; } else { my $now = time; my %symbs; @@ -321,22 +331,30 @@ sub exportcourse { open(OUTPUT, "zip -r $imszip * 2> /dev/null |"); close(OUTPUT); chdir $cwd; - $outcome .= '

' - .&mt('Download the zip file from [_1]IMS '.lc($type).' archive[_2]' - ,'','') - .'

'; 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, because there was a problem creating a manifest file.').'
'; + $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') + .'

'; } } - $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(&Apache::loncommon::start_page('Export '.$type.' to IMS Package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($outcome); $r->print(&Apache::loncommon::end_page()); } else { @@ -489,13 +507,13 @@ function containerCheck(item) { // ]]> |; - $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', + $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package', $scripttag)); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); $r->print($display. '

'. '

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

'); } } @@ -980,7 +998,7 @@ sub group_import { } sub breadcrumbs { - my ($where,$allowed,$type)=@_; + my ($allowed,$type)=@_; &Apache::lonhtmlcommon::clear_breadcrumbs(); my (@folders); if ($env{'form.pagepath'}) { @@ -995,6 +1013,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); @@ -1014,11 +1041,7 @@ sub breadcrumbs { if ($3) { $isencrypted=1; } if ($4 ne '') { $is_random_order = 1; } if ($folder eq 'supplemental') { - if ($allowed) { - $name = &mt('Supplemental '.$type.' Documents'); - } else { - $name = &mt($type.' Documents'); - } + $name = &mt('Supplemental '.$type.' Documents'); } &Apache::lonhtmlcommon::add_breadcrumb( {'href'=>$url.$cpinfo, @@ -1030,7 +1053,7 @@ sub breadcrumbs { } $plain=~s/\>\;\s*$//; return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', - 'LC_docs_path', undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); + undef, undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); } sub log_docs { @@ -1254,10 +1277,11 @@ sub print_paste_buffer { my ($r,$container) = @_; return if (!defined($env{'docs.markedcopy_url'})); - $r->print(<

-ENDPASTE - $r->print(' '); + $r->print('

' + .''.&mt('Clipboard').'' + .'
' + .' ' + ); my $type; if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) { @@ -1271,7 +1295,7 @@ ENDPASTE if ($extension eq 'sequence' && $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) { $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); - $icon .= '/folder_closed.gif'; + $icon .= '/navmap.folder.closed.gif'; } $icon = ''; $r->print($icon.$type.': '. &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}))); @@ -1286,7 +1310,7 @@ ENDPASTE '); } - $r->print('

'); + $r->print('
'); } sub do_paste_from_buffer { @@ -1474,7 +1498,6 @@ sub handle_edit_cmd { sub editor { my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_; - my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1489,9 +1512,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,$type); + $r->print($breadcrumbtrail); + } else { + $randompick = -1; + } # ------------------------------------------------------------ Process commands @@ -1569,34 +1597,70 @@ sub editor { my $idx=0; my $shown=0; if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) { - $r->print('

'.&mt('Parameters').':

'); + + if ($allowed) { $r->print('
@@ -3348,17 +3443,18 @@ sub generate_admin_options { my %env = %{$env_ref}; my $dumpbut=&dumpbutton(); my $exportbut=&exportbutton(); - return (< - $help{'Verify_Content'}
- $help{'Check_Resource_Versions'}
- $dumpbut - $exportbut - -
- - -ENDOPTIONFORM + my @list = ( + {'pic21'=>"$lt{'vc'}$help{'Verify_Content'}"}, + {'pic22'=>"$lt{'cv'}$help{'Check_Resource_Versions'}"}, + ); + if($dumpbut ne ''){ + push @list, {'pic23'=>$dumpbut}; + } + push @list, ({'pic24'=>$exportbut}, + {'pic25'=>"$lt{'ls'}"}, + {'pic26'=>"$lt{'sl'}"}, + ); + return '
'.create_form_ul(create_list_elements(@list)).'
'; } @@ -3372,35 +3468,33 @@ sub generate_edit_table { if($env{'form.active'} ne ''){ $activetab = $env{'form.active'}; } - $form = '

'.&mt($varcd).'

'; + $form = '
'; $form .= ''; - $form .= '
'; + $form .= '
'; foreach my $field (keys(%orderhash)){ - if($field ne 'zz'){ + if($field ne '00'){ if($activetab eq '' || $activetab ne $field){ $active = 'style="display: none;"'; }elsif($activetab eq $field){ $active = 'style="display:block;"'; } - $form .= '
'.${$orderhash{$field}}[1].'
'; + $form .= '
'.${$orderhash{$field}}[1] + .'
'; } } $form .= '
'; @@ -3613,13 +3707,21 @@ function unselectInactive(nav) { currentNav = document.getElementById(nav); currentLis = currentNav.getElementsByTagName('LI'); for (i = 0; i < currentLis.length; i++) { - currentLis[i].className = 'i'; + if(currentLis[i].className == 'right active' || currentLis[i].className == 'right'){ + currentLis[i].className = 'right'; + }else{ + currentLis[i].className = 'i'; + } } } function hideAll(current, nav, data) { unselectInactive(nav); -current.className = 'active'; +if(current.className == 'right'){ + current.className = 'right active' + }else{ + current.className = 'active'; +} currentData = document.getElementById(data); currentDivs = currentData.getElementsByTagName('DIV'); for (i = 0; i < currentDivs.length; i++) { @@ -3629,8 +3731,25 @@ for (i = 0; i < currentDivs.length; i++) } } +function openTabs(pageId) { + tabnav = document.getElementById(pageId).getElementsByTagName('UL'); + if(tabnav.length > 2 ){ + currentNav = document.getElementById(tabnav[1].id); + currentLis = currentNav.getElementsByTagName('LI'); + for(i = 0; i< currentLis.length; i++){ + if(currentLis[i].className == 'active') { + funcString = currentLis[i].onclick.toString(); + tab = funcString.split('"'); + currentData = document.getElementById(tab[1]); + currentData.style.display = 'block'; + } + } + } +} + function showPage(current, pageId, nav, data) { hideAll(current, nav, data); + openTabs(pageId); unselectInactive(nav); current.className = 'active'; currentData = document.getElementById(pageId); @@ -3638,6 +3757,13 @@ function showPage(current, pageId, nav, return false; } +function injectData(current, hiddenField, name, value) { + currentElement = document.getElementById(hiddenField); + currentElement.name = name; + currentElement.value = value; + current.submit(); +} + ENDNEWSCRIPT } 1;